public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cr_YearlyOPex rpt = new cr_YearlyOPex();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemplo n.º 2
0
        private void GetYearlyOpexReport(DateTime fromDate, DateTime toDate)
        {
            try
            {
                cr_YearlyOPex           objcrYearlyOpex         = new cr_YearlyOPex();
                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.Daily_Expenditure_Yearly_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.GetYearlyDailyOpexReport(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     = "Daily Opex Report: Year wise";
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtFrom"]).Text       = fromDate.ToString("yyyy");
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtTo"]).Text         = toDate.ToString("yyyy");
                ((TextObject)objcrYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text = ddlBranchList.Text;

                objReportviewer.crvReportViewer.ReportSource = objcrYearlyOpex;
                objReportviewer.Text = "Daily Opex Report: Year wise";
                objReportviewer.Show();
            }
            catch (Exception)
            {
                throw;
            }
        }