POCONFIRMGST
POCONFIRMGST
//HSN Tables
ServiceAccountingCodeTable_IN saccode;
HSNCodeTable_IN _hsncodetable;
//Tax Tables
TaxInformationVendTable_IN taxInfoVendPan;
TaxInformationLegalEntity_IN taxForPan;
taxInformation_IN taxInformation_IN_GST;
taxRegistrationNumbers_IN taxRegistrationNumbers;
//Temp Tables
STH_PurchConfirmHeadGSTTmp sth_PurchConfirmHeadGSTTmp;
STH_PurchConfirmLineGSTTmp sth_PurchConfirmLineGSTTmp;
STH_PurchConfirmGSTChargesTmp sth_PurchConfirmGSTChargesTmp;
VendPurchOrderJour _vendPurchOrderJour1;
TaxTrans_IN taxtrans;
PurchLine purchLine;
MarkupTrans markupTrans;
HcmWorker hcmworker;
//GST Tables
ITaxDocument taxDocument;
ITaxDocumentComponentLineEnumerator componentLineEnumerator;
ITaxDocumentComponentLine componentLineObject;
ITaxDocumentMeasureEnumerator measureEnumerator;
TaxAmount taxAmount,taxValue;
TaxComponent_IN taxComponent;
[SRSReportDataSetAttribute(tableStr(STH_PurchConfirmHeadGSTTmp))]
public STH_PurchConfirmHeadGSTTmp getsth_PurchConfirmHeadGSTTmp()
{
select sth_PurchConfirmHeadGSTTmp;
return sth_PurchConfirmHeadGSTTmp;
}
[SRSReportDataSetAttribute(tableStr(STH_PurchConfirmLineGSTTmp))]
public STH_PurchConfirmLineGSTTmp getsth_PurchConfirmLineGSTTmp()
{
select sth_PurchConfirmLineGSTTmp;
return sth_PurchConfirmLineGSTTmp;
}
[SRSReportDataSetAttribute(tableStr(STH_PurchConfirmGSTChargesTmp))]
public STH_PurchConfirmGSTChargesTmp getsth_PurchConfirmGSTChargesTmp()
{
select sth_PurchConfirmGSTChargesTmp;
return sth_PurchConfirmGSTChargesTmp;
}
companyInfo = CompanyInfo::find();
// Calling Methods
while select vendPurchOrderJour where vendPurchOrderJour.RecId == recId
{
this.insertHeader(vendPurchOrderJour.PurchId);
this.insertLine(vendPurchOrderJour.PurchId, vendPurchOrderJour);
// this.insertMarkUp();
}
}
//Header info.
sth_PurchConfirmHeadGSTTmp.DeliveryAddress =
vendPurchOrderJour.deliveryAddress().Address;
sth_PurchConfirmHeadGSTTmp.VendorContact =
vendTable.phone();
//Company info
sth_PurchConfirmHeadGSTTmp.CompanyName_STH =
companyInfo.Name();
sth_PurchConfirmHeadGSTTmp.CompanyLogo_STH =
SalesQuotationEditLinesForm::companyLogo();
sth_PurchConfirmHeadGSTTmp.VendorName =
DirParty::primaryPostalAddress(vendTable.Party).displayLocationDescription();
sth_PurchConfirmHeadGSTTmp.CompanyAddress =
companyInfo.postalAddress().Address;
sth_PurchConfirmHeadGSTTmp.VendorAddress =
DirParty::primaryPostalAddress(vendTable.Party).Address;
sth_PurchConfirmHeadGSTTmp.CompanyPhone =
companyInfo.phone();
sth_PurchConfirmHeadGSTTmp.CompanyGST =
companyInfo.CoRegNum;
sth_PurchConfirmHeadGSTTmp.CompanyFax =
CompanyInfo.teleFax();
sth_PurchConfirmHeadGSTTmp.CompanyGST =
companyInfo.CoRegNum;
sth_PurchConfirmHeadGSTTmp.CompanyFax =
CompanyInfo.teleFax();
// PAN number
while select taxForPan where companyInfo.RecId == taxForPan.LegalEntity
{
sth_PurchConfirmHeadGSTTmp.CompanyPAN =
taxForPan.PANNumber;
}
//Vendor GST
select dirPartyTable where dirPartyTable.RecId == vendTable.Party;
sth_PurchConfirmHeadGSTTmp.VendorGST =
taxRegistrationNumbers.RegistrationNumber;
//verndor GST End
sth_PurchConfirmHeadGSTTmp.insert();
// purchTable = purchTable::findRecId(purchTable.RecId);
taxDocument =
TaxBusinessService::getTaxDocumentBySource(purchTable.TableId, purchTable.RecId);
componentLineEnumerator = taxDocument.componentLines();
sth_PurchConfirmLineGSTTmp.ItemId =
purchLineAllVersions.ItemId;
sth_PurchConfirmLineGSTTmp.ItemName =
purchLineAllVersions.Name;
sth_PurchConfirmLineGSTTmp.PurchOrderedQty =
purchLineAllVersions.PurchQty;
sth_PurchConfirmLineGSTTmp.PurchPrice =
purchLineAllVersions.PurchPrice;
sth_PurchConfirmLineGSTTmp.UOM =
purchLineAllVersions.PurchUnit;
sth_PurchConfirmLineGSTTmp.AccessableValue =
purchLineAllVersions.LineAmount;
sth_PurchConfirmLineGSTTmp.DiscAmount =
purchLineAllVersions.DiscAmount;
//Total amounts
//GST
while(componentLineEnumerator.moveNext())
{
componentLineObject = componentLineEnumerator.current();
taxComponent = componentLineObject.metaData().taxComponent();
taxValue = componentLineObject.getMeasure("Rate").value().value() *
100;
taxAmount = componentLineObject.getMeasure("Tax
Amount").value().value();
if(taxComponent == 'CGST')
{
sth_PurchConfirmLineGSTTmp.CGSTAmount =
componentLineObject.getMeasure("Tax Amount").value().value();
sth_PurchConfirmLineGSTTmp.CGSTRate=
componentLineObject.getMeasure("Rate").value().value() * 100;
}
if(taxComponent == 'SGST')
{
sth_PurchConfirmLineGSTTmp.SGSTAmount =
componentLineObject.getMeasure("Tax Amount").value().value();
sth_PurchConfirmLineGSTTmp.SGSTRate=
componentLineObject.getMeasure("Rate").value().value() * 100;
break;
}
if(taxComponent == 'IGST')
{
sth_PurchConfirmLineGSTTmp.IGSTAmount =
componentLineObject.getMeasure("Tax Amount").value().value();
sth_PurchConfirmLineGSTTmp.IGSTRate=
componentLineObject.getMeasure("Rate").value().value() * 100;
break;
}
}
if(sth_PurchConfirmLineGSTTmp.CGSTAmount > 0 ||
sth_PurchConfirmLineGSTTmp.SGSTAmount > 0)
{
sth_PurchConfirmLineGSTTmp.Amount =
abs(sth_PurchConfirmLineGSTTmp.CGSTAmount+sth_PurchConfirmLineGSTTmp.SGSTAmount+
purchLineAllVersions.LineAmount);
}
else
{
sth_PurchConfirmLineGSTTmp.Amount =
abs(sth_PurchConfirmLineGSTTmp.IGSTAmount+purchLineAllVersions.LineAmount);
}
sth_PurchConfirmLineGSTTmp.insert();
//Inserting Line details into temp table
//STH_Venu - End
}
}
// Other Charges
//protected void insertMarkUp()
//{
// //Inserting Header chares details into temp table
// //STH_Venu - Start
// //Header charges
// select purchTable where purchTable.PurchId ==
vendPurchOrderJour.PurchId;
// while select Txt,Value,CalculatedAmount from markUpTrans where
markUpTrans.TransTableId == purchTable.TableId
// && markUpTrans.TransRecId == purchTable.RecId
// {
// if(markUpTrans.CalculatedAmount >= 0)
// {
// sth_PurchConfirmGSTChargesTmp.HeadTransTxt
= markUpTrans.Txt;
// sth_PurchConfirmGSTChargesTmp.HeadMarkupValue
= markUpTrans.Value;
// sth_PurchConfirmGSTChargesTmp.insert();
// //Inserting Header charges details into temp table
// //STH_Venu - End
// }
// }
// // select purchTable where vendPurchOrderJour.PurchId ==
PurchTable.PurchId;
// //Line Charges
// //while select purchLineAllVersions where vendPurchOrderJour.PurchId ==
purchLineAllVersions.PurchID
// //{
// // while select Txt,Value,CalculatedAmount from markUpTrans where
purchLineAllVersions.RecId == markUpTrans.TransRecId
// // {
// }
//}