private void button11_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptSales rpt = new rptSales(); //The report you created. cmd = new MySqlCommand(); MySqlDataAdapter myDA = new MySqlDataAdapter(); //SIS_DBDataSet myDS = new SIS_DBDataSet(); DataSet myDS = new DataSet(); //The DataSet you created. con = new MySqlConnection(connString()); cmd.Connection = con; cmd.CommandText = "SELECT Invoice.InvoiceNo, Invoice.InvoiceDate, Invoice.CusID, Invoice.SubTotal, Invoice.TaxPercentage, Invoice.TaxAmount,Invoice.Discount, Invoice.GrandTotal, Invoice.TotalPayment,Invoice.PaymentDue, Customer.CusID AS \"Expr1\", Customer.CusName, Customer.CusCity, Customer.CusMob FROM (Sales INNER JOIN Customer ON Sales.CusID = Customer.CusID) Where InvoiceDate between #" + DateTimePicker2.Text + "# And #" + DateTimePicker1.Text + "# and PaymentDue > 0 order by InvoiceDate desc"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "invoice"); myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); frmSalesReport frm = new frmSalesReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptSales rpt = new rptSales(); rpt.Site = this.Site; return(rpt); }
private void button10_Click(object sender, EventArgs e) { try { if (cmbCustomerName.Text == "") { MessageBox.Show("Please select Customer name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbCustomerName.Focus(); return; } Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptSales rpt = new rptSales(); //The report you created. cmd = new MySqlCommand(); MySqlDataAdapter myDA = new MySqlDataAdapter(); DataSet myDS = new DataSet(); //The DataSet you created. con = new MySqlConnection(connString()); cmd.Connection = con; cmd.CommandText = "SELECT Invoice.InvoiceNo, Invoice.CusID, Invoice.SubTotal, Invoice.TaxPercentage, Invoice.TaxAmount,Invoice.Discount, Invoice.GrandTotal, Invoice.TotalPayment,Invoice.PaymentDue, Customer.CusID AS Expr1, Customer.CusName, Customer.CusCity, Customer.CusMob FROM (Invoice INNER JOIN Customer ON Invoice.CusID = Customer.CusID) where Cusname='" + cmbCustomerName.Text + "' order by CusName,InvoiceDate"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "invoice"); myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); frmSalesReport frm = new frmSalesReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }