예제 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptInvoice rpt = new rptInvoice();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptInvoice rpt = new rptInvoice();
         //The report you created.
         cmd = new SqlCommand();
         SqlDataAdapter myDA = new SqlDataAdapter();
         POS_DBDataSet  myDS = new POS_DBDataSet();
         //The DataSet you created.
         con                = new SqlConnection(cs.DBConn);
         cmd.Connection     = con;
         cmd.CommandText    = "SELECT * from product,invoice_info,productsold,customer where invoice_info.invoiceno=productsold.invoiceno and invoice_info.customerID=Customer.CustomerID and ProductSold.ProductID=Product.ProductID and Invoice_info.invoiceNo='" + txtInvoiceNo.Text + "'";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "product");
         myDA.Fill(myDS, "Invoice_Info");
         myDA.Fill(myDS, "ProductSold");
         myDA.Fill(myDS, "Customer");
         rpt.SetDataSource(myDS);
         frmInvoiceReport frm = new frmInvoiceReport();
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }