예제 #1
0
 def calculateValueGross(self, valueNet, taxId):
     try:
         tax = self.findById("Dictionary", taxId)
         bdValueNet = BigDecimal(valueNet)
         bdTax = BigDecimal(tax.getKey())
         return bdValueNet.add(
             bdValueNet.multiply(bdTax).setScale(
                 2, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP)
     except:
         return BigDecimal(0)
예제 #2
0
 def calculateValueNet(self, volume, unitPrice):
     try:
         bdVolume = BigDecimal(volume).setScale(2, RoundingMode.HALF_UP)
         bdUnitPrice = BigDecimal(unitPrice).setScale(
             2, RoundingMode.HALF_UP)
         return str(
             bdVolume.multiply(bdUnitPrice).setScale(
                 2, RoundingMode.HALF_UP).floatValue())
     except:
         return '0'