DataPort Sales Invoices with Fixed Vat value

ADARTIHSADARTIHS Member Posts: 78
Hi Guys/Dolls merry xmas :o

Version: NAV 2009 SP1
Database:SQL

I am trying to import details from a spreadsheet to import Sales invoice lines. The import creates A header and lines into the Sales Header and Lines table. The spreadsheet provided also has VAT values which I cannot import in? When I calculate with NAV there is rounding differnces.
Is there anyway I can import the VAT value and keep this fixed. Also to be a pain some invoices have settlement discount.

thanks for your help. This is a horrible one.

Thanks
ADARTIHS

Comments

  • SavatageSavatage Member Posts: 7,142
    "The spreadsheet provided also has VAT values which I cannot import in?"

    Why? are you getting an error or something?

    Have you tried importing that value into a variable and then mapping it to it's proper field?

    Validate(Taxfield,Your Variable);
  • BeliasBelias Member Posts: 2,998
    hi ADARTIHS, i've just faced the same problem with VAT: no matter what field you validate before, nav will screw up your calculation in some way.
    For "screw up" i mean that nav has its own logic, and based on it, it calculates the vat, but when interfacing with external programs, you usually want the data to be perfectly the same in nav and external system, and this is hard to do when facing with vat differences and roundings. The only method i found (it's really odd, but it works fine) is to force all the values in: here's the code (put it in the loop for the lines). before reassigning the values, remember to run

    lCUReleaseDoc.PerformManualRelease(lTBSalesHeader);//lCUReleaseDoc is Release sales document codeunit
    //pdecnewvat: vat amount per line in the external program
    //this code does not support the foreign currency, but you can adapt it
    lDECVATAmountFromNAV := vTBSalesLines."Amount Including VAT" - vTBSalesLines.Amount;
    lDECVATDifference := pDECNewVAT - lDECVATAmountFromNAV;
    vTBSalesLines."VAT Difference" := lDECVATDifference;
    vTBSalesLines.Amount := pDECNewAmount;
    vTBSalesLines."Amount Including VAT" := pDECNewAmount + pDECNewVAT;
    vTBSalesLines."Outstanding Amount" := pDECNewAmount + pDECNewVAT;  
    vTBSalesLines."Outstanding Amount (LCY)" := pDECNewAmount + pDECNewVAT;
    vTBSalesLines."VAT Base Amount" := pDECNewAmount;
    vTBSalesLines."Line Amount" := pDECNewAmount;
    
    vTBSalesLines.MODIFY(TRUE);
    

    I know that's not the way nav works, but we couldn't find another way...if there's one and someone knows it, please suggest it to us
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.