currently i am working on the sales invoice report(Morphx).
Need to fetch the multiple addresses of the customer in the report based on the 'Purpose.'
i trying to write the code in the Fetch method for getting this values.
currently i am getting only one address that is delivery address(purpose = delivery Or Business).(from sales table)
diffcult to get the another addresses (purpose = consignee And Invoice).
these are in the dirpartyPostalAddressview
I am trying to get this using the getpostaladdressbytype Method in the Dirparty(Class)
but it is not working. i am writing the following code in the fetch method.
select TaxInformation_IN where TaxInformation_IN.RegistrationLocation == CompanyInfo::find().PrimaryAddressLocation
&& TaxInformation_IN.IsPrimary == NoYes::Yes;
can any one know about how to solve this.
Please help me.
select salesTable where salesTable.SalesId == custinvoicejourloc.SalesId;
// Header related data
salesid = custinvoicejourloc.SalesId;
invoiceid = custinvoicejourloc.InvoiceId;
//CompanyTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN.TIN).RegistrationNumber;
CompanyTIN = "27615247749V";
CompanyCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN.STCRegistrationNumberTable).RegistrationNumber;
CompanyECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN.ManECCRegistrationNumberTable).RegistrationNumber;
Range = TaxInformation_IN.Range;
Division = TaxInformation_IN.Division;
Commissionarate = TaxInformation_IN.Commissionarate;
companyLST = "27615247749V";
invoiceDate1 = custinvoicejourloc.InvoiceDate;
invoiceDate2 = custinvoicejourloc.InvoiceDate;
//typeofCopy = "Accounts Copy";
//CompanyCIN = CompanyInfo::find().TaxRepresentative;
CompanyCIN = "U15500MH2009PTC193480";
FSSAINo = "10015022003730";
select taxInformationLegalEntity where taxInformationLegalEntity.LegalEntity == CompanyInfo::find().RecId;
PanNo = taxInformationLegalEntity.PANNumber;
// Delivery Details Start
//info(strFmt("%1", salesTable.deliveryLocation()));
//srini
while select TaxInformation_IN_delivery
where TaxInformation_IN_delivery.RegistrationLocation ==salesTable.deliveryLocation()
join logisticsLocation
where logisticsLocation.RecId == TaxInformation_IN_delivery.RegistrationLocation
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
join logisticsLocationRole
where logisticsLocationRole.IsPostalAddress == logisticsLocation.IsPostalAddress
join logisticsPostalAddressView
where logisticsPostalAddressView.Location == logisticsPostalAddress.Location
//join custinvoicejourloc
//where custinvoicejourloc.OrderAccount == custTable.AccountNum
//join custTable
//where custTable.Party == dirPartyPostalAddressView.Party
//join dirPartyTable
//where dirPartyTable.RecId == logisticsPostalAddress.PrivateForParty
join dirPartyLocation
where dirPartyLocation.Location == logisticsPostalAddressView.Location
//&& logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery
if(logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery || logisticsLocationRole.Type == LogisticsLocationRoleType::Business)
{
//DeliveryAddress = SalesTable.DeliveryName+"\n"+ SalesTable.deliveryAddressing();
//DeliveryAddress = salesTable.DeliveryName+"\n"+ salesTable::find(salesid).deliveryAddressing();
DeliveryAddress = logisticsLocation.Description+"\n"+ logisticsPostalAddress::findByLocation(logisticsPostalAddress.Location).Address;
//DeliveryAddress = this.getPostalAddressByType(custTable.Party, LogisticsLocationRoleType::Delivery).Address;
DeliveryCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.SalesTaxRegistrationNumber).RegistrationNumber;
//DeliveryTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.TIN).RegistrationNumber;
DeliveryTIN = "78635738076V";
DeliveryECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.ManECCRegistrationNumberTable).RegistrationNumber;
// Delivery Details End
}
//srini
//Consignee Address Start
/*while select TaxInformation_IN_Buyer
where TaxInformation_IN_Buyer.RegistrationLocation == logisticsLocation.RecId
join logisticsLocation
where logisticsLocation.RecId == TaxInformation_IN_Buyer.RegistrationLocation
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
//join custPackingSlipJour
//where custPackingSlipJour.InvoicePostalAddress == custinvoicejourloc.InvoicePostalAddress
join logisticsLocationRole
where logisticsLocationRole.IsPostalAddress == logisticsLocation.IsPostalAddress
//&& logisticsLocationRole.Type == LogisticsLocationRoleType::Consignment_IN;*/
else if(logisticsLocationRole.Type == LogisticsLocationRoleType::Consignment_IN)
{
ConsigneeAddress = logisticsLocation.Description+"\n"+ logisticsPostalAddress::findByLocation(logisticsPostalAddress.Location).Address;
ConsigneeCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.SalesTaxRegistrationNumber).RegistrationNumber;
ConsigneeECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.ManECCRegistrationNumberTable).RegistrationNumber;
//ConsigneeTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.TIN).RegistrationNumber;
ConsigneeTIN = "78635738076V";
}
//consignee Address End.
//Buyer Address Start
/*while select TaxInformation_IN_delivery
where TaxInformation_IN_delivery.RegistrationLocation == logisticsLocation.RecId
join logisticsLocation
where logisticsLocation.RecId == TaxInformation_IN_delivery.RegistrationLocation
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
//join custPackingSlipJour
//where custPackingSlipJour.InvoicePostalAddress == custinvoicejourloc.InvoicePostalAddress
join logisticsLocationRole
where logisticsLocationRole.IsPostalAddress == logisticsLocation.IsPostalAddress
//&& logisticsLocationRole.Type == LogisticsLocationRoleType::Invoice;*/
else if(logisticsLocationRole.Type == LogisticsLocationRoleType::Invoice)
{
BuyerAddress = logisticsLocation.Description+"\n"+ logisticsPostalAddress::findByLocation(logisticsPostalAddress.Location).Address;
//BuyerAddress = custPackingSlipJour.DeliveryName+"\n"+ custPackingSlipJour.invoicingAddress();
BuyerCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.SalesTaxRegistrationNumber).RegistrationNumber;
BuyerECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.ManECCRegistrationNumberTable).RegistrationNumber;
//BuyerTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.TIN).RegistrationNumber;
BuyerTIN = "78635738076V";
}
//Buyer Address End.
public boolean fetch(){ boolean ret; str CurrentMenuItem; Args args = new Args(); //SalesLine salesLine; LogisticsLocationRoleType _type; DirPartyRecId _party;
;
CurrentMenuItem = element.args().menuItemName(); if(CurrentMenuItem == element.args().menuItemName(menuItemOutputStr(S3_SalesInvoiceReport_AccountsCopy))) {
typeofCopy = "Account Copy"; } if(CurrentMenuItem == element.args().menuItemName(menuItemOutputStr(S3_SalesInvoiceReport_ExtraaCopy))) { typeofCopy = "Extra Copy"; } if(CurrentMenuItem == element.args().menuItemName(menuItemOutputStr(S3_SalesInvoiceReport_duplfortranporters))) { typeofCopy = "Transporters"; } if(CurrentMenuItem == element.args().menuItemName(menuItemOutputStr(S3_SalesInvoiceReport_OrigForBuyer))) { typeofCopy = "Original for Buyers"; }
select TaxInformation_IN where TaxInformation_IN.RegistrationLocation == CompanyInfo::find().PrimaryAddressLocation && TaxInformation_IN.IsPrimary == NoYes::Yes;
select salesTable where salesTable.SalesId == custinvoicejourloc.SalesId; // Header related data salesid = custinvoicejourloc.SalesId; invoiceid = custinvoicejourloc.InvoiceId;
//CompanyTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN.TIN).RegistrationNumber; CompanyTIN = "27615247749V"; CompanyCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN.STCRegistrationNumberTable).RegistrationNumber; CompanyECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN.ManECCRegistrationNumberTable).RegistrationNumber; Range = TaxInformation_IN.Range; Division = TaxInformation_IN.Division; Commissionarate = TaxInformation_IN.Commissionarate; companyLST = "27615247749V"; invoiceDate1 = custinvoicejourloc.InvoiceDate; invoiceDate2 = custinvoicejourloc.InvoiceDate; //typeofCopy = "Accounts Copy"; //CompanyCIN = CompanyInfo::find().TaxRepresentative; CompanyCIN = "U15500MH2009PTC193480";
FSSAINo = "10015022003730";
select taxInformationLegalEntity where taxInformationLegalEntity.LegalEntity == CompanyInfo::find().RecId; PanNo = taxInformationLegalEntity.PANNumber;
// Delivery Details Start //info(strFmt("%1", salesTable.deliveryLocation())); //srini
while select TaxInformation_IN_delivery where TaxInformation_IN_delivery.RegistrationLocation ==salesTable.deliveryLocation() join logisticsLocation where logisticsLocation.RecId == TaxInformation_IN_delivery.RegistrationLocation join logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId join logisticsLocationRole where logisticsLocationRole.IsPostalAddress == logisticsLocation.IsPostalAddress join logisticsPostalAddressView where logisticsPostalAddressView.Location == logisticsPostalAddress.Location //join custinvoicejourloc //where custinvoicejourloc.OrderAccount == custTable.AccountNum //join custTable //where custTable.Party == dirPartyPostalAddressView.Party //join dirPartyTable //where dirPartyTable.RecId == logisticsPostalAddress.PrivateForParty join dirPartyLocation where dirPartyLocation.Location == logisticsPostalAddressView.Location
//&& logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery
if(logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery || logisticsLocationRole.Type == LogisticsLocationRoleType::Business) {
//DeliveryAddress = SalesTable.DeliveryName+"\n"+ SalesTable.deliveryAddressing(); //DeliveryAddress = salesTable.DeliveryName+"\n"+ salesTable::find(salesid).deliveryAddressing(); DeliveryAddress = logisticsLocation.Description+"\n"+ logisticsPostalAddress::findByLocation(logisticsPostalAddress.Location).Address;
//DeliveryAddress = this.getPostalAddressByType(custTable.Party, LogisticsLocationRoleType::Delivery).Address; DeliveryCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.SalesTaxRegistrationNumber).RegistrationNumber; //DeliveryTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.TIN).RegistrationNumber; DeliveryTIN = "78635738076V"; DeliveryECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.ManECCRegistrationNumberTable).RegistrationNumber; // Delivery Details End }
//srini //Consignee Address Start
/*while select TaxInformation_IN_Buyer where TaxInformation_IN_Buyer.RegistrationLocation == logisticsLocation.RecId join logisticsLocation where logisticsLocation.RecId == TaxInformation_IN_Buyer.RegistrationLocation join logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId //join custPackingSlipJour //where custPackingSlipJour.InvoicePostalAddress == custinvoicejourloc.InvoicePostalAddress join logisticsLocationRole where logisticsLocationRole.IsPostalAddress == logisticsLocation.IsPostalAddress //&& logisticsLocationRole.Type == LogisticsLocationRoleType::Consignment_IN;*/ else if(logisticsLocationRole.Type == LogisticsLocationRoleType::Consignment_IN) {
ConsigneeAddress = logisticsLocation.Description+"\n"+ logisticsPostalAddress::findByLocation(logisticsPostalAddress.Location).Address; ConsigneeCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.SalesTaxRegistrationNumber).RegistrationNumber; ConsigneeECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.ManECCRegistrationNumberTable).RegistrationNumber; //ConsigneeTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.TIN).RegistrationNumber; ConsigneeTIN = "78635738076V"; } //consignee Address End.
//Buyer Address Start /*while select TaxInformation_IN_delivery where TaxInformation_IN_delivery.RegistrationLocation == logisticsLocation.RecId join logisticsLocation where logisticsLocation.RecId == TaxInformation_IN_delivery.RegistrationLocation join logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId //join custPackingSlipJour //where custPackingSlipJour.InvoicePostalAddress == custinvoicejourloc.InvoicePostalAddress join logisticsLocationRole where logisticsLocationRole.IsPostalAddress == logisticsLocation.IsPostalAddress //&& logisticsLocationRole.Type == LogisticsLocationRoleType::Invoice;*/ else if(logisticsLocationRole.Type == LogisticsLocationRoleType::Invoice) {
BuyerAddress = logisticsLocation.Description+"\n"+ logisticsPostalAddress::findByLocation(logisticsPostalAddress.Location).Address; //BuyerAddress = custPackingSlipJour.DeliveryName+"\n"+ custPackingSlipJour.invoicingAddress(); BuyerCST = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.SalesTaxRegistrationNumber).RegistrationNumber; BuyerECC = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.ManECCRegistrationNumberTable).RegistrationNumber; //BuyerTIN = TaxRegistrationNumbers_IN::find(TaxInformation_IN_delivery.TIN).RegistrationNumber; BuyerTIN = "78635738076V"; } //Buyer Address End.
element.execute(1); // for address related fields element.execute(2); // for address related fields element.execute(3); // Item Headings
while select custInvoiceTransloc where custInvoiceTransloc.SalesId == custinvoicejourloc.SalesId && custInvoiceTransloc.InvoiceId == custinvoicejourloc.InvoiceId && custInvoiceTransloc.InvoiceDate == custinvoicejourloc.InvoiceDate && custInvoiceTransloc.numberSequenceGroup == custinvoicejourloc.numberSequenceGroup {
LineNo = LineNo + 1; itemid = custInvoiceTransloc.ItemId; itemName = InventTable::find(itemid).itemDescriptionOrName(); qty = custInvoiceTransloc.Qty; rateOfItem = custInvoiceTransloc.SalesPrice; Amount = custInvoiceTransloc.LineAmount; unit = custInvoiceTransloc.SalesUnit; TotalAmount = TotalAmount + Amount; element.execute(4); }
deliveryTerms = DlvTerm::find(SalesTable::find(salesid).DlvTerm).Txt; paymentTerms = PaymTerm::find(SalesTable::find(salesid).Payment).Description;
//tax Breakup Start
TotalTax = this.TaxAmountLoc(salesLine); VATCST = Vat+CST; VATCSTValue = VatValue+CSTValue; // tax breakups end
while select salesline where SalesLine.salesid == salesid { while select markupTrans where markupTrans.TransRecId == salesline.RecId && markupTrans.ModuleType == MarkupModuleType::Cust && (markupTrans.MarkupCode == markupTrans.MarkupCode)//|| markupTrans.MarkupCode == 'Load') { if(markupTrans.MarkupCode == 'Fr') { FreightAmount += markupTrans.Value; } else { otherAmount += markupTrans.Value; } } }
GrandTotal = totalamount + FreightAmount + otherAmount+TotalTax;
grandTotalinWords = numtoRupees::numberToRupees(GrandTotal); //element.execute(9); //element.execute(11);
element.execute(5); element.execute(12); element.send(custinvoicejourloc); return true;}