Closed dankennedy closed 7 years ago
I'm guessing you are referring to the Sage 50 Accounts Sdata adapter here. Assuming that is the case then you can't have mixed tax on a single line item I'm afraid. The best approach would be as you suggest to create separate lines for each separate tax rate item.
Hope that helps.
Thanks for clarifying so quickly Darrin. Very much appreciated. I'll split them as suggested.
Thanks again.
Darron,
I made the changes discussed and split the invoice lines so it creates 2 per source entry i.e. VATable and non VATable, and while it creates the first two invoice lines as expected, it applies VAT across all remaining lines regardless of the product/commodity. Example attached. Any ideas?
What does your payload look like for that submission?
I've not traced the HTTP request but I've added a reference to the SData lib from C# and my code to construct each line looks like this: `var invoiceLine = new purchaseOrderLineFeedEntry {
deliveryDate = transactionDate,
netTotal = net,
taxTotal = tax,
grossTotal = gross,
actualPrice = gross,
status = Constants.WrittenSalesOrderLine,
text = lineReference,
quantity = 1
};
// Default to S1 product line if we have tax or set the commodity to a tax exempt product
// for this line to ensure Tax isn't forced on the invoice line
if (tax != 0)
invoiceLine.type = Constants.FreeTextInvoiceLine;
else
{
invoiceLine.type = Constants.StandardInvoiceLine;
invoiceLine.commodity = taxExemptProduct;
}
return invoiceLine;`
Sorry can't seem to get code to format correctly :(
Have you tried setting to S2 for tax exempt?
From: Dan Kennedy notifications@github.com Sent: Monday, November 21, 2016 3:44:46 PM To: Sage/SData-2.0 Subject: Re: [Sage/SData-2.0] Mixed VAT on invoice line (#71)
I've not traced the HTTP request but I've added a reference to the SData lib from C# and my code to construct each line looks like this:
` var invoiceLine = new purchaseOrderLineFeedEntry {
deliveryDate = transactionDate,
netTotal = net,
taxTotal = tax,
grossTotal = gross,
actualPrice = gross,
status = Constants.WrittenSalesOrderLine,
text = lineReference,
quantity = 1
};
// Default to S1 product line if we have tax or set the commodity to a tax exempt product
// for this line to ensure Tax isn't forced on the invoice line
if (tax != 0)
invoiceLine.type = Constants.FreeTextInvoiceLine;
else
{
invoiceLine.type = Constants.StandardInvoiceLine;
invoiceLine.commodity = taxExemptProduct;
}
return invoiceLine;
`
You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Sage/SData-2.0/issues/71#issuecomment-261974449, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHAXXegRf2F_0lUXAlosXE21jQWseQGCks5rAbxtgaJpZM4KxTK6.
No, so instead of retrieving the TAXEXEMPTPRODUCT, retrieve the S2 product and set it instead of taxExemptProduct after setting the line type?
Have you tried setting to S2 for tax exempt?
You won't find the S1, S2 or S3 products in the commodities feeds I'm afraid so you couldn't set the commodity to that for the line..
If the taxExemptProduct variable in your above code snippet represents a commodity that is a zero rated tax item in Accounts then I would expect the resulting invoice line to have zero tax set on it too.
So Darron, firstly thanks for your help in figuring this out. For info I think I've finally got something that works. Basically I now retrieve the 2 tax codes and only set the taxTotal when there is tax to apply i.e. retrieve taxcode T0 for zero rated lines and T1 for standard rate, and then set this on the invoice line itself and leave the taxTotal as null when it's zero rated. This seems to have cured the problem.
Thanks again.
Dan
I'm trying to use the SData API to automate creation of invoices but regardless of the VAT amount I set on the feed entry, Sage automatically recalculates the amount based (presumably) on the commodity/product and tax code. My problems is a single invoice line may contain VAT which has already been calculated and applies to only a portion of net value.
Is it possible to create a single invoice line entry with predefined net, VAT and gross fields and prevent Sage from recalculating anything or do I have to create separate lines for each of the VAT and non VATable elements?
Any help, much appreciated.
Thanks
Dan