Error after applying discount

Hi all

This is my xml shown below, i need to know why i got an error, what is wrong in my XML?

noted that, i have 2 items:

1- UnitPrice: 750000;discount: 20000;TotalPrice(without vat) should be: 730000

VATValue: 109500 (730000 * 15%)

Total After VAT: 839500

2-UnitPrice: 100000;discount: 0;TotalPrice(without vat) should be: 100000

VATValue: 15000 (100000 * 15%)

Total After VAT: 115000

<cac:AllowanceCharge>
    <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID="SAR">20000.00</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
      <cbc:Percent>15</cbc:Percent>
      <cac:TaxScheme>
        <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
      </cac:TaxScheme>
    </cac:TaxCategory>
    <cac:TaxCategory>
      <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
      <cbc:Percent>15</cbc:Percent>
      <cac:TaxScheme>
        <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
      </cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="SAR">124500.00</cbc:TaxAmount>
  </cac:TaxTotal>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="SAR">124500.00</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="SAR">830000.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="SAR">124500.00</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
        <cbc:Percent>15.00</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="SAR">830000.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="SAR">830000.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="SAR">954500.00</cbc:TaxInclusiveAmount>
    <cbc:AllowanceTotalAmount currencyID="SAR">20000.00</cbc:AllowanceTotalAmount>
    <cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
    <cbc:PayableAmount currencyID="SAR">954500.00</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="SAR">730000.00</cbc:LineExtensionAmount>
    <cac:TaxTotal>
      <cbc:TaxAmount currencyID="SAR">109500.00</cbc:TaxAmount>
      <cbc:RoundingAmount currencyID="SAR">839500.00</cbc:RoundingAmount>
    </cac:TaxTotal>
    <cac:Item>
      <cbc:Name>Item1</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>15</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="SAR">730000.00</cbc:PriceAmount>
      <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">20000.00</cbc:Amount>
      </cac:AllowanceCharge>
    </cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>2</cbc:ID>
    <cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="SAR">100000.00</cbc:LineExtensionAmount>
    <cac:TaxTotal>
      <cbc:TaxAmount currencyID="SAR">15000.00</cbc:TaxAmount>
      <cbc:RoundingAmount currencyID="SAR">115000.00</cbc:RoundingAmount>
    </cac:TaxTotal>
    <cac:Item>
      <cbc:Name>Item2</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>15</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="SAR">100000.00</cbc:PriceAmount>
      <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
      </cac:AllowanceCharge>
    </cac:Price>
  </cac:InvoiceLine>

Dear @Alattar

Thanks for reaching out,

To provide comprehensive support as usual, can I kindly ask you to share the exact response from ZATCA for lists of [Warning and errors]?

Thanks,
Ibrahem Daoud.

Thanks Ibrahim,

Below is the response i got:

“WarningMessages”: [

        {

            "Type": "WARNING",

            "Code": "BR-S-08",

            "Category": "EN_16931",

            "Message": "بالنسبة لتوزيع ضريبة القيمة المضافة (BG-23) الذي يكون فيه الرمز الخاصّ بفئة ضريبة القيمة المضافة (BT-118) 'خاضع للضريبة بالنسبة الأساسية'، يجب أن يكون المبلغ الخاضع للضريبة ضمن فئة ضريبة القيمة المضافة (BT-116) مساويًا لمجموع المبالغ الصافية على مستوى بند الفاتورة (BT-131) مطروحًا منه مجموع مبالغ الخصم على مستوى المستند (BT-92) بالإضافة إلى مجموع مبالغ الرسوم على مستوى المستند (BT-99) في الحالات التي تكون فيها الرموز الخاصّة بفئة ضريبة القيمة المضافة (BT-151, BT-95, BT-102) 'خاضعة للضريبة بالنسبة الأساسية'.",

            "Status": "WARNING"

        },

        {

            "Type": "WARNING",

            "Code": "BR-CO-13",

            "Category": "EN_16931",

            "Message": "إجمالي مبلغ الفاتورة غير شامل ضريبة القيمة المضافة (BT-109) = مجموع صافي مبلغ السلعة \\\\ والخدمة للفاتورة (BT-131) - مجموع المخصصات على مستوى المستند (BT-107)",

            "Status": "WARNING"

        }

    \]

Dear @Alattar

Thanks for your collaborate, Please find the below response:

The way you describe your invoice is different from the way you are generating your XML, due to following explanation:
In your first Item you describe that you have line level discount as 20000 but in your XML you describe the discount as document level.

You need to update your XML to add the discount in the item level in this case the calculation for first Item cbc:LineExtensionAmount will be ( (Unit price * Quantity) - discount(for this Item) + charges(for this Item “If exists”) ) the value will be ( (750000 * 1) - 20000 ) = 730000

To do this in the XML your first Item should be like:

<cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="SAR">730000.00</cbc:LineExtensionAmount>
********************Here you need to add the Line-Level Discount*************************
<cac:AllowanceCharge>
            <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
            <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
            <cbc:Amount currencyID="SAR">20000.000</cbc:Amount>
        </cac:AllowanceCharge>
    <cac:TaxTotal>
      <cbc:TaxAmount currencyID="SAR">109500.00</cbc:TaxAmount>
      <cbc:RoundingAmount currencyID="SAR">839500.00</cbc:RoundingAmount>
    </cac:TaxTotal>
    <cac:Item>
      <cbc:Name>Item1</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>15</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="SAR">750000.00</cbc:PriceAmount>
      <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">0</cbc:Amount>    **not the right place to do the lineLevel discount.**
      </cac:AllowanceCharge>
    </cac:Price>
  </cac:InvoiceLine>

The second Item Should be the same.

Now on the document Level, you need to remove the AllowanceCharge Tag since you don’t have any document-level allowance.

If the Allowance mechanism is not clear enough, Please share an email to the below mail requesting more clarification mentioning this post on the subject.

SP mail: sp_support@zatca.gov.sa

CC: @Ankit.K.Tiwari

Thanks,
Ibrahem Daoud.

1 Like

Thanks Ibrahim,

Your efforts is much appreciated

When i remove AllowanceCharge from documentLevel (or set it 0.0 as there is no discount in any line) i faced this issue:

ErrorMessages": [

        {

            "Type": "ERROR",

            "Code": "BR-CO-11",

            "Category": "EN_16931",

            "Message": "مجموع الخصومات على مستوى المستند (BT-107) = Σ مبلغ الخصم على مستوى المستند (BT-92)",

            "Status": "ERROR"

        }

    \]

That means that i should produce it