コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cr_CommonExpenditureReport rpt = new cr_CommonExpenditureReport();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void GetCommonOpexReport(DateTime fromDate, DateTime toDate)
        {
            try
            {
                cr_CommonExpenditureReport objcrCommonOpex      = new cr_CommonExpenditureReport();
                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.Common_Expenditure);
                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.GetCommonOpexReport(fromDate, toDate, TempBranchId);
                }
                objcrCommonOpex.SetDataSource(dataTable);

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

                ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtReport"]).Text     = "Common Expenditure";
                ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtFrom"]).Text       = fromDate.ToString("yyyy");
                ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtTo"]).Text         = toDate.ToString("yyyy");
                ((TextObject)objcrCommonOpex.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text = ddlBranchList.Text;



                objReportviewer.crvReportViewer.ReportSource        = objcrCommonOpex;
                objReportviewer.crvReportViewer.ShowGroupTreeButton = false;
                objReportviewer.Text = "Common Expenditure";
                objReportviewer.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }