public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { cr_ExpenseReport rpt = new cr_ExpenseReport(); rpt.Site = this.Site; return(rpt); }
//private void GetReport(int BranchID, int CatgId, int FreqId, DateTime fromDate, DateTime toDate, string Grouping) //{ // try // { // if (Grouping == Indication_ExpenseReports.Expense_Grouping_Monthly) // { // cr_MonthlyOpex objcrmonthlyopex = new cr_MonthlyOpex(); // DataTable datatable = new DataTable(); // frmReportViewer objreportviewer = new frmReportViewer(); // RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL(); // ExpenseEntryBAL exbal = new ExpenseEntryBAL(); // int tempbranchid = -2; // int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex); // int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid); // if (BranchID == Indication_BrokerBranch.HeadOffice_ID) // { // tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid)); // if (BranchID != tempbranchid) // { // MessageBox.Show("you are restricted"); // return; // } // else // { // datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate); // } // } // else // { // tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid)); // if (BranchID != tempbranchid) // { // MessageBox.Show("you are restricted"); // return; // } // else // { // datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate); // } // } // objcrmonthlyopex.SetDataSource(datatable); // GetCommonInfo(); // ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName; // ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "Branch name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber; // ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtreport"]).Text = Selected_CategoryType_Name +" Report: Monthly Wise"; // ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-mmm-yyyy"); // ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy"); // ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtbranchname"]).Text = _branchName; // objreportviewer.crvReportViewer.ReportSource = objcrmonthlyopex; // objreportviewer.Text = Selected_CategoryType_Name + " Report: Monthly wise"; // objreportviewer.Show(); // } // else if (Grouping == Indication_ExpenseReports.Expense_Grouping_Daily) // { // cr_DailyOpex objctDailyOpex = new cr_DailyOpex(); // DataTable datatable = new DataTable(); // frmReportViewer objreportviewer = new frmReportViewer(); // RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL(); // ExpenseEntryBAL exbal = new ExpenseEntryBAL(); // int tempbranchid = -2; // int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex); // int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid); // if (BranchID == Indication_BrokerBranch.HeadOffice_ID) // { // tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid)); // if (BranchID != tempbranchid) // { // MessageBox.Show("you are restricted"); // return; // } // else // { // datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate); // } // } // else // { // tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid)); // if (BranchID != tempbranchid) // { // MessageBox.Show("you are restricted"); // return; // } // else // { // datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate); // } // } // objctDailyOpex.SetDataSource(datatable); // GetCommonInfo(); // ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName; // ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber; // ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtreport"]).Text = Selected_CategoryType_Name+" Report: Daily Wise"; // ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-mmm-yyyy"); // ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy"); // //((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtbranchname"]).Text = _branchName; // objreportviewer.crvReportViewer.ReportSource = objctDailyOpex; // objreportviewer.Text = Selected_CategoryType_Name + " Report: Daily wise"; // objreportviewer.Show(); // } // else if (Grouping == Indication_ExpenseReports.Expense_Grouping_Yearly) // { // cr_YearlyOPex objctYearlyOpex = new cr_YearlyOPex(); // DataTable datatable = new DataTable(); // frmReportViewer objreportviewer = new frmReportViewer(); // RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL(); // ExpenseEntryBAL exbal = new ExpenseEntryBAL(); // int tempbranchid = -2; // int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex); // int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid); // if (BranchID == Indication_BrokerBranch.HeadOffice_ID) // { // tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid)); // if (BranchID != tempbranchid) // { // MessageBox.Show("you are restricted"); // return; // } // else // { // datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate); // } // } // else // { // tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid)); // if (BranchID != tempbranchid) // { // MessageBox.Show("you are restricted"); // return; // } // else // { // datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate); // } // } // objctYearlyOpex.SetDataSource(datatable); // GetCommonInfo(); // ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName; // ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "branch name:" + _branchName + "," + _branchAddress + ". phone:" + _branchContactNumber; // ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtreport"]).Text = Selected_CategoryType_Name+ " Report: Yearly wise"; // ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-mmm-yyyy"); // ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy"); // ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtbranchname"]).Text = _branchName; // objreportviewer.crvReportViewer.ReportSource = objctYearlyOpex; // objreportviewer.Text = Selected_CategoryType_Name + " Report: Yearly wise"; // objreportviewer.Show(); // } // } // catch (Exception) // { // throw; // } //} private void GetReport(int BranchID, int CatgId, int FreqId, DateTime fromDate, DateTime toDate, string Grouping) { try { cr_ExpenseReport objcrmonthlyopex = new cr_ExpenseReport(); DataTable datatable = new DataTable(); frmReportViewer objreportviewer = new frmReportViewer(); RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL(); ExpenseEntryBAL exbal = new ExpenseEntryBAL(); bool IsExpensedate = false; int tempbranchid = -2; int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex); int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid); if (rd_ExpenseDate.Checked) { IsExpensedate = rd_ExpenseDate.Checked; } if (BranchID == Indication_BrokerBranch.HeadOffice_ID) { tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid)); if (BranchID != tempbranchid) { MessageBox.Show("you are restricted"); return; } else { datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate, IsExpensedate); } } else { tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid)); if (BranchID != tempbranchid) { MessageBox.Show("you are restricted"); return; } else { datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate, IsExpensedate); } } ParameterDiscreteValue pdv = new ParameterDiscreteValue(); pdv.Value = (object)Grouping; objcrmonthlyopex.SetDataSource(datatable); GetCommonInfo(); ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName; ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;; ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-MMM-yyyy") + " To " + toDate.ToString("dd-MMM-yyyy"); //((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy"); ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtDate"]).Text = IsExpensedate ? "Expense Date" : "Payment Date"; objcrmonthlyopex.ParameterFields["GroupingDate"].CurrentValues.Add(pdv); objreportviewer.crvReportViewer.ReportSource = objcrmonthlyopex; objreportviewer.Text = "Expense Report "; objreportviewer.Show(); } catch (Exception) { throw; } }