public class VKSupplierBankAccAuditController extends SrsReportRunController { #define.supplierBankAccountAuditReportName('VKSupplierBankAccAudit.Report') #define.parameterVendAccount('VendAccount') #define.parameterFromDate('FromDate') #define.parameterToDate('ToDate') } protected void preRunModifyContract() { SrsReportRdlDataContract rdlContract = this.parmReportContract().parmRdlContract(); Query query = this.getFirstQuery(); QueryBuildDataSource qbds; VendAccount vendAccount = rdlContract.getParameter(#parameterVendAccount).getValueTyped(); date fromDate = rdlContract.getParameter(#parameterFromDate).getValueTyped(); date toDate = rdlContract.getParameter(#parameterToDate).getValueTyped(); qbds = query.dataSourceTable(tableNum(VKSupplierBankAccountLog)); if (vendAccount) { qbds.addRange(fieldNum(VKSupplierBankAccountLog, VendAccount)).value(SysQuery::value(vendAccount)); } if (fromDate || ToDate) { // set date range on user role change log according to the selected date range SrsReportHelper::addFromAndToDateRangeToQuery( query, fromDate, ToDate, tableNum(VKSupplierBankAccountLog), fieldNum(VKSupplierBankAccountLog, ActiveDate)); // add simple range if required /*SrsReportHelper::addParameterValueRangeToQuery(query, tableNum(AssetBasis), fieldNum(AssetBasis, BookId), bookId);*/ } } public static VKSupplierBankAccAuditController construct(Args _args) { VKSupplierBankAccAuditController controller = new VKSupplierBankAccAuditController(); if (!_args) { throw error(Error::missingParameter(null)); } controller.parmReportName(#supplierBankAccountAuditReportName); controller.parmArgs(_args); return controller; } public static void main(Args args) { VKSupplierBankAccAuditController::construct(args).startOperation(); }
[ SrsReportNameAttribute(ssrsReportStr(VKSupplierBankAccAudit, Report)), SysOperationContractProcessingAttribute(classstr(VKSupplierBankAccAuditUIBuilder), SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly) ] class VKSupplierBankAccAuditRdlContract extends SrsReportRdlDataContract { VendAccount vendAccount; TransDate fromDate; TransDate toDate; #define.parameterVendAccount('VendAccount') #define.parameterFromDate('FromDate') #define.parameterToDate('ToDate') }
class VKSupplierBankAccAuditRdlContract extends SrsReportRdlDataContract implements SysOperationValidatable .... /// Determines whether the parameters are valid. /// </summary> /// <returns> /// true when the parameters are valid; otherwise, false. /// </returns> public boolean validate() { boolean isValid = true; if (!dateFrom) { isValid = checkFailed(strFmt("@SYS84753", "@SYS180311")); } if (!dateTo) { isValid = checkFailed(strFmt("@SYS84753", "@SYS180217")); } if (dateFrom > dateTo) { isValid = checkFailed(strFmt("@SYS300457", date2StrUsr(dateFrom, DateFlags::FormatAll), date2StrUsr(dateTo, DateFlags::FormatAll))); } return isValid; }
[ SrsReportNameAttribute(ssrsReportStr(VKSupplierBankAccAudit, Report)), SysOperationContractProcessingAttribute(classstr(VKSupplierBankAccAuditUIBuilder), SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly) ] public class VKSupplierBankAccAuditUIBuilder extends SrsReportDataContractUIBuilder { VKSupplierBankAccAuditRdlContract rdlContract; DialogField dialogVendAccount; DialogField dialogFromDate; DialogField dialogToDate; #define.parameterVendAccount('VendAccount') #define.parameterFromDate('FromDate') #define.parameterToDate('ToDate') } public void build() { Dialog parameterDialog = this.dialog(); rdlContract = this.getRdlContract(); dialogVendAccount = parameterDialog.addFieldValue(extendedTypeStr(VendAccount), rdlContract.getValue(#parameterVendAccount)); dialogFromDate = parameterDialog.addFieldValue(extendedTypeStr(FromDate), rdlContract.getValue(#parameterFromDate)); dialogToDate = parameterDialog.addFieldValue(extendedTypeStr(ToDate), rdlContract.getValue(#parameterToDate)); } public void getFromDialog() { rdlContract.setValue(#parameterFromDate, DateTimeUtil::newDateTime(dialogFromDate.value(), 0)); rdlContract.setValue(#parameterToDate, DateTimeUtil::newDateTime(dialogToDate.value(), 0)); rdlContract.setValue(#parameterVendAccount, dialogVendAccount.value()); } public VKSupplierBankAccAuditRdlContract getRdlContract() { return this.getRdlContractInfo().dataContractObject() as VKSupplierBankAccAuditRdlContract; } public void preBuild() { date defaultFromDate; date defaultToDate; super(); // if there are no SysLastValue's for the date range, then default them rdlContract = this.getRdlContract(); defaultFromDate = rdlContract.getValue(#parameterFromDate); defaultToDate = rdlContract.getValue(#parameterToDate); if (! defaultFromDate || ! defaultToDate) { rdlContract.setValue(#parameterFromDate, today() - 30); rdlContract.setValue(#parameterToDate, today()); } }
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units and "buy me a coffee" link.
Join us.