private void btnSave_Click(object sender, EventArgs e) { int invoiceid = insertToDB(); if (invoiceid != -1) { decimal total = 0; for (int i = 0; i < grdItems.Rows.Count; i++) { total += decimal.Parse(grdItems.Rows[i].Cells[4].Value.ToString()); } FrmPay frmPay = new FrmPay(); frmPay.txtTotal.Text = total.ToString(); frmPay.invoiceid = invoiceid; frmPay.ShowDialog(); grdItems.Rows.Clear(); } count_enter = 0; }
private void txtCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtCode.Text != "") { count_enter = 0; DTO.Product product = null;// new DAO.ProductDAO().getProduct(txtCode.Text); if (product != null) { addToGrid(product); } else { MessageBox.Show("No Product Found"); } txtCode.Clear(); } else if(grdItems.Rows.Count>0) { count_enter += 1; } if (count_enter >= 2) { int invoiceid=insertToDB(); if (invoiceid!=-1) { decimal total = 0; for (int i = 0; i < grdItems.Rows.Count; i++) { total += decimal.Parse(grdItems.Rows[i].Cells[4].Value.ToString()); } FrmPay frmPay = new FrmPay(); frmPay.txtTotal.Text = total.ToString(); frmPay.invoiceid = invoiceid; frmPay.ShowDialog(); grdItems.Rows.Clear(); } count_enter = 0; } } }
private void btnSave_Click(object sender, EventArgs e) { int invoiceid = insertToDB(); if (invoiceid != -1) { decimal total = decimal.Parse(lblDollar.Text.Substring(0, lblDollar.Text.Length - 2)); FrmPay frmPay = new FrmPay(); frmPay.txtTotal.Text = total.ToString(); frmPay.invoiceid = invoiceid; frmPay.ShowDialog(); grdItems.Rows.Clear(); } count_enter = 0; }
private void txtName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtCode.Text != "") { count_enter = 0; DTO.Product product = new DAO.ProductDAO().getProduct(txtCode.Text, UserSession.Session.Staff.StoreId); if (product != null) { addToGrid(product); } else { MessageBox.Show("No Product Found"); } txtCode.Clear(); } else if (grdItems.Rows.Count > 0) { count_enter += 1; } if (count_enter >= 2) { int invoiceid = insertToDB(); if (invoiceid != -1) { decimal total = decimal.Parse(lblDollar.Text.Substring(0, lblDollar.Text.Length-2)); FrmPay frmPay = new FrmPay(); frmPay.txtTotal.Text = total.ToString(); frmPay.invoiceid = invoiceid; frmPay.ShowDialog(); grdItems.Rows.Clear(); } count_enter = 0; } } }