Check Code,
If we are going to find tax data for the transfer order then I think you have RecID of particular Invoiced Transfer Order lets move to the data and some X++ code to find the data in D365 F and O
HSN Code
HSN = HSNCodeTable_IN::find(this.GetHSNCode(inventTransferLine));
RefRecId GetHSNCode(InventTransferLine inventTransferLine){
TransTaxInformation taxInfo;
TransTaxInformationRelationView taxRelation;
select firstonly1 taxRelation
where taxRelation.TransactionRefRecId == inventTransferLine.RecId
&& taxRelation.TransactionRefTableId == tablenum(InventTransferLine)
join taxInfo
where taxInfo.RecId == taxRelation.TransTaxInformationRefRecId;
return taxInfo.HSNCodeTable;
}
ServiceAccountingCode
SAC = ServiceAccountingCodeTable_IN::find(this.GetServiceAccountingCode(inventTransferLine));
RefRecId GetServiceAccountingCode(InventTransferLine inventTransferLine){
TransTaxInformation taxInfo;
TransTaxInformationRelationView taxRelation;
select firstonly1 taxRelation
where taxRelation.TransactionRefRecId == inventTransferLine.RecId
&& taxRelation.TransactionRefTableId == tablenum(InventTransferLine)
join taxInfo
where taxInfo.RecId == taxRelation.TransTaxInformationRefRecId;
return taxInfo.ServiceAccountingCodeTable;
}
NetAmount
InventTransferJourLine_IN::findByInventTransferJourLineRecId(inventTransferJournLine.RecId).AssessableValue;
Tax Rate
line.CGSTRate = abs(this.TaxRate(inventTransferJournLine,'CGST', line.NetAmount));line.SGSTRate = abs(this.TaxRate(inventTransferJournLine,'SGST', line.NetAmount)); line.IGSTRate = abs(this.TaxRate(inventTransferJournLine,'IGST', line.NetAmount));
str _component,
Amount _netAmount)
{
TaxTrans taxtrans, taxtransvalue;
select sum(SourceRegulateAmountCur),TaxValue,SourceRecid from taxtrans
where taxtrans.InventTransId == _inventTransferJournLine.InventTransID
&& taxtrans.Voucher == _inventTransferJournLine.VoucherId
&& taxtrans.TaxCode == _component;
select taxtransvalue where taxtransvalue.inventtransid == _inventTransferJournLine.InventTransID
&& taxtransvalue.Voucher == _inventTransferJournLine.VoucherId
&& taxtransvalue.TaxCode == _component;
return abs(taxtransvalue.TaxValue);
}
Tax Amount
line.SGST = abs(this.TaxAmount(inventTransferJournLine,'SGST', line.NetAmount));
line.IGST = abs(this.TaxAmount(inventTransferJournLine,'IGST', line.NetAmount));
str _component,
Amount _netAmount)
{
TaxTrans taxtrans, taxtransvalue;
select sum(SourceRegulateAmountCur),TaxValue,SourceRecid from taxtrans
where taxtrans.InventTransId == _inventTransferJournLine.InventTransID
&& taxtrans.Voucher == _inventTransferJournLine.VoucherId
&& taxtrans.TaxCode == _component;
select taxtransvalue where taxtransvalue.inventtransid == _inventTransferJournLine.InventTransID
&& taxtransvalue.Voucher == _inventTransferJournLine.VoucherId
&& taxtransvalue.TaxCode == _component;
return abs(taxtrans.SourceRegulateAmountCur);
}
Amount taxAmount = line.CGST + line.SGST + line.IGST;
line.UnitPrice = inventTransferJournLine.UnitPrice_IN - (taxAmount / line.Qty);
line.Total = inventTransferJournLine.QtyShipped * line.UnitPrice;
line.GrossAmount = line.TaxableAmount + taxAmount;
Amount totalAmount += line.GrossAmount;
Now move to Transfer Order Header Details,
Company Related Details:
Address:
LogisticsPostalAddress fromWhAddress;
select firstonly fromWhAddress where fromWhAddress.RecId == _jour.FromPostalAddress;
header.CompanyAddress = 'Text' +' '+ fromWhAddress.Street + ','
+ LogisticsAddressCity::find(fromWhAddress.City).Description + ',' + LogisticsAddressDistrict::findRecId(fromWhAddress.District).Name + ','
+ LogisticsAddressState::find(fromWhAddress.CountryRegionId, fromWhAddress.State).Name + ','
+ LogisticsAddressCountryRegion::find(fromWhAddress.CountryRegionId).displayName() + '-'
+ fromWhAddress.ZipCode + '.';
GSTIN:
header.CompanyGSTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN::findDefaultbyLocation(fromWhAddress.Location).GSTIN).RegistrationNumber;
Transaction ID Or Transaction Date:
ITaxDocument taxDocumentObject;
TaxDocumentExtension_IN taxDocumentExtension;
taxDocumentObject = TaxBusinessService::getTaxDocumentBySource(_jour.TableId, _jour.RecId);
taxDocumentExtension = taxDocumentExtension_in::findByTaxDocument(taxDocumentObject.getGUID());
header.InvoiceNumber = taxDocumentExtension.TaxTransactionId;
header.InvoiceDate = taxDocumentExtension.TaxTransactionDate;
Customer Related Details:
Address:
LogisticsPostalAddress ToWhAddress;
select firstonly ToWhAddress where fromWhAddress.RecId == _jour.ToPostalAddress;
header.CompanyAddress = 'Text' +' '+ ToWhAddress.Street + ','
+ LogisticsAddressCity::find(ToWhAddress.City).Description + ',' + LogisticsAddressDistrict::findRecId(ToWhAddress.District).Name + ','
+ LogisticsAddressState::find(ToWhAddress.CountryRegionId, ToWhAddress.State).Name + ','
+ LogisticsAddressCountryRegion::find(ToWhAddress.CountryRegionId).displayName() + '-'
+ ToWhAddress.ZipCode + '.';
GSTIN:
header.CompanyGSTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN::findDefaultbyLocation(ToWhAddress.Location).GSTIN).RegistrationNumber;
State Code:
StateCode = subStr(header.GSTIN, 1, 2);
Enjoy 👍
No comments:
Post a Comment