private void frmNhapMoiCuaCuonDongBo_Load(object sender, EventArgs e)
        {
            Entities      db = new Entities();
            List <string> Ma_nhom_vat_tu_bo = new List <string>();
            List <string> Ma_loai_vat_tu_bo = new List <string>();

            NhanVienCtrl.LoadLookUpEdit(ledNhanVienNhap, db);
            KhoVatTuCtrl.LoadLookUpEdit(ledKhoNhap, "CCDB", db);
            NhaCungCapCtrl.LoadLookUpEdit(ledNhaCungCap, db);
            VatTuCtrl.LoadLookUpEdit(ledThanCuaCuon, "CCDB", "ThanCCDB", Ma_nhom_vat_tu_bo, Ma_loai_vat_tu_bo, db);
            VatTuCtrl.LoadLookUpEdit(ledMoToCuaCuon, "CCDB", "MoToCCDB", Ma_nhom_vat_tu_bo, Ma_loai_vat_tu_bo, db);
            VatTuCtrl.LoadLookUpEdit(ledKhoaCuaCuon, "CCDB", "KhoaCCDB", Ma_nhom_vat_tu_bo, Ma_loai_vat_tu_bo, db);
            VatTuCtrl.LoadLookUpEdit(ledChotCuaCuon, "CCDB", "ChotCCDB", Ma_nhom_vat_tu_bo, Ma_loai_vat_tu_bo, db);
            Ma_nhom_vat_tu_bo = new List <string>()
            {
                " "
            };
            Ma_loai_vat_tu_bo = new List <string>()
            {
                "ThanCCDB", "MoToCCDB", "KhoaCCDB", "ChotCCDB"
            };
            VatTuCtrl.LoadLookUpEdit(rleVatTu, "CCDB", "", Ma_nhom_vat_tu_bo, Ma_loai_vat_tu_bo, db);
            dteNgayNhap.EditValue = QLK_DongLuc.Helper.DatabaseHelper.GetDatabaseDate();
            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            GridHelper.ReconfigGridView(grvPhieuNhapCT);
        }
Beispiel #2
0
        private void ledLoaiVatTu_EditValueChanged(object sender, EventArgs e)
        {
            Entities db = new Entities();

            ID_loai_vat_tu = int.Parse(ledLoaiVatTu.EditValue.ToString());
            VatTuCtrl.LoadBindingSource(sTOVatTuBindingSource, ID_loai_vat_tu, db);

            string[] Ma_nhom = { "NAN", "PROFILE" };

            var result = (from p in db.STO_LoaiVatTu
                          join p1 in db.STO_NhomVatTu on p.ID_nhom_vat_tu equals p1.ID_nhom_vat_tu
                          where p.ID_loai_vat_tu == ID_loai_vat_tu && Ma_nhom.Contains(p.Ma_loai_vat_tu)
                          select p).ToList();

            if (result.Any())
            {
                gridView.Columns["Don_vi"].Visible      = true;
                gridView.Columns["Don_vi"].VisibleIndex = 5;
            }
            else
            {
                gridView.Columns["Don_vi"].Visible = false;
            }

            GridHelper.BestFitAllColumns(gridView);
        }
        private void frmKhoVatTu_Load(object sender, EventArgs e)
        {
            Entities db = new Entities();

            KhoVatTuCtrl.LoadBindingSource(sTOKhoVatTuBindingSource, db);
            VatTuCtrl.LoadLookUpEdit(rleVatTu, db);
            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            GridHelper.ReconfigGridView(grvKhoVatTu);
            GridHelper.ReconfigGridView(grvKhoVatTuCT);
        }
Beispiel #4
0
        private void gridControl_Load()
        {
            Entities db = new Entities();

            LoaiVatTuCtrl.LoadLookUpEdit(rleLoaiVatTu, db);
            KhoVatTuCtrl.LoadLookUpEdit(rleKhoVatTu, db);
            NhomVatTuCtrl.LoadLookUpEdit(rleNhomVatTu, db);
            VatTuCtrl.LoadBindingSource(sTOVatTuBindingSource, (int)ledLoaiVatTu.EditValue, db);
            GridHelper.BestFitAllColumns(gridView);
        }
        private void frmLapPhieuNhapLai_Load(object sender, EventArgs e)
        {
            Entities db = new Entities();

            NhanVienCtrl.LoadLookUpEdit(ledNhanVienNhap, db);
            KhoVatTuCtrl.LoadLookUpEdit(ledKhoNhap, db);
            VatTuCtrl.LoadLookUpEdit(repositoryItemLookUpEdit1, db);
            dteNgayNhap.EditValue = QLK_DongLuc.Helper.DatabaseHelper.GetDatabaseDate();
            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            GridHelper.ReconfigGridView(grvPhieuNhapCT);
        }
Beispiel #6
0
 private void InitForm()
 {
     InitializeComponent();
     txtMahoadon.Focus();
     db = new Entities();
     // đưa dữ liệu vào các đối tượng lookupedit
     NhanVienCtrl.LoadLookUpEdit(leNhanvienxuat, db);
     KhoVatTuCtrl.LoadLookUpEdit(leKhoxuat, db);
     //
     VatTuCtrl.LoadLookUpEdit(repositoryItemLookUpEdit1, db);
     dtNgayxuat.EditValue = QLK_DongLuc.Helper.DatabaseHelper.GetDatabaseDate();
 }
        private void frmPhieuNhap_Load(object sender, EventArgs e)
        {
            Entities db = new Entities();

            NhanVienCtrl.LoadLookUpEdit(rleNhanVienLap, db);
            NhanVienCtrl.LoadLookUpEdit(rleNhanVienNhap, db);
            TuyChonTimKiemCtrl.LoadLookUpEdit(ledTuyChon);
            VatTuCtrl.LoadLookUpEdit(rleVatTu, db);
            dteNgayBatDau.EditValue = DateTimeHelper.GetStartDateOfMonth(DatabaseHelper.GetDatabaseDate());
            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            GridHelper.ReconfigGridView(grvPhieuNhap);
            GridHelper.ReconfigGridView(grvPhieuNhapCT);
        }
Beispiel #8
0
        private void frmNhapMoiThanhCuaNhua_Load(object sender, EventArgs e)
        {
            Entities      db = new Entities();
            List <string> Ma_nhom_vat_tu_bo = new List <string>();
            List <string> Ma_loai_vat_tu_bo = new List <string>();

            NhanVienCtrl.LoadLookUpEdit(ledNhanVienNhap, db);
            KhoVatTuCtrl.LoadLookUpEdit(ledKhoNhap, "NLCN", db);
            NhaCungCapCtrl.LoadLookUpEdit(ledNhaCungCap, db);
            VatTuCtrl.LoadLookUpEdit(rleVatTu, "PROFILE", "", Ma_nhom_vat_tu_bo, Ma_loai_vat_tu_bo, db);
            dteNgayNhap.EditValue = QLK_DongLuc.Helper.DatabaseHelper.GetDatabaseDate();
            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            GridHelper.ReconfigGridView(grvPhieuNhapCT);
        }
Beispiel #9
0
        private void InsertCommand()
        {
            var vt = (ViewCboVatTu)gridView.GetFocusedRow();

            vt.ID_loai_vat_tu = (int)ledLoaiVatTu.EditValue;

            int rs = VatTuCtrl.Insert(vt);

            if (rs == 0)
            {
                NotifyHelper.ShowInsertError();
                gridControl_Load();
            }
        }
Beispiel #10
0
        private void UpdateCommand()
        {
            gridView.SetRowCellValue(gridView.FocusedRowHandle, gridView.Columns["ID_loai_vat_tu"], ID_loai_vat_tu);

            var vt = (ViewCboVatTu)gridView.GetFocusedRow();

            vt.ID_loai_vat_tu = (int)ledLoaiVatTu.EditValue;

            int rs = VatTuCtrl.Update(vt);

            if (rs == 0)
            {
                NotifyHelper.ShowUpdateError();
                gridControl_Load();
            }
        }
Beispiel #11
0
        private void frmVatTu_Load(object sender, EventArgs e)
        {
            Entities db = new Entities();

            LoaiVatTuCtrl.LoadLookUpEdit(rleLoaiVatTu, db);
            KhoVatTuCtrl.LoadLookUpEdit(rleKhoVatTu, db);
            NhomVatTuCtrl.LoadLookUpEdit(rleNhomVatTu, db);

            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            GridHelper.ReconfigGridView(gridView);
            GridHelper.HAlignmentAllHeaderColumns(gridView);
            VatTuCtrl.LoadBindingSource(sTOVatTuBindingSource, db);
            GridHelper.BestFitAllColumns(gridView);
            //-------------------------------------------------------
            KhoVatTuCtrl.LoadLookUpEdit(ledKhoVatTu, db);
            NhomVatTuCtrl.LoadLookUpEdit(ledNhomVatTu, db);
            LoaiVatTuCtrl.LoadLookUpEdit(ledLoaiVatTu, db);
        }
        private void frmSuaPhieuNhap_Load(object sender, EventArgs e)
        {
            if (pn == null)
            {
                XtraMessageBox.Show("Có lỗi xảy ra, không tìm thấy phiếu nhập!", "Sửa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.Cancel;
            }

            Entities db = new Entities();

            VaiTroQuyenCtrl.ReconfigFormControls(this, db);
            VatTuCtrl.LoadLookUpEdit(repositoryItemLookUpEdit1, db);
            NhanVienCtrl.LoadLookUpEdit(ledNhanVienNhap, db);
            KhoVatTuCtrl.LoadLookUpEdit(ledKhoNhap, db);

            if (pn.ID_loai_nhap == 1)
            {
                NhaCungCapCtrl.LoadLookUpEdit(ledNhaCungCap, db);
            }
            else
            {
                txtChungTuGoc.Properties.ReadOnly = true;
                ledNhaCungCap.Properties.ReadOnly = true;
            }

            ledNhanVienNhap.EditValue = pn.ID_nhan_vien_nhap;
            ledKhoNhap.EditValue      = pn.ID_kho;
            mmoGhiChu.Text            = pn.Ghi_chu;
            txtChungTuGoc.Text        = pn.So_chung_tu_goc;
            ledNhaCungCap.EditValue   = pn.ID_nha_cung_cap;
            dteNgayNhap.EditValue     = pn.Ngay_nhap;

            PhieuNhapCTCtrl.LoadBindingSource(pn.ID_phieu_nhap, iMPPhieuNhapCTBindingSource, db);

            if (pn.Trang_thai != 0)
            {
                colID_vat_tu.OptionsColumn.ReadOnly            = true;
                colSo_luong.OptionsColumn.ReadOnly             = true;
                ledKhoNhap.Properties.ReadOnly                 = true;
                grvPhieuNhapCT.OptionsView.NewItemRowPosition  = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                grvPhieuNhapCT.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False;
            }
        }
Beispiel #13
0
 public int Undo()
 {
     if (type == ActType.DELETE)
     {
         if (paras[0].ToUpper().Equals("VATTU"))
         {
             return(VatTuCtrl.InsertVatTu(paras[1], paras[2], paras[3], Convert.ToInt32(paras[4])));
         }
         else if (paras[0].ToUpper().Equals("KHO"))
         {
             return(KhoCtrl.InsertKho(paras[1], paras[2], paras[3], paras[4]));
         }
         else if (paras[0].ToUpper().Equals("NHANVIEN"))
         {
             return(NhanVienCtrl.Restore(Convert.ToInt32(paras[1])));
         }
     }
     else if (type == ActType.INSERT)
     {
         if (paras[0].ToUpper().Equals("VATTU"))
         {
             return(VatTuCtrl.DeleteVatTu(paras[1]));
         }
         else if (paras[0].ToUpper().Equals("KHO"))
         {
             return(KhoCtrl.DeleteKho(paras[1]));
         }
         else if (paras[0].ToUpper().Equals("NHANVIEN"))
         {
             return(NhanVienCtrl.DeleteNhanVien(Convert.ToInt32(paras[1])));
         }
     }
     else if (type == ActType.CHUYENCN)
     {
         if (paras[0].ToUpper().Equals("NHANVIEN"))
         {
             return(NhanVienCtrl.Restore_ChuyenNV(paras[1]));
         }
     }
     return(1);
 }
Beispiel #14
0
        private void DeleteCommand()
        {
            if (gridView.FocusedRowHandle < 0)
            {
                return;
            }

            var result = NotifyHelper.ShowDeleteConfirm();

            if (result == DialogResult.Yes)
            {
                var vt = (ViewCboVatTu)gridView.GetFocusedRow();
                int rs = VatTuCtrl.Delete(vt.ID_vat_tu);

                if (rs > 0)
                {
                    gridControl_Load();
                }
                else
                {
                    NotifyHelper.ShowDeleteError();
                }
            }
        }
Beispiel #15
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            string _MaVT = "";

            try
            {
                _MaVT = txtMaVT.Text.Trim(' ');
            }
            catch { }

            string _TenVT = "";

            try
            {
                _TenVT = txtTenVT.Text.Trim(' ');
            }
            catch { }

            string _DVT = "";

            try
            {
                _DVT = txtDVT.Text.Trim(' ');
            }
            catch { }

            int _SoLuongTon = 0;

            try
            {
                _SoLuongTon = Convert.ToInt32(txtSoLuongTon.Text.Replace(",", ""));
            }
            catch { }

            if (_MaVT == "")
            {
                MessageBox.Show("Mã vật tư không được để trống !");
            }
            else if (_TenVT == "")
            {
                MessageBox.Show("Tên vật tư không được để trống !");
            }
            else if (_DVT == "")
            {
                MessageBox.Show("Đơn vị tính không được để trống !");
            }
            else if (txtSoLuongTon.Text.Trim(' ').Equals(""))
            {
                MessageBox.Show("Số lượng không được để trống !");
            }
            else if (_SoLuongTon <= 0)
            {
                MessageBox.Show("Số lượng >= 0");
            }
            else
            {
                int k = VatTuCtrl.InsertVatTu(_MaVT, _TenVT, _DVT, _SoLuongTon);
                if (k == 0)
                {
                    MessageBox.Show("Thêm thành công !");
                    string str = "VATTU," + txtMaVT.Text + "," + txtDVT.Text + "," + txtTenVT.Text + "," + txtSoLuongTon.Text;
                    addActUndo(str, Act.ActType.INSERT);
                    redoList.Clear();
                    uctVatTu_Load(sender, e);
                    btnThem_Click(sender, e);
                }
                else
                {
                    MessageBox.Show("Thêm thất bại !");
                }
            }
        }