/// <summary>
 /// xử lý thêm mới
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsslthemmoi_Click(object sender, EventArgs e)
 {
     if (!Common.Utilities.User.Administrator && !(new Common.Utilities().CheckQuyen(this.Name, 4)))
     {
         MessageBox.Show("Bạn không có quyền vào", "Hệ thống cảnh báo");
         return;
     }
     try
     {
         for (int j = 0; j < 1000; j++)
         {
             if (trave == "")
             {
                 frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Them");
                 tmptc.ShowDialog();
                 SelectData();
             }
             else
             {
                 trave = "";
                 break;
             }
         }
     }
     catch
     {
     }
 }
        /// <summary>
        /// sửa dữ liệu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsslsua_Click(object sender, EventArgs e)
        {
            frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvChitien.Rows[i]);

            tmptc.ShowDialog();
            SelectData();
        }
 private void dtgvThutien_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     i = e.RowIndex;
     try
     {
         if (i < 0)
         {
             return;
         }
         frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvThutien.Rows[i]);
         tmptc.ShowDialog();
         SelectData();
     }
     catch { }
 }
Exemple #4
0
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            i = e.RowIndex;
            if (i < 0)
            {
                return;
            }
            try
            {
                bool   kt         = true;
                string objname    = congnochitiet[i].TruongNgam;
                string madoituong = congnochitiet[i].MaTruongNgam;
                switch (objname)
                {
                case "BanBuon":
                {
                    kt = false;
                    dtgvngam.DataSource = bb1;
                    int so = 0;
                    for (int j = 0; j < bb1.Length; j++)
                    {
                        if (bb1[j].MaHDBanHang == madoituong)
                        {
                            so = j; kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyBanBuon b = new frmXuLyBanBuon("Sua", dtgvngam.Rows[so]);
                        b.ShowDialog();
                    }
                    break;
                }

                case "Thu":
                {
                    dtgvngam.DataSource = ptc;
                    kt = false;
                    int so = 0;
                    for (int j = 0; j < ptc.Length; j++)
                    {
                        if (ptc[j].MaPhieuThu == madoituong)
                        {
                            so = j;
                            kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]);
                        tmptc.ShowDialog();
                    }
                    break;
                }

                case "Chi":
                {
                    dtgvngam.DataSource = ptc;
                    kt = false;
                    int so = 0;
                    for (int j = 0; j < ptc.Length; j++)
                    {
                        if (ptc[j].MaPhieuThu == madoituong)
                        {
                            so = j;
                            kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Chi", "Sua", dtgvngam.Rows[so]);
                        tmptc.ShowDialog();
                    }
                    break;
                }

                case "KHTL":
                {
                    kt = false;
                    int so = 0;
                    for (int j = 0; j < khtl1.Length; j++)
                    {
                        if (khtl1[j].MaKhachHangTraLai == madoituong)
                        {
                            so = j;
                            kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_KhachHangTraLai", "KhachHangTraLai", "Update", khtl1[so]);
                        b.ShowDialog();
                    }
                    break;
                }

                case "HoaDonNhap":
                {
                    kt = false;
                    int so = 0;
                    for (int j = 0; j < hdn1.Length; j++)
                    {
                        if (hdn1[j].MaHoaDonNhap == madoituong)
                        {
                            so = j;
                            kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyNhapKho b = new frmXuLyNhapKho("Update", hdn1[so]);
                        b.ShowDialog();
                    }
                    break;
                }

                case "TLNCC":
                {
                    kt = false;
                    int so = 0;
                    for (int j = 0; j < tlncc1.Length; j++)
                    {
                        if (tlncc1[j].MaHDTraLaiNCC == madoituong)
                        {
                            so = j;
                            kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_TraLaiNhaCungCap", "TraLaiNhaCungCap", "Update", tlncc1[so]);
                        b.ShowDialog();
                    }
                    break;
                }

                case "PhieuTTCuaKH":
                {
                    kt = false;
                    dtgvngam.DataSource = phieuttcuakh1;
                    int so = 0;
                    for (int j = 0; j < phieuttcuakh1.Length; j++)
                    {
                        if (phieuttcuakh1[j].MaPhieuTTCuaKH == madoituong)
                        {
                            so = j; kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyPhieuTTCuaKH b = new frmXuLyPhieuTTCuaKH("Sua", dtgvngam.Rows[so]);
                        b.ShowDialog();
                    }
                    break;
                }

                case "PhieuTTNCC":
                {
                    kt = false;
                    dtgvngam.DataSource = phieuttncc1;
                    int so = 0;
                    for (int j = 0; j < phieuttncc1.Length; j++)
                    {
                        if (phieuttncc1[j].MaPhieuTTNCC == madoituong)
                        {
                            so = j; kt = true;
                            break;
                        }
                    }
                    if (kt == true)
                    {
                        frmXuLyPhieuTTNCC b = new frmXuLyPhieuTTNCC("Sua", dtgvngam.Rows[so]);
                        b.ShowDialog();
                    }
                    break;
                }

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
            }
        }
 /// <summary>
 /// Thêm mới
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsslthemmoi_Click(object sender, EventArgs e)
 {
     if (!Common.Utilities.User.Administrator && !(new Common.Utilities().CheckQuyen(this.Name, 4)))
     {
         MessageBox.Show("Bạn không có quyền vào", "Hệ thống cảnh báo");
         return;
     }
     for (int j = 0; j < 1000; j++)
     {
         if (frmQuanLyPhieuThu.trave == "")
         {
             frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Chi", "Them");
             tmptc.ShowDialog();
             SelectData();
         }
         else
         {
             frmQuanLyPhieuThu.trave = "";
             break;
         }
     }
 }
 /// <summary>
 /// sửa dữ liệu
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsslsua_Click(object sender, EventArgs e)
 {
     frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvChitien.Rows[i]);
     tmptc.ShowDialog();
     SelectData();
 }
        private void dtgvChitien_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            i = e.RowIndex;
            if (i < 0)
                return;
            try
            {
                frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Chi", "Sua", dtgvChitien.Rows[i]);
                tmptc.ShowDialog();
                SelectData();
            }
            catch
            {

            }
        }
Exemple #8
0
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            i = e.RowIndex;
            if (i < 0)
            {
                return;
            }
            try
            {
                string objname = soquy[i].TruongNgam;
                string maphieu = soquy[i].MaPhieu;
                switch (objname)
                {
                case "PhieuThu":
                {
                    dtgvngam.DataSource = pt;
                    int so = 0;
                    for (int j = 0; j < pt.Length; j++)
                    {
                        if (pt[j].MaPhieuThu == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }

                    frmXuLyPhieuThuChi b = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]);
                    b.ShowDialog();
                    break;
                }

                case "PhieuChi":
                {
                    dtgvngam.DataSource = pc;
                    int so = 0;
                    for (int j = 0; j < pc.Length; j++)
                    {
                        if (pc[j].MaPhieuThu == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }

                    frmXuLyPhieuThuChi b = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]);
                    b.ShowDialog();
                    break;
                }

                case "BanBuon":
                {
                    dtgvngam.DataSource = bb;
                    int so = 0;
                    for (int j = 0; j < bb.Length; j++)
                    {
                        if (bb[j].MaHDBanHang == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }
                    frmXuLyBanBuon b = new frmXuLyBanBuon("Sua", dtgvngam.Rows[so]);
                    b.ShowDialog();
                    break;
                }

                case "BanLe":
                {
                    dtgvngam.DataSource = bl;
                    int so = 0;
                    for (int j = 0; j < bl.Length; j++)
                    {
                        if (bl[j].MaHDBanHang == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }
                    frmXuLyBanLe b = new frmXuLyBanLe("Sua", dtgvngam.Rows[so]);
                    b.ShowDialog();
                    break;
                }

                case "HoaDonNhap":
                {
                    int so = 0;
                    for (int j = 0; j < hdn.Length; j++)
                    {
                        if (hdn[j].MaHoaDonNhap == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }
                    frmXuLyNhapKho b = new frmXuLyNhapKho("Update", hdn[so]);
                    b.ShowDialog();
                    break;
                }

                case "KHTL":
                {
                    int so = 0;
                    for (int j = 0; j < kh.Length; j++)
                    {
                        if (kh[j].MaKhachHangTraLai == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }
                    frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_KhachHangTraLai", "KhachHangTraLai", "Update", kh[so]);
                    b.ShowDialog();
                    break;
                }

                case "TLNCC":
                {
                    int so = 0;
                    for (int j = 0; j < tl.Length; j++)
                    {
                        if (tl[j].MaHDTraLaiNCC == maphieu)
                        {
                            so = j;
                            break;
                        }
                    }
                    frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_TraLaiNhaCungCap", "TraLaiNhaCungCap", "Update", tl[so]);
                    b.ShowDialog();
                    break;
                }

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            i = e.RowIndex;
            if (i < 0)
                return;
            try
            {
                bool kt = true;
                string objname = congnochitiet[i].TruongNgam;
                string madoituong = congnochitiet[i].MaTruongNgam;
                switch (objname)
                {
                    case "BanBuon":
                        {
                            kt = false;
                            dtgvngam.DataSource = bb1;
                            int so = 0;
                            for (int j = 0; j < bb1.Length; j++)
                            {
                                if (bb1[j].MaHDBanHang == madoituong)
                                {
                                    so = j; kt = true;
                                    break;
                                }
                            }
                            if (kt == true)
                            {
                                frmXuLyBanBuon b = new frmXuLyBanBuon("Sua", dtgvngam.Rows[so]);
                                b.ShowDialog();
                            }
                            break;
                        }
                    case "Thu":
                        {
                            dtgvngam.DataSource = ptc;
                            kt = false;
                            int so = 0;
                            for (int j = 0; j < ptc.Length; j++)
                            {
                                if (ptc[j].MaPhieuThu == madoituong)
                                {
                                    so = j;
                                    kt = true;
                                    break;
                                }
                            } if (kt == true)
                            {
                                frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]);
                                tmptc.ShowDialog();
                            }
                            break;
                        }

                    case "Chi":
                        {
                            dtgvngam.DataSource = ptc;
                            kt = false;
                            int so = 0;
                            for (int j = 0; j < ptc.Length; j++)
                            {
                                if (ptc[j].MaPhieuThu == madoituong)
                                {
                                    so = j;
                                    kt = true;
                                    break;
                                }
                            } if (kt == true)
                            {
                                frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Chi", "Sua", dtgvngam.Rows[so]);
                                tmptc.ShowDialog();
                            }
                            break;
                        }

                    case "KHTL":
                        {
                            kt = false;
                            int so = 0;
                            for (int j = 0; j < khtl1.Length; j++)
                            {
                                if (khtl1[j].MaKhachHangTraLai == madoituong)
                                {
                                    so = j;
                                    kt = true;
                                    break;
                                }
                            } if (kt == true)
                            {
                                frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_KhachHangTraLai", "KhachHangTraLai", "Update", khtl1[so]);
                                b.ShowDialog();
                            }
                            break;
                        }
                    case "HoaDonNhap":
                        {
                            kt = false;
                            int so = 0;
                            for (int j = 0; j < hdn1.Length; j++)
                            {
                                if (hdn1[j].MaHoaDonNhap == madoituong)
                                {
                                    so = j;
                                    kt = true;
                                    break;
                                }
                            }
                            if (kt == true)
                            {
                                frmXuLyNhapKho b = new frmXuLyNhapKho("Update", hdn1[so]);
                                b.ShowDialog();
                            }
                            break;
                        }
                    case "TLNCC":
                        {
                            kt = false;
                            int so = 0;
                            for (int j = 0; j < tlncc1.Length; j++)
                            {
                                if (tlncc1[j].MaHDTraLaiNCC == madoituong)
                                {
                                    so = j;
                                    kt = true;
                                    break;
                                }
                            }
                            if (kt == true)
                            {
                                frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_TraLaiNhaCungCap", "TraLaiNhaCungCap", "Update", tlncc1[so]);
                                b.ShowDialog();
                            }
                            break;
                        }
                    case "PhieuTTCuaKH":
                        {
                            kt = false;
                            dtgvngam.DataSource = phieuttcuakh1;
                            int so = 0;
                            for (int j = 0; j < phieuttcuakh1.Length; j++)
                            {
                                if (phieuttcuakh1[j].MaPhieuTTCuaKH == madoituong)
                                {
                                    so = j; kt = true;
                                    break;
                                }
                            }
                            if (kt == true)
                            {
                                frmXuLyPhieuTTCuaKH b = new frmXuLyPhieuTTCuaKH("Sua", dtgvngam.Rows[so]);
                                b.ShowDialog();
                            }
                            break;
                        }
                    case "PhieuTTNCC":
                        {
                            kt = false;
                            dtgvngam.DataSource = phieuttncc1;
                            int so = 0;
                            for (int j = 0; j < phieuttncc1.Length; j++)
                            {
                                if (phieuttncc1[j].MaPhieuTTNCC == madoituong)
                                {
                                    so = j; kt = true;
                                    break;
                                }
                            }
                            if (kt == true)
                            {
                                frmXuLyPhieuTTNCC b = new frmXuLyPhieuTTNCC("Sua", dtgvngam.Rows[so]);
                                b.ShowDialog();
                            }
                            break;
                        }
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            i = e.RowIndex;
            if (i < 0)
                return;
            try
            {
                string objname = soquy[i].TruongNgam;
                string maphieu = soquy[i].MaPhieu;
                switch (objname)
                {
                    case "PhieuThu":
                        {
                            dtgvngam.DataSource = pt;
                            int so = 0;
                            for (int j = 0; j < pt.Length; j++)
                            {
                                if (pt[j].MaPhieuThu == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }

                            frmXuLyPhieuThuChi b = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]);
                            b.ShowDialog();
                            break;
                        }
                    case "PhieuChi":
                        {
                            dtgvngam.DataSource = pc;
                            int so = 0;
                            for (int j = 0; j < pc.Length; j++)
                            {
                                if (pc[j].MaPhieuThu == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }

                            frmXuLyPhieuThuChi b = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]);
                            b.ShowDialog();
                            break;
                        }
                    case "BanBuon":
                        {
                            dtgvngam.DataSource = bb;
                            int so = 0;
                            for (int j = 0; j < bb.Length; j++)
                            {
                                if (bb[j].MaHDBanHang == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }
                            frmXuLyBanBuon b = new frmXuLyBanBuon("Sua", dtgvngam.Rows[so]);
                            b.ShowDialog();
                            break;
                        }
                    case "BanLe":
                        {
                            dtgvngam.DataSource = bl;
                            int so = 0;
                            for (int j = 0; j < bl.Length; j++)
                            {
                                if (bl[j].MaHDBanHang == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }
                            frmXuLyBanLe b = new frmXuLyBanLe("Sua", dtgvngam.Rows[so]);
                            b.ShowDialog();
                            break;
                        }
                    case "HoaDonNhap":
                        {
                            int so = 0;
                            for (int j = 0; j < hdn.Length; j++)
                            {
                                if (hdn[j].MaHoaDonNhap == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }
                            frmXuLyNhapKho b = new frmXuLyNhapKho("Update", hdn[so]);
                            b.ShowDialog();
                            break;
                        }
                    case "KHTL":
                        {
                            int so = 0;
                            for (int j = 0; j < kh.Length; j++)
                            {
                                if (kh[j].MaKhachHangTraLai == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }
                            frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_KhachHangTraLai", "KhachHangTraLai", "Update", kh[so]);
                            b.ShowDialog();
                            break;
                        }
                    case "TLNCC":
                        {
                            int so = 0;
                            for (int j = 0; j < tl.Length; j++)
                            {
                                if (tl[j].MaHDTraLaiNCC == maphieu)
                                {
                                    so = j;
                                    break;
                                }
                            }
                            frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_TraLaiNhaCungCap", "TraLaiNhaCungCap", "Update", tl[so]);
                            b.ShowDialog();
                            break;
                        }
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
            }
        }