Way 1->
private TaxAmountCur getTaxAmount(TableId _transTableId, RefRecId _transRecId)
{
TaxTrans taxTrans;
select sum(SourceTaxAmountCur) from taxTrans
where taxTrans.SourceTableId == _transTableId
&& taxTrans.SourceRecId == _transRecId;
return taxTrans.SourceTaxAmountCur > 0 ? taxTrans.SourceTaxAmountCur : -taxTrans.SourceTaxAmountCur;
}
Way - 2->
public TaxAmountCur getSalesTaxAmount(TableId _transTableId, RefRecId _transRecId)
{
TaxAmountCur taxAmountCur;
TransDate transDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
SalesLine SalesLine = SalesLine::findRecId(_transRecId);
TaxAmountCur = Tax::calcTaxAmount(salesline.TaxGroup,
salesline.TaxItemGroup,
transDate,
salesline.CurrencyCode,
salesline.LineAmount,
TaxModuleType::Sales,
salesline.SalesQty,
salesline.SalesUnit,
salesline.ItemId,
TaxDirection::OutgoingTax);
return taxAmountCur;
}
Way 3->
TmpTaxWorkTrans tmpTax;
SalesTable salesTable;
SalesTotals salesTotals;
SalesLine SalesLine = SalesLine::findRecId(_transRecId);
salesTable = SalesTable::find(salesline.SalesId);
salesTotals = SalesTotals::construct(salesTable);
salesTotals.calc();
tmpTax.setTmpData(salesTotals.tax().tmpTaxWorkTrans());
select sum(TaxAmount) from tmpTax
where tmpTax.InventTransId == salesline.InventTransId;
taxAmountCur = tmpTax.TaxAmount;
Way 4-> (If price incl of tax)
(salesline.calcLineAmount() - salesline.calcLineAmountExclTax())