Exemplo n.º 1
0
        protected void btnHuyPhieuXuatKhac_Click(object sender, EventArgs e)
        {
            data = new dtPhieuXuatKhac();
            int ID = Int32.Parse(IDPhieuXuatKhac_Temp.Value.ToString());

            data.XoaChiTietPhieuXuatKhac_Temp(IDPhieuXuatKhac_Temp.Value.ToString());
            Response.Redirect("DanhSachPhieuXuatKhac.aspx");
        }
Exemplo n.º 2
0
        protected void btnThemPhieuXuatKhac_Click(object sender, EventArgs e)
        {
            if (cmbLyDoXuat.Text != "")
            {
                string    IDPhieuXuatKhac = IDPhieuXuatKhac_Temp.Value.ToString();
                DataTable db = data.LayDanhSachPhieuXuatKhac(IDPhieuXuatKhac);
                if (db.Rows.Count != 0)
                {
                    string   IDNguoiLapPhieu = cmbNguoiLapPhieu.Value.ToString();
                    DateTime NgayLapPhieu    = DateTime.Parse(cmbNgayLapPhieu.Text.ToString());
                    string   IDLyDoXuat      = cmbLyDoXuat.Value.ToString();
                    string   GhiChu          = txtGhiChu == null ? "" : txtGhiChu.Text.ToString();
                    string   SoDonXuat       = txtSoDonXuat.Text.ToString();
                    string   IDNhanVien      = Session["IDNhanVien"].ToString();
                    data = new dtPhieuXuatKhac();
                    object ID = data.ThemPhieuXuatKhac(IDNhanVien, IDLyDoXuat, GhiChu, NgayLapPhieu, SoDonXuat);
                    if (ID != null)
                    {
                        foreach (DataRow dr in db.Rows)
                        {
                            string MaHang      = dr["MaHang"].ToString();
                            string IDHangHoa   = dr["IDHangHoa"].ToString();
                            string IDDonViTinh = dr["IDDonViTinh"].ToString();
                            string TonKho      = dr["TonKho"].ToString();
                            string SoLuongXuat = dr["SoLuongXuat"].ToString();
                            string GhiChuHH    = dr["GhiChu"].ToString();
                            data = new dtPhieuXuatKhac();
                            data.ThemChiTietPhieuXuatKhac(ID, MaHang, IDHangHoa, IDDonViTinh, TonKho, SoLuongXuat, GhiChuHH);
                            // dtLichSuKho.ThemLichSu(IDHangHoa, Session["IDNhanVien"].ToString(), SoLuong, "Phiếu xuất khác", Session["IDKho"].ToString());
                            // dtLichSuKho.ThemLichSuXuat(IDHangHoa, Session["IDNhanVien"].ToString(), SoLuong, Session["IDKho"].ToString());

                            // xuất khác qua giám đốc duyệt
                            // object TheKho = dtTheKho.ThemTheKho(SoDonXuat, "Phiếu xuất khác ", "0", "", (Int32.Parse(dtCapNhatTonKho.SoLuong_TonKho(IDHangHoa, Session["IDKho"].ToString()).ToString()) - Int32.Parse(SoLuongXuat)).ToString(), Session["IDNhanVien"].ToString(), Session["IDKho"].ToString(), IDHangHoa, "Xuất", SoLuongXuat, "0", "0");
                            // if (TheKho != null)
                            // {
                            dtCapNhatTonKho.TruTonKho(IDHangHoa, SoLuongXuat, Session["IDKho"].ToString());
                            // }
                        }
                        dtLichSuTruyCap.ThemLichSu(Session["IDNhanVien"].ToString(), Session["IDNhom"].ToString(), "Phiếu Xuất Khác", Session["IDKho"].ToString(), "Nhập xuất tồn", "Thêm");
                        data = new dtPhieuXuatKhac();
                        data.XoaChiTietPhieuXuatKhac_Temp(IDPhieuXuatKhac);
                        Response.Redirect("DanhSachPhieuXuatKhac.aspx");
                    }
                }
                else
                {
                    Response.Write("<script language='JavaScript'> alert('Danh sách hàng hóa rỗng.'); </script>");
                }
            }
            else
            {
                Response.Write("<script language='JavaScript'> alert('Vui lòng chọn lý do để xuất.'); </script>");
            }
        }
