[ DataContractAttribute ] class VKSalesQuotationDailyContract extends SrsReportRdlDataContract implements SysOperationValidatable { TransDate dateFrom; TransDate dateTo; NoYes showDetails; [ DataMemberAttribute('dateFrom'), SysOperationLabelAttribute(literalStr("@SYS35369")), SysOperationControlVisibilityAttribute(true) ] public TransDate parmDateFrom(TransDate _dateFrom = dateFrom) { dateFrom = _dateFrom; return dateFrom; } [ DataMemberAttribute('dateTo'), SysOperationLabelAttribute(literalStr("@SYS114982")), SysOperationControlVisibilityAttribute(true) ] public TransDate parmDateTo(TransDate _dateTo = dateTo) { dateTo = _dateTo; return dateTo; } [ DataMemberAttribute('ShowDetails'), SysOperationLabelAttribute(literalStr("@SYS8811")), SysOperationControlVisibilityAttribute(true) ] public NoYes parmShowDetails(NoYes _showDetails = showDetails) { showDetails = _showDetails; return showDetails; } /// <summary> /// Validates the parameters. /// </summary> /// <returns> /// true if successful; otherwise, false. /// </returns> public boolean validate() { boolean isValid = true; if(!this.parmDateFrom()) { error("Date from is mandatory"); isValid = false; } if(this.parmDateFrom() && this.parmDateTo()) { // Check whether FromDate is greater than ToDate or not if (this.parmDateFrom() > this.parmDateTo()) { error("@SYS91020"); isValid = false; } } return isValid; } }Controller class:
class VKSalesQuotationDailyController extends SrsReportRunController { public static VKSalesQuotationDailyController construct() { return new VKSalesQuotationDailyController(); } public static void main(Args _args) { VKSalesQuotationDailyController salesQuotationDailyController = VKSalesQuotationDailyController::construct(); salesQuotationDailyController.parmReportName(ssrsReportStr(VKSalesQuotationDailyBookingR, Report)); salesQuotationDailyController.parmArgs(_args); salesQuotationDailyController.parmDialogCaption("Sales quotation daily bookings"); salesQuotationDailyController.startOperation(); } protected void prePromptModifyContract() { VKSalesQuotationDailyContract contract = this.parmReportContract().parmRdpContract(); // Set the report design name. this.parmReportContract().parmReportName(ssrsReportStr(VKSalesQuotationDailyBookingR, Report)); } /// <summary> /// Modifies the contract before the report is run. /// </summary> protected void preRunModifyContract() { VKSalesQuotationDailyContract contract = this.parmReportContract().parmRdpContract(); date fromDate = contract.parmDateFrom(); date toDate = contract.parmDateTo(); Query query = this.getFirstQuery(); // Modify the query contract based on fromDate & toDate. SrsReportHelper::addFromAndToDateRangeToQuery(query, fromDate, toDate, tableNum(SalesQuotationTable), fieldNum(SalesQuotationTable, CreatedDateTime)); } }
[ SRSReportParameterAttribute(classStr(VKSalesQuotationDailyContract)) ] class VKSalesQuotationDailyDP extends SRSReportDataProviderPreProcessTempDB { VKSalesQuotationDailyHeaderFooter salesQuotationDailyHeaderFooter; VKSalesQuotationDailyContract contract; [SRSReportDataSetAttribute(tablestr(VKSalesQuotationDailyHeaderFooter))] public VKSalesQuotationDailyHeaderFooter getSalesQuotationDailyHeaderFooter() { select salesQuotationDailyHeaderFooter; return salesQuotationDailyHeaderFooter; } /// <summary> /// Process report data. /// </summary> public void processReport() { contract = this.parmDataContract() as VKSalesQuotationDailyContract; // Populate report header / footer information this.populateSalesQuotationDailyHeaderFooter(); } protected void populateSalesQuotationDailyHeaderFooter() { CompanyInfo companyInfo = CompanyInfo::find(); salesQuotationDailyHeaderFooter.CompanyName = companyInfo.name(); salesQuotationDailyHeaderFooter.DateFrom = contract.parmDateFrom(); salesQuotationDailyHeaderFooter.DateTo = contract.parmDateTo(); salesQuotationDailyHeaderFooter.ShowDetails = contract.parmShowDetails(); salesQuotationDailyHeaderFooter.insert(); } }Output menu item:
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.