lavaloon-eg / ksa_compliance

KSA Compliance App for KSA E-invoice
https://www.lavaloon.com/
GNU Affero General Public License v3.0
30 stars 18 forks source link

Country code ,en validation warnings and errors #121

Open hamzaRuzmh opened 5 days ago

hamzaRuzmh commented 5 days ago

hello lavaloon team when I create b2b invoice simulation i get this warning error can you please help me to solve it .

this message

Errors and Warnings en validation warnings : CODE : BR-CO-16, MESSAGE : [BR-CO-16]-Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Pre-Paid amount (BT-113) + Rounding amount (BT-114). ksa validation errors : CODE : BR-KSA-04, MESSAGE : [BR-KSA-04]-The document issue date (BT-2) must be less or equal to the current date. Screenshot 2024-09-17 013728

mhaggag commented 5 days ago

For the country code warning, please update the country code for the associated country to upper-case (e.g. SA instead of sa). Then go to the ZATCA Business Settings list, open the settings for the company in question, and re-select the company address; just clear the field, then select the same address and save. It'll update the country code in the business settings to the updated code.

For the other warning, can you please share the POS invoice and the generated Sales Invoice Additional Fields XML?

hamzaRuzmh commented 5 days ago

thanks , for country code it solved as you said also I have those error in b2b invoice as shown in attached image Screenshot 2024-09-17 013728

also i will attach the invoice xml but I can not attach xml files her not allow so if there is other way to attach file tell me and I will attach it

