Hi Experts, Please help me out to resolve the below problem.
I am working on Sales Report(AOT Report) in Accounts Receivable module. I have to write the code to take the value of site field in Sales Table. I have two reports(AOT). If the site value is "Unit 1" Report_1 Should get executed and If the value is "Unit 2" Report_2 should get executed.
please find the below code.if you need.Present code i am using to solve this error is in the Bold and red Color.But it is not a valid code.it is by default taking some other design in the report.
void init()
{
WMSShipment wmsShipment;
SalesLine sL;
InventSiteId inventsiteidobj;
;
super();
// breakpoint;
paymentReference = element.design().sectionName('Invoice').controlName('PaymentReference');
printCopyOriginal = element.args().parmEnum();
if (element.args().parm())
{
taxUnrealizedPayment = element.args().parmObject();
if (taxUnrealizedPayment)
{
ledgerJournalTrans = taxUnrealizedPayment.parmledgerJournalTrans();
}
}
if (classidget(element.args().caller()) == classnum(SalesFormLetter_Invoice))
{
salesFormLetter = element.args().caller();
}
if (element.args().dataset() == tablenum(WMSShipment))
{
wmsShipment = element.args().record();
journalList = FormLetter::createJournalListCopy(ShipCarrierShipmentInvoice::custInvoiceJour(wmsShipment.ShipmentId));
}
else
{
if (element.args().record())
journalList = FormLetter::createJournalListCopy(element.args().record());
else
journalList = element.args().object();
}
if (!journalList)
throw '';
journalList.first(custInvoiceJour);
if (!custInvoiceJour)
throw error("@SYS26348");
custFormletterParameters = CustFormletterParameters::find();
companyInfo = CompanyInfo::find();
custFormletterDocument = CustFormletterDocument::find();
custParameters = CustParameters::find();
this.arrangeLevelNone();
this.changeDesign();
totalsFirstLastPage = custFormletterParameters.TotalsFirstLastPage;
taxPrintTaxFreeBalance = custFormletterParameters.TaxPrintTaxFreeBalance;
this.initPrepaidTotals(0);
this.enableTotalsSections();
this.cashDiscOnInvoice();
if(cashDiscOnInvoice)
{
this.showCashDiscOnInvoiceControls();
}
this.isCreditInvoicingReportEnabled();
this.footerEnable(giro_FIK65, false);
this.footerEnable(giro_FIK762, false);
this.footerEnable(giro_BBS, false);
this.footerEnable(giro_CH_red, false);
this.footerEnable(giro_CH_blue, false);
this.footerEnable(giro_CH_orange, false);
this.footerEnable(giro_Finnish, false);
inventDimReport = InventDimCtrl_Rep_Sales::newFromReport(element);
inventDimReport.parmDocumentStatus(DocumentStatus::Invoice);
inventDimReport.parmDisableLabel(custFormletterParameters.PrePrintLevelInvoice == PrePrintLevel::PrePrinted);
inventDimReport.initDimParmVisible();
inventDimReport.updateControls();
inventdimSetup = inventDimReport.dimFieldsActive(inventDimReport.parmDimParmVisible());
salesFormLetterReport = FormLetterReport::construct(PrintMgmtDocumentType::SalesOrderInvoice);
salesFormLetterReport.parmReportDesign(element);
salesFormLetterReport.parmPrintType(printCopyOriginal);
if (salesFormLetter)
{
salesFormLetterReport.parmDefaultCopyPrintJobSettings(new PrintJobSettings(salesFormLetter.printerSettingsFormletter(PrintSetupOriginalCopy::Copy)));
salesFormLetterReport.parmDefaultOriginalPrintJobSettings(new PrintJobSettings(salesFormLetter.printerSettingsFormletter(PrintSetupOriginalCopy::Original)));
salesFormLetterReport.parmUsePrintMgmtDestinations(salesFormLetter.usePrintManagement());
}
else if (printCopyOriginal == PrintCopyOriginal::OriginalPrint)
{
// Always use the print mgmt destinations when reprinting for the OriginalPrint case.
salesFormLetterReport.parmUsePrintMgmtDestinations(true);
}
//mohan
//ERB_Keshav
breakpoint;
if (salesTable::find(custInvoiceJour.SalesId).CustGroup == "EXPORT")
{
// element.design("Commercial");
// Started - ERB_Vignesh @ 20/7/2018
element.design("Domestic_1");
//Ended - ERB_Vignesh @ 20/7/2018
//ERB_Keshav
}
// element.design("Export");
//element.design("Domestic_1");
else
{
// element.design("Commercial");
// Started_ERB_Vignesh @ 20/7/2018
// if(InventDim::find(purch1.InventDimId).InventLocationId == "Unit I")
//if(purchLine::find(InventDim.inventDimId).InventDimId == "Unit I")
if(!sL)
{
select firstonly sL
where sL.SalesId;
}
inventsiteidobj = InventDim::find(sL.InventDimId).InventLocationId;
if(inventsiteidobj == "UNIT I")
{
element.design("Domestic_1");
// Ended_ERB_Vignesh @ 20/7/2018
//ERB_Keshav
}
else if(InventDim::find(sL.InventDimId).InventLocationId == "UNIT II")
{
element.design("Domestic_2");
}
//mohan
this.initReverseCharge();
this.arrangeLevelGlobal();
this.initUnrealizedTax();
}
}