def PrecioSobre(self, tipo, sobre): '''Computes percentages over a type.''' ptipo= basic_types.ppl_price(0.0); #Precio total. for i in self: #Percentages. if (i).getType()==tipo and (i).isPercentage(): ptipo+= (i).PrecioSobre(sobre) return ptipo
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 Redondeo(self): #return -self.getTotal().Redondeo() #XXX Redondeo para 2 decimales. tmp= self.getTotal() tmp*= Decimal('100') rnd= basic_types.ppl_price(round(tmp))-tmp rnd/= Decimal('100') return rnd
def Redondeo(self): #return -self.getTotal().Redondeo() #XXX Redondeo para 2 decimales. tmp = self.getTotal() tmp *= Decimal('100') rnd = basic_types.ppl_price(round(tmp)) - tmp rnd /= Decimal('100') return rnd
def __init__(self,pa, mano, mater, maqui, otr, perc): self.cumulated_percentages= pa self.mano_de_obra= mano self.materiales= mater self.maquinaria= maqui self.otros= otr self.percentages= perc base= basic_types.ppl_price(self.Base()) if self.cumulated_percentages: self.percentages.SetBaseAcum(base) else: self.percentages.SetBase(base)
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 __init__(self, pa, mano, mater, maqui, otr, perc): ''' Constructor. :param pa: True if cumulated percentages :param mano: labor (instance of PriceJustificationRecord class) :param mater: materials (instance of PriceJustificationRecord class) :param maqui: machinery (instance of PriceJustificationRecord class) :param otr: not-classified elemental price (instance of PriceJustificationRecord class) :param perc: percentage (ex: indirect costs) (instance of PriceJustificationRecordContainer class) ''' self.cumulated_percentages = pa self.mano_de_obra = mano self.materiales = mater self.maquinaria = maqui self.otros = otr self.percentages = perc base = basic_types.ppl_price(self.Base()) if self.cumulated_percentages: self.percentages.SetBaseAcum(base) else: self.percentages.SetBase(base)
def PrecioPorTipo(self, tipo): ptipo= basic_types.ppl_price(0.0) #Total price. for i in self: if (i).getType()==tipo and not (i).isPercentage(): ptipo+= (i).getRoundedPrice() return ptipo
def getRoundedPrice(self): lista= self.getPriceJustificationList(True)#XXX Here cumulated percentages. return basic_types.ppl_price(float(lista.getRoundedTotal()))
def ApplyPercentage(p, pc): temp2 = basic_types.ppl_percentage(pc) temp3 = basic_types.ppl_price(p) temp3 *= temp2 return temp3
def getTotalCP1(self): return basic_types.ppl_price(float(self.getRoundedTotal()))
def getTotal(self): retval= basic_types.ppl_price(self.Base()) retval+= self.percentages.getTotal() return retval
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 Base(self): retval = basic_types.ppl_price(self.mano_de_obra.getTotal()) retval += self.materiales.getTotal() retval += self.maquinaria.getTotal() retval += self.otros.getTotal() return retval
def SetBaseAcum(self, b): if (len(self)): base = basic_types.ppl_price(b) for i in self: (i).SetBase(base) base += (i).getTotal()
def getTotal(self): retval = basic_types.ppl_price(self.base()) retval *= self.rdto return retval
def base(self): if self.is_percentage: return self.sobre else: return basic_types.ppl_price(self.unitario)
def getTotalCP1(self): return basic_types.ppl_price(float(self.getRoundedTotal()))
def getTotal(self): retval = basic_types.ppl_price(self.Base()) retval += self.percentages.getTotal() return retval
def SetBaseAcum(self, b): if(len(self)): base= basic_types.ppl_price(b) for i in self: (i).SetBase(base) base+= (i).getTotal()
def getTotal(self): retval = basic_types.ppl_price(0.0) for i in self: retval += (i).getTotal() return retval
def getTotal(self): retval= basic_types.ppl_price(0.0) for i in self: retval+= (i).getTotal() return retval
def getRoundedPrice(self): t= basic_types.ppl_price(0.0) for i in self: t+=(i).getRoundedPrice() return t
def Base(self): retval= basic_types.ppl_price(self.mano_de_obra.getTotal()) retval+= self.materiales.getTotal() retval+= self.maquinaria.getTotal() retval+= self.otros.getTotal() return retval
def base(self): if self.is_percentage: return self.sobre else: return basic_types.ppl_price(self.unitario)
def getTotal(self): retval= basic_types.ppl_price(self.base()) retval*= self.rdto return retval
def getRoundedPrice(self): t= basic_types.ppl_price(0.0) for i in self: t+=(i).getRoundedPrice() return t
def PrecioSobre(self, sobre): '''For percentages.''' d= basic_types.ppl_price(sobre) d*= getProduct() return d
def PrecioSobre(self, sobre): '''For percentages.''' d= basic_types.ppl_price(sobre) d*= getProduct() return d