<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>nCe8p+SGpM1BzPjpCPDUnnZzTfu3ByRewN4GjTbPsFU=</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>YjgwOTM4NTgxODNmMmQ2NDAxMDlmYWYjJmZjE4NDAyZDcwN2UxMjFmZjQ1OA==</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>MEQCIHYCx7OZ8xXuLNM7lNR2dZf0RqlNBekjYm7myw==</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUUrekNDQktHZ0F3SUJBZ0lUZWdBQVR1T2hKRjNlYlpBeWN3QUJBQUJPNHpBS0JnZ3Foa2pPUFFRREFqQmlNUlV3RXdZS0NaSW1pWlB5TEdRQkdSWFFWkZnZGxlSFJuWVhwME1Sc3dHUVlEVlFRREV4SlFSVnBGU1U1V1QwbERSVk5EUVRNdFEwRXdIaGNOTWpRd09URTJNakExTXpNeFdoY05Nall3T1RFMk1qRXdNek14V2pCQk1Rc3dDUVlEVlFRR0V3SlRRVEVRTUE0R0ExVUVDaE1IZEdGbWQyVmxaREVQTUEwR0ExVUVDeE1HVFdGcGJpMHhNUTh3RFFZRFZRUURFd1pOWVdsdUxURXdWakFRQmdjcWhrak9QUUlCQmdVcmdRUUFDZ05DQUFUcXMwYTV1ZWhYcUZOVXBLRkRXcm5BdGoyMzhlUzdoSW5kRmFSZFJPTDcxZERNZEZrbUlUWjZteGFoeTJJRjFtWDdRdnV2QkVzaFdzVmQzL1F0ZkVsam80SURXRENDQTFRd2djSUdBMV</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-09-16T22:21:43</xades:SigningTime>
<xades:SigningCertificate>
<xades:Cert>
<xades:CertDigest>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>MWE1ZWU4Oc1NmZkMjMyNWMyNDdjYzE3ZDBkODUwMDIyMg==</ds:DigestValue>
</xades:CertDigest>
<xades:IssuerSerial>
<ds:X509IssuerName>CN=PEZEINVOICESCA3-CA, DC=extgazt, DC=gov, DC=local</ds:X509IssuerName>
<ds:X509SerialNumber>2720691019082439430589244863143450149574954723</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>ACC-SINV-2024-00007</cbc:ID>
<cbc:UUID>c027ae38-02ed-4b16-af96-524e4231ede8</cbc:UUID>
<cbc:IssueDate>2024-09-17</cbc:IssueDate>
<cbc:IssueTime>01:21:41</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>2</cbc:UUID>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference>
<cbc:ID>PIH</cbc:ID>
<cac:Attachment>
<cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">+U7+lgGibN5ATrTqnks8OWjLBlPCRu7oPCYFuQXoSfM=</cbc:EmbeddedDocumentBinaryObject>
</cac:Attachment>
</cac:AdditionalDocumentReference>
<!--  Seller info  -->
<cac:AdditionalDocumentReference>
<cbc:ID>QR</cbc:ID>
<cac:Attachment>
<cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">AQd0YWZ3ZWVkAg8zMDEwMjY0NjcyMDAwMDMDEzIwMjQtMDktMTdUMDE6MjE6NDEEBDExLjUFAzEuNQYsbkNlOHArU0dwTTFCelBqcENQRT0HYE1FUUNJSFlDeDdPWjh4WHVMTk03bE5SdXpGNk1jdXRjZzFEZGxsc2tOUlRCVkh4UUFpQmpEZzdYZktVeGlvYmFOcXdxcXV5Y0tEczJkWmYwUnFsTkJla2pZbTdteXc9PQhYMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE6rNGubnoV6hTVKShQ1q5wLY9t/Hku4SJ3RWkXUTi+9XQzHRZJiE2epsWoctiBdZl+0L7rwRLIVrFXd/0LXxJYw==</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>
<!--  Additional seller IDs  -->
<cac:PartyIdentification>
<cbc:ID schemeID="CRN">101023456</cbc:ID>
</cac:PartyIdentification>
<cac:PostalAddress>
<cbc:StreetName>Al-Rayyan District - Eastern Sub-Ring Ring</cbc:StreetName>
<cbc:BuildingNumber>6805</cbc:BuildingNumber>
<cbc:CitySubdivisionName>Al-Rayyan District</cbc:CitySubdivisionName>
<cbc:CityName>Riyadh</cbc:CityName>
<cbc:PostalZone>14213</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>SA</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<!--  Vat Registration Number  -->
<cbc:CompanyID>3010263597200003</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>tafweed</cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingSupplierParty>
<!--  Buyer info  -->
<cac:AccountingCustomerParty>
<cac:Party>
<cac:PostalAddress>
<cbc:StreetName>riyadh -oliaa</cbc:StreetName>
<cbc:BuildingNumber>1234</cbc:BuildingNumber>
<cbc:CitySubdivisionName>riyadh</cbc:CitySubdivisionName>
<cbc:CityName>riyadh</cbc:CityName>
<cbc:PostalZone>14213</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>SA</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>3010296557200003</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>ahmed</cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cbc:ActualDeliveryDate>2024-09-17</cbc:ActualDeliveryDate>
</cac:Delivery>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReason>Discount</cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">0.0</cbc:Amount>
<cac:TaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15.0</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:AllowanceCharge>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">1.5</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">10.0</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">1.5</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15.0</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">1.5</cbc:TaxAmount>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="SAR">10.0</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="SAR">10.0</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="SAR">11.5</cbc:TaxInclusiveAmount>
<cbc:AllowanceTotalAmount currencyID="SAR">0.0</cbc:AllowanceTotalAmount>
<cbc:PayableRoundingAmount currencyID="SAR">0.5</cbc:PayableRoundingAmount>
<cbc:PayableAmount currencyID="SAR">11.5</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<!--  Invoice item lines  -->
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:Note>tset</cbc:Note>
<cbc:InvoicedQuantity unitCode="PCE">1.0</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">10.0</cbc:LineExtensionAmount>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">1.5</cbc:TaxAmount>
<cbc:RoundingAmount currencyID="SAR">11.5</cbc:RoundingAmount>
</cac:TaxTotal>
<cac:Item>
<cbc:Name>tset</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15.0</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="SAR">10.0</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="PCE">1.0</cbc:BaseQuantity>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:Amount currencyID="SAR">140.0</cbc:Amount>
<cbc:BaseAmount currencyID="SAR">150.0</cbc:BaseAmount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
</Invoice>
omarashrafsarhan commented 5 days ago

This invoice has discount on the line level as I see, But this is okay the rejection reason is in the rounding amount in this line

0.5 All you need to do is to disable the rounding, and it will work
hamzaRuzmh commented 5 days ago

Thank you very much for your response and quick response , I stopped the rounding and the error disappear.

but i still have point please explain it to me

  1. in some invoice log there is some warning is it important to solve those warning for Zatca or are they normal and do not cause problems? Is it important for all invoice to be in "Accepted Invoices" category? Screenshot 2024-09-17 170124
omarashrafsarhan commented 5 days ago

You have three possible responses from ZATAC

Open ZATCA integration log and check the warnings reason.