private void txtmahangduocquydoi_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F4) { frmTimHangHoa a = new frmTimHangHoa(); a.ShowDialog(); if (frmTimHangHoa.drvr != null) { txtmahangduocquydoi.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString(); txttenhangduocquydoi.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); txtdonvitinhduocquydoi.Text = frmTimHangHoa.drvr.Cells["TenDonViTinh"].Value.ToString(); txtsoluongduocquydoi.Focus(); frmTimHangHoa.drvr = null; } } }
private void btnmathang_Click(object sender, EventArgs e) { try { frmTimHangHoa a = new frmTimHangHoa(); a.ShowDialog(); if (frmTimHangHoa.drvr != null) { txtmathang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); frmTimHangHoa.drvr = null; } } catch { } }
public void KeyDown_Chung(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F6) { XuLyDTGV(); tsslsoluong.Focus(); } else if (e.KeyCode == Keys.F5) { txtkhachtra.Focus(); } else if (e.KeyCode == Keys.F7) { txtPhantramchietkhau.Focus(); } else if (e.KeyCode == Keys.F8) { txtMaTheVip.Focus(); txtMaTheVip.SelectAll(); } else if (e.KeyCode == Keys.F4) { try { if (cbbkhohang.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Kho hàng", "Hệ thống cảnh báo"); return; } string maKho = LayMaKho(cbbkhohang.Text); frmTimHangHoa thh = new frmTimHangHoa(maKho); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString(); tssltenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); tsslgia.Text = new Common.Utilities().FormatMoney(double.Parse(frmTimHangHoa.drvr.Cells["GiaBanLe"].Value.ToString())); try { //SelectMaCapNhatKH(); KiemTraCk(_cngkh); } catch { phantramchietkhau = tsslchietkhau.Text = "0"; } LayGiaTriThue(frmTimHangHoa.drvr.Cells["MaThueGiaTriGiaTang"].Value.ToString()); toolStrip_txtTracuu.ReadOnly = true; tsslsoluong.Focus(); frmTimHangHoa.drvr = null; } else toolStrip_txtTracuu.ReadOnly = false; } catch { } } }
/// <summary> /// xử lý khi ấn phím /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsslsoluong_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { // Qui đổi đơn vị tính foreach (Entities.QuyDoiDonViTinh item in _quidoidvt) { if (item.MaHangQuyDoi == mahanghoa) { mahanghoa = toolStrip_txtTracuu.Text = item.MaHangDuocQuyDoi.ToUpper(); tssltenhang.Text = item.TenHangDuocQuyDoi; tsslsoluong.Text = (item.SoLuongDuocQuyDoi * int.Parse(tsslsoluong.Text)).ToString(); break; } } LayHangHoaTheoMa(); NewRow(); toolStrip_txtTracuu_Click(sender, e); toolStrip_txtTracuu.Focus(); } if (e.KeyCode == Keys.F6) { XuLyDTGV(); tsslsoluong.Focus(); } if (e.KeyCode == Keys.F5) { txtkhachtra.Focus(); } if (e.KeyCode == Keys.F7) { txtPhantramchietkhau.Focus(); } if (e.KeyCode == Keys.F4) { try { if (cbbkhohang.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Kho hàng", "Hệ thống cảnh báo"); return; } string maKho = LayMaKho(cbbkhohang.Text); frmTimHangHoa thh = new frmTimHangHoa(maKho); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString(); tssltenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); tsslgia.Text = new Common.Utilities().FormatMoney(double.Parse(frmTimHangHoa.drvr.Cells["GiaBanLe"].Value.ToString())); try { //SelectMaCapNhatKH(); KiemTraCk(_cngkh); } catch { phantramchietkhau = tsslchietkhau.Text = "0"; } LayGiaTriThue(frmTimHangHoa.drvr.Cells["MaThueGiaTriGiaTang"].Value.ToString()); toolStrip_txtTracuu.ReadOnly = true; tsslsoluong.Focus(); frmTimHangHoa.drvr = null; } else toolStrip_txtTracuu.ReadOnly = false; } catch { } } } catch { } }
/// <summary> /// xử lý khi ấn phím /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStrip_txtTracuu_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.F4) { if (cbbkhohang.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Kho hàng", "Hệ thống cảnh báo"); return; } string maKho = LayMaKho(cbbkhohang.Text); frmTimHangHoa thh = new frmTimHangHoa(maKho, true); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString().ToUpper(); tssltenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); tsslgia.Text = frmTimHangHoa.drvr.Cells["GiaBanLe"].Value.ToString(); try { //SelectMaCapNhatKH(); KiemTraCk(_cngkh); } catch { phantramchietkhau = tsslchietkhau.Text = "0"; } LayGiaTriThue(frmTimHangHoa.drvr.Cells["MaThueGiaTriGiaTang"].Value.ToString()); toolStrip_txtTracuu.ReadOnly = true; tsslsoluong.Focus(); frmTimHangHoa.drvr = null; } else toolStrip_txtTracuu.ReadOnly = false; } if (e.KeyCode == Keys.Enter) { if (toolStrip_txtTracuu.Text.Length > 0) { if (cbbkhohang.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Kho hàng", "Hệ thống cảnh báo"); toolStrip_txtTracuu.Text = ""; return; } foreach (char ch in toolStrip_txtTracuu.Text) { if (TestCharacter(ch)) { MessageBox.Show(" Mã Hàng Hóa Không được nhập tiếng việt có dấu " + "\nNếu bạn đang dùng máy quét mã vạch hãy tắt bộ gõ Tiếng Tiệt đi! ", "Hệ Thống Cảnh Báo"); toolStrip_txtTracuu.Focus(); toolStrip_txtTracuu.SelectAll(); return; } } mahanghoa = toolStrip_txtTracuu.Text; bool kt = true; // Qui đổi đơn vị tính foreach (Entities.QuyDoiDonViTinh item in _quidoidvt) { if (item.MaHangQuyDoi == mahanghoa) { tssltenhang.Text = item.TenHangDuocQuyDoi; tsslsoluong.Focus(); kt = false; break; } } if (tssltenhang.Text.Length == 0) { //MessageBox.Show("Hàng hóa không có trong kho", "Hệ thống cảnh báo"); //return; } if (kt) LayHangHoaTheoMa(); } } if (e.KeyCode == Keys.F5) { txtkhachtra.Focus(); } if (e.KeyCode == Keys.F6) { dtgvsanpham.Focus(); } if (e.KeyCode == Keys.F7) { txtPhantramchietkhau.Focus(); } } catch { } }
private void txtmahangquydoi_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F4) { frmTimHangHoa a = new frmTimHangHoa(); a.ShowDialog(); if (frmTimHangHoa.drvr != null) { txtmahangquydoi.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString(); txttenhangquydoi.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); txtdonvitinhquydoi.Text = frmTimHangHoa.drvr.Cells["TenDonViTinh"].Value.ToString(); txtsoluongquydoi.Focus(); frmTimHangHoa.drvr = null; } } }
public void XuLyHH() { try { if (txtMakhachhang.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Mã khách hàng", "Hệ thống cảnh báo"); btnTimmakhachhang.Focus(); return; } if (cbbKhoban.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Kho hàng", "Hệ thống cảnh báo"); cbbKhoban.Focus(); return; } string maKho = LayMaKho(cbbKhoban.Text); frmTimHangHoa thh = new frmTimHangHoa(maKho, false); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString().ToUpper(); tssltenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); tsslgia.Text = new Common.Utilities().FormatMoney(double.Parse(frmTimHangHoa.drvr.Cells["GiaBanBuon"].Value.ToString())); try { //SelectMaCapNhatKH(); KiemTraCK(cngkh); } catch { phantramchietkhau = tsslchietkhau.Text = "0"; } LayGiaTriThue(frmTimHangHoa.drvr.Cells["MaThueGiaTriGiaTang"].Value.ToString()); toolStrip_txtTracuu.ReadOnly = true; tsslsoluong.Focus(); frmTimHangHoa.drvr = null; } else toolStrip_txtTracuu.ReadOnly = false; } catch { } }
public void XuLyHH1() { try { string makho = new Common.Utilities().CaiDatKho("View", "", "").Giatritruyen; if (txtManhacungcap.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Mã khách hàng", "Hệ thống cảnh báo"); btnTimnhacungcap.Focus(); return; } if (check_loaidathang.Checked == false && cbxMaKho.Text.Length == 0) { MessageBox.Show("Bạn hãy nhập Kho hàng", "Hệ thống cảnh báo"); cbxMaKho.Focus(); return; } //string maKho = cbxMaKho.SelectedValue.ToString();frmTimHangHoa(maKho); frmTimHangHoa thh = new frmTimHangHoa(makho); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString().ToUpper(); toolStrip_txtTenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); toolStrip_txtGiagoc.Text = frmTimHangHoa.drvr.Cells["GiaBanBuon"].Value.ToString(); try { SelectMaCapNhatKH(); KiemTraCK(cngkh); } catch { phantramchietkhau = toolStrip_txtGianhap.Text = "0"; } LayGiaTriThue(frmTimHangHoa.drvr.Cells["MaThueGiaTriGiaTang"].Value.ToString()); //toolStrip_txtTracuu.ReadOnly = true; toolStrip_txtSoluong.Focus(); frmTimHangHoa.drvr = null; } else toolStrip_txtTracuu.ReadOnly = false; } catch { } }
public void XulyHH() { try { string maKho = LayMaKho(cbbkhohang.Text); maKho = new Common.Utilities().CaiDatKho("View", "", "").Giatritruyen; frmTimHangHoa thh = new frmTimHangHoa(maKho,"HangHoa",""); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString(); tssltenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); tsslgia.Text = frmTimHangHoa.drvr.Cells["GiaNhap"].Value.ToString(); tsslsoluong.Text = ""; string soluong = "0"; if (tsslsoluong.Text == "") soluong = "0"; else soluong = tsslsoluong.Text; tsslthanhtien.Text = (Convert.ToDouble(soluong) * Convert.ToDouble(tsslgia.Text)).ToString(); frmTimHangHoa.drvr = null; tsslsoluong.Focus(); toolStrip_txtTracuu.ReadOnly = true; } else toolStrip_txtTracuu.ReadOnly = false; } catch { } }
void LayHH() { try { string kho = new Common.Utilities().CaiDatKho("View", "", "").Giatritruyen; frmTimHangHoa thh = new frmTimHangHoa(kho, "HangHoa", ""); thh.ShowDialog(); if (frmTimHangHoa.drvr != null) { mahanghoa = toolStrip_txtTracuu.Text = frmTimHangHoa.drvr.Cells["MaHangHoa"].Value.ToString().ToUpper(); toolStrip_txtTenhang.Text = frmTimHangHoa.drvr.Cells["TenHangHoa"].Value.ToString(); toolStrip_txtTonkho.Text = frmTimHangHoa.drvr.Cells["GiaNhap"].Value.ToString(); toolStrip_txtTonThucTe.Text = frmTimHangHoa.drvr.Cells["GiaBanBuon"].Value.ToString(); toolStripTextBox1.Text = frmTimHangHoa.drvr.Cells["GiaBanLe"].Value.ToString(); toolStripTextBox2.Focus(); } } catch { } finally { try { fix(); } catch { } } }