private void GetCommonOpexReport(DateTime fromDate, DateTime toDate) { try { cr_CommonExpenditureReport objcrCommonOpex = new cr_CommonExpenditureReport(); DataTable dataTable = new DataTable(); frmReportViewer objReportviewer = new frmReportViewer(); RecordLevelFilteringBAL recordLevelFilteringBAL = new RecordLevelFilteringBAL(); int TempBranchId = -2; OpexBAL objOpexBal = new OpexBAL(); int BranchId = Int32.Parse(ddlBranchList.SelectedValue.ToString()); int resourceId = recordLevelFilteringBAL.GetResourceID(ResourceName.Common_Expenditure); int criteriaId = recordLevelFilteringBAL.GetCriteriaID(resourceId); if (BranchId == 0) { TempBranchId = Convert.ToInt32(recordLevelFilteringBAL.FilterWorkStation_All(BranchId.ToString(), resourceId, criteriaId)); if (TempBranchId == 0) { dataTable = objOpexBal.GetAllBranchDailyOpex(fromDate, toDate, TempBranchId); } else { dataTable = objOpexBal.GetAllBranchDailyOpex(fromDate, toDate, TempBranchId); dataTable.Rows.Clear(); } } else { TempBranchId = Convert.ToInt32(recordLevelFilteringBAL.FilterBranchID(BranchId.ToString(), resourceId, criteriaId)); dataTable = objOpexBal.GetCommonOpexReport(fromDate, toDate, TempBranchId); } objcrCommonOpex.SetDataSource(dataTable); GetCommonInfo(); ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName; ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtAddress"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber; ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtReport"]).Text = "Common Expenditure"; ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtFrom"]).Text = fromDate.ToString("yyyy"); ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtTo"]).Text = toDate.ToString("yyyy"); ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text = ddlBranchList.Text; objReportviewer.crvReportViewer.ReportSource = objcrCommonOpex; objReportviewer.crvReportViewer.ShowGroupTreeButton = false; objReportviewer.Text = "Common Expenditure"; objReportviewer.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
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; } }
private void GetDailyDaywiseOpexReport(DateTime fromDate, DateTime toDate) { try { cr_groupByBranchDailyOpexReport objcrDailyOpex = new cr_groupByBranchDailyOpexReport(); DataTable dataTable = new DataTable(); frmReportViewer objReportviewer = new frmReportViewer(); RecordLevelFilteringBAL recordLevelFilteringBAL = new RecordLevelFilteringBAL(); OpexBAL objOpexBal = new OpexBAL(); int TempBranchId = -2; int resourceId = recordLevelFilteringBAL.GetResourceID(ResourceName.Daily_Expenditure_group_By_Branch_Daily_Opex_Report); int criteriaId = recordLevelFilteringBAL.GetCriteriaID(resourceId); int branchId = Int32.Parse(ddlBranchList.SelectedValue.ToString()); if (branchId == 0) { TempBranchId = Convert.ToInt32(recordLevelFilteringBAL.FilterWorkStation_All(branchId.ToString(), resourceId, criteriaId)); if (TempBranchId == 0) { dataTable = objOpexBal.GetAllBranchDailyOpex(fromDate, toDate, TempBranchId); } else { //dataTable = objOpexBal.GetAllBranchDailyOpex(fromDate, toDate, branchId); //dataTable.Rows.Clear(); MessageBox.Show("You are restricted"); return; } } else if (branchId != 0) { TempBranchId = Convert.ToInt32(recordLevelFilteringBAL.FilterBranchID(branchId.ToString(), resourceId, criteriaId)); if (branchId != TempBranchId) { MessageBox.Show("You are restricted"); return; } dataTable = objOpexBal.GetAllBranchDailyOpex(fromDate, toDate, TempBranchId); } objcrDailyOpex.SetDataSource(dataTable); GetCommonInfo(); ((TextObject)objcrDailyOpex.ReportDefinition.Sections[1].ReportObjects["txtCompanyName"]).Text = _CommpanyName; ((TextObject)objcrDailyOpex.ReportDefinition.Sections[1].ReportObjects["txtAddress"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber; ((TextObject)objcrDailyOpex.ReportDefinition.Sections[1].ReportObjects["txtReportTitle"]).Text = "Day wise Daily Opex "; ((TextObject)objcrDailyOpex.ReportDefinition.Sections[1].ReportObjects["txtFromDate"]).Text = fromDate.ToString("dd-MMM-yyyy"); ((TextObject)objcrDailyOpex.ReportDefinition.Sections[1].ReportObjects["txtToDate"]).Text = toDate.ToString("dd-MMM-yyyy"); ((TextObject)objcrDailyOpex.ReportDefinition.Sections[1].ReportObjects["txtBranchName"]).Text = ddlBranchList.Text; objReportviewer.crvReportViewer.ReportSource = objcrDailyOpex; objReportviewer.Text = "Daily Opex Report : Day wise"; objReportviewer.Show(); } catch (Exception) { throw; } }