Item level charges getting added two times

I am trying to add Item Level Charges to the Invoice XML, But unable to add the same without warnings if added corrects. For to get rid of warnings the calculations are made in such a way that the Charges are added twice in the final total.

Please correct me if I am wrong.

Based on this the LineExtensionAmount it already includes “Charges”.

But based on this we need to again add the “Charges” to the overall total

This is causing the Charges Amount to get doubled when I scan the QR.

Here is an example

<cac:InvoiceLine>
.
.
<cbc:LineExtensionAmount currencyID="SAR">2510.00</cbc:LineExtensionAmount>
<cac:AllowanceCharge>
          <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
          <cbc:AllowanceChargeReasonCode>HD</cbc:AllowanceChargeReasonCode>
          <cbc:AllowanceChargeReason>Handling service</cbc:AllowanceChargeReason>
          <cbc:Amount currencyID="SAR">10.00</cbc:Amount>
</cac:AllowanceCharge>
.
.
</cac:InvoiceLine>

The amount ‘2510.00’ already include the charges i.e. 10 SAR. Now while calculating the Document Level Total. I have to again add the 10 SAR to the total.

<cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">2510.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">2520.00</cbc:TaxExclusiveAmount> <------
        <cbc:TaxInclusiveAmount currencyID="SAR">2898.00</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="SAR">10</cbc:ChargeTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">2898.00</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>

Only this gets accepted without warnings.

I think the below seems correct, but, I cannot do this without warnings

 <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">2500.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">2510.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">2886.50</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="SAR">10</cbc:ChargeTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">2886.50</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">5</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">2500.00</cbc:LineExtensionAmount> <----
        <cac:AllowanceCharge>
          <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
          <cbc:AllowanceChargeReasonCode>HD</cbc:AllowanceChargeReasonCode>
          <cbc:AllowanceChargeReason>Handling service</cbc:AllowanceChargeReason>
          <cbc:Amount currencyID="SAR">10.00</cbc:Amount>
        </cac:AllowanceCharge>
.
.
</cac:InvoiceLine>

The Warning is obviously about the ‘Charges’ not being added in LineExtensionAmount.

Warnings:

"warningMessages": [
                        {
                            "type": "WARNING",
                            "code": "BR-KSA-EN16931-11",
                            "category": "KSA",
                            "message": "Invoice line net amount (BT-131) must equal (Invoiced quantity (BT-129) * (Item net price (BT-146) / item price base quantity (BT-149))) + Sum of invoice line charge amount (BT-141) - Sum of invoice line allowance amount (BT-136)",
                            "status": "WARNING"
                        }
                    ],

Please guide.

@mohamedazher as discussed during Q&A session you have to update the lineextensionamount value and not repeat allowancecharge twice (provide this either at line level or at document level but only once).

Ok we got the solution from the Thursday sessions .

The solutions is to not include the amount in the ChargeTotalAmount

this

<cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">2500.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">2510.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">2886.50</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="SAR">10</cbc:ChargeTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">2886.50</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>

should be

<cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">2500.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">2510.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">2886.50</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="SAR">0</cbc:ChargeTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">2886.50</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>

We haven’t tried this yet. Will try and confirm…