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

            rpt.Site = this.Site;
            return(rpt);
        }
Beispiel #2
0
        public void print()
        {
            DialogResult result1 = MessageBox.Show("Do you want to print this Receipt?", "Account Management",
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result1 == DialogResult.Yes)
            {
                try
                {
                    rptReceipt rpt = new rptReceipt();
                    //The report you created.
                    cmd = new OleDbCommand();
                    OleDbDataAdapter myDA = new OleDbDataAdapter();
                    DataSet          myDS = new DataSet();
                    //The DataSet you created.
                    con                = new OleDbConnection(lblpath.Text);
                    cmd.Connection     = con;
                    cmd.CommandText    = "SELECT RECEIPTID,RECEIPTDATE,CUSTOMERNAME,PAYMENTMODE,CHEQUEDATE,CHEQUENO,INSTALLMENTNO,AMOUNT,EXTRADETAIL,PLOTSELLID FROM  Receipt   WHERE  RECEIPTID =" + txtReceiptNo.Text + "";
                    cmd.CommandType    = CommandType.Text;
                    myDA.SelectCommand = cmd;
                    myDA.Fill(myDS, "Receipt");


                    cmd.CommandText    = "SELECT Company.COMPANYNAME,Company.ADDRESS,Company.PHONENO,Company.EMAIL,Company.WEB,Company.TINNO,Company.CSTNO,Company.EXTRA1,Company.EXTRA2 FROM Company ";
                    cmd.CommandType    = CommandType.Text;
                    myDA.SelectCommand = cmd;
                    myDA.Fill(myDS, "Company");

                    cmd.CommandText    = "SELECT PLOTNO,SURVEYNO FROM  PlotSell   WHERE  PlotSell.PLOTSELLID =" + cmbPlotSellId.Text + "";
                    cmd.CommandType    = CommandType.Text;
                    myDA.SelectCommand = cmd;
                    myDA.Fill(myDS, "Plotdetail");


                    con.Close();
                    rpt.SetDataSource(myDS);
                    frmReport frm = new frmReport();
                    frm.crystalReportViewer1.ReportSource = rpt;
                    frm.Visible = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }