private void button11_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptVendas rpt = new rptVendas(); //The report you created. cmd = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); RMS_DBDataSet myDS = new RMS_DBDataSet(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from Invoice_Info where InvoiceDate Between @d1 and @d2 and PaymentDue > 0 order by InvoiceDate "; cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "InvoiceDate").Value = dateTimePicker2.Value.Date; cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "InvoiceDate").Value = dateTimePicker1.Value.Date; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Invoice_Info"); rpt.SetDataSource(myDS); frmVendasReport frm = new frmVendasReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmCustomersReport_Load(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptCustomers rpt = new rptCustomers(); //The report you created. cmd = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); RMS_DBDataSet myDS = new RMS_DBDataSet(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from Customer order by CustomerName"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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 SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); RMS_DBDataSet myDS = new RMS_DBDataSet(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from Invoice_Info where InvoiceDate Between @d1 and @d2 and PaymentDue > 0 order by InvoiceDate "; cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "InvoiceDate").Value = DateTimePicker2.Value.Date; cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "InvoiceDate").Value = DateTimePicker1.Value.Date; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Invoice_Info"); 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); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptFatura rpt = new rptFatura(); //The report you created. cmd = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); RMS_DBDataSet myDS = new RMS_DBDataSet(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from invoice_info,productsold where invoice_info.invoiceno=productsold.invoiceno and Invoice_info.invoiceNo='" + txtNumPedido.Text + "'"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Invoice_Info"); myDA.Fill(myDS, "ProductSold"); rpt.SetDataSource(myDS); frmFaturaReport frm = new frmFaturaReport(); //frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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(); RMS_DBDataSet myDS = new RMS_DBDataSet(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from invoice_info,productsold where invoice_info.invoiceno=productsold.invoiceno and Invoice_info.invoiceNo='" + txtInvoiceNo.Text + "'"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Invoice_Info"); myDA.Fill(myDS, "ProductSold"); 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); } }