Ejemplo n.º 1
0
        private void frmNhapHang_Load(object sender, EventArgs e)
        {
            ctrlSanPham.HienthiAutoComboBox(cmbSanPham);
            ctrlMaSanPham.HienThiDataGridViewComboBox(colMaSanPham);

            cmbSanPham.SelectedIndexChanged += new EventHandler(cmbSanPham_SelectedIndexChanged);

            ctrlKhachHang.HienthiAutoComboBox(cmbKhachHang, true);


            ctrlPhieuBan.HienthiPhieuBan(bindingNavigator, cmbKhachHang, txtMaPhieu, dtNgayLapPhieu, numTongTien, numDaTra, numConNo);
            bindingNavigator.BindingSource.CurrentChanged += new EventHandler(BindingSource_CurrentChanged);

            ctrlChiTiet.HienThiChiTiet(dgvDanhsachSP, txtMaPhieu.Text);


            if (status == Controll.AddNew)
            {
                txtMaPhieu.Text = ThamSo.LayMaPhieuBan().ToString();
            }
            else
            {
                this.Allow(false);
            }
        }
Ejemplo n.º 2
0
        void ThemMoi()
        {
            DataRow row = ctrlPhieuBan.NewRow();

            row["ID"]            = txtMaPhieu.Text;
            row["ID_KHACH_HANG"] = cmbKhachHang.SelectedValue;
            row["NGAY_BAN"]      = dtNgayLapPhieu.Value.Date;
            row["TONG_TIEN"]     = numTongTien.Value;
            row["DA_TRA"]        = numDaTra.Value;
            row["CON_NO"]        = numConNo.Value;
            ctrlPhieuBan.Add(row);

            PhieuBanController ctrl = new PhieuBanController();

            if (ctrl.LayPhieuBan(txtMaPhieu.Text) != null)
            {
                MessageBox.Show("Mã Phiếu bán này đã tồn tại !", "Phieu Nhap", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (ThamSo.LaSoNguyen(txtMaPhieu.Text))
            {
                long so = Convert.ToInt64(txtMaPhieu.Text);
                if (so >= ThamSo.LayMaPhieuBan())
                {
                    ThamSo.GanMaPhieuBan(so + 1);
                }
            }

            ctrlPhieuBan.Save();

            ctrlChiTiet.Save();
        }
Ejemplo n.º 3
0
 private void toolLuu_Them_Click(object sender, EventArgs e)
 {
     ctrlPhieuBan      = new PhieuBanController();
     status            = Controll.AddNew;
     txtMaPhieu.Text   = ThamSo.LayMaPhieuBan().ToString();
     numTongTien.Value = 0;
     ctrlChiTiet.HienThiChiTiet(dgvDanhsachSP, txtMaPhieu.Text);
     this.Allow(true);
 }