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

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        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;
            }
        }