Need clarification about Schematron Validation

@idaoud ,
1-yes
2- I installed it from zatca as the user manual documentation

Can you share the source of fatooranet.exe or any example for .net 8 using latest sdk?

Dear @hassanayoub85

Please provide the exact steps you followed after installing the SDK .Net 3.3.9 to ensure comprehensive support as usual.

Additionally, you can reach out to your RM to reach out our support team via below mail.

SP mail: sp_support@zatca.gov.sa

Thanks,
Ibrahem Daoud.

Check Ikvm.runtime.dll file version is need to use latest updated version.

If you need more clarification please send your files in my email jasimwts@gmail.com.

Hello @jasimsa, I just sent you the files in your email.

Hello @idaoud , I just sent the files.

Your code now working.

First you need a copy of ikvm and runtime folder from sdk folder.
Then I will share Dlls related java.

Hi @jasimsa , Thanks alot, it works!.
But how come that the Official SDK have this issue, they should solve it

@eCloud @idaoud @jasimsa

In our ERP system, we do not issue separate invoices for prepayments. Instead, customers make advance payments, and we record the prepayment amount directly during invoice generation in the frontend. The prepayment is subtracted from the total amount to calculate the net payable amount.

For example, consider the calculation shown below:

  1. Invoice Details:
  • Description: “Laptop”
  • Quantity: 2
  • Unit Price: 500
  • Amount (Excl. VAT): 1000
  • VAT @ 15%: 150
  • Amount (Incl. VAT): 1150
  1. Prepayment Handling:
  • Total Amount: 1000.00
  • Discount: 50.00
  • Total Before VAT: 950.00
  • VAT Amount: 142.50
  • Amount with VAT: 1092.50
  • Advance Amount: 100.00
  • Net Amount Payable: 992.50

My Understanding and Approach:

From my research, it seems I need to structure the XML as follows for the prepayment:

Invoice Line for Prepaid Amount:

<cac:InvoiceLine>
    <cbc:ID>2</cbc:ID>
    <cbc:InvoicedQuantity unitCode="PCE">0.000000</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="SAR">0.00</cbc:LineExtensionAmount>
    <cac:DocumentReference>
        <cbc:ID>46531</cbc:ID>
        <cbc:UUID>a79760f7-2f48-4da9-85a5-40459a147c80</cbc:UUID>
        <cbc:IssueDate>2022-08-15</cbc:IssueDate>
        <cbc:IssueTime>12:28:17</cbc:IssueTime>
        <cbc:DocumentTypeCode>386</cbc:DocumentTypeCode>
    </cac:DocumentReference>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0</cbc:TaxAmount>
        <cbc:RoundingAmount currencyID="SAR">0</cbc:RoundingAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">1000</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">150</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:Item>
        <cbc:Name>Laptop | حاسوب محمول</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">0.00</cbc:PriceAmount>
    </cac:Price>
</cac:InvoiceLine>

Prepaid Amount in LegalMonetaryTotal:

<cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="SAR">2000</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="SAR">1900</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="SAR">2185</cbc:TaxInclusiveAmount>
    <cbc:AllowanceTotalAmount currencyID="SAR">100</cbc:AllowanceTotalAmount>
    <cbc:PrepaidAmount currencyID="SAR">1150</cbc:PrepaidAmount>
    <cbc:PayableAmount currencyID="SAR">1035</cbc:PayableAmount>
</cac:LegalMonetaryTotal>

My Question:

Since we do not generate separate prepayment invoices, we simply deduct the advance amount during the invoice generation. In this scenario, how should the XML structure look to comply with ZATCA regulations?

Could you confirm if the above XML structure is correct for such cases? If not, how should we handle the advance payment in the XML to ensure compliance?

@arjun_tech24

In my opinion, on the eInvoice side, if the sales advance payment is not reported, you do not need to include it in your eInvoice.

However, regarding tax regulations, you may want to consult a tax advisor in KSA for further clarification. Or maybe from ZATCA can give more accurate answer to your question.

Hello @eCloud ,
Hope you are doing well. I need your help. We have created our dot net projection with using ZATCA SDK DLL. But when we deployed it to SAP BTP platform. We have faced validation error. that error is related to validation files path. Becasue SAP BTP has changed files path. That’s why it has not access to schema control files with path. Zatca side they created static path. Do you have any sample code or any suggestion to fix that path for schema control? Could you please help me?

Thanks,
Mustafa Acar

@Mustafa.Acar

Salam,

I am also faced this issues while deploying.

I created folders in file manager of hosting panel as follows

for example

Root Folder : Zatca
I copied our complete ‘data’ folder into Zatca root folder.

Then I created folder - ‘A’
within A I created folder-‘B’
within B I created folder-‘C’

after that I deploying my released files into folder ‘C’

Now Schematron validated properly.

Try it from your side if you are facing any issues please let me know.

Salam @jasimsa
Have you deployed to SAP BTP?

@Mustafa.Acar
I don’t fully understand what SAP BTP is. Regarding the RelativePath issue (Zatca .NET SDK), you can follow @jasimsa’s advice:

Move the Data folder from Zatca SDK into the Zatca folder, and then relocate your application executable and dependency files into the C folder.

Dears,

I have one doubt.

Both Standard and Simplified invoice xml files need to validate before posting into Zatca?

ValidationResult ValidateEInvoice(XmlDocument eInvoice, string certificateFileContent, string pihFileContent)

some people told only validate simplified invoices need to validate standard invoices no need to validate.

Please clarify

@idaoud @Malik

Hi,
Check this video I for ZATCA might help you,

thanks