Ejemplo n.º 1
0
 private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 4))
         {
             return;
         }
         for (int j = 0; j < 100; j++)
         {
             if (BaoDong == "")
             {
                 frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Insert");
                 fr.ShowDialog();
                 SelectData();
             }
             else
             {
                 BaoDong = "";
                 break;
             }
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
        /// <summary>
        /// hungvv form them moi
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Running()
        {
            if (Luu.BienTam == "Close")
            {
                frmXuLyDonDatHang insert = new frmXuLyDonDatHang("Insert");

                insert.ShowDialog(this);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// hungvv form them moi
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Running()
        {
            try
            {
                if (Luu.BienTam == "Close")
                {
                    frmXuLyDonDatHang insert = new frmXuLyDonDatHang("Insert");

                    insert.ShowDialog(this);
                }
            }
            catch (Exception ex)
            { string s = ex.Message; }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// ham main
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmXuLy_DonDatHang_Load(object sender, EventArgs e)
        {
            //doc du lieu dong
            makNgaydonhang.Text    = new Common.Utilities().XuLy(2, DateTime.Today.ToString());
            makNgaynhapdukien.Text = new Common.Utilities().XuLy(2, DateTime.Today.ToString());

            LayKhoHang();
            LayTenTT();
            LayNhanVien();
            //fig cung combox
            this.cbxDieukienthanhtoan.Items.AddRange(new object[] { "Thanh toán ngay", "Thanh toán từng phần", "Mua nợ" });
            this.cbxDieukienthanhtoan.Text = "Chọn loại thanh toán";
            this.cbxHinhthucthanhtoan.Items.AddRange(new object[] { "Tiền mặt", "Séc", "VISA", "MASTER CARD", "AMEX", "CONNECT", "JCB" });
            this.cbxHinhthucthanhtoan.Text = "Chọn hình thức thanh toán";
            this.txtTrangthaidonhang.Text  = "Đang mở";
            frmXuLyDonDatHang fr = new frmXuLyDonDatHang();

            //danh cho delete
            if (this.HanhDong == "Insert")
            {
                getID("DonDatHang");
                btnTimnhacungcap.Enabled            = true;
                txtManhacungcap.ReadOnly            = false;
                toolStripStatus_Them.Enabled        = true;
                toolStripStatus_Ghilai.Enabled      = false;
                Application.OpenForms[fr.Name].Text = "Quản lý đơn đặt hàng - Thêm đơn đặt hàng";
                txtTrangthaidonhang.ReadOnly        = true;
            }
            //danh cho update
            if (this.HanhDong == "Update")
            {
                btnTimnhacungcap.Enabled            = false;
                txtManhacungcap.ReadOnly            = true;
                toolStripStatus_Them.Enabled        = false;
                toolStripStatus_Ghilai.Enabled      = true;
                Application.OpenForms[fr.Name].Text = "Quản lý đơn đặt hàng - Sửa đơn đặt hàng";
                DoDuLieu(this.dathang);
                if (txtTrangthaidonhang.Text == "Đã thành công")
                {
                    toolStripStatus_Ghilai.Enabled   = false;
                    toolStripStatusLabel3.Enabled    = false;
                    toolStripStatusLabel4.Enabled    = true;
                    toolStripDropDownButton1.Enabled = false;
                    btnTimnhacungcap.Enabled         = false;
                }
            }
        }
 private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
 {
     for (int j = 0; j < 1000; j++)
     {
         if (BaoDong == "")
         {
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Insert");
             fr.ShowDialog();
             SelectData();
         }
         else
         {
             BaoDong = "";
             break;
         }
     }
 }
 /// <summary>
 /// hungvv form sua
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripStatus_Sua_Click(object sender, EventArgs e)
 {
     for (int j = 0; j < 1000; j++)
     {
         if (BaoDong == "")
         {
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         {
             BaoDong = "";
             break;
         }
     }
 }
 private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     for (int j = 0; j < 1000; j++)
     {
         if (BaoDong == "")
         {
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         {
             BaoDong = "";
             break;
         }
     }
 }
 private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     for (int j = 0; j < 1000; j++)
     {
         if (BaoDong == "")
         {
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         {
             BaoDong = "";
             break;
         }
     }
 }
Ejemplo n.º 9
0
 private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvHienThi.RowCount > 0)
         {
             BaoDong = "A";
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         {
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// hungvv form sua
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripStatus_Sua_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 2))
         {
             return;
         }
         if (dgvHienThi.RowCount > 0)
         {
             BaoDong = "A";
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         {
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
 }
Ejemplo n.º 11
0
 private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
 {
     for (int j = 0; j < 1000; j++)
     {
         if (BaoDong == "")
         {
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Insert");
             fr.ShowDialog();
             SelectData();
         }
         else
         {
             BaoDong = "";
             break;
         }
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// hungvv form them moi
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Running()
        {
            try
            {
                if (Luu.BienTam == "Close")
                {
                    frmXuLyDonDatHang insert = new frmXuLyDonDatHang("Insert");

                    insert.ShowDialog(this);
                }
            }
            catch (Exception ex)
            { string s = ex.Message; }
        }
Ejemplo n.º 13
0
        private void TraVe()
        {
            try
            {
                if (names == "Lay_HangHoa_GoiHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells["MaHang"].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells["TenHang"].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells["GiaNhap"].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells["GiaBanBuon"].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells["GiaBanLe"].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells["Thue"].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "Lay_HangHoa_GoiHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "DonDatHang_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoa";
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HoaDonDat_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonDat_HangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "DonDatHang_NhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string giatri = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "DonDatHang_NhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.Giatri2 = giatri;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "HoaDonNhap_NhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string no = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonNhap_NhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.TonKho = no;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "ThongTin_KhachHangTraLai")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "ThongTin_KhachHangTraLai";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HoaDonNhap_DonDatHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonNhap_DonDatHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HangTraLai_KhachHangTraLai_MaDonHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[0].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_MaDonHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HangTraLai_KhachHangTraLai_KhachHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string duno = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_KhachHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri2 = duno;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "HangTraLai_TraLaiNhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string nohienthoi = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_TraLaiNhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.Giatri2 = nohienthoi;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "ChiTietKhachHangTraLaiHang_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        frmXuLyHangTraLai.soluongmua = doituong;
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string sl = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        string giatrigiatrang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "ChiTietKhachHangTraLaiHang_HangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.Giatri2 = sl;
                        GiaTriCanLuu.giatrigiatang = giatrigiatrang;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "ChiTietTraLaiNhaCungCap_MaHangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        frmXuLyHangTraLai.soluongmua = doituong;
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string sl = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        string g = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "ChiTietTraLaiNhaCungCap_MaHangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.makhachhang = sl;
                        GiaTriCanLuu.giatrigiatang = g;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HoaDonNhap_MaDonDatHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonNhap_MaDonDatHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "KiemKeKho_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        int temVITRI = dgvHieThi.CurrentRow.Index;
                        string ID = dgvHieThi.Rows[temVITRI].Cells["MaHangHoa"].Value.ToString();
                        string Name = dgvHieThi.Rows[temVITRI].Cells["TenHangHoa"].Value.ToString();
                        string add = dgvHieThi.Rows[temVITRI].Cells["GiaNhap"].Value.ToString();
                        string ton = dgvHieThi.Rows[temVITRI].Cells["Tonkho"].Value.ToString();
                        string sl = dgvHieThi.Rows[temVITRI].Cells["Tonkho"].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.TonKho = ton;
                        GiaTriCanLuu.Giatri2 = sl;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyKiemKeKho fr = new frmXuLyKiemKeKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                ///-------------------------------------------------------------------
                if (names == "DonDatHang_HangHoaTheoKho")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoaTheoKho";
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "HangTraLai_DonDatHangNhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[0].Value.ToString();
                        string ngay = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_DonDatHangNhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = ngay;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HangTraLai_MaTraLaiNhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string ngay = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_MaTraLaiNhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = ngay;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "XuLyKhachHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string ngay = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "XuLyKhachHang";
                        GiaTriCanLuu.Ma = ID;
                        frmXuLyKhachHang fr = new frmXuLyKhachHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "DonDatHang_KhachHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string duno = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "DonDatHang_KhachHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri2 = duno;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
        }
Ejemplo n.º 14
0
        private void TraveLoai()
        {
            try
            {
                if (names == "Lay_HangHoa_GoiHang")
                {
                    GiaTriCanLuu.Loaitrave = "Lay_HangHoa_GoiHang";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "DonDatHang_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoa";
                    frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "HoaDonDat_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonDat_HangHoa";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "DonDatHang_NhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "DonDatHang_NhaCungCap";
                    frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "HoaDonNhap_NhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonNhap_NhaCungCap";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "ThongTin_KhachHangTraLai")
                {
                    GiaTriCanLuu.Loaitrave = "ThongTin_KhachHangTraLai";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HoaDonNhap_DonDatHang")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonNhap_DonDatHang";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_KhachHangTraLai_MaDonHang")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_MaDonHang";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_KhachHangTraLai_KhachHang")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_KhachHang";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "HangTraLai_TraLaiNhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_TraLaiNhaCungCap";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "ChiTietKhachHangTraLaiHang_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "ChiTietKhachHangTraLaiHang_HangHoa";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "ChiTietTraLaiNhaCungCap_MaHangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "ChiTietTraLaiNhaCungCap_MaHangHoa";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HoaDonNhap_MaDonDatHang")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonNhap_MaDonDatHang";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "KiemKeKho_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa";
                    frmXuLyKiemKeKho fr = new frmXuLyKiemKeKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_DonDatHangNhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_DonDatHangNhaCungCap";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_MaTraLaiNhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_MaTraLaiNhaCungCap";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "XuLyKhachHang")
                {
                    GiaTriCanLuu.Loaitrave = "XuLyKhachHang";
                    frmXuLyKhachHang fr = new frmXuLyKhachHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "DonDatHang_KhachHang")
                {
                    GiaTriCanLuu.Loaitrave = "DonDatHang_KhachHang";
                    frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
            }
            catch (Exception ex)
            { string s = ex.Message; }
        }
Ejemplo n.º 15
0
 private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvHienThi.RowCount > 0)
         {
             BaoDong = "A";
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         { }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// ham main
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmXuLy_DonDatHang_Load(object sender, EventArgs e)
        {
            try
            {
                datesv = DateServer.Date();
                Entities.HienThi_ChiTiet_DonDatHang[] row = new Entities.HienThi_ChiTiet_DonDatHang[0];
                dgvInsertOrder.DataSource = row;
                DoiTen(dgvInsertOrder);
                //doc du lieu dong
                makNgaydonhang.Text = DateServer.Date().ToString("dd/MM/yyyy"); ;
                makNgaynhapdukien.Text = DateServer.Date().ToString("dd/MM/yyyy");
                this.cbxHinhthucthanhtoan.Items.AddRange(new object[] { "Tiền mặt", "ATM" });
                cbxHinhthucthanhtoan.SelectedIndex = 0;
                this.txtTrangthaidonhang.Text = "Đang mở";
                txtPhuongthucvanchuyen.Text = "Tự vận chuyển";
                //fig cung combox
                frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                if (this.HanhDong == "Insert")
                {
                    btnTimnhacungcap.Enabled = true;
                    toolStripStatus_Them.Enabled = true;
                    toolStripStatus_Ghilai.Enabled = false;
                    Application.OpenForms[fr.Name].Text = "Thêm Mới - F4 Thêm Hàng Hóa F5 Nhập Phí Vận Chuyển F6 Sửa Hàng Hóa F7 Nhập Phí Khác";
                    txtTrangthaidonhang.ReadOnly = true;
                    getID("DonDatHang");
                    txtSodonhang.Text = makiemtra;
                    checkData();
                    toolStripStatusLabel3.Enabled = false;
                }
                //LayKhoHang();
                ///lay kho hang trong xml
                new Common.Utilities().ComboxKhoHang(cbxMaKho);

                Entities.KiemTraChung[] tt = new Entities.KiemTraChung[1];
                Entities.KiemTraChung g = new Entities.KiemTraChung();
                Common.Utilities com = new Common.Utilities();
                g.Khoachinh = Common.Utilities.User.NhanVienID;
                g.Giatri = Common.Utilities.User.TenNhanVien;
                tt[0] = g;
                com.BindingCombobox(tt, cbxNhanvien, "giatri", "khoachinh");
                //LayNhanVien();
                LayTenTT();
                txtGiatien.Text = tigia[0].Giatri2.ToString();
                cbxTiente_Tygia.SelectedIndex = 0;
                cbxTiente_Tygia.Enabled = false;
                //danh cho update
                if (this.HanhDong == "Update")
                {
                    if (this.dathang.DonDatHangID > 0)
                    {
                        btnTimnhacungcap.Enabled = false;
                        toolStripStatus_Them.Enabled = false;
                        toolStripStatus_Ghilai.Enabled = true;
                        Application.OpenForms[fr.Name].Text = "Quản lý đơn đặt hàng - Xem Chi Tiết Đơn";
                        DoDuLieu(this.dathang);
                        if (txtTrangthaidonhang.Text == "Đã thành công")
                        {
                            toolStripStatus_Ghilai.Enabled = false;
                            toolStripStatusLabel3.Enabled = false;
                            toolStripStatusLabel4.Enabled = true;
                            btnTimnhacungcap.Enabled = false;
                        }
                        if (dgvInsertOrder.RowCount <= 0)
                        {
                            txtChietkhau.Text = "0";
                            txtTienhang.Text = "0";
                            txtGiatrigiatang.Text = "0";
                            txtPhivanchuyen.Text = "0";
                            txtPhikhac.Text = "0";
                            txtTongtien.Text = "0";
                        }
                        check_loaidathang.Enabled = false;
                        TinhToan();
                    }
                    else
                    { MessageBox.Show("Không tìm thấy mã đơn đặt hàng cần sửa !"); this.Close(); }
                    toolStripStatusLabel3.Enabled = true;
                }

            }
            catch (Exception ex)
            {
                string s = ex.Message;
                if (txtSodonhang.Text == "")
                {
                    txtSodonhang.Text = makhachhang;
                }
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// hungvv form sua
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripStatus_Sua_Click(object sender, EventArgs e)
 {
     for (int j = 0; j < 1000; j++)
     {
         if (BaoDong == "")
         {
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         {
             BaoDong = "";
             break;
         }
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// hungvv form sua
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripStatus_Sua_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 2))
         { return; }
         if (dgvHienThi.RowCount > 0)
         {
             BaoDong = "A";
             frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Update", getDatagridview());
             fr.ShowDialog();
             SelectData();
         }
         else
         { }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
 }
Ejemplo n.º 19
0
 private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 4))
         { return; }
         for (int j = 0; j < 100; j++)
         {
             if (BaoDong == "")
             {
                 frmXuLyDonDatHang fr = new frmXuLyDonDatHang("Insert");
                 fr.ShowDialog();
                 SelectData();
             }
             else
             {
                 BaoDong = "";
                 break;
             }
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// ham main
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmXuLy_DonDatHang_Load(object sender, EventArgs e)
        {
            //doc du lieu dong
            makNgaydonhang.Text = new Common.Utilities().XuLy(2,DateTime.Today.ToString());
            makNgaynhapdukien.Text = new Common.Utilities().XuLy(2,DateTime.Today.ToString());

            LayKhoHang();
            LayTenTT();
            LayNhanVien();
            //fig cung combox
            this.cbxDieukienthanhtoan.Items.AddRange(new object[] { "Thanh toán ngay", "Thanh toán từng phần", "Mua nợ" });
            this.cbxDieukienthanhtoan.Text = "Chọn loại thanh toán";
            this.cbxHinhthucthanhtoan.Items.AddRange(new object[] { "Tiền mặt", "Séc", "VISA", "MASTER CARD", "AMEX", "CONNECT", "JCB" });
            this.cbxHinhthucthanhtoan.Text = "Chọn hình thức thanh toán";
            this.txtTrangthaidonhang.Text = "Đang mở";
            frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
            //danh cho delete
            if (this.HanhDong == "Insert")
            {
                getID("DonDatHang");
                btnTimnhacungcap.Enabled = true;
                txtManhacungcap.ReadOnly = false;
                toolStripStatus_Them.Enabled = true;
                toolStripStatus_Ghilai.Enabled = false;
                Application.OpenForms[fr.Name].Text = "Quản lý đơn đặt hàng - Thêm đơn đặt hàng";
                txtTrangthaidonhang.ReadOnly = true;
            }
            //danh cho update
            if (this.HanhDong == "Update")
            {
                btnTimnhacungcap.Enabled = false;
                txtManhacungcap.ReadOnly = true;
                toolStripStatus_Them.Enabled = false;
                toolStripStatus_Ghilai.Enabled = true;
                Application.OpenForms[fr.Name].Text = "Quản lý đơn đặt hàng - Sửa đơn đặt hàng";
                DoDuLieu(this.dathang);
                if (txtTrangthaidonhang.Text == "Đã thành công")
                {
                    toolStripStatus_Ghilai.Enabled = false;
                    toolStripStatusLabel3.Enabled = false;
                    toolStripStatusLabel4.Enabled = true;
                    toolStripDropDownButton1.Enabled = false;
                    btnTimnhacungcap.Enabled = false;
                }
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// hungvv form them moi
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Running()
        {
            if (Luu.BienTam == "Close")
            {
                frmXuLyDonDatHang insert = new frmXuLyDonDatHang("Insert");

                insert.ShowDialog(this);
            }
        }