Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrpPartiesList rpt = new CrpPartiesList();

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        public void ShowReport(string vReportTitle, DataTable dt)
        {
            DataTable dt1;

            objDAL.connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["MyString"].ConnectionString;

            try
            {
                dt1 = objDAL.getCompanyInfo();

                if (vReportTitle == "BANK ACCOUNT LIST")
                {
                    CrpBankAccList Rpt = new CrpBankAccList();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "GEN ACCOUNT LIST")
                {
                    CrpGenAccList Rpt = new CrpGenAccList();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "PARTIES LIST")
                {
                    CrpPartiesList Rpt = new CrpPartiesList();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "CURRENT STOCK")
                {
                    CrpCurrentStock Rpt = new CrpCurrentStock();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "JOURNAL VOUCHER")
                {
                    CrpAccountVoucher Rpt = new CrpAccountVoucher();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    Rpt.SummaryInfo.ReportTitle = vReportTitle;

                    if (!string.IsNullOrEmpty(dt.Rows[0]["PrintVoucherType"].ToString()))
                    {
                        Rpt.SetParameterValue("VoucherTitle", dt.Rows[0]["PrintVoucherType"].ToString());
                    }
                    else
                    {
                        Rpt.SetParameterValue("VoucherTitle", vReportTitle);
                    }

                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "BANK DEPOSIT VOUCHER" || vReportTitle == "BANK PAYMENT VOUCHER")
                {
                    CrpAccountVoucher Rpt = new CrpAccountVoucher();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    Rpt.SummaryInfo.ReportTitle = vReportTitle;
                    Rpt.SetParameterValue("VoucherTitle", vReportTitle);
                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "CASH RECEIVING VOUCHER")
                {
                    CrpAccountVoucher Rpt = new CrpAccountVoucher();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    Rpt.SummaryInfo.ReportTitle = vReportTitle;

                    if (!string.IsNullOrEmpty(dt.Rows[0]["PrintVoucherType"].ToString()))
                    {
                        Rpt.SetParameterValue("VoucherTitle", dt.Rows[0]["PrintVoucherType"].ToString());
                    }
                    else
                    {
                        Rpt.SetParameterValue("VoucherTitle", vReportTitle);
                    }

                    this.CRViewer.ReportSource = Rpt;
                }
                else if (vReportTitle == "CASH PAYMENT VOUCHER")
                {
                    CrpAccountVoucher Rpt = new CrpAccountVoucher();
                    Rpt.Database.Tables[0].SetDataSource(dt);
                    Rpt.Database.Tables[1].SetDataSource(dt1);
                    Rpt.SummaryInfo.ReportTitle = vReportTitle;
                    if (!string.IsNullOrEmpty(dt.Rows[0]["PrintVoucherType"].ToString()))
                    {
                        Rpt.SetParameterValue("VoucherTitle", dt.Rows[0]["PrintVoucherType"].ToString());
                    }
                    else
                    {
                        Rpt.SetParameterValue("VoucherTitle", vReportTitle);
                    }
                    this.CRViewer.ReportSource = Rpt;
                }

                this.Text = vReportTitle;
                this.CRViewer.Refresh();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }