I am writing a program that sends ecommerce orders from our website to AX and I am running into trouble with updating the sales tax. We are using a third party site to get our tax rates and I need to be able to update the rates AX generated for that order.I can get the adjustment to show in the Sales Tax Form on the sales order but I still can’t process it.
the closest I’ve come is using the code below:
// This is the only method in the ImportToAX Class
str ImportSalesOrder (str CustAccount, str _oppNo,SalesPrice MinPmtAmt)
retval = “”;
// Obtain the next SalesId (Next Number Sequence)…
NumberSeq = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequence);
salesTable.SalesId = NumberSeq.num();
// Create the Sales Order…
salesTable.CustAccount = CustAccount;
salesTable.PurchOrderFormNum = _oppNo;
salesTable.SalesResponsible = “CADMIN”;
// Create the Sales Line…
salesLine.SalesId = salesTable.SalesId;
// The following three lines were added, because AX was requiring a defined site for inventory dimensions…
inventDim = salesLine.inventDim();
inventDim.InventSiteId = “001”;
// Item information
salesLine.ItemId = ‘MMP’;
salesLine.SalesPrice = MinPmtAmt;
salesLine.LineAmount = MinPmtAmt;
salesLine.SalesQty = 1;
salesLine.QtyOrdered = 1;
salesLine.SalesUnit = ‘EA’;
salesLine.TaxItemGroup = ‘ALL’;
// Create the Sales Order Line
salesLine.createLine(NoYes::Yes, NoYes::Yes, NoYes::No, NoYes::Yes, NoYes::No, NoYes::No);
////////////////// Test code for sales tax adjustment
taxWorkRegulation.TaxRegulationAmountCur = -987;
retval = salesTable.SalesId;
retval = “”;
SalesFormLetter CreateInvoice(TransDate MinDate)
// Create the Invoice
letter.update(salesTable, MinDate, SalesUpdate::All, AccountOrder::None, NoYes::No, NoYes::No);
ret = letter;
I still get the following error:
Tax is regulated on sales order ID S24601
Tax regulations are found Sales orders cannot be rearranged when individual sales orders are tax regulated.
Remove the regulation on the orders, rearrange and regulate the tax on the summary order.
Update has been canceled because of an error.
Any help would be greatly appreciated.