예제 #1
0
        private void button11_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;

                var rpt = new rptSales();

                cmd = new OleDbCommand();
                var myDA = new OleDbDataAdapter();
                var myDS = new SIS_DBDataSet();

                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);
                var frm = new frmSalesReport();
                frm.crystalReportViewer1.ReportSource = rpt;
                frm.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void button11_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                timer1.Enabled = true;

                var rpt = new rptSales();

                cmd = new OleDbCommand();
                var myDA = new OleDbDataAdapter();
                var myDS = new SIS_DBDataSet();

                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);
                var frm = new frmSalesReport();
                frm.crystalReportViewer1.ReportSource = rpt;
                frm.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }