How to calculate CGST, SGST & IGST through X++

Hi Thirumal,

The same code only,
dynamicsuser.net/…/490271

just remove the summing
actual:
CGST += partyTaxMeasureValue.amountTransactionCurrency();
Replace with:
CGST = partyTaxMeasureValue.amountTransactionCurrency();

remove the summation on every loop.

just debug the code and change accordingly in all applicable places.

Dear Arunachalam,

we using ax 2012 r3cu12, in this environment we didn’t find[purchtotals1 = purchtotals::construct(purchtable::find(‘00136646_052’));)Construct method.

will u able to help us to before po invoice process we need to get the item wise gst percentage and value.

Thanks,
Hareesh

use purchTotals = PurchTotals::newPurchTable(purchTable);

for item wise, look into my previous comment.

Revert back if any issues

Guys sorry for the delay. This is used in Ax 2009.

void GSTItem_TaxCalculation()
{
TmpTaxDocument tmpTax;
PurchCalcTax PurchCalcTax;
SalesTotals salesTotals;
PurchTotals purchTotals;
ITaxableDocument taxableDocument;
ITaxDocumentComponentLineEnumerator lineEnumerator;
ITaxDocument taxDocumentObject;
real taxTotalGTE,taxtotal,SGST,CGST,IGST;
ITaxDocumentMeasure taxMeasure;
ITaxDocumentMeasureEnumerator taxMeasureEnumerator;
ITaxDocumentMeasureValue partyTaxMeasureValue;
int j,Line_loop;
;

// SGST_Value = 0; CGST_Value = 0; IGST_Value = 0;
purchTotals = PurchTotals::POconstruct(PurchTable::find(vendPurchOrderJour.PurchId));
taxableDocument = TaxableDocumentObject::construct(purchTotals.parmTaxableDocumentDescriptor());
taxDocumentObject = TaxBusinessService::calculateTax(taxableDocument);

if (taxDocumentObject)
{
taxTotalGTE = taxDocumentObject.getTotalTax().amountTransactionCurrency();

// Calculation of Tax amount for Tax type GST and Tax component SGST
Line_Loop = 0;
lineEnumerator = taxDocumentObject.componentLines(“GST”,“SGST”);
while (lineEnumerator.moveNext())
{
Line_Loop++;
taxMeasureEnumerator = lineEnumerator.current().measures();
while (taxMeasureEnumerator.moveNext())
{
j++;
if (j == 3)
{
partyTaxMeasureValue = taxMeasureEnumerator.current().value();
SGST_Arr[Line_Loop] = partyTaxMeasureValue.amountTransactionCurrency();
j=0;
break;
}
}
}

// Calculation of Tax amount for Tax type GST and Tax component CGST
Line_Loop = 0;
lineEnumerator = taxDocumentObject.componentLines(“GST”,“CGST”);
while (lineEnumerator.moveNext())
{
Line_Loop++;
taxMeasureEnumerator = lineEnumerator.current().measures();
while (taxMeasureEnumerator.moveNext())
{
j++;
if (j == 3)
{
partyTaxMeasureValue = taxMeasureEnumerator.current().value();
CGST_Arr[Line_Loop] = partyTaxMeasureValue.amountTransactionCurrency();
j=0;
break;
}
}
}

// Calculation of Tax amount for Tax type GST and Tax component IGST
Line_Loop = 0;
lineEnumerator = taxDocumentObject.componentLines(“GST”,“IGST”);
while (lineEnumerator.moveNext())
{
Line_Loop++;
taxMeasureEnumerator = lineEnumerator.current().measures();
while (taxMeasureEnumerator.moveNext())
{
j++;
if (j == 3)
{
partyTaxMeasureValue = taxMeasureEnumerator.current().value();
IGST_Arr[Line_Loop] = partyTaxMeasureValue.amountTransactionCurrency();
j=0;
break;
}
}
}
}
}
Array has to be declare in the classdeclaration itself.

You have to create the below method in the PurchTotals class.

static PurchTotals POconstruct(Common _purchTable,
PurchUpdate _specQty = PurchUpdate::All,
AccountOrder _sumBy = AccountOrder::None,
ParmId _parmId = ‘’,
PurchId _sumPurchId = ‘’,
DocumentStatus _documentStatus = DocumentStatus::None)
{
PurchTable purchTable;
;
if (_purchTable.TableId)
{
if (_purchTable.TableId == tablenum(PurchParmTable))
{
purchTable = _purchTable.purchTable();
}
else
{
purchTable = _purchTable;
}
if (_parmId == ‘’)
return new PurchTotals_Trans(_purchTable, _specQty);
}
Else
{
return null;
}
}

Hi Krishna,
I am working on SalesQuotation report and want to calculate CGST,IGST,SGST.Can you please tell me the way around,I tried using TaxTrans_IN table,but could not find the records.
Should I go for using ITaxdocument?

Thanks in advance,
Priyanka

Hi Krishna,
I am working on SalesQuotation report and want to calculate CGST,IGST,SGST.Can you please tell me the way around,I tried using TaxTrans_IN table,but could not find the records.
Should I go for using ITaxdocument?

Thanks in advance,
Priyanka

TaxTrans, TaxTrans_IN will have the posted tax details. Sales quotation will not post any tax.
Try using the same approach (using taxDocument classes).

Dear Krishna,

Can u Post sale-order line wise CGST,SGST,IGST value printing.