private void GetCustomizedOpexReport(DateTime fromDate, DateTime toDate) { try { cr_CustomizedOpex objcrcustomizedOpex = new cr_CustomizedOpex(); DataTable dataTable = new DataTable(); frmReportViewer objReportviewer = new frmReportViewer(); RecordLevelFilteringBAL recordLevelFilteringBAL = new RecordLevelFilteringBAL(); OpexBAL objOpexBal = new OpexBAL(); int TempBranchId = -2; int BranchId = Int32.Parse(ddlBranchList.SelectedValue.ToString()); int resourceId = recordLevelFilteringBAL.GetResourceID(ResourceName.Daily_Expenditure_Customized_Opex); int criteriaId = recordLevelFilteringBAL.GetCriteriaID(resourceId); if (BranchId == 0) { TempBranchId = Convert.ToInt32(recordLevelFilteringBAL.FilterWorkStation_All(BranchId.ToString(), resourceId, criteriaId)); if (BranchId != TempBranchId) { MessageBox.Show("You are restricted"); return; } else { dataTable = objOpexBal.GetAllBranchDailyOpex(fromDate, toDate, TempBranchId); } } else { TempBranchId = Convert.ToInt32(recordLevelFilteringBAL.FilterBranchID(BranchId.ToString(), resourceId, criteriaId)); if (BranchId != TempBranchId) { MessageBox.Show("You are restricted"); return; } else { dataTable = objOpexBal.GetCustomizedOpexReport(fromDate, toDate, TempBranchId); } } objcrcustomizedOpex.SetDataSource(dataTable); GetCommonInfo(); ((TextObject)objcrcustomizedOpex.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName; ((TextObject)objcrcustomizedOpex.ReportDefinition.Sections[2].ReportObjects["txtAddress"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber; ((TextObject)objcrcustomizedOpex.ReportDefinition.Sections[2].ReportObjects["txtReport"]).Text = "Daily Opex Report: Customized"; ((TextObject)objcrcustomizedOpex.ReportDefinition.Sections[2].ReportObjects["txtFrom"]).Text = fromDate.ToString("MMMM-yyyy"); ((TextObject)objcrcustomizedOpex.ReportDefinition.Sections[2].ReportObjects["txtTo"]).Text = toDate.ToString("MMMM-yyyy"); ((TextObject)objcrcustomizedOpex.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text = ddlBranchList.Text; objReportviewer.crvReportViewer.ReportSource = objcrcustomizedOpex; objReportviewer.crvReportViewer.DisplayGroupTree = true; objReportviewer.Text = "Daily Opex Report: Customized"; objReportviewer.Show(); } catch (Exception) { throw; } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { cr_CustomizedOpex rpt = new cr_CustomizedOpex(); rpt.Site = this.Site; return rpt; }