def discount_percent(self, value): """Sets the discount percent of the invoice. """ if value > 1 or value < -1: self._discount_percent = round(value / 100, 2) else: self._discount_percent = round(value, 2) amount = self._discount_percent * self.gross_subtotal() self._discount_amount = parse_money(amount, self._currency)
def line_extension_amount(self, price): """Sets the LineExtensionAmount. """ if price is None: return try: self._line_extension_amount = parse_money(price, self._currency) except ValueError: raise ValueError( "Unrecognized line_extension_amount {}".format(price))
def price(self, price): """Sets the price of one item. """ if price is None: return try: self._price = parse_money(price, self._currency) self._line_extension_amount = self._price * self._quantity except ValueError: raise ValueError("Unrecognized price {}".format(price))
def price(self, price): """Sets the price of one item. Paramters --------- price: string, integer, float The input must be a valid input for the Decimal class the Python Standard Library. """ if price is None: return try: self._price = parse_money(price, self._currency) self._line_extension_amount = self._price * self._quantity except ValueError: raise ValueError("Unrecognized price {}".format(price))
def line_extension_amount(self, price): """Sets the LineExtensionAmount. Paramters --------- line_extension_amount: string, integer, float The input must be a valid input for the Decimal class the Python Standard Library. Computed unless the invoice is imported from an XML file. """ if price is None: return try: self._line_extension_amount = parse_money(price, self._currency) except ValueError: raise ValueError( "Unrecognized line_extension_amount {}".format(price))
def discount(self, value): """Sets the AllowanceTotalAmount of the invoice. Parameters ---------- value: string, integer, float The input must be a valid input for the Decimal class the Python Standard Library. Raises ------ decimal.InvalidOperation: If the input cannot be converted to a Decimal. """ self._discount_amount = parse_money(value, self._currency) self._discount_percent = round( self._discount_amount / self.gross_subtotal(), 2)
def payable_amount(self, value): """Sets the PayableAmount of the invoice. Only used when importing from an XML file. """ self._payable_amount = parse_money(value, self._currency)
def tax_inclusive_amount(self, value): """Sets the TaxInclusiveAmount of the invoice. Only used when importing from an XML file. """ self._tax_inclusive_amount = parse_money(value, self._currency)
def line_extension_amount(self, value): """Sets the LineExtensionAmount of the invoice. Only used when importing from an XML file. """ self._line_extension_amount = parse_money(value, self._currency)
def discount_amount(self, value): """Sets the AllowanceTotalAmount of the invoice. """ self._discount_amount = parse_money(value, self._currency) self._discount_percent = round( self._discount_amount / self.gross_subtotal(), 2)
def charge_amount(self, value): """Sets the ChargeTotalAmount of the invoice. """ self._charge_amount = parse_money(value, self._currency) self._charge_percent = round( self._charge_amount / self.gross_subtotal(), 2)