Parameter form
public void postBuild()
{
DialogField dialogEntity;
Args args = this.controller().parmArgs();
super();
dialogEntity= this.bindInfo().getDialogField(this.dataContractObject(), methodStr(custAgingReportContract, parmDataArea));
if (args && args.menuItemName() == menuitemoutputstr(AweCustAgingReportForMultiCompanies)||menuitemoutputstr(AweCustAging))// || menuitemOutputStr(AweCustAgingWithFinancialDimensions))
{
dialogEntity.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(CustAgingReportUIBuilder,lookupEntity),this);
if (dialogEntity)
{
dialogEntity.lookupButton(2);//(2);
}
}
else
{
dialogEntity.visible(false);
dialogEntity.value("");
}
}
public void postRun()
{
if (CustParameters::isBillingClassificationEnabled())
{
this.billingClassificationLookup();
}
/* else
{
super();
}*/
}
Controller class:
public class CustAgingReportController extends SrsReportRunController
{
}
private str getReportName(CustAgingReportContract _contract)
{
str reportNameLocal;
if (_contract.parmDetailed())
{
if (_contract.parmIncludeAmountCur())
{
reportNameLocal = ssrsReportStr(CustAgingReport, DesignWithDetailAndWithTransactionCur);
}
else
{
reportNameLocal = ssrsReportStr(CustAgingReport, DesignWithDetailAndNoTransactionCur);
}
if(_contract.parmMenuItemName() == menuitemoutputstr(AweCustAging))
{
if (_contract.parmIncludeAmountCur())
{
reportNameLocal = ssrsReportStr(CustAgingReport, AweDesignWithDetailAndWithTransaction);
}
else
{
reportNameLocal = ssrsReportStr(CustAgingReport, AweDesignWithDetailAndNoTransaction);
}
}
if (_contract.parmMenuItemName() == menuitemoutputstr(AweCustAgingWithFinancialDimensions))
{
if (_contract.parmIncludeAmountCur())
{
reportNameLocal = ssrsReportStr(CustAgingReport, AweDimensionWithDetailAndWithTransaction);
}
else
{
reportNameLocal = ssrsReportStr(CustAgingReport, AweDimensionWithDetailAndNoTransaction);
}
}
}
else
{
if (_contract.parmIncludeAmountCur())
{
reportNameLocal = ssrsReportStr(CustAgingReport, DesignWithNoDetailAndWithTransactionCur);
}
else
{
reportNameLocal = ssrsReportStr(CustAgingReport, DesignWithNoDetailAndNoTransactionCur);
}
}
return reportNameLocal;
}
protected void prePromptModifyContract()
{
CustAgingReportContract contract = this.parmReportContract().parmRdpContract() as CustAgingReportContract;
this.setRanges(this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey()), contract);
}
protected void preRunModifyContract()
{
CustAgingReportContract contract = this.parmReportContract().parmRdpContract() as CustAgingReportContract;
this.parmReportContract().parmReportName(this.getReportName(contract));
super();
}
protected container preRunValidate()
{
// Now that this report is a preprocess tempdb report, we no longer need
// the limits that were required in the SYS version of the report.
return super();
}
public void setRanges(Query _query, CustAgingReportContract _contract)
{
CustAgingReportTmp custAgingReportTmp;
// Checking the current table number
if (this.parmArgs() && this.parmArgs().record() && this.parmArgs().record().TableId == tableNum(CustAgingReportTmp))
{
custAgingReportTmp = this.parmArgs().record();
// Modifying the query
_query.dataSourceTable(tableNum(CustTable)).rangeField(fieldNum(CustTable, AccountNum)).value(custAgingReportTmp.AccountNum);
// Setting the ranges
_contract.parmDateTransactionDuedate(any2int(custAgingReportTmp.Balance01));
_contract.parmAgingBuckets(custAgingReportTmp.Txt);
}
}
public static void main(Args _args)
{
CustAgingReportContract contract;
CustAgingReportController controller = new CustAgingReportController();
//CustAgingReportController controllerLoc = new CustAgingReportController();
controller.parmReportName(ssrsReportStr(CustAgingReport, DesignWithNoDetailAndNoTransactionCur));
//controllerLoc.parmReportName(ssrsReportStr(CustAgingReport, AweCustAgingWithFinancialDimensions));
contract = controller.parmReportContract().parmRdpContract() as CustAgingReportContract;
contract.parmMenuItemName(_args.menuItemName());
if (contract.parmMenuItemName()==menuitemoutputstr(AweCustAging))
{
contract.parmDetailed(true);
}
if (contract.parmMenuItemName()==menuitemoutputstr(AweCustAgingWithFinancialDimensions))
{
contract.parmDetailed(true);
}
controller.parmArgs(_args);
controller.startOperation();
}
[
SRSReportQueryAttribute(queryStr(CustAgingReport)),
SRSReportParameterAttribute(classStr(CustAgingReportContract))
]
DP Class:
private CustAgingReportTmp insertCustAgingReportTmp(boolean _reverseAmountsAndHeadings)
{
Str1260 asOfDate = strFmt("@SYS84682", date2StrUsr(contract.parmZeroDate(), DateFlags::FormatAll), contract.parmDateTransactionDuedate());
Addressing headingAccount = strFmt("@SYS24500");
TransTxt headingName = strFmt("@SYS7399");
AmountMST balance = 100;
CustVendTransAging custVendTransAging = custVendBalanceList.getCustVendTransAging();
#define.Location("Location")
#Define.Department("Department")
#Define.Product("Product")
#Define.Project("Project")
#define.LOB("LineofBusiness")
SubledgerVoucherGeneralJournalEntry subledgervouchergenraljournalentry;
GeneralJournalEntry generalJournalEntry;
DimensionAttribute dimAttribute;
GeneralJournalAccountEntry generalJournalAccountEntry,generalJournalAccountEntryDimension;
DimensionAttributeLevelValueAllView dimView;
DefaultDimensionView defaultDimensionView;
MainAccountLedgerDimensionView mainAccountView;
Name awaDeprtment, awaLOB ,awaLOC, awaProdcut, aweproj;
int64 ledgerDimension;
CustTrans custTrans;
CustTable custTable;
int ledgerAcc;
if (_reverseAmountsAndHeadings)
{
insert_recordset custAgingReportTmp
(Balance01, Balance02, Balance03, Balance04, Balance05, Balance06, Balance07,
Balance01cur, Balance02cur, Balance03cur, Balance04cur, Balance05cur, Balance06cur, Balance07cur,
TransDate, InvoiceId, Voucher, AccountNum, Name, CustAccount, Txt, Currency, CustGroup, BillingClassification,
AsOfDate, HeadingAccount, HeadingName, HeadingDate, Heading1, Heading2DateValue, Heading2,
Heading3, Heading4, Heading5, Heading6, Heading7DateValue, Heading7, Heading8, Heading9,
Heading10, Heading11, Heading12, Heading13, Heading14, HeadingAgingBucketDescription02,
HeadingAgingBucketDescription03, HeadingAgingBucketDescription04, HeadingAgingBucketDescription05,
//HeadingAgingBucketDescription06, HeadingAgingBucketDescription07, Balance,
HeadingAgingBucketDescription06, HeadingAgingBucketDescription07, Balance,
AweSalesAgreementId,
AweSalesPoolId,
AweClaimId,SortOrder)
select
Balance01, Balance07, Balance06, Balance05, Balance04, Balance03, Balance02,
Balance01cur, Balance07cur, Balance06cur, Balance05cur, Balance04cur, Balance03cur, Balance02cur,
TransDate, InvoiceId, Voucher, AccountNum, Name, AccountNum, Txt, CurrencyCode, GroupId, BillingClassification,
asOfDate, headingAccount, headingName, headingDate, heading01, heading02, heading07Text,
heading03, heading04, heading05, heading06, heading07, heading02Text, heading011, heading03,
heading031, heading041, heading051, heading061, heading061, headingAgingBucketDescription02,
headingAgingBucketDescription03, headingAgingBucketDescription04, headingAgingBucketDescription05,
headingAgingBucketDescription06, headingAgingBucketDescription07, balance,
AweSalesAgreementId,
AweSalesPoolId,
AweClaimId
from tmpAccountSum
join SortOrder
from custVendTransAging
where tmpAccountSum.AccountNum == custVendTransAging.AccountNum;
}
else
{
insert_recordset custAgingReportTmp
(Balance01, Balance02, Balance03, Balance04, Balance05, Balance06, Balance07,
Balance01cur, Balance02cur, Balance03cur, Balance04cur, Balance05cur, Balance06cur, Balance07cur,
TransDate, InvoiceId, Voucher, AccountNum, Name, CustAccount, Txt, Currency, CustGroup, BillingClassification,
AsOfDate, HeadingAccount, HeadingName, HeadingDate, Heading1, Heading2DateValue, Heading2,
Heading3, Heading4, Heading5, Heading6, Heading7DateValue, Heading7, Heading8, Heading9,
Heading10, Heading11, Heading12, Heading13, Heading14, HeadingAgingBucketDescription02,
HeadingAgingBucketDescription03, HeadingAgingBucketDescription04, HeadingAgingBucketDescription05,
HeadingAgingBucketDescription06, HeadingAgingBucketDescription07, Balance,
AweSalesAgreementId,
AweSalesPoolId,
AweClaimId,SortOrder)
select
Balance01, Balance02, Balance03, Balance04, Balance05, Balance06, Balance07,
Balance01cur, Balance02cur, Balance03cur, Balance04cur, Balance05cur, Balance06cur, Balance07cur,
TransDate, InvoiceId, Voucher, AccountNum, Name, AccountNum, Txt, CurrencyCode, GroupId, BillingClassification,
asOfDate, headingAccount, headingName, headingDate, heading01, heading02, heading02Text,
heading03, heading04, heading05, heading06, heading07, heading07Text, heading011, heading021,
heading031, heading041, heading051, heading061, heading071, headingAgingBucketDescription02,
headingAgingBucketDescription03, headingAgingBucketDescription04, headingAgingBucketDescription05,
headingAgingBucketDescription06, headingAgingBucketDescription07, balance,
AweSalesAgreementId,
AweSalesPoolId,
AweClaimId
from tmpAccountSum
join SortOrder
from custVendTransAging
where tmpAccountSum.AccountNum == custVendTransAging.AccountNum;
if(contract.parmmenuitemname() == menuitemoutputstr(awecustaging))
{
while select forupdate custAgingReportTmp
{
custAgingReportTmp.awelocation = this.getDimensionValueLocation(CustTable::find(custAgingReportTmp.AccountNum).DefaultDimension);
custAgingReportTmp.update();
}
}
if (contract.parmMenuItemName()==menuitemoutputstr(AweCustAgingWithFinancialDimensions))
{
while select accountnum from tmpAccountSum
{
while select AccountNum from custTable
where custTable.AccountNum == tmpAccountSum.AccountNum
{
while select forUpdate custAgingReportTmp
where custAgingReportTmp.AccountNum == tmpAccountSum.AccountNum
{
ttsBegin;
custAgingReportTmp.AWEDataArea = curext();
custAgingReportTmp.update();
select firstOnly subledgervouchergenraljournalentry
where subledgervouchergenraljournalentry.Voucher == custAgingReportTmp.Voucher //custTrans.Voucher && join RecId from generalJournalEntry
where generalJournalEntry.RecId == subledgervouchergenraljournalentry.GeneralJournalEntry
join GeneralJournalEntry, LedgerDimension , LedgerAccount from generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
join mainAccountView
where mainAccountView.LedgerDimensionId == generalJournalAccountEntry.LedgerDimension &&
mainAccountView.Type == DimensionLedgerAccountType::ProfitAndLoss
join custTrans
where custTrans.AccountNum == custAgingReportTmp.AccountNum;
ledgerAcc = strLen(generalJournalAccountEntry.LedgerAccount);
if (generalJournalAccountEntry.LedgerDimension)
{
ledgerDimension = generalJournalAccountEntry.LedgerDimension;
while select dimView where dimView.ValueCombinationRecId == ledgerDimension
join dimAttribute
where dimAttribute.RecId == dimView.DimensionAttribute
{
if (dimAttribute.Name == 'LineofBusiness')
{
custAgingReportTmp.AWELOB = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Location' )
{
custAgingReportTmp.AWELOC = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Department')
{
custAgingReportTmp.AweDepartment = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Product' )
{
custAgingReportTmp.AWEProduct = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Project')
{
custAgingReportTmp.AWEProject = dimView.DisplayValue;
custAgingReportTmp.update();
}
}
}
else
{
select subledgervouchergenraljournalentry
where subledgervouchergenraljournalentry.Voucher == custAgingReportTmp.Voucher //custTrans.Voucher &&
join RecId from generalJournalEntry
where generalJournalEntry.RecId == subledgervouchergenraljournalentry.GeneralJournalEntry
join GeneralJournalEntry, LedgerDimension , LedgerAccount from generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
join mainAccountView
where mainAccountView.LedgerDimensionId == generalJournalAccountEntry.LedgerDimension //&&
join custTrans
where custTrans.AccountNum == custAgingReportTmp.AccountNum;
ledgerAcc = strLen(generalJournalAccountEntry.LedgerAccount);
ledgerDimension = generalJournalAccountEntry.LedgerDimension;
if (ledgerAcc >= 12)//17)
{
while select dimView where dimView.ValueCombinationRecId == ledgerDimension
join dimAttribute
where dimAttribute.RecId == dimView.DimensionAttribute
{
if (dimAttribute.Name == 'LineofBusiness')
{
custAgingReportTmp.AWELOB = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Location' )
{
custAgingReportTmp.AWELOC = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Department')
{
custAgingReportTmp.AweDepartment = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Product' )
{
custAgingReportTmp.AWEProduct = dimView.DisplayValue;
custAgingReportTmp.update();
}
if (dimAttribute.Name == 'Project')
{
custAgingReportTmp.AWEProject = dimView.DisplayValue;
custAgingReportTmp.update();
}
}
}
}
ttsCommit;
}
}
}
}
}
return custAgingReportTmp;
}
[SysEntryPointAttribute]
public void processReport()
{
List dataArea;
ListIterator iterator;
DataAreaId dataAreaId;
dataArea = new List(Types::String);
contract = this.parmDataContract() as CustAgingReportContract;
dataArea = contract.parmDataArea();
if (dataArea && !dataArea.empty())
{
iterator = new ListIterator(dataArea);
while(iterator.more())
{
dataAreaId = iterator.value();
changeCompany(dataAreaId)
{
this.AweProcessReport();
}
iterator.next();
}
}
else
{
this.AweProcessReport();
}
}
No comments:
Post a Comment