Class EinvoiceAllowanceCharge() Professional

Document-level allowance or charge of an invoice.

Description

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().

Constructors
:new()
Initializes a new allowance or charge object.
Class Methods
:from()
Converts a value into an allowance or charge object.
Methods
:getAmount()
Returns the amount (BT-92/BT-99).
:getBaseAmount()
Returns the calculation base amount (BT-93/BT-100).
:getCharge()
Checks whether the entry is a charge (BG-21/BG-20).
:getPercent()
Returns the calculation percentage (BT-94/BT-101).
:getReason()
Returns the reason text (BT-97/BT-104).
:getReasonCode()
Returns the reason code (BT-98/BT-105).
:getVatCategory()
Returns the VAT category (BT-95/BT-102).
:getVatRate()
Returns the VAT rate (BT-96/BT-103).
:setAmount()
Sets the amount (BT-92/BT-99).
:setBaseAmount()
Sets the calculation base amount (BT-93/BT-100).
:setCharge()
Sets whether the entry is a charge (BG-20/BG-21).
:setPercent()
Sets the calculation percentage (BT-94/BT-101).
:setReason()
Sets the reason text (BT-97/BT-104).
:setReasonCode()
Sets the reason code (BT-98/BT-105).
:setVatCategory()
Sets the VAT category (BT-95/BT-102).
:setVatRate()
Sets the VAT rate (BT-96/BT-103).
Examples
Adding a document-level charge
LOCAL oCharge 

oCharge := EinvoiceAllowanceCharge():new():setAmount(15):setReason("Shipping"):setReasonCode("FC") 
oInvoice:addCharge( oCharge ) 

Adding a document-level allowance from a DataObject
LOCAL oSpec 

oSpec := DataObject():new() 
oSpec:Amount := 10 
oSpec:Reason := "Volume discount" 
oInvoice:addAllowance( oSpec ) 

Feedback

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.