If we are going to find the data for the sales order or free text invoice then I think you have RecID of particular Invoiced sales order or free text invoice lets move to the data and some X++ code to find the data in D365 F and O
TransTaxInformation table contains HSN, SAC, and other tax Related line Information.
TransTaxInformation GetTransTaxInformation(CustInvoiceTrans invoiceLine){
TransTaxInformation taxInfo;
TransTaxInformationRelationView taxRelation;
select firstonly1 taxRelation
where taxRelation.TransactionRefRecId == invoiceLine.RecId
&& taxRelation.TransactionRefTableId == tablenum(CustInvoiceTrans)
join taxInfo
where taxInfo.RecId == taxRelation.TransTaxInformationRefRecId;
return taxInfo;
}
HSN = HSNCodeTable_IN::find(this.GetTransTaxInformation(transLine).HSNCodeTable);
SAC = ServiceAccountingCodeTable_IN::find(this.GetServiceAccountingCode(transLine).ServiceAccountingCodeTable);
Purchase Line Tax Details Before Invoicing:
this.taxData(purchLine,purchTable);
public void taxData(PurchLine _line, PurchTable _head)
{
ITaxDocument taxDocument;
ITaxDocumentLine taxDocumentLine;
ITaxDocumentComponentLineEnumerator componentLineEnumerator,totalcomponentLineEnumerator;
ITaxDocumentComponentLine componentLineObject;
ITaxDocumentMeasureEnumerator measureEnumerator;
TaxAmount taxAmount,taxValue;
TaxComponent_IN taxComponent;
taxDocument = TaxBusinessService::getTaxDocumentBySource(_head.TableId, _head.RecId);
taxDocumentLine = taxDocument.findLineBySource(_line.TableId,_line.RecId);
componentLineEnumerator = taxDocumentLine.componentLines();
while(componentLineEnumerator.moveNext())
{
componentLineObject = componentLineEnumerator.current();
if(taxComponent)
{
taxComponent = taxComponent + "/" + componentLineObject.metaData().taxComponent();
}
else
{
taxComponent = componentLineObject.metaData().taxComponent();
}
taxValue += componentLineObject.getMeasure("Rate").value().value() * 100;
taxAmount += componentLineObject.getMeasure("Tax Amount").value().value();
}
tmpTable.TaxCode = taxComponent;
tmpTable.TaxValue = taxValue;
tmpTable.TaxAmount = taxAmount;
tmptable.GrossAmt = abs(tmptable.LineAmount) + tmptable.TaxAmount - tmptable.DiscAmount;
}
TAX RATE
line.CGSTRate = abs(this.TaxRate(_jour,'CGST', transLine));line.SGSTRate = abs(this.TaxRate(_jour,'SGST', transLine));
{
TaxTrans taxTrans;
select taxTrans where taxTrans.InventTransId == invoiceTrans.InventTransId
&& taxTrans.Voucher == invoiceJour.LedgerVoucher
&& taxTrans.TaxCode == _component;
return abs(taxTrans.TaxValue);
{
TaxTrans taxTrans;
select sum(SourceRegulateAmountCur),TaxValue,SourceRecid from taxTrans
where taxTrans.Voucher == invoiceJour.LedgerVoucher
&& taxTrans.TaxCode == _component
&& taxTrans.TransDate == invoiceJour.InvoiceDate
&& taxTrans.InventTransId == invoiceTrans.InventTransId;
return abs(taxtrans.SourceRegulateAmountCur);
No comments:
Post a Comment