def writePriceTableTwoIntoLatexDocument(self, data_table): total= self.getTotal() rnd= self.Redondeo() total_rnd= self.getRoundedTotal() if(len(self)<2): row1= ['','',basic_types.sin_desc_string,''] data_table.add_row(row1) row2= ['','',pylatex.utils.bold('TOTAL'),pylatex.utils.bold(basic_types.human_readable(total))] #Total data_table.add_row(row2) else: data_table.add_empty_row() self.mano_de_obra.writePriceTableTwoIntoLatexDocument(data_table) self.materiales.writePriceTableTwoIntoLatexDocument(data_table) self.maquinaria.writePriceTableTwoIntoLatexDocument(data_table) self.otros.writePriceTableTwoIntoLatexDocument(data_table) self.percentages.writePriceTableTwoIntoLatexDocumentPorc(data_table) #Suma row1= ['','',pylatex.NoEscape('Suma \ldots'),basic_types.human_readable(total)] data_table.add_row(row1) #Redondeo row2= ['','',pylatex.NoEscape('Redondeo \ldots'),basic_types.human_readable(rnd)] data_table.add_row(row2) #Total data_table.append(pylatex.Command(pylatex.NoEscape('cline{4-4}'))) row3= ['','',pylatex.NoEscape('TOTAL\ldots'),basic_types.human_readable(total_rnd)] data_table.add_row(row3)
def writePriceJustification(self, data_table): row= [pylatex_utils.ascii2latex(self.codigo)] row.append(basic_types.human_readable(self.rdto)) row.append(pylatex_utils.ascii2latex(self.unidad)) row.append(pylatex_utils.ascii2latex(self.titulo)) if self.is_percentage: row.append(basic_types.human_readable(self.unitario) + pylatex_utils.ltx_porciento); #Percentage else: row.append(basic_types.human_readable(self.unitario)) #Precio unitario row.append(basic_types.human_readable(self.getTotal())) data_table.add_row(row)
def writePriceJustification(self, data_table): row = [pylatex_utils.ascii2latex(self.codigo)] row.append(basic_types.human_readable(self.rdto)) row.append(pylatex_utils.ascii2latex(self.unidad)) row.append(pylatex_utils.ascii2latex(self.titulo)) if self.is_percentage: row.append( basic_types.human_readable(self.unitario) + pylatex_utils.ltx_porciento) #Percentage else: row.append(basic_types.human_readable( self.unitario)) #Precio unitario row.append(basic_types.human_readable(self.getTotal())) data_table.add_row(row)
def writePriceTableTwoIntoLatexDocument(self, data_table): total = self.getTotal() if total > basic_types.ppl_price(0.0): data_table.add_row( ['', '', self.StrTipo(), basic_types.human_readable(total)])
def getLtxBudgetRow(self, ancho): totalr= basic_types.human_readable(self.getRoundedTotal()) row= [pylatex_utils.ascii2latex(self.getUnitPriceCode())] row.append(totalr+ " " + pylatex_utils.ascii2latex(self.UnidadMedida())) row.append(pylatex.table.MultiColumn(1, align=pylatex.utils.NoEscape(ancho),data=self.ud.getLongDescription())) row.append(self.getUnitLtxPriceString()) row.append(self.getLtxPriceString()) return row
def writePriceTableTwoIntoLatexDocument(self, data_table): ''' Write row of a percentage price (e.g. indirect costs) in price table number two''' if (self.is_percentage): data_table.add_row([ '', '', pylatex_utils.ascii2latex(self.titulo), basic_types.human_readable(self.getTotal()) ])
def writePriceJustification(self, data_table): if(len(self)): for i in self: (i).writePriceJustification(data_table) row= [pylatex.table.MultiColumn(4, align='r',data='Total '+self.StrTipo())] row.append('') row.append(basic_types.human_readable(self.getTotal())) data_table.add_row(row)
def writePriceTableTwoIntoLatexDocument(self, data_table): total = self.getTotal() rnd = self.Redondeo() total_rnd = self.getRoundedTotal() if (len(self) < 2): row1 = ['', '', basic_types.sin_desc_string, ''] data_table.add_row(row1) row2 = [ '', '', pylatex.utils.bold('TOTAL'), pylatex.utils.bold(basic_types.human_readable(total)) ] #Total data_table.add_row(row2) else: data_table.add_empty_row() self.mano_de_obra.writePriceTableTwoIntoLatexDocument(data_table) self.materiales.writePriceTableTwoIntoLatexDocument(data_table) self.maquinaria.writePriceTableTwoIntoLatexDocument(data_table) self.otros.writePriceTableTwoIntoLatexDocument(data_table) self.percentages.writePriceTableTwoIntoLatexDocumentPorc( data_table) #Suma row1 = [ '', '', pylatex.NoEscape('Suma \ldots'), basic_types.human_readable(total) ] data_table.add_row(row1) #Redondeo row2 = [ '', '', pylatex.NoEscape('Redondeo \ldots'), basic_types.human_readable(rnd) ] data_table.add_row(row2) #Total data_table.append(pylatex.Command(pylatex.NoEscape('cline{4-4}'))) row3 = [ '', '', pylatex.NoEscape('TOTAL\ldots'), basic_types.human_readable(total_rnd) ] data_table.add_row(row3)
def writeQuantitiesIntoLatexDocument(self, data_table): data_table.add_empty_row() totalr = basic_types.human_readable(self.getRoundedTotal()) self.printLatexHeader(data_table, totalr, 'p{6cm}') #data_table.append(pylatex_utils.ltx_fin_reg + '\n') self.printLtxColumnHeaders(data_table) data_table.add_hline() self.quantities.printLtx(data_table) self.ImprLtxPie(data_table, totalr) data_table.add_hline() data_table.add_empty_row()
def writeQuantitiesIntoLatexDocument(self, data_table): data_table.add_empty_row() totalr= basic_types.human_readable(self.getRoundedTotal()) self.printLatexHeader(data_table,totalr,'p{6cm}') #data_table.append(pylatex_utils.ltx_fin_reg + '\n') self.printLtxColumnHeaders(data_table) data_table.add_hline() self.quantities.printLtx(data_table) self.ImprLtxPie(data_table,totalr) data_table.add_hline() data_table.add_empty_row()
def writePriceJustification(self, data_table): if (len(self)): for i in self: (i).writePriceJustification(data_table) row = [ pylatex.table.MultiColumn(4, align='r', data='Total ' + self.StrTipo()) ] row.append('') row.append(basic_types.human_readable(self.getTotal())) data_table.add_row(row)
def printLtx(self, data_table, ancho): row= [pylatex.table.MultiColumn(1,align= pylatex.utils.NoEscape(ancho),data= pylatex_utils.ascii2latex(self.comentario))] components= self.getComponents() zero= self.dimension(0.0); row.append(components[1]) row.append(components[2]) row.append(components[3]) row.append(components[4]) total= self.getRoundedTotal() if(total!=zero): str_t= basic_types.human_readable(total) row.append(str_t) data_table.add_row(row)
def getLtxBudgetRow(self, ancho): totalr = basic_types.human_readable(self.getRoundedTotal()) row = [pylatex_utils.ascii2latex(self.getUnitPriceCode())] row.append(totalr + " " + pylatex_utils.ascii2latex(self.UnidadMedida())) row.append( pylatex.table.MultiColumn(1, align=pylatex.utils.NoEscape(ancho), data=self.ud.getLongDescription())) row.append(self.getUnitLtxPriceString()) row.append(self.getLtxPriceString()) return row
def printLtx(self, data_table, ancho): row = [ pylatex.table.MultiColumn(1, align=pylatex.utils.NoEscape(ancho), data=pylatex_utils.ascii2latex( self.comentario)) ] components = self.getComponents() zero = self.dimension(0.0) row.append(components[1]) row.append(components[2]) row.append(components[3]) row.append(components[4]) total = self.getRoundedTotal() if (total != zero): str_t = basic_types.human_readable(total) row.append(str_t) data_table.add_row(row)
def ImprCompLtxMed(self, doc, otra): '''Imprime la partida.''' doc.add_empty_row() totalr_otra= human_readable(otra.getRoundedTotal()) otra.printLatexHeader(os,totalr_otra,"p{4.5cm}|") doc.append(pylatex_utils.ltx_ampsnd) totalr_esta= basic_types.human_readable(getRoundedTotal()) printLatexHeader(os,totalr_esta,"p{4.5cm}") doc.append(pylatex_utils.ltx_fin_reg + '\n') ImprLtxLeyenda(doc) doc.append(pylatex_utils.ltx_ampsnd) ImprLtxLeyenda(doc) doc.append(pylatex_utils.ltx_fin_reg + '\n' + pylatex_utils.ltx_hline + '\n') quantities.ImprCompLtx(os,otra.quantities) ImprLtxPie(os,totalr_otra) doc.append(pylatex_utils.ltx_ampsnd) ImprLtxPie(os,totalr_esta) doc.append(pylatex_utils.ltx_fin_reg + '\n') doc.append(pylatex_utils.ltx_hline + '\n') doc.add_empty_row()
def ImprCompLtxMed(self, doc, otra): '''Imprime la partida.''' doc.add_empty_row() totalr_otra = human_readable(otra.getRoundedTotal()) otra.printLatexHeader(os, totalr_otra, "p{4.5cm}|") doc.append(pylatex_utils.ltx_ampsnd) totalr_esta = basic_types.human_readable(getRoundedTotal()) printLatexHeader(os, totalr_esta, "p{4.5cm}") doc.append(pylatex_utils.ltx_fin_reg + '\n') ImprLtxLeyenda(doc) doc.append(pylatex_utils.ltx_ampsnd) ImprLtxLeyenda(doc) doc.append(pylatex_utils.ltx_fin_reg + '\n' + pylatex_utils.ltx_hline + '\n') quantities.ImprCompLtx(os, otra.quantities) ImprLtxPie(os, totalr_otra) doc.append(pylatex_utils.ltx_ampsnd) ImprLtxPie(os, totalr_esta) doc.append(pylatex_utils.ltx_fin_reg + '\n') doc.append(pylatex_utils.ltx_hline + '\n') doc.add_empty_row()
def printLtx(self, doc, precio_ejec_mat): precision = 2 with doc.create(pylatex.Itemize()) as itemize: itemize.add_item(u'Total presupuesto de ejecución material ') itemize.append(pylatex.Command('dotfill')) itemize.append( basic_types.human_readable(precio_ejec_mat, precision)) precio_gg = basic_types.ppl_price(self.GGenerales(precio_ejec_mat)) itemize.add_item(str(self.gg * 100) + u'% Gastos generales ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(precio_gg, precision)) precio_bi = basic_types.ppl_price( self.BIndustrial(precio_ejec_mat)) itemize.add_item(str(self.bi * 100) + u'% Beneficio industrial ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(precio_bi, precision)) suma_gg_bi = precio_ejec_mat + precio_gg + precio_bi itemize.add_item('Suma ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(suma_gg_bi, precision)) precio_iva = basic_types.ppl_price(self.IVA(suma_gg_bi)) itemize.add_item(str(self.iva * 100) + u'% I.V.A. ') itemize.append(pylatex.Command('dotfill')) itemize.append(basic_types.human_readable(precio_iva, precision)) total = suma_gg_bi + precio_iva doc.append( pylatex.utils.bold(u'Presupuesto de ejecución por contrata:') + pylatex.NoEscape('\dotfill') + pylatex.utils.bold(basic_types.human_readable(total, precision))) doc.append(pylatex.VerticalSpace('0.5cm')) doc.append(pylatex.NewLine()) doc.append( u'Asciende el presente presupuesto de ejecución por contrata a la expresada cantidad de: ' ) doc.append( pylatex_utils.textsc( basic_types.to_words(total, False) + ' euros.'))
def StrPrecioSobreLtx(self, sobre): '''For percentages.''' return basic_types.human_readable(PrecioSobre(sobre))
def writePriceJustification(self, data_table): total= self.getTotal() rnd= self.Redondeo() total_rnd= self.getRoundedTotal() if(len(self)<2): row= [pylatex.table.MultiColumn(4, align='r',data=basic_types.sin_desc_string)] row.extend(['','']) data_table.add_row(row) #Total row= [pylatex.table.MultiColumn(4, align='r',data='Total')] row.append(pylatex.table.MultiColumn(2, align='r',data=pylatex.utils.bold(basic_types.human_readable(total)))) data_table.add_row(row) else: self.mano_de_obra.writePriceJustification(data_table) self.materiales.writePriceJustification(data_table) self.maquinaria.writePriceJustification(data_table) self.otros.writePriceJustification(data_table) self.percentages.writePriceJustification(data_table) #Suma row= [pylatex.table.MultiColumn(4, align='r',data= pylatex.NoEscape("Suma\\ldots"))] row.append(pylatex.table.MultiColumn(2, align='r',data=pylatex.utils.bold(basic_types.human_readable(total)))) data_table.add_row(row) #Redondeo row= [pylatex.table.MultiColumn(4, align='r',data= pylatex.NoEscape("Redondeo\\ldots"))] row.append(pylatex.table.MultiColumn(2, align='r',data=pylatex.utils.bold(basic_types.human_readable(rnd)))) data_table.add_row(row) #Total row= [pylatex.table.MultiColumn(4, align='r',data= pylatex.NoEscape("Total\\ldots"))] row.append(pylatex.table.MultiColumn(2, align='r',data=pylatex.utils.bold(basic_types.human_readable(total_rnd)))) data_table.add_row(row)
def getLtxPriceString(self): return basic_types.human_readable(self.getTotalCP1())
def writePriceTableTwoIntoLatexDocument(self, data_table): total= self.getTotal() if total>basic_types.ppl_price(0.0): data_table.add_row(['','',self.StrTipo(),basic_types.human_readable(total)])
def writePriceJustification(self, data_table): total = self.getTotal() rnd = self.Redondeo() total_rnd = self.getRoundedTotal() if (len(self) < 2): row = [ pylatex.table.MultiColumn(4, align='r', data=basic_types.sin_desc_string) ] row.extend(['', '']) data_table.add_row(row) #Total row = [pylatex.table.MultiColumn(4, align='r', data='Total')] row.append( pylatex.table.MultiColumn( 2, align='r', data=pylatex.utils.bold( basic_types.human_readable(total)))) data_table.add_row(row) else: self.mano_de_obra.writePriceJustification(data_table) self.materiales.writePriceJustification(data_table) self.maquinaria.writePriceJustification(data_table) self.otros.writePriceJustification(data_table) self.percentages.writePriceJustification(data_table) #Suma row = [ pylatex.table.MultiColumn(4, align='r', data=pylatex.NoEscape("Suma\\ldots")) ] row.append( pylatex.table.MultiColumn( 2, align='r', data=pylatex.utils.bold( basic_types.human_readable(total)))) data_table.add_row(row) #Redondeo row = [ pylatex.table.MultiColumn( 4, align='r', data=pylatex.NoEscape("Redondeo\\ldots")) ] row.append( pylatex.table.MultiColumn( 2, align='r', data=pylatex.utils.bold(basic_types.human_readable(rnd)))) data_table.add_row(row) #Total row = [ pylatex.table.MultiColumn( 4, align='r', data=pylatex.NoEscape("Total\\ldots")) ] row.append( pylatex.table.MultiColumn( 2, align='r', data=pylatex.utils.bold( basic_types.human_readable(total_rnd)))) data_table.add_row(row)
def getLtxPriceString(self): return basic_types.human_readable(self.getRoundedPrice())
def getLtxPriceString(self): return basic_types.human_readable(getRoundedPrice())
def writePriceTableTwoIntoLatexDocument(self, os): doc.append(" & & " + pylatex_utils.ascii2latex(self.titulo) + " & ") if(self.is_percentage): doc.append(basic_types.human_readable(self.getTotal())) #Total. doc.append(pylatex_utils.ltx_fin_reg + '\n')