Пример #1
0
 private void button8_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();
         POS_DBDataSet  myDS = new POS_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 order by InvoiceDate desc";
         cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "InvoiceDate").Value = dtpInvoiceDateFrom.Value.Date;
         cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "InvoiceDate").Value = dtpInvoiceDateTo.Value.Date;
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Invoice_Info");
         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);
     }
 }
Пример #2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptSales rpt = new rptSales();

            rpt.Site = this.Site;
            return(rpt);
        }
Пример #3
0
 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 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 Invoice_Info where  CustomerName='" + cmbCustomerName.Text + "' order by InvoiceDate desc";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Invoice_Info");
         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);
     }
 }
Пример #4
0
        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 OleDbCommand();
                OleDbDataAdapter myDA = new OleDbDataAdapter();
                SIS_DBDataSet    myDS = new SIS_DBDataSet();
                //The DataSet you created.
                con                = new OleDbConnection(cs);
                cmd.Connection     = con;
                cmd.CommandText    = "SELECT Sales.InvoiceNo, Sales.InvoiceDate, Sales.CustomerID, Sales.SubTotal, Sales.VATPercentage, Sales.VATAmount, Sales.GrandTotal, Sales.TotalPayment,Sales.PaymentDue, Sales.Remarks, Customer.CustomerID AS Expr1, Customer.CustomerName, Customer.Address, Customer.Landmark, Customer.City, Customer.State, Customer.ZipCode, Customer.Phone, Customer.MobileNo, Customer.FaxNo, Customer.Email, Customer.Notes FROM (Sales INNER JOIN Customer ON Sales.CustomerID = Customer.CustomerID) 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, "Sales");
                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);
            }
        }