[Help] Warning/Error with mulitple items in simplified invoice

<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
    <ext:UBLExtensions>SET_UBL_EXTENSIONS_STRING
    </ext:UBLExtensions>
    <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
    <cbc:ID>SINV-20063</cbc:ID>
    <cbc:UUID>6f4d20e0-6bfe-4a80-9389-7dabe6620f12</cbc:UUID>
    <cbc:IssueDate>2024-10-21</cbc:IssueDate>
    <cbc:IssueTime>14:33:23</cbc:IssueTime>
    <cbc:InvoiceTypeCode name="0200000">388</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
    <cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode>
    <cac:AdditionalDocumentReference>
        <cbc:ID>ICV</cbc:ID>
        <cbc:UUID>20063</cbc:UUID>
    </cac:AdditionalDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>PIH</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">rVtEXRq4jCbm2fBreg6lvolkqNu6PifeSkdLXeXP3+w=</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>QR</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">SET_QR_CODE_DATA</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    <cac:Signature>
      <cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
      <cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
    </cac:Signature>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="CRN">301121971500003</cbc:ID>
            </cac:PartyIdentification>
            <cac:PostalAddress>
                <cbc:StreetName>King Fahahd st</cbc:StreetName>
                <cbc:BuildingNumber>0000</cbc:BuildingNumber>
                <cbc:PlotIdentification>0000</cbc:PlotIdentification>
                <cbc:CitySubdivisionName>Est</cbc:CitySubdivisionName>
                <cbc:CityName>Riyadh</cbc:CityName>
                <cbc:PostalZone>31952</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>SA</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>301121971500003</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>Mohd Arafat Hossain</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty/>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
        <cbc:InstructionNote>Received payment</cbc:InstructionNote>
    </cac:PaymentMeans>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">938.25</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">1755.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">263.25</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>                
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">4500.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">675.00</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>

                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">938.25</cbc:TaxAmount>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">6255.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">6255.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">7193.25</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">300</cbc:PrepaidAmount>
        <cbc:PayableRoundingAmount currencyID="SAR">0.00</cbc:PayableRoundingAmount>
        <cbc:PayableAmount currencyID="SAR">6893.25</cbc:PayableAmount>
    </cac:LegalMonetaryTotal><cac:InvoiceLine>
                <cbc:ID>1</cbc:ID>
                <cbc:InvoicedQuantity unitCode="PCE">0.00</cbc:InvoicedQuantity>
                <cbc:LineExtensionAmount currencyID="SAR">0.00</cbc:LineExtensionAmount>
                <cac:DocumentReference>
                    <cbc:ID/>
                    <cbc:IssueDate>1970-01-01</cbc:IssueDate>
                    <cbc:IssueTime>03:00:00</cbc:IssueTime>
                    <cbc:DocumentTypeCode>386</cbc:DocumentTypeCode>
                </cac:DocumentReference>
                <cac:TaxTotal>
                    <cbc:TaxAmount currencyID="SAR">0.00</cbc:TaxAmount>
                    <cbc:RoundingAmount currencyID="SAR">0.00</cbc:RoundingAmount>
                    <cac:TaxSubtotal>
                        <cbc:TaxableAmount currencyID="SAR">260.87</cbc:TaxableAmount>
                        <cbc:TaxAmount currencyID="SAR">39.13</cbc:TaxAmount>
                        <cac:TaxCategory>
                            <cbc:ID>S</cbc:ID>
                            <cbc:Percent>15</cbc:Percent>
                            <cac:TaxScheme>
                                <cbc:ID>VAT</cbc:ID>
                            </cac:TaxScheme>
                        </cac:TaxCategory>
                    </cac:TaxSubtotal>
                </cac:TaxTotal>
                <cac:Item>
                    <cbc:Name>Prepayment adjustment</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">0.00</cbc:PriceAmount>
                </cac:Price>
            </cac:InvoiceLine>    
    <cac:InvoiceLine>
        <cbc:ID>27769</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">1755.00</cbc:LineExtensionAmount>    
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="SAR">263.25</cbc:TaxAmount>
            <cbc:RoundingAmount currencyID="SAR">2018.25</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>DYSPORT 151 TO 200 UNITS</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">1755</cbc:PriceAmount>
            <cac:AllowanceCharge>
                <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
                <cbc:AllowanceChargeReason>Service Doctor Discount</cbc:AllowanceChargeReason>
                <cbc:Amount currencyID="SAR">945.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>

    </cac:InvoiceLine>    
    <cac:InvoiceLine>
        <cbc:ID>27770</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">4500.00</cbc:LineExtensionAmount>    
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="SAR">675.00</cbc:TaxAmount>
            <cbc:RoundingAmount currencyID="SAR">5175.00</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>Sculptra vail</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">4500</cbc:PriceAmount>
            <cac:AllowanceCharge>
                <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
                <cbc:AllowanceChargeReason>Service Doctor Discount</cbc:AllowanceChargeReason>
                <cbc:Amount currencyID="SAR">1500.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

I get this warning/error:

 [warningMessages] => Array
                (
                    [0] => stdClass Object
                        (
                            [type] => WARNING
                            [code] => BR-S-08
                            [category] => EN_16931
                            [message] => [BR-S-08]-In a VAT breakdown (BG-23) where the VAT category code (BT-118) is ' Standard rated' the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are 'Standard Rate'.
                            [status] => WARNING
                        )
)

@mohdarafathossain you are providing some amount towards Allowance Charge under cac:Price tag but you are not considering its impact in calculations. This is the reason for getting BR-S-08. Please update your calculations after consider allowance charge amount provided under cac:price tag.

Please look at sample XMLs in SDK. You have to use the XML tags as provided in samples

Dear @mohdarafathossain

Thanks for reaching out,

Please note that the XML you provide does not comply with UBL2.1 standard as it’s contains XSD error when we validate it from our side, As @Ankit_Tiwari mentioned kindly install the latest version of SDK navigate to this path
(zatca-einvoicing-sdk-Java-238-R3.3.9\Data\Samples) to find the samples provide by ZATCA and comply with UBL2.1 standard,
However, regarding to your concerns about BR-S-08, after reviewing your XML it’s appear that it’s contains the below:

  • 3 InvoiceLine with S 15% VAT category.
  • In document level you have 2 TaxSubtotal for the same S VAT category.

Now since you don’t have any discount or charges on the Document level, the reason for getting the warning is that you are separating TaxSubtotal for each line Item with the same VAT, But As per the rule discerption taxable amount (BT-116) shall equal the “sum” of Invoice line net amounts (BT-131) , until the end of the rule
So in your case you need to delete one of the TaxSubtotal and ensure that the remaining one achieving the correct calculation, to make it easy it shoud be like the below:

  <cac:TaxSubtotal>
        <cbc:TaxableAmount currencyID="SAR">6255.00</cbc:TaxableAmount>
        <cbc:TaxAmount currencyID="SAR">938.25</cbc:TaxAmount>
        <cac:TaxCategory>
            <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>                
            <cbc:Percent>15.00</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:TaxSubtotal>    

Please let me know if you faced any further concerns,

Thanks,
Ibrahem Daoud