Class EinvoiceAllowanceCharge() Professional
Document-level allowance or charge of an invoice.
The EinvoiceAllowanceCharge class represents a document-level allowance (BG-20), for example a volume discount, or a document-level charge (BG-21), for example a freight charge, which applies to the invoice as a whole. It contains the amount, the reason and, if the invoice lines use more than one VAT rate, the VAT category and rate to which the allowance or charge belongs.
An allowance or charge is added to an invoice via AbstractEinvoice():addAllowance() or AbstractEinvoice():addCharge(). Both methods accept either an EinvoiceAllowanceCharge()object or a DataObject with the corresponding members, which is converted via EinvoiceAllowanceCharge():from(). An EinvoiceAllowanceCharge object can be created in one of the following ways:
EinvoiceAllowanceCharge():new() - Creates an empty object whose values are assigned via the setter methods, for example :setAmount() and :setReason().
EinvoiceAllowanceCharge():new( oInit ) - Creates an object from a DataObject whose members have the same names as the values, for example :Amount and :Reason.
Both ways call the same setter methods, so the values are normalized identically. Amounts and VAT rates are stored as EinvoiceDecimal() objects and texts are converted to UTF-8.
The methods AbstractEinvoice:addAllowance() and AbstractEinvoice:addCharge() set the charge flag themselves. It therefore does not need to be set via :setCharge().
LOCAL oCharge
oCharge := EinvoiceAllowanceCharge():new():setAmount(15):setReason("Shipping"):setReasonCode("FC")
oInvoice:addCharge( oCharge )
LOCAL oSpec
oSpec := DataObject():new()
oSpec:Amount := 10
oSpec:Reason := "Volume discount"
oInvoice:addAllowance( oSpec )
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.