public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptInvoice rpt = new rptInvoice(); rpt.Site = this.Site; return(rpt); }
private void btnPrint_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; var rpt = new rptInvoice(); cmd = new OleDbCommand(); var myDA = new OleDbDataAdapter(); var myDS = new DataSet(); con = new OleDbConnection(cs); cmd.Connection = con; cmd.CommandText = "SELECT Config.ConfigID, Config.ProductName, Config.Features, Config.Price, Sales.InvoiceNo, Sales.InvoiceDate, Sales.CustomerID, Sales.SubTotal,Sales.VATPercentage, Sales.VATAmount, Sales.GrandTotal, Sales.TotalPayment, Sales.PaymentDue, Sales.Remarks, ProductSold.ID,ProductSold.InvoiceNo AS Expr1, ProductSold.ConfigID AS Expr2, ProductSold.Quantity, ProductSold.Price AS Expr3, ProductSold.TotalAmount,Customer.CustomerID AS Expr4, Customer.CustomerName, Customer.Address, Customer.Landmark, Customer.City, Customer.State, Customer.ZipCode,Customer.Phone, Customer.MobileNo, Customer.FaxNo, Customer.Email, Customer.Notes FROM (((Customer INNER JOIN Sales ON Customer.CustomerID = Sales.CustomerID) INNER JOIN ProductSold ON Sales.InvoiceNo = ProductSold.InvoiceNo) INNER JOIN Config ON ProductSold.ConfigID = Config.ConfigID) where Sales.invoiceNo='" + txtInvoiceNo.Text + "'"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Config"); myDA.Fill(myDS, "Sales"); myDA.Fill(myDS, "ProductSold"); myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); var frm = new frmInvoiceReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; var rpt = new rptInvoice(); cmd = new SqlCommand(); var myDA = new SqlDataAdapter(); var myDS = new DataSet(); con = new SqlConnection(cs); cmd.Connection = con; cmd.CommandText = "SELECT Config.ConfigID, Config.ProductName, Config.Features, Config.Price, Sales.InvoiceNo, Sales.InvoiceDate, Sales.CustomerID, Sales.SubTotal,Sales.VATPercentage, Sales.VATAmount, Sales.GrandTotal, Sales.TotalPayment, Sales.PaymentDue, Sales.Remarks, ProductSold.ID,ProductSold.InvoiceNo AS Expr1, ProductSold.ConfigID AS Expr2, ProductSold.Quantity, ProductSold.Price AS Expr3, ProductSold.TotalAmount,Customer.CustomerID AS Expr4, Customer.CustomerName, Customer.Address, Customer.Landmark, Customer.City, Customer.State, Customer.ZipCode,Customer.Phone, Customer.MobileNo, Customer.FaxNo, Customer.Email, Customer.Notes FROM (((Customer INNER JOIN Sales ON Customer.CustomerID = Sales.CustomerID) INNER JOIN ProductSold ON Sales.InvoiceNo = ProductSold.InvoiceNo) INNER JOIN Config ON ProductSold.ConfigID = Config.ConfigID) where Sales.invoiceNo='" + txtInvoiceNo.Text + "'"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Config"); myDA.Fill(myDS, "Sales"); myDA.Fill(myDS, "ProductSold"); myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); var frm = new frmInvoiceReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptInvoice rpt = new rptInvoice(); rpt.Site = this.Site; return rpt; }