I am implementing a link to this accounts package from my application (C#) and am posting an purchase ledger invoice over to Sage. I have already done a similar thing with Sage Line 50 (UK) without problems, as there is a property to set the Tax Amount per line on the invoice.
Looking through the SDKs properties and also documentation, I'm struggling to find out how to do this on Sage 50 Accounting. Does anyone know what I should be doing here?
From the documentation, I can see the object (PurchaseJournal) has a method to get the tax amount, just nothing to set it. This is a major problem for us as some invoices from suppliers have adjusted tax values (for rounding) which needs to be used over Sage's calculations.
Thanks in advance!
EDIT: I'm getting closer to my solution! I've been able to proceed as normal with my posting information. Once all lines have been added to the journal entry for the invoice, I can then use the method on the Journal called GetTotalTaxAmountInfo(). This will get all the tax lines and I can set the amounts on there.. only problem is that I'm now struggling to find how to link the tax code on the line to the one returned by this method!
I figured this out in the end. After setting the tax code, I have to fetch the TaxLineSummaryInfo to process (C#): -
journalEntry.SetTaxCodeString(item.TaxCode, lineNumber);
// Set a manual figure (as it might be different on the suppliers invoice.
TaxSummaryInfo taxLineSummary = journalEntry.GetLineTaxAmountInfo(lineNumber);
if (taxLineSummary.GetCount() > 0 && item.TaxAmount.HasValue)
{
taxLineSummary.SetTaxAmountByRow(1, item.TaxAmount.Value);
taxLineSummary.Save();
}
else
{
taxLineSummary.Cancel();
}
I am assuming there is only 1 Sales Tax set against each code though here.