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

  • In reply to Arunachalam MR:

    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
  • In reply to Rajkumar Govindan:

    Hello Raj,
    Can you help me for Tax calculation item wise at the time of Purchase Order Confirmation itself?
  • In reply to Forever:

    just check this.

    dynamicsuser.net/.../490271

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

  • In reply to ThirumalReddy.S:

    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.
  • In reply to Arunachalam MR:

    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
  • In reply to hareeshreddy:

    use purchTotals = PurchTotals::newPurchTable(purchTable);

    for item wise, look into my previous comment.

    Revert back if any issues

  • In reply to Arunachalam MR:

    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;
    }
    }
  • In reply to krishna:

    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
  • In reply to krishna:

    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
  • In reply to Priyanka Karimungi:

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