예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptCustomers rpt = new rptCustomers();
         //The report you created.
         frmCustomersReport frm          = new frmCustomersReport();
         SqlConnection      myConnection = default(SqlConnection);
         SqlCommand         MyCommand    = new SqlCommand();
         SqlDataAdapter     myDA         = new SqlDataAdapter();
         POS_DBDataSet      myDS         = new POS_DBDataSet();
         //The DataSet you created.
         myConnection          = new SqlConnection(cs.DBConn);
         MyCommand.Connection  = myConnection;
         MyCommand.CommandText = "select * from Customer Order by CustomerName";
         MyCommand.CommandType = CommandType.Text;
         myDA.SelectCommand    = MyCommand;
         myDA.Fill(myDS, "Customer");
         rpt.SetDataSource(myDS);
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void btnVerRelat_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptEstoque rpt = new rptEstoque();
         //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 Product.ProductID,ProductName,Features,Price,Quantity,Price,Image from Temp_Stock,Product where Temp_Stock.ProductID=Product.ProductID and quantity > 0 order by ProductName";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "temp_Stock");
         myDA.Fill(myDS, "product");
         rpt.SetDataSource(myDS);
         frmEstoqueRelatorio frm = new frmEstoqueRelatorio();
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
 private void btnImprimir_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();
         POS_DBDataSet  myDS = new POS_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='" + txtContaFat.Text + "'";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Invoice_Info");
         myDA.Fill(myDS, "ProductSold");
         rpt.SetDataSource(myDS);
         frmFaturaRelatorio frm = new frmFaturaRelatorio();
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #4
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);
     }
 }
예제 #5
0
 private void button3_Click(object sender, EventArgs e)
 {
     try{
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptStock rpt = new rptStock();
         //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 Stock,Product,Supplier where Stock.ProductID=Product.ProductID and Stock.SupplierID=Supplier.SupplierID and StockDate Between @d1 and @d2 order by StockDate";
         cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "StockDate").Value = dtpStockDateFrom.Value.Date;
         cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "StockDate").Value = dtpStockDateTo.Value.Date;
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Stock");
         myDA.Fill(myDS, "Product");
         myDA.Fill(myDS, "Supplier");
         rpt.SetDataSource(myDS);
         frmStockReport frm = new frmStockReport();
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
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);
     }
 }
예제 #7
0
 private void button3_Click_1(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         rptInvoice rpt = new rptInvoice();
         //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 product,invoice_info,productsold where invoice_info.invoiceno=productsold.invoiceno and ProductSold.ProductID=Product.ProductID and Invoice_info.invoiceNo='" + textBox1.Text + "'";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "product");
         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);
     }
 }
예제 #8
0
 private void frmLowStockReport_Load(object sender, EventArgs e)
 {
     try{
         rptLowStock rpt = new rptLowStock();
         //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 Temp_Stock,Product where Temp_Stock.ProductID=Product.ProductID and quantity < 10 order by ProductName";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Temp_Stock");
         myDA.Fill(myDS, "Product");
         rpt.SetDataSource(myDS);
         this.crystalReportViewer1.ReportSource = rpt;
         this.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                CrystalReport1 rpt = new CrystalReport1();
                //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 companyname='" + cmbCustomerName.Text.Trim() + "'";
                cmd.CommandText    = "SELECT * from personalExpense where ExpenseNo='" + textBox6.Text.Trim() + "'";
                cmd.CommandType    = CommandType.Text;
                myDA.SelectCommand = cmd;
                myDA.Fill(myDS, "personalExpense");

                // 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);
            }
        }
예제 #10
0
 private void button5_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtProductname.Text == "")
         {
             MessageBox.Show("Please enter product name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtProductname.Focus();
             return;
         }
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptStock rpt = new rptStock();
         //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 Stock,Product,Supplier where Stock.ProductID=Product.ProductID and Stock.SupplierID=Supplier.SupplierID and ProductName like '" + txtProductname.Text + "%' order by StockDate";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Stock");
         myDA.Fill(myDS, "Product");
         myDA.Fill(myDS, "Supplier");
         rpt.SetDataSource(myDS);
         frmStockReport frm = new frmStockReport();
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }