/// <summary> /// /// </summary> /// <returns></returns> private XtraReport InitPayrollReport(ReportDynamicModel report) { // check payroll config id if (!int.TryParse(report.Argument, out var payrollConfigId) || payrollConfigId <= 0) { // invalid argument return(null); } // set current payroll config id hdfPayrollConfigId.Text = payrollConfigId.ToString(); // check payroll id if (!int.TryParse(hdfPayrollId.Text, out var payrollId) || payrollId <= 0) { // get last payroll var payrolls = PayrollController.GetAll(null, payrollConfigId, hdfSelectedDepartmentIds.Text, null, null, null, false, null, 1); // check result if (payrolls.Count > 0) { // set current payroll id hdfPayrollId.Text = payrolls.First().Id.ToString(); // payroll selected cboPayroll.Text = payrolls.First().Title; } else { // no payroll found return(null); } } else { // get payroll by id var payroll = PayrollController.GetById(payrollId); if (payroll != null) { // get month and year var payrollMonth = payroll.Month; var payrollYear = payroll.Year; // set payroll start date report.StartDate = new DateTime(payrollYear, payrollMonth, 1); // set payroll end date report.EndDate = new DateTime(payrollYear, payrollMonth, DateTime.DaysInMonth(payrollYear, payrollMonth)); // payroll selected cboPayroll.Text = payroll.Title; } else { // no payroll found return(null); } } // init payroll report XtraReport rpHRM_Payroll = new rpHRM_Payroll_A4_Landscape(report.Id, payrollId); // check paper kind and orientation switch (report.PaperKind) { case ReportPaperKind.A4: switch (report.Orientation) { case ReportOrientation.Landscape: rpHRM_Payroll = new rpHRM_Payroll_A4_Landscape(report.Id, payrollId); break; case ReportOrientation.Portrait: rpHRM_Payroll = new rpHRM_Payroll_A4_Potrait(report.Id, payrollId); break; } break; case ReportPaperKind.A3: switch (report.Orientation) { case ReportOrientation.Landscape: rpHRM_Payroll = new rpHRM_Payroll_A3_Landscape(report.Id, payrollId); break; case ReportOrientation.Portrait: rpHRM_Payroll = new rpHRM_Payroll_A3_Potrait(report.Id, payrollId); break; } break; case ReportPaperKind.A2: switch (report.Orientation) { case ReportOrientation.Landscape: rpHRM_Payroll = new rpHRM_Payroll_A2_Landscape(report.Id, payrollId); break; case ReportOrientation.Portrait: rpHRM_Payroll = new rpHRM_Payroll_A2_Landscape(report.Id, payrollId); break; } break; } // init extra report return(rpHRM_Payroll); }