SBX - Search With Button

SBX - Forum Post Title

how to calculate salestaxgroup from the vat percentage

Microsoft Dynamics AX Forum

rohit1900 asked a question on 14 Sep 2018 3:57 AM

Question Status

Suggested Answer

Hi experts,

I am able to calculate vat percentage from the salestaxgroup

by the follwing code:

static void salestaxpercent(Args _args)
{
TaxOnItem TaxOnItem;
TaxGroupData TaxGroupData;
real TaxAmount;
TaxValue TaxValue;
SalesLine salesline;
TaxData TaxData;
TaxTable TaxTable;
// TaxData TaxData;
;

select firstOnly salesLine where salesLine.SalesId == 'IN000000466'
&& salesLine.LineNum == 2;
if(salesLine.TaxItemGroup && salesLine.TaxGroup && salesLine.LineAmount != 0)
{
while select TaxOnItem
where TaxOnItem.TaxItemGroup == salesline.TaxItemGroup
{
if(TaxOnItem)
{
while select TaxGroupData
where TaxGroupData.TaxGroup == Salesline.TaxGroup
&& TaxGroupData.TaxCode == TaxOnItem.TaxCode
{
if(TaxGroupData)
{
TaxValue = TaxData::find(TaxOnItem.TaxCode, Systemdateget(), 0).TaxValue;
TaxAmount = (Salesline.LineAmount * TaxValue) / 100;
info(strFmt("Rate = %1, Tax Amount = %2",TaxValue,TaxAmount));

}
}
}
}
}

i want reverse when i provide the vat percentage i need to get the taxitemgroup,group for the salesline

in the taxdata table  we have find method by which i am able to calculate the tax value

but to get the taxitemgroup if we provide the vatpercentage????
}

Reply
Rustem Galiamov responded on 14 Sep 2018 4:16 AM
My Badges
Suggested Answer

Hi!

You can copy TaxData::find() method and replace TaxCode by Percent and use that variable inside your new find() method. But what if in TaxData table you create more than one TaxCode with the same vat percent?

Reply
Rustem Galiamov responded on 14 Sep 2018 4:16 AM
My Badges
Suggested Answer

Hi!

You can copy TaxData::find() method and replace TaxCode by Percent and use that variable inside your new find() method. But what if in TaxData table you create more than one TaxCode with the same vat percent?

Reply

SBX - Two Col Forum

SBX - Migrated JS