Ejemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cr_MonthlyOpex rpt = new cr_MonthlyOpex();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void GetMonthlyWiseOpexReport(DateTime fromDate, DateTime toDate)
        {
            try
            {
                cr_MonthlyOpex          objcrMonthlyOpex        = new cr_MonthlyOpex();
                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.Monthly_Expenditure_Monthly_Opex);
                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.GetMonthwiseMonthlyOpexReport(fromDate, toDate, TempBranchId);
                }
                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     = "Montly Opex Report : Month 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 = ddlBranchList.Text;



                objReportviewer.crvReportViewer.ReportSource = objcrMonthlyOpex;
                objReportviewer.Text = "Monthly Opex Report : Monthly Wise";
                objReportviewer.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }