Пример #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cr_YearlyMonthOpex rpt = new cr_YearlyMonthOpex();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void GetYearWiseOpexReport(DateTime fromDate, DateTime toDate)
        {
            try
            {
                cr_YearlyMonthOpex      objcrYearlyOpex         = new cr_YearlyMonthOpex();
                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_Yearly_Month_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.GetYearwiseMonthlyOpexReport(fromDate, toDate, TempBranchId);
                }
                objcrYearlyOpex.SetDataSource(dataTable);

                GetCommonInfo();
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtAddress"]).Text     = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtReport"]).Text     = "Montly Opex Report : Year wise";
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtFrom"]).Text       = fromDate.Year.ToString();
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtTo"]).Text         = toDate.Year.ToString();
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text = ddlBranchList.Text;



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