Exemple #1
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();
        }
Exemple #2
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);
 }
        private void toolPrint_Click(object sender, EventArgs e)
        {
            DataRowView row = (DataRowView)bindingNavigator.BindingSource.Current;

            if (row != null)
            {
                PhieuBanController ctrlPB   = new PhieuBanController();
                String             ma_phieu = row["ID"].ToString();
                CuahangNongduoc.BusinessObject.PhieuBan ph = ctrlPB.LayPhieuBan(ma_phieu);
                frmInPhieuBan PhieuBan = new frmInPhieuBan(ph);
                PhieuBan.Show();
            }
        }
Exemple #4
0
        private void toolLuuIn_Click(object sender, EventArgs e)
        {
            if (status != Controll.Normal)
            {
                MessageBox.Show("Vui lòng lưu lại Phiếu bán hiện tại!", "Phieu Ban Le", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                String ma_phieu = txtMaPhieu.Text;

                PhieuBanController ctrlPB = new PhieuBanController();

                CuahangNongduoc.BusinessObject.PhieuBan ph = ctrlPB.LayPhieuBan(ma_phieu);

                frmInPhieuBan InPhieuBan = new frmInPhieuBan(ph);

                InPhieuBan.Show();
            }
        }
Exemple #5
0
 public frmBanSi(PhieuBanController ctrlPB)
     : this()
 {
     this.ctrlPhieuBan = ctrlPB;
     status            = Controll.Normal;
 }