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

Hi all,

How to calculate CGST, CGST & IGST through code , i want to display in POinvoiceReport . Anyone tell me Process how to get GST values through X++.

Thanks,

Chaitana

Are they tax codes? Please tag your AX version.

He indeed seems to be talking about Indian Goods and Service Tax, although he even forget to mention which country’s GST he meant.
Unfortunately I’m not familiar with Indian localization (and knowing the version of AX is crucial even for those who are).

Version Ax 2012 R3 cu11 country India

There is a method on sales side SalesInvoiceDP.insertIntoGSTTaxAmount_IN, see if you can use the similar logic on purchase side.

Thanks For Replay Kranthi,

I have solved my issue as per similar logic in salesinvoiceDP am getting CGST & SGST values and amount also.

Thanks
siva rama Krishna

Hello Techies,

I want to know how it is calculating item wise CGST & SGST ?
And also getting company GST Number & Vendor GST Number

Kindly share me the lines of code to my mail Id “thirumal.siddhavatam@gmail.com

Hi thirumal,

// Company GSTINNumber
select companyInfo where companyInfo.DataArea == curext()
join dirpartytable where dirpartytable.PartyNumber == companyInfo.PartyNumber
join dirPartyLocation where dirPartyLocation.Party == dirpartytable.RecId
join logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location
join taxInformation_IN where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId
&& taxInformation_IN.IsPrimary == NoYes::Yes;

tmp.comapanyGSTINNumber = TaxRegistrationNumbers_IN::find(taxInformation_IN.GSTIN).RegistrationNumber;

//Vendor GSTINNumber
select vendtable1 where vendtable1.AccountNum==vendtable.AccountNum
join dirPartyLocation where dirPartyLocation.Party == vendtable1.Party
join logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location
join taxInformation_IN where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId
&& taxInformation_IN.IsPrimary == NoYes::Yes;

tmp.vendorGSTINNumber = TaxRegistrationNumbers_IN::find(taxInformation_IN.GSTIN).RegistrationNumber;

// CGST , SGST & IGST numbers with rates.
select firstOnly HSNCode, SAC from taxDocumentRowTransaction_IN
join RecId, DiscountAmount from taxDocumentRowTransaction
where taxDocumentRowTransaction.RecId == taxDocumentRowTransaction_IN.TaxDocumentRowTransactionRecId
&& taxDocumentRowTransaction.TransactionHeaderTableId == vendInvoiceinfotable.TableId
&& taxDocumentRowTransaction.TransactionHeaderRecId == vendInvoiceinfotable.RecId
&& taxDocumentRowTransaction.TransactionLineTableId == vendInvoiceinfoline.TableId
&& taxDocumentRowTransaction.TransactionLineRecId == vendInvoiceinfoline.RecId;

if(taxDocumentRowTransaction.RecId)
{
while select taxDocumentComponentTransaction

where taxDocumentComponentTransaction.TaxDocumentRowTransactionRecId == taxDocumentRowTransaction.RecId
{
if(taxDocumentComponentTransaction.TaxCode ==“CGST”)
{
tmp.CGST_TaxRate = taxDocumentComponentTransaction.TaxRate100;
tmp.CGST = taxDocumentComponentTransaction.TaxAmountCur;
}
if(taxDocumentComponentTransaction.TaxCode == “SGST”)
{
tmp.SGST_Taxrate = taxDocumentComponentTransaction.TaxRate
100;
tmp.SGST = taxDocumentComponentTransaction.TaxAmountCur;
}
if(taxDocumentComponentTransaction.TaxCode == “IGST”)
{
tmp.IGST_Taxrate = taxDocumentComponentTransaction.TaxRate*100;
tmp.IGST = taxDocumentComponentTransaction.TaxAmountCur;
}
}
}

Thanks,
Siva Rama Krishna.

Better and Thanks Once
I want to get the TAX calculation details for the Purchase order after confirmation done and before of Invoicing the same purchase order.

Regards,
G.Rajkumar
gov.rajkumar@gmail.com

View this post at dynamicsuser.net/…/gst-tax-calculation-for-all-formats-so-po-confirmation-invoice-for-ax2012-ax2009

Thanks Arun,

I am asking the Tax calculation for Purchase Order not for Sales Order or Purchase Invoice.
But, you have given for Sales Order and I am thinking that you have given for AX 2012. I am requesting for Ax 2009.

Regards,
G.Rajkumar

I have given for both :slight_smile: For Purchase Order, u replace the sales objects into purchase. and it will work for 2009 also. Regards,
Arun

Arun,

Thats right, u given the code for 2012, because the declarations are assigned in 2012. There is no tables in Ax 2009 as you mentioned. (TmpTaxDocument, ITaxableDocument etc.).

We found for Sales Invoice & also for Purchase Invoice. But for Purchase Order, the tax will not hit the tax tables, and not able to find where the tax are hitting and stored. for Tax Document, the details are arriving.

Regards,
G.Rajkumar

Hi Raj,

Both TmpTaxDocument, ITaxableDocument etc are available in AX2009. I think you must check and confirm whether your AX is up to date with GST Roll up. Please check again.

Arun,

Found them and got the tax details by changing some conditions in PurchTotals Class. According to INDIAN GST, made the changes and the tax details arrived.

Regards,
G.Rajkumar

Hi Raj,

Can you put the updated code here for Purchase Order ? This might help many who struggle in getting TAX Calculations for PO.

we need to calculate gst from VendPurchOrderTrans and VendPurchOrderjour after confirm the purchase order and before creating the invoice. can you have code?

in taxtrans table update after purchase invoice posting…we need before purchase invoice posting

Hello Raj,
Can you help me for Tax calculation item wise at the time of Purchase Order Confirmation itself?

just check this.

dynamicsuser.net/.../490271

Change the objects with purchase and you will get the result.