Announcing the launch of the Saudi Zatca-2 E-Invoicing app on FrappeCloud

@Support-at-ERPgulf May i know which are the fields that are taking for building number,street name etc for this zatca phase 2, currently we dont have fields like this right?

Give it on Address line 1 and 2 , we are using it for zatca
make sure PO Box number is 5 digits and valid.

@Support-at-ERPgulf Thank you very much for your valuable response. Just now i have done all the process of zatca and complaince check also get successfull. And all the files got generated too. I have just one more doubt on the xml file.

</cac:Signature><cac:AccountingSupplierParty>
    <cac:Party>
      <cac:PartyIdentification>
        <cbc:ID schemeID="CRN">3578964215</cbc:ID>
      </cac:PartyIdentification>
      <cac:PostalAddress>
        <cbc:StreetName>Near al thamam</cbc:StreetName>
        <cbc:BuildingNumber>6819</cbc:BuildingNumber>
        <cbc:PlotIdentification>Near al thamam</cbc:PlotIdentification>
        <cbc:CitySubdivisionName>no.97</cbc:CitySubdivisionName>
        <cbc:CityName>Jubail</cbc:CityName>
        <cbc:PostalZone>89654</cbc:PostalZone>
        <cbc:CountrySubentity>Eastern Province</cbc:CountrySubentity>
        <cac:Country>
          <cbc:IdentificationCode>SA</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>399999999900003</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Duplex Solutions (Demo)</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>

here i can see a building number for company has generated with 6819 which column is selected for this in address. where i cannot see this number which is not entered by me.

for address in address_list:
                    cac_PostalAddress = ET.SubElement(cac_Party_1, "cac:PostalAddress")
                    cbc_StreetName = ET.SubElement(cac_PostalAddress, "cbc:StreetName")
                    cbc_StreetName.text = address.address_line1
                    cbc_BuildingNumber = ET.SubElement(cac_PostalAddress, "cbc:BuildingNumber")
                    cbc_BuildingNumber.text = "6819"
                    cbc_PlotIdentification = ET.SubElement(cac_PostalAddress, "cbc:PlotIdentification")
                    cbc_PlotIdentification.text =  address.address_line1
                    cbc_CitySubdivisionName = ET.SubElement(cac_PostalAddress, "cbc:CitySubdivisionName")
                    cbc_CitySubdivisionName.text = address.address_line2
                    cbc_CityName = ET.SubElement(cac_PostalAddress, "cbc:CityName")
                    cbc_CityName.text = address.city
                    cbc_PostalZone = ET.SubElement(cac_PostalAddress, "cbc:PostalZone")
                    cbc_PostalZone.text = address.pincode
                    cbc_CountrySubentity = ET.SubElement(cac_PostalAddress, "cbc:CountrySubentity")
                    cbc_CountrySubentity.text = address.state
                    break

here in the code i can see that building number is given as static also.

Its a bug, will change the code to take it from Address-line-2 and push again later today.

@Support-at-ERPgulf While validating b2c sales invoice xml file through zatca sandbox xml testing portal got errors that

E-invoice-ACC-SINV-2024-00010.xml

Valid : false

Errors
category : QR_CODE_ERROR
code :QRCODE_INVALID
message : Invalid QR code format, Please follow the ZATCA QR code specifications
category : SIGNATURE_ERROR
code :invoiceSignedDataDigestValue
message : wrong invoice hashing
category : SIGNATURE_ERROR
code :X509IssuerName
message : wrong X509IssuerName  
category : XSD_SCHEMA_ERROR
code :SAXParseException
message : Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 90; columnNumber: 124; cvc-datatype-valid.1.2.1: 'GsiuvGjvchjbFhibcDhjv1886G' is not a valid value for 'base64Binary'.
category : SIGNATURE_ERROR
code :xadesSignedPropertiesDigestValue
message : wrong xadesSignedPropertiesDigestValue  
category : SIGNATURE_ERROR
code :X509SerialNumber
message : wrong X509SerialNumber  
category : SIGNATURE_ERROR
code :signatureValue
message : wrong signature Value 

Is it still under development?