Exemplo n.º 3
0
        protected void btnThemPhieuXuatKhac_Click(object sender, EventArgs e)
        {
            if (cmbLyDoXuat.Text != "")
            {
                string    IDPhieuXuatKhac = IDPhieuXuatKhac_Temp.Value.ToString();
                DataTable db = data.LayDanhSachPhieuXuatKhac_Temp(IDPhieuXuatKhac);
                if (db.Rows.Count != 0)
                {
                    string   IDNguoiLapPhieu = Session["IDNhanVien"].ToString();
                    DateTime NgayLapPhieu    = DateTime.Parse(cmbNgayLapPhieu.Text.ToString());
                    string   IDLyDoXuat      = cmbLyDoXuat.Value.ToString();
                    string   GhiChu          = txtGhiChu == null ? "" : txtGhiChu.Text.ToString();
                    string   IDChiNhanh      = Session["IDChiNhanh"].ToString();
                    data = new dtPhieuXuatKhac();
                    object ID = data.ThemPhieuXuatKhac_Temp();
                    if (ID != null)
                    {
                        data.CapNhatPhieuXuatKhac_ID(ID, IDNguoiLapPhieu, IDLyDoXuat, NgayLapPhieu, GhiChu, IDChiNhanh);
                        foreach (DataRow dr in db.Rows)
                        {
                            string IDNguyenLieu = dr["IDNguyenLieu"].ToString();
                            string TonKho       = dr["TonKho"].ToString();
                            string IDDonViTinh  = dr["IDDonViTinh"].ToString();
                            string SoLuongXuat  = dr["SoLuongXuat"].ToString();
                            string MaNguyenLieu = dr["MaNguyenLieu"].ToString();
                            string DonGia       = dr["DonGia"].ToString();
                            string ThanhTien    = dr["ThanhTien"].ToString();
                            data = new dtPhieuXuatKhac();
                            data.ThemChiTietPhieuXuatKhac(ID, IDNguyenLieu, TonKho, IDDonViTinh, SoLuongXuat, MaNguyenLieu, DonGia, ThanhTien);

                            //dtLichSuKho.ThemLichSu(Session["IDChiNhanh"].ToString(), IDNguyenLieu, Session["IDNhanVien"].ToString(), dtLichSuKho.LaySoLuongTonKho(Session["IDChiNhanh"].ToString(), IDNguyenLieu), (Int32.Parse(dtLichSuKho.LaySoLuongTonKho(Session["IDChiNhanh"].ToString(), IDNguyenLieu)) - Int32.Parse(SoLuongXuat)) + "", "Phiếu xuất khác");

                            dtSetting.TruTonKho(IDNguyenLieu, SoLuongXuat, IDChiNhanh);
                        }
                        data = new dtPhieuXuatKhac();
                        data.XoaChiTietPhieuXuatKhac_Temp(IDPhieuXuatKhac);

                        dtLichSuTruyCap.ThemLichSu(Session["IDChiNhanh"].ToString(), Session["IDNhom"].ToString(), Session["IDNhanVien"].ToString(), "Phiếu xuất khác", "Thêm phiếu xuất khác");
                        Response.Redirect("DanhSachPhieuXuatKhac.aspx");
                    }
                }
                else
                {
                    cmbHangHoa.Focus();
                    Response.Write("<script language='JavaScript'> alert('Danh sách hàng hóa rỗng.'); </script>");
                }
            }
            else
            {
                cmbLyDoXuat.Focus();
                Response.Write("<script language='JavaScript'> alert('Vui lòng chọn lý do để xuất.'); </script>");
            }
        }