Beispiel #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (fgQD.Row < fgQD.Rows.Fixed)
            {
                BaseMessages.ShowInformationMessage("Chưa chọn quyết định.");
                return;
            }
            if (BaseMessages.ShowDeleteQuestionMessage() == DialogResult.No)
            {
                return;
            }

            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();

            cls.ID_QuyetDinh = int.Parse(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh"));
            cls.SelectOne();
            cls.TonTai = false;
            cls.Update();
            BaseMessages.ShowInformationMessage("Xóa thành công!");

            LockEdit(true);
            Loadfg();

            ResetTextboxs();
            fgChiTiet.Rows.Count = fgChiTiet.Rows.Fixed;
        }
Beispiel #2
0
        private void Duyet(string question, byte trangthai, string message)
        {
            if (fgQD.Row < fgQD.Rows.Fixed)
            {
                BaseMessages.ShowInformationMessage("Chưa chọn quyết định.");
                return;
            }
            if (MessageBox.Show(question, "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            int  fgRow             = fgQD.Row;
            byte previousTrangThai = Convert.ToByte(fgQD[fgQD.Row, "TrangThai"]);

            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();

            cls.ID_QuyetDinh = int.Parse(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh"));
            cls.SelectOne();
            cls.TrangThai = trangthai;
            cls.Update();
            BaseMessages.ShowInformationMessage(message);
            if (trangthai == 1)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Trình duyệt";
                fgQD[fgQD.Row, "TrangThai"]     = 1;
                fgQD.Rows[fgQD.Row].Style       = cs2;
            }
            else if (trangthai == 3)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Hủy duyệt";
                fgQD[fgQD.Row, "TrangThai"]     = 3;
                fgQD.Rows[fgQD.Row].Style       = cs3;
                CapNhatSLVatTuKhoVer2(Convert.ToInt32(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh")), 3);
            }
            else if (trangthai == 5)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Phê duyệt";
                fgQD[fgQD.Row, "TrangThai"]     = 5;
                fgQD.Rows[fgQD.Row].Style       = cs4;
            }
            else if (trangthai == 6)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Ghi thẻ kho";
                fgQD[fgQD.Row, "TrangThai"]     = 6;
                fgQD.Rows[fgQD.Row].Style       = cs5;
                CapNhatSLVatTuKhoVer2(Convert.ToInt32(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh")), 6);
            }
            LockEdit(true);
            Lock(false, false, false, false, false, false);
            fgQD.Row = -1;

            ResetTextboxs();
            fgChiTiet.Rows.Count = fgChiTiet.Rows.Fixed;
            //focus
            fgQD.Row = fgRow;
        }
Beispiel #3
0
        private void Loadfg()
        {
            fgQD.Tag = 0;
            fgQD.BeginUpdate();
            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();
            DataTable       dt  = cls.SelectAllDayDu();

            dt.DefaultView.RowFilter = "TonTai = 1";

            int iSTT = 1;

            fgQD.Rows.Count = fgQD.Rows.Fixed;
            foreach (DataRow dr in dt.DefaultView.ToTable().Rows)
            {
                Row fgRow = fgQD.Rows.Add();
                fgRow["STT"] = iSTT;
                iSTT++;
                fgRow["ID_QuyetDinh"]   = dr["ID_QuyetDinh"];
                fgRow["So_QuyetDinh"]   = dr["So_QuyetDinh"];
                fgRow["ID_NhaCungCap"]  = dr["ID_NhaCungCap"];
                fgRow["Ten_NhaCungCap"] = dr["Ten_NhaCungCap"];
                fgRow["Ngay_QuyetDinh"] = dr["Ngay_QuyetDinh"];
                fgRow["NgayLap"]        = dr["NgayLap"];
                fgRow["Ngay_SuaCuoi"]   = dr["Ngay_SuaCuoi"];
                fgRow["TrangThai"]      = dr["TrangThai"];
                fgRow["Ten_TrangThai"]  = dr["Ten_TrangThai"];
                fgRow["TonTai"]         = dr["TonTai"];
                if (fgRow["Ten_TrangThai"].ToString() == "Đang lập")
                {
                    fgRow.Style = cs1;
                }
                if (fgRow["Ten_TrangThai"].ToString() == "Trình duyệt")
                {
                    fgRow.Style = cs2;
                }
                else if (fgRow["Ten_TrangThai"].ToString() == "Hủy duyệt")
                {
                    fgRow.Style = cs3;
                }
                else if (fgRow["Ten_TrangThai"].ToString() == "Phê duyệt")
                {
                    fgRow.Style = cs4;
                }
                else if (fgRow["Ten_TrangThai"].ToString() == "Ghi thẻ kho")
                {
                    fgRow.Style = cs5;
                }
            }

            fgQD.Row = -1;
            fgQD.AutoSizeRows();
            fgQD.EndUpdate();
            fgQD.Tag = 1;
        }
Beispiel #4
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            int fgRow = 0;

            if (!IsValid() || !IsValidChiTiet())
            {
                return;
            }

            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();

            cls.So_QuyetDinh   = txtSoQuyetDinh.Text.Trim();
            cls.Ngay_QuyetDinh = Convert.ToDateTime(dtmNgayQD.Value);
            cls.ID_NhaCungCap  = int.Parse(cmbNhaCungCap.EditValue.ToString());
            SqlDateTime currentDateTime = (new clsFunctions()).SelectCurrentDateTime();

            cls.TonTai = true;

            if (m_blFlag) //Them moi' quyet dinh
            {
                cls.NgayLap      = currentDateTime;
                cls.Ngay_SuaCuoi = currentDateTime;
                cls.TrangThai    = 0;
                cls.Insert();
                SaveDataChiTiet(int.Parse(cls.ID_QuyetDinh.ToString()));
            }
            else //Sua quyet dinh
            {
                fgRow            = fgQD.Row; //lưu lại vị trí dòng đang sửa
                cls.ID_QuyetDinh = Convert.ToInt32(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh"));
                cls.Ngay_SuaCuoi = currentDateTime;
                cls.NgayLap      = Convert.ToDateTime(fgQD.GetData(fgQD.Row, "NgayLap"));
                cls.TrangThai    = Convert.ToByte(fgQD.GetDataDisplay(fgQD.Row, "TrangThai"));
                cls.Update();
                SaveDataChiTiet(int.Parse(cls.ID_QuyetDinh.ToString()));
            }

            BaseMessages.ShowInformationMessage("Cập nhật thành công!");
            LockEdit(true);
            LockEditfgChiTiet(true);
            Loadfg();

            ResetTextboxs();
            fgChiTiet.Rows.Count = fgChiTiet.Rows.Fixed;

            //option: focus vào dòng đã sửa
            if (!m_blFlag)
            {
                fgQD.Row = fgRow;
            }
        }