Its bcs you generated with sandbox csr and testing on validation portal.

Post directly to zatca from your invoice screen and if you get any error or warning, post it here

@Support-at-ERPgulf Thanks for your valuable response. In invoice screen there is no errors i got success 200 message only. After getting success and the generated xml file validation in zatca sandbox portal only i got the error. Ok Fine

200 OK is final . good to know it all worked for you finally :slight_smile:

@Support-at-ERPgulf Yeah Thank you. Actually we have done the same process for phase 2 in codeigniter but while validating xml for simplified invoice we are not getting any errors. Thats why we suggest you to check on these errors.
The same thing i did for standard invoice xml generated with your code in zatca validation its getting validated with no errors.

Try to validate QR with zatca mobile app as well. if you get any error let me know

@Support-at-ERPgulf I have scanned the the qr with qrksareader its showing compatible. no issues. I will check with official zatca app and let you know.

@Support-at-ERPgulf any idea on creating debit note against sales invoice which is needed for phase 2 on saudi arabia? as zatca is checking for the system to bill both credit note and debit note against sales invoice but in the erpnext do we have an option to create debit note against sales invoice?

Its accountants to decide whether they are issuing debit-note against invoices. Not common.
Btw, do you have sample XML with line-discounts.?

@Support-at-ERPgulf Thanks for your valuable and timely response. Suppose the accountants has decided to issue debit for a sales invoice which is amount entered wrongly or in some other scenarios like sudden increment in sale price or something. how the accountants will create the debit note for that which has to be send to zatca for compliance? Also in your settings you have provided an option to select simplified and standard debit note for checking compliance. Which is the invoice you are looking for? is it from purchase debit note?

1-For compliance test, we use same invoice, but internally changing code. Its not actual debit-note
2-ERPNext needs customization to issue debit note against Invoice.

Btw, do you have sample XML with line-discounts.?

@Support-at-ERPgulf Yes I am attaching the xml with line-discounts it with this message.

<?xml version="1.0" encoding="UTF-8"?>
<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>
    <ext:UBLExtension>
        <ext:ExtensionURI>urn:oasis:names:specification:ubl:dsig:enveloped:xades</ext:ExtensionURI>
        <ext:ExtensionContent>
            <sig:UBLDocumentSignatures xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2" xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2">
                <sac:SignatureInformation> 
                    <cbc:ID>urn:oasis:names:specification:ubl:signature:1</cbc:ID>
                    <sbc:ReferencedSignatureID>urn:oasis:names:specification:ubl:signature:Invoice</sbc:ReferencedSignatureID>
                    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="signature">
                        <ds:SignedInfo>
                            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
                            <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"/>
                            <ds:Reference Id="invoiceSignedData" URI="">
                                <ds:Transforms>
                                    <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
                                        <ds:XPath>not(//ancestor-or-self::ext:UBLExtensions)</ds:XPath>
                                    </ds:Transform>
                                    <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
                                        <ds:XPath>not(//ancestor-or-self::cac:Signature)</ds:XPath>
                                    </ds:Transform>
                                    <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
                                        <ds:XPath>not(//ancestor-or-self::cac:AdditionalDocumentReference[cbc:ID='QR'])</ds:XPath>
                                    </ds:Transform>
                                    <ds:Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
                                </ds:Transforms>
                                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                <ds:DigestValue>Rg5ftr1f+4XWLQnhOBop7prGRnE6d39SEYZfFzVx+Bk=</ds:DigestValue>
                            </ds:Reference>
                            <ds:Reference Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties" URI="#xadesSignedProperties">
                                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                <ds:DigestValue>OGU1NTRiNjBkZDc4ZmFkOTNlMjg2MWE5OGMxNjEzYjI4Yjc2NjkxMTA2ZDA0YmZlMjZjZDFmYzdhYzJkZjJiYg==</ds:DigestValue>
                            </ds:Reference>
                        </ds:SignedInfo>
                        <ds:SignatureValue>MEYCIQDBtGM1tYEH1+5LSBuKazuSv0fpE52h3zmMW8/gX623qwIhAIpQwQ0GrKaMB3WDLKjtx8WI1RQIGmJIQbAgUpK9hJfE</ds:SignatureValue>
                        <ds:KeyInfo>
                            <ds:X509Data>
                                <ds:X509Certificate>MIID3jCCA4SgAwIBAgITEQAAOAPF90Ajs/xcXwABAAA4AzAKBggqhkjOPQQDAjBiMRUwEwYKCZImiZPyLGQBGRYFbG9jYWwxEzARBgoJkiaJk/IsZAEZFgNnb3YxFzAVBgoJkiaJk/IsZAEZFgdleHRnYXp0MRswGQYDVQQDExJQUlpFSU5WT0lDRVNDQTQtQ0EwHhcNMjQwMTExMDkxOTMwWhcNMjkwMTA5MDkxOTMwWjB1MQswCQYDVQQGEwJTQTEmMCQGA1UEChMdTWF4aW11bSBTcGVlZCBUZWNoIFN1cHBseSBMVEQxFjAUBgNVBAsTDVJpeWFkaCBCcmFuY2gxJjAkBgNVBAMTHVRTVC04ODY0MzExNDUtMzk5OTk5OTk5OTAwMDAzMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEoWCKa0Sa9FIErTOv0uAkC1VIKXxU9nPpx2vlf4yhMejy8c02XJblDq7tPydo8mq0ahOMmNo8gwni7Xt1KT9UeKOCAgcwggIDMIGtBgNVHREEgaUwgaKkgZ8wgZwxOzA5BgNVBAQMMjEtVFNUfDItVFNUfDMtZWQyMmYxZDgtZTZhMi0xMTE4LTliNTgtZDlhOGYxMWU0NDVmMR8wHQYKCZImiZPyLGQBAQwPMzk5OTk5OTk5OTAwMDAzMQ0wCwYDVQQMDAQxMTAwMREwDwYDVQQaDAhSUlJEMjkyOTEaMBgGA1UEDwwRU3VwcGx5IGFjdGl2aXRpZXMwHQYDVR0OBBYEFEX+YvmmtnYoDf9BGbKo7ocTKYK1MB8GA1UdIwQYMBaAFJvKqqLtmqwskIFzVvpP2PxT+9NnMHsGCCsGAQUFBwEBBG8wbTBrBggrBgEFBQcwAoZfaHR0cDovL2FpYTQuemF0Y2EuZ292LnNhL0NlcnRFbnJvbGwvUFJaRUludm9pY2VTQ0E0LmV4dGdhenQuZ292LmxvY2FsX1BSWkVJTlZPSUNFU0NBNC1DQSgxKS5jcnQwDgYDVR0PAQH/BAQDAgeAMDwGCSsGAQQBgjcVBwQvMC0GJSsGAQQBgjcVCIGGqB2E0PsShu2dJIfO+xnTwFVmh/qlZYXZhD4CAWQCARIwHQYDVR0lBBYwFAYIKwYBBQUHAwMGCCsGAQUFBwMCMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwMwCgYIKwYBBQUHAwIwCgYIKoZIzj0EAwIDSAAwRQIhALE/ichmnWXCUKUbca3yci8oqwaLvFdHVjQrveI9uqAbAiA9hC4M8jgMBADPSzmd2uiPJA6gKR3LE03U75eqbC/rXA==</ds:X509Certificate>
                            </ds:X509Data>
                        </ds:KeyInfo>
                        <ds:Object>
                            <xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Target="signature">
                                <xades:SignedProperties Id="xadesSignedProperties">
                                    <xades:SignedSignatureProperties>
                                        <xades:SigningTime>2024-08-28T12:13:11</xades:SigningTime>
                                        <xades:SigningCertificate>
                                            <xades:Cert>
                                                <xades:CertDigest>
                                                    <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                                    <ds:DigestValue>ZDMwMmI0MTE1NzVjOTU2NTk4YzVlODhhYmI0ODU2NDUyNTU2YTVhYjhhMDFmN2FjYjk1YTA2OWQ0NjY2MjQ4NQ==</ds:DigestValue>
                                                </xades:CertDigest>
                                                <xades:IssuerSerial>
                                                    <ds:X509IssuerName>CN=PRZEINVOICESCA4-CA, DC=extgazt, DC=gov, DC=local</ds:X509IssuerName>
                                                    <ds:X509SerialNumber>379112742831380471835263969587287663520528387</ds:X509SerialNumber>
                                                </xades:IssuerSerial>
                                            </xades:Cert>
                                        </xades:SigningCertificate>
                                    </xades:SignedSignatureProperties>
                                </xades:SignedProperties>
                            </xades:QualifyingProperties>
                        </ds:Object>
                    </ds:Signature>
                </sac:SignatureInformation>
            </sig:UBLDocumentSignatures>
        </ext:ExtensionContent>
    </ext:UBLExtension>
</ext:UBLExtensions><cbc:ProfileID>reporting:1.0</cbc:ProfileID>
    <cbc:ID>INV/011</cbc:ID>
    <cbc:UUID>3de5f17d-c480-4935-9486-136365b66f49</cbc:UUID>
    <cbc:IssueDate>2024-08-28</cbc:IssueDate>
    <cbc:IssueTime>12:06:06</cbc:IssueTime>
    <cbc:InvoiceTypeCode name="0100000">388</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
    <cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode><cac:AdditionalDocumentReference>
        <cbc:ID>ICV</cbc:ID>
        <cbc:UUID>105</cbc:UUID>
    </cac:AdditionalDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>PIH</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">LsBApcuR1Eal+0S9nxwHc0M37GnXS+UotOJpjPYaL2I=</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference><cac:AdditionalDocumentReference>
        <cbc:ID>QR</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">ATbYtNix2YPYqSDYudiv2YQg2KfZhNiu2YTZitisINmE2LTYqNmD2KfYqiAgfCBBREFMIEdVTEYCDzM5OTk5OTk5OTkwMDAwMwMTMjAyNC0wOC0yOFQxMjowNjowNgQGMTEwLjAwBQUxNC4zNQYsUmc1ZnRyMWYrNFhXTFFuaE9Cb3A3cHJHUm5FNmQzOVNFWVpmRnpWeCtCaz0HYE1FWUNJUURCdEdNMXRZRUgxKzVMU0J1S2F6dVN2MGZwRTUyaDN6bU1XOC9nWDYyM3F3SWhBSXBRd1EwR3JLYU1CM1dETEtqdHg4V0kxUlFJR21KSVFiQWdVcEs5aEpmRQhYMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEoWCKa0Sa9FIErTOv0uAkC1VIKXxU9nPpx2vlf4yhMejy8c02XJblDq7tPydo8mq0ahOMmNo8gwni7Xt1KT9UeA==</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">2055134209</cbc:ID>
            </cac:PartyIdentification>
            <cac:PostalAddress>
                <cbc:StreetName>  شارع الفهد | Al-Fahadh Street</cbc:StreetName>
                <cbc:BuildingNumber>8596</cbc:BuildingNumber>
                <cbc:CitySubdivisionName>  مدينة الجبيل | Jubail City</cbc:CitySubdivisionName>
                <cbc:CityName>  الدمام | Dammam</cbc:CityName>
                <cbc:PostalZone>65656</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>SA</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>399999999900003</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>شركة عدل الخليج لشبكات  | ADAL GULF</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingSupplierParty><cac:AccountingCustomerParty>
        <cac:Party>
            <cac:PostalAddress>
                <cbc:StreetName>
 

 
شارع ١ | street 1</cbc:StreetName>
                <cbc:BuildingNumber>7896</cbc:BuildingNumber>
                <cbc:CitySubdivisionName>
 

 
الجبيل | Al Jubail</cbc:CitySubdivisionName>
                <cbc:CityName>
 

 
الجبيل | Jubail</cbc:CityName>
                <cbc:PostalZone>45632</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>SA</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
             <cbc:CompanyID>300000000000003</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName> | Prasanth</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingCustomerParty><cac:Delivery>
        <cbc:ActualDeliveryDate>2024-08-28</cbc:ActualDeliveryDate>
    </cac:Delivery>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode></cac:PaymentMeans>
    <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">2.00</cbc:Amount>
        <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:AllowanceCharge><cac:AllowanceCharge>
        <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReasonCode>RV</cbc:AllowanceChargeReasonCode>
        <cbc:AllowanceChargeReason>Loading Charge</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">4.00</cbc:Amount>
        <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:AllowanceCharge><cac:AllowanceCharge>
        <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReasonCode>SAA</cbc:AllowanceChargeReasonCode>
        <cbc:AllowanceChargeReason>Shipping Charge</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">10.00</cbc:Amount>
        <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:AllowanceCharge><cac:AllowanceCharge>
        <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReasonCode>ADR</cbc:AllowanceChargeReasonCode>
        <cbc:AllowanceChargeReason>Other Charges</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">3.00</cbc:Amount>
        <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:AllowanceCharge><cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">14.35</cbc:TaxAmount>
    </cac:TaxTotal>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">14.35</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">95.65</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">14.35</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">80.65</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">95.65</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">110.00</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">2.00</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="SAR">17.00</cbc:ChargeTotalAmount><cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
        <cbc:PayableRoundingAmount currencyID="SAR">0.00</cbc:PayableRoundingAmount>
        <cbc:PayableAmount currencyID="SAR">110.00</cbc:PayableAmount>
    </cac:LegalMonetaryTotal><cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">1.000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">38.48</cbc:LineExtensionAmount>
        <cac:TaxTotal>
             <cbc:TaxAmount currencyID="SAR">5.77</cbc:TaxAmount>
             <cbc:RoundingAmount currencyID="SAR">44.25</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>  البند 1 | item 1</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">38.48</cbc:PriceAmount>
            <cbc:BaseQuantity unitCode="PCE">1</cbc:BaseQuantity>
            <cac:AllowanceCharge>
               <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
               <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
               <cbc:Amount currencyID="SAR">5.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine><cac:InvoiceLine>
        <cbc:ID>2</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">1.000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">42.17</cbc:LineExtensionAmount>
        <cac:TaxTotal>
             <cbc:TaxAmount currencyID="SAR">6.33</cbc:TaxAmount>
             <cbc:RoundingAmount currencyID="SAR">48.50</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>  البند 2 | item 2</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">42.17</cbc:PriceAmount>
            <cbc:BaseQuantity unitCode="PCE">1</cbc:BaseQuantity>
            <cac:AllowanceCharge>
               <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
               <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
               <cbc:Amount currencyID="SAR">10.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine></Invoice>

Here is the one which asked for. Also i suggest you check on the error which i have raised before that while validating the simplified sales invoice getting errors from zatca

E-invoice-ACC-SINV-2024-00010.xml

Valid : false

Errors
category : QR_CODE_ERROR
code :QRCODE_INVALID
message : Invalid QR code format, Please follow the ZATCA QR code specifications
category : SIGNATURE_ERROR
code :invoiceSignedDataDigestValue
message : wrong invoice hashing
category : SIGNATURE_ERROR
code :X509IssuerName
message : wrong X509IssuerName  
category : XSD_SCHEMA_ERROR
code :SAXParseException
message : Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 90; columnNumber: 124; cvc-datatype-valid.1.2.1: 'GsiuvGjvchjbFhibcDhjv1886G' is not a valid value for 'base64Binary'.
category : SIGNATURE_ERROR
code :xadesSignedPropertiesDigestValue
message : wrong xadesSignedPropertiesDigestValue  
category : SIGNATURE_ERROR
code :X509SerialNumber
message : wrong X509SerialNumber  
category : SIGNATURE_ERROR
code :signatureValue
message : wrong signature Value

this errors can be solved it seems i dont know exactly as we also got this same errors in codeigniter but now it is solved as we validated our simplified sales invoice to zatca we are getting cleared. This is my suggestion to remove the future issues from zatca.

Can I integrate Two Companies in simulation with same Tax Id ?

on simulation, YES

same thing for production or different ?

For production, you invoice has to be posted from respective company VAT number. Otherwise there will be an accounting mismatch. If both company using same VAT, there may be a group VAT ID. check with your zatca account manager