Following Tax classes used to calculate tax for sales order in axapta
1. Taxsales
2. Tax
3. TaxRegulation.
In Tax class there is a method CalcTax on which tax calculate for particular tax code. First tax itemgroup takes from Sales Line then its take formula then formulate evaluated by using evabuf method.
tmptaxworkTrans is a temporary table which shows temporary tax calculation.If there is tax adjustment then you need to apply tax button on salestax form to get effects.
Corrected Tax or tax adjustment stored in field SourceRegulateAmountCur of Tmptaxworktrans and
Regular tax field is sourceTaxAmountCur.
Before posting table is
tmptax and tmptaxworktrans,tmptaxregulation
After posting Tax table is
TaxTrans,ledgerTrans,CustInvoiceJour.
static void saleslinewisetax(Args _args)
{
SalesTotals salesTotals;
SalesTable salesTable;
container displayFields;
str totalTax, amountWithoutTax, amountInclTax;
SalesLine SalesLine;
TmpTaxWorkTrans taxWorkTrans;
tax tax;
int i;
taxcode TaxName;
salesTable = salesTable::find('PWI-0001058');
salesTotals = SalesTotals::construct(salesTable, salesUpdate::All);
salesTotals.calc();
tax = salesTotals::getTax(salesTable);
taxWorkTrans.setTmpData(tax.tmpTaxWorkTrans());
while select taxWorkTrans
{
//info (strFmt('%1-%2-%3-%4', taxWorkTrans.TaxCode, taxWorkTrans.TaxAmount,taxWorkTrans.SourceRecId,taxWorkTrans.SourceTableId));
I++;
if(I==1)
{
TaxName = taxWorkTrans.TaxCode;
}
else
{
TaxName =TaxName+","+taxWorkTrans.TaxCode;
}
}
displayFields = salesTotals.displayFieldsCurrency(salesTotals.currencyCode());
// Total sales tax for perticular sales order
/*
amountWithoutTax = conpeek(displayFields, TradeTotals::posBalance());
amountInclTax = conpeek(displayFields, TradeTotals::posTotalAmount());
totalTax = conpeek(displayFields,TradeTotals::posTaxTotal());
*/
}
Job to find SalesTax totals – Ax2012
static void SalesTaxTotal(Args _args)
{
SalesTotals salesTotals;
SalesTable salesTable;
container displayFields;
str totalTax, amountWithoutTax, amountInclTax;
salesTable = salesTable::find(‘000870');
salesTotals = SalesTotals::construct(salesTable, salesUpdate::All);
salesTotals.calc();
displayFields = salesTotals.displayFieldsCurrency(salesTotals.currencyCode());
amountWithoutTax = conpeek(displayFields, TradeTotals::posBalance());
amountInclTax = conpeek(displayFields, TradeTotals::posTotalAmount());
totalTax = conpeek(displayFields,TradeTotals::posTaxTotal());
print totalTax;
pause;
}
static void PSI_SalesTax_per_POLine(Args _args)
{
TaxTmpWorkTransForm taxTmpWorkTransForm;
PurchTotals purchTotals;
TaxPurch taxPurch;
purchTotals = PurchTotals::newPurchTable(PurchTable::find(‘PO0000004CA’));
purchTotals.calc();
taxPurch = purchTotals.tax();
taxTmpWorkTransForm = TaxTmpWorkTransForm::construct();
taxTmpWorkTransForm.parmTaxObject(taxPurch);
taxTmpWorkTransForm.updateTaxShowTaxesSourceSingleLine(tableNum(PurchLine), PurchLine::find(‘PO0000004CA’,2,false).RecId, true);
info(strFmt(‘%1',taxTmpWorkTransForm.parmTaxAmountCurTotal()));
}
DIXF import \Export in AX 2012 R3:
http://shafeaa.blogspot.in/2015/04/install-dynamics-ax-2012-r3-step-by_12.html
https://daxusers.wordpress.com/2014/08/06/import-customer-master-data-through-data-import-export-framework-in-ax-2012/
http://us.hitachi-solutions.com/2015/06/01/data-migration-microsoft-dynamics-ax-2012-r2-r3/
http://axkanha.blogspot.in/2015/03/microsoft-dynamics-ax-2012-dixf.html
http://dynamicsaxspaingermany.blogspot.de/2013/03/dmf-create-custom-entity-for-importing.html
http://ax2012dmfdataimport.blogspot.com/2014/10/microsoft-dynamics-ax-2012-dixf.html
static void saleslinewisetax(Args _args)
{
SalesTotals salesTotals;
SalesTable salesTable;
container displayFields;
str totalTax, amountWithoutTax, amountInclTax;
SalesLine SalesLine;
TmpTaxWorkTrans taxWorkTrans;
tax tax;
int i;
taxcode TaxName;
salesTable = salesTable::find('PWI-0001058');
salesTotals = SalesTotals::construct(salesTable, salesUpdate::All);
salesTotals.calc();
tax = salesTotals::getTax(salesTable);
taxWorkTrans.setTmpData(tax.tmpTaxWorkTrans());
while select taxWorkTrans
{
//info (strFmt('%1-%2-%3-%4', taxWorkTrans.TaxCode, taxWorkTrans.TaxAmount,taxWorkTrans.SourceRecId,taxWorkTrans.SourceTableId));
I++;
if(I==1)
{
TaxName = taxWorkTrans.TaxCode;
}
else
{
TaxName =TaxName+","+taxWorkTrans.TaxCode;
}
}
displayFields = salesTotals.displayFieldsCurrency(salesTotals.currencyCode());
// Total sales tax for perticular sales order
/*
amountWithoutTax = conpeek(displayFields, TradeTotals::posBalance());
amountInclTax = conpeek(displayFields, TradeTotals::posTotalAmount());
totalTax = conpeek(displayFields,TradeTotals::posTaxTotal());
*/
}
Job to find SalesTax totals – Ax2012
static void SalesTaxTotal(Args _args)
{
SalesTotals salesTotals;
SalesTable salesTable;
container displayFields;
str totalTax, amountWithoutTax, amountInclTax;
salesTable = salesTable::find(‘000870');
salesTotals = SalesTotals::construct(salesTable, salesUpdate::All);
salesTotals.calc();
displayFields = salesTotals.displayFieldsCurrency(salesTotals.currencyCode());
amountWithoutTax = conpeek(displayFields, TradeTotals::posBalance());
amountInclTax = conpeek(displayFields, TradeTotals::posTotalAmount());
totalTax = conpeek(displayFields,TradeTotals::posTaxTotal());
print totalTax;
pause;
}
static void PSI_SalesTax_per_POLine(Args _args)
{
TaxTmpWorkTransForm taxTmpWorkTransForm;
PurchTotals purchTotals;
TaxPurch taxPurch;
purchTotals = PurchTotals::newPurchTable(PurchTable::find(‘PO0000004CA’));
purchTotals.calc();
taxPurch = purchTotals.tax();
taxTmpWorkTransForm = TaxTmpWorkTransForm::construct();
taxTmpWorkTransForm.parmTaxObject(taxPurch);
taxTmpWorkTransForm.updateTaxShowTaxesSourceSingleLine(tableNum(PurchLine), PurchLine::find(‘PO0000004CA’,2,false).RecId, true);
info(strFmt(‘%1',taxTmpWorkTransForm.parmTaxAmountCurTotal()));
}
DIXF import \Export in AX 2012 R3:
http://shafeaa.blogspot.in/2015/04/install-dynamics-ax-2012-r3-step-by_12.html
https://daxusers.wordpress.com/2014/08/06/import-customer-master-data-through-data-import-export-framework-in-ax-2012/
http://us.hitachi-solutions.com/2015/06/01/data-migration-microsoft-dynamics-ax-2012-r2-r3/
http://axkanha.blogspot.in/2015/03/microsoft-dynamics-ax-2012-dixf.html
http://dynamicsaxspaingermany.blogspot.de/2013/03/dmf-create-custom-entity-for-importing.html
http://ax2012dmfdataimport.blogspot.com/2014/10/microsoft-dynamics-ax-2012-dixf.html
Is this above a programming language? Or some script to calculate taxes? What kind of language is that for what purpose? the out will be perfect calculation? It's really unclear.
ReplyDeleteUptra Consultancy
Very clear-cut information easy to understand.
ReplyDeleteMicrosoft Dynamics AX Online Training