How to get tax amount for LedgerJournalTrans lines

i need tax amount for linewise for reporting purpose

need to get tax amount for non-posted lines in LedgerJournalTrans

Accounts Payable → Journals → Invoice → Invoice Journals → Lines

for both debit and credit i need tax amount

how to get it, any job is there…

Thanks…

Have a look at \Classes\LedgerJournalEngine\taxAmountJournal

I run it through job, while debugging the return value CalculatedTax is 0

while select ledgerJournalTrans
where ledgerJournalTrans.JournalNum == “ABC”
&& ledgerJournalTrans.Voucher == “ABC001”
&& ledgerJournalTrans.TransDate == today()
{
engine.taxAmountJournal(ledgerJournalTrans);
}

You are just looping the the records and calculating the tax. You are not assigning the value returned by engine.taxAmountJournal(ledgerJournalTrans); to any variable.

Example = calculatedTax += engine.taxAmountJournal(ledgerJournalTrans);

Thanks kranthi, i acheived my result in otherway

I’m inserting my values in tmpTable and extract the tmpTable i get my values…

Here we using LedgerJournalAccountMovementDP class

  1. before lines executing(b4 while loop for lines starting execution):

while select ledgerJournalTrans

where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum

{

this.calcTaxDocument(ledgerJournalTrans.JournalNum, ledgerJournalTrans.Voucher);

}

  1. Create Method in class:

protected void calcTaxDocument(LedgerJournalId _journalNum, Voucher _voucher)

{

TaxEngineLedgerJournalTransHeader taxEngineLedgerJournalTrans;

ITaxDocument taxDocument;

ITaxDocumentComponentLineEnumerator componentLineEnumerator;

ITaxDocumentComponentLine componentLineObject;

ITaxDocumentMeasureEnumerator measureEnumerator;

ITaxDocumentLine line;

ITaxDocumentLineEnumerator lineEnumerator;

TaxAmount taxAmount,taxValue;

TaxComponent_IN taxComponent;

taxEngineLedgerJournalTrans = TaxEngineLedgerJournalTransHeader::findByJourNumVoucher(_journalNum, _voucher);

taxDocument = TaxBusinessService::getTaxDocumentBySource(taxEngineLedgerJournalTrans.TableId, taxEngineLedgerJournalTrans.RecId);

if(taxDocument != null)

{

componentLineEnumerator = taxDocument.componentLines();

lineEnumerator = taxDocument.lines();

if (taxDocument)

{

lineEnumerator = taxDocument.lines();

while(lineEnumerator.moveNext())

{

line = lineEnumerator.current();

line.setTaxDocument(taxDocument);

if(line.originSourceRecId() != 0 && line.getInvoiceTax().value() != 0)

{

while(componentLineEnumerator.moveNext())

{

componentLineObject = componentLineEnumerator.current();

taxComponent = componentLineObject.metaData().taxComponent();

tmpFrmVirtual.initValue();

tmpFrmVirtual.RefRecId = line.originSourceRecId();

tmpFrmVirtual.JournalNum = taxComponent;

tmpFrmVirtual._Real2 = componentLineObject.getMeasure(“Tax Amount”).value().value();

tmpFrmVirtual.insert();

if (taxComponent == “SGST” || taxComponent == “IGST”)

{

break;

}

}

}

}

}

}

}

  1. used to extract the values (create inside while loop executes where you want):

while select tmpFrmVirtual

where tmpFrmVirtual.RefRecId == ledgerJournalAccountMovementTmp.RefRecId

{

switch (tmpFrmVirtual.JournalNum)

{

case “CGST” :

ledgerJournalAccountMovementTmp.CGSTAmount = tmpFrmVirtual._Real2;

break;

case “SGST” :

ledgerJournalAccountMovementTmp.SGSTAmount = tmpFrmVirtual._Real2;

break;

case “IGST” :

ledgerJournalAccountMovementTmp.IGSTAmount = tmpFrmVirtual._Real2;

break;

}

}