private void frmCustomersRecord1_FormClosing(object sender, FormClosingEventArgs e) { Hide(); var frm = new frmInvoice(); frm.label6.Text = label1.Text; frm.Show(); }
private void salesToolStripMenuItem_Click(object sender, EventArgs e) { Hide(); var frm = new frmInvoice(); frm.label6.Text = lblUser.Text; frm.Show(); }
private void DataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { var dr = DataGridView2.SelectedRows[0]; Hide(); var frmSales = new frmInvoice(); frmSales.Show(); frmSales.txtInvoiceNo.Text = dr.Cells[0].Value.ToString(); frmSales.dtpInvoiceDate.Text = dr.Cells[1].Value.ToString(); frmSales.txtCustomerID.Text = dr.Cells[2].Value.ToString(); frmSales.txtCustomerName.Text = dr.Cells[3].Value.ToString(); frmSales.txtSubTotal.Text = dr.Cells[4].Value.ToString(); frmSales.txtTaxPer.Text = dr.Cells[5].Value.ToString(); frmSales.txtTaxAmt.Text = dr.Cells[6].Value.ToString(); frmSales.txtTotal.Text = dr.Cells[7].Value.ToString(); frmSales.txtTotalPayment.Text = dr.Cells[8].Value.ToString(); frmSales.txtPaymentDue.Text = dr.Cells[9].Value.ToString(); frmSales.txtRemarks.Text = dr.Cells[10].Value.ToString(); frmSales.btnUpdate.Enabled = true; frmSales.Delete.Enabled = true; frmSales.btnPrint.Enabled = true; frmSales.Save.Enabled = false; frmSales.label6.Text = label9.Text; con = new OleDbConnection(cs); con.Open(); cmd = new OleDbCommand("SELECT Config.ConfigID,Config.Productname,ProductSold.Price,ProductSold.Quantity,ProductSold.TotalAmount from Sales,ProductSold,Config where Sales.InvoiceNo=ProductSold.InvoiceNo and Config.ConfigID=ProductSold.ConfigID and Sales.InvoiceNo='" + dr.Cells[0].Value.ToString() + "'", con); rdr = cmd.ExecuteReader(); while (rdr.Read()) { var lst = new ListViewItem(); lst.SubItems.Add(rdr[0].ToString().Trim()); lst.SubItems.Add(rdr[1].ToString().Trim()); lst.SubItems.Add(rdr[2].ToString().Trim()); lst.SubItems.Add(rdr[3].ToString().Trim()); lst.SubItems.Add(rdr[4].ToString().Trim()); frmSales.ListView1.Items.Add(lst); } frmSales.ListView1.Enabled = false; frmSales.Button7.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { var dr = dataGridView1.SelectedRows[0]; Hide(); var frm = new frmInvoice(); frm.Show(); frm.txtCustomerID.Text = dr.Cells[0].Value.ToString(); frm.txtCustomerName.Text = dr.Cells[1].Value.ToString(); frm.label6.Text = label1.Text; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void DataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { var dr = DataGridView2.SelectedRows[0]; Hide(); var frmSales = new frmInvoice(); frmSales.Show(); frmSales.txtInvoiceNo.Text = dr.Cells[0].Value.ToString(); frmSales.dtpInvoiceDate.Text = dr.Cells[1].Value.ToString(); frmSales.txtCustomerID.Text = dr.Cells[2].Value.ToString(); frmSales.txtCustomerName.Text = dr.Cells[3].Value.ToString(); frmSales.txtSubTotal.Text = dr.Cells[4].Value.ToString(); frmSales.txtTaxPer.Text = dr.Cells[5].Value.ToString(); frmSales.txtTaxAmt.Text = dr.Cells[6].Value.ToString(); frmSales.txtTotal.Text = dr.Cells[7].Value.ToString(); frmSales.txtTotalPayment.Text = dr.Cells[8].Value.ToString(); frmSales.txtPaymentDue.Text = dr.Cells[9].Value.ToString(); frmSales.txtRemarks.Text = dr.Cells[10].Value.ToString(); frmSales.btnUpdate.Enabled = true; frmSales.Delete.Enabled = true; frmSales.btnPrint.Enabled = true; frmSales.Save.Enabled = false; frmSales.label6.Text = label9.Text; con = new SqlConnection(cs); con.Open(); cmd = new SqlCommand("SELECT Config.ConfigID,Config.Productname,ProductSold.Price,ProductSold.Quantity,ProductSold.TotalAmount from Sales,ProductSold,Config where Sales.InvoiceNo=ProductSold.InvoiceNo and Config.ConfigID=ProductSold.ConfigID and Sales.InvoiceNo='" + dr.Cells[0].Value.ToString() + "'", con); rdr = cmd.ExecuteReader(); while (rdr.Read()) { var lst = new ListViewItem(); lst.SubItems.Add(rdr[0].ToString().Trim()); lst.SubItems.Add(rdr[1].ToString().Trim()); lst.SubItems.Add(rdr[2].ToString().Trim()); lst.SubItems.Add(rdr[3].ToString().Trim()); lst.SubItems.Add(rdr[4].ToString().Trim()); frmSales.ListView1.Items.Add(lst); } frmSales.ListView1.Enabled = false; frmSales.Button7.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }