protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string      manguoidung = Session["user"].ToString();
            GridViewRow row         = GridView1.SelectedRow;
            string      maphieu     = row.Cells[2].Text;

            Session["maphieu"] = maphieu;
            string loaiphieu = row.Cells[1].Text;

            Session["loaiphieu"] = loaiphieu;
            string tieude = row.Cells[3].Text;

            Session["tieude"] = tieude;
            string bophan = row.Cells[7].Text;

            Session["bophan"] = bophan;
            Label  lblMaDV  = (Label)row.FindControl("lblMaDonVi");
            string mabophan = lblMaDV.Text.Trim();

            Session["mabophan"] = mabophan;
            Abcon chitietduyet = AbconBUS.LayChiTietXetDuyetTheoNhanVienDuyet(maphieu, manguoidung);

            if (chitietduyet.abtype == "PDN2")
            {
                Response.Redirect("phieumuahangD.aspx");
            }
            else
            {
                Response.Redirect("frmDetails2D.aspx");
            }
        }
Esempio n. 2
0
        private void KiemTraTruocKhiXoa()
        {
            string maphieu = Session["maphieu"].ToString();
            string macongty = Session["congty"].ToString();
            int    buocduyet = 1; int capduyet = 1;
            Abcon  kiemtra = AbconBUS.KiemTraPhieu(maphieu, macongty, capduyet, buocduyet);

            if (kiemtra.abrult == true && kiemtra.Yn == 1)
            {
                btnHuy.Visible = false;
            }
            else
            {
                btnHuy.Visible = true;
                string ngonngu = Session["languege"].ToString();
                if (ngonngu == "lbl_VN")
                {
                    btnHuy.Text  = "Hủy Phiếu Đã Gửi";
                    btnBack.Text = "Trở Về";
                }
                else
                {
                    if (ngonngu == "lbl_TW")
                    {
                        btnHuy.Text  = "删除已寄出档案";
                        btnBack.Text = "背部";
                    }
                    else
                    {
                        btnHuy.Text  = "Cancel";
                        btnBack.Text = "背部";
                    }
                }
            }
        }
Esempio n. 3
0
        public void reloadTreeView()
        {
            string maloai = Session["loaiphieu"].ToString();
            string phieu  = Session["maphieu"].ToString();

            ctxds.Clear();
            TreeView1.Nodes.Clear();
            lvb      = AbconBUS.LayDSLoaiVanBan_CapDuyet(maloai, true);
            dschucvu = abill1BUS.ListAbill1();
            TreeNode parentNode = new TreeNode(str13);

            parentNode.Text = "parentNode";
            TreeView1.Nodes.Add(parentNode);
            foreach (Abcon loaivb in lvb)
            {
                TreeNode childNode = new TreeNode(loaivb.abde.ToString() + "-" + loaivb.Auditor.ToString());
                childNode.Value = loaivb.abde.ToString();
                childNode.Text  = "Cấp" + ":" + (TreeView1.Nodes[0].ChildNodes.Count + 1);
                parentNode.ChildNodes.Add(childNode);
                Abcon vbcd = new Abcon();
                vbcd.abde    = loaivb.abde;
                vbcd.pdno    = phieu;
                vbcd.cothutu = loaivb.cothutu;
                ctxds.Add(childNode.Text, vbcd);
            }
            TreeView1.ExpandAll();
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)

        {
            string       maphieu             = "2014062600014";
            string       macongty            = "LTY";
            List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
            int          max = (from ct1 in lstChiTietXetDuyet1
                                select ct1.Abstep).Max();

            if (max <= 6)
            {
                lbChuNhiemTW.Visible  = false;
                lbChuNhiemVN.Visible  = false;
                lbChuQuanTKTW.Visible = false;
                lbChuQuanTKVN.Visible = false;
                ImageLevel3.Visible   = false;
                ImageLevel4.Visible   = false;
            }
            else
            {
                lbChuNhiemTW.Visible  = true;
                lbChuNhiemVN.Visible  = true;
                lbChuQuanTKTW.Visible = true;
                lbChuQuanTKVN.Visible = true;
                ImageLevel3.Visible   = true;
                ImageLevel4.Visible   = true;
            }
        }
Esempio n. 5
0
        private void HienThi()
        {
            string idphieu = Session["maphieu"].ToString();
            //string bophan = Session["bophan"].ToString();

            //string noidung = Session["noidung"].ToString();
            //string ngaytao = Session["ngaythang"].ToString();
            string user = Session["user"].ToString();

            string congty = Session["congty"].ToString();

            DataTable dt = dalP.TimPhieuTheoMaNguoiTao(idphieu, congty, user);

            if (dt.Rows.Count > 0)
            {
                string      madonvi        = dt.Rows[0]["pddepid"].ToString();
                string      maloaiphieu    = dt.Rows[0]["Abtype"].ToString();
                int         Abc            = int.Parse(dt.Rows[0]["ABC"].ToString());
                BDepartment bophan         = BDepartmentBUS.TimMaDonVi(madonvi, congty);
                abill       loaiphieu      = abillBUS.SearchAbillByID(maloaiphieu);
                aABC        douutien       = ABCDAO.TimDoUuTien(Abc);
                string      tenloaiphieuVN = loaiphieu.abname;
                string      tenloaiphieuTW = loaiphieu.abnameTW;

                if (douutien != null)
                {
                    lblDoUutien.Text = douutien.NameABC + "-" + douutien.NameABCTW;
                }
                lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW;


                lblTieuDe.Text     = dt.Rows[0]["mytitle"].ToString() + " " + dt.Rows[0]["pdnsubject"].ToString();
                lbBoPhan.Text      = bophan.DepName;
                lbSoPhieu.Text     = idphieu;
                lbNoiDung.Text     = dt.Rows[0]["pdmemovn"].ToString();
                LbNoiDungDich.Text = dt.Rows[0]["NoiDungDich"].ToString();
                //lbNgay.Text = phieu.CFMDate0.ToString();
                string dinhdang = dt.Rows[0]["CFMDate0"].ToString();
                string thang    = dinhdang.Substring(3, 2);
                string ngay     = dinhdang.Substring(0, 2);
                string nam      = dinhdang.Substring(6, 4);
                lbNgay.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
            }
            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(idphieu, congty);

            if (user0 != null)
            {
                TextBox1.Text = user0.USERID;
                //ImageLevel0.ImageUrl = users.signatue;
                ImageLevel0.Width    = 100;
                ImageLevel0.Height   = 100;
                ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
            }
        }
        private void HienThi()
        {
            string idphieu = Session["maphieu"].ToString();
            //string bophan = Session["bophan"].ToString();

            //string noidung = Session["noidung"].ToString();
            //string ngaytao = Session["ngaythang"].ToString();
            string      user   = Session["user"].ToString();
            string      bp     = Session["bp"].ToString();
            string      congty = Session["congty"].ToString();
            BDepartment bophan = BDepartmentBUS.TimMaDonVi(bp, congty);
            //string loaiphieu = Session["loaiphieu"].ToString();
            pdna  phieu     = pdnaBUS.TimVanBanTheoMa(idphieu, congty, true);
            abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype);

            string tenloaiphieuVN = loaiphieu.abname;
            string tenloaiphieuTW = loaiphieu.abnameTW;

            lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW;
            //    lbBoPhan.Text = bophan;
            //    lbNoiDung.Text = phieu.pdmemovn.ToString();
            //    lbNgay.Text =Convert.ToString(phieu.CFMDate0);
            //  Buser users = UserBUS.TimMaNhanVienTheoBoPhan(user, bp);
            lblTieuDe.Text        = phieu.mytitle + phieu.pdnsubject;
            lbldonvidenghi.Text   = bophan.DepName;
            lbSoPhieu.Text        = idphieu;
            lblMucDichSuDung.Text = phieu.UseIntent;

            //lbNgay.Text = phieu.CFMDate0.ToString();
            string dinhdang = phieu.CFMDate0.ToString();
            string thang    = dinhdang.Substring(3, 2);
            string ngay     = dinhdang.Substring(0, 2);
            string nam      = dinhdang.Substring(6, 4);

            lblNgaytao.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";


            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(idphieu, congty);

            if (user0 != null)
            {
                TextBox1.Text = user0.USERID;
                //ImageLevel0.ImageUrl = users.signatue;
                ImageLevel0.Width    = 100;
                ImageLevel0.Height   = 100;
                ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
            }
        }
Esempio n. 7
0
        private void HienThi()
        {
            string idphieu = Session["maphieu"].ToString();

            string user = Session["user"].ToString();
            //string bp = Session["bp"].ToString();
            string congty = Session["congty"].ToString();


            //pdna phieu = pdnaBUS.TimVanBanTheoMa(idphieu, congty, true);
            DataTable dt = dalPDN.TimPhieuTheoMaPhieu(idphieu, congty);

            if (dt.Rows.Count > 0)
            {
                string      madonvi   = dt.Rows[0]["pddepid"].ToString();
                string      maloaip   = dt.Rows[0]["Abtype"].ToString();
                int         dout      = int.Parse(dt.Rows[0]["ABC"].ToString());
                BDepartment bophan    = BDepartmentBUS.TimMaDonVi(madonvi, congty);
                abill       loaiphieu = abillBUS.SearchAbillByID(maloaip);

                string tenloaiphieuVN = loaiphieu.abname;
                string tenloaiphieuTW = loaiphieu.abnameTW;

                lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW;

                lbldonvidenghi.Text   = bophan.DepName;
                lbSoPhieu.Text        = idphieu;
                lblMucDichSuDung.Text = dt.Rows[0]["UseIntent"].ToString();
                lblTieuDe.Text        = dt.Rows[0]["mytitle"].ToString() + "-" + dt.Rows[0]["pdnsubject"].ToString();
                //lbNgay.Text = phieu.CFMDate0.ToString();
                string dinhdang = dt.Rows[0]["CFMDate0"].ToString();
                string thang    = dinhdang.Substring(3, 2);
                string ngay     = dinhdang.Substring(0, 2);
                string nam      = dinhdang.Substring(6, 4);
                lblNgaytao.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
            }

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(idphieu, congty);

            if (user0 != null)
            {
                TextBox1.Text = user0.USERID;
                //ImageLevel0.ImageUrl = users.signatue;
                ImageLevel0.Width    = 100;
                ImageLevel0.Height   = 100;
                ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
            }
        }
        private void hienthi()
        {
            string       macongty    = Session["congty"].ToString();
            string       manguoidung = Session["user"].ToString();
            List <Abcon> Captruoc    = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoChiTiet(manguoidung);

            Abcon   capdangduyet = AbconBUS.LayCapDuyetCuaNhanVien(manguoidung);
            int     buoctruoc    = capdangduyet.Abstep - 1;
            string  nguoiduyet   = Session["user"].ToString();
            Busers2 suer         = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);

            GridView2.DataSource = db.QryVanBanDenChuaDuyetTheoNguoiDuyet(manguoidung, buoctruoc);
            GridView2.DataBind();
            //string maphieu = row.Cells[1].Text;
            //Session["maphieu"] = maphieu;
        }
Esempio n. 9
0
        private void HienThi()
        {
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();
            //string bophan = Session["bophan"].ToString();

            //string madonvi = Session["mabophan"].ToString();
            string macongty = Session["congty"].ToString();
            // pdna phieu = pdnaBUS.TimVanBanTheoMa(maphieu, macongty, true);
            DataTable dt = dal.TimPhieuTheoMaPhieu(maphieu, macongty);

            if (dt.Rows.Count > 0)
            {
                string      madonvi = dt.Rows[0]["pddepid"].ToString();
                string      maloaip = dt.Rows[0]["Abtype"].ToString();
                int         dout    = int.Parse(dt.Rows[0]["ABC"].ToString());
                pdna        phieucu = pnaDAO.TimPhieuDaTungBiHuy(maphieu, macongty);
                Busers2     users   = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);
                BDepartment bp      = BDepartmentDAO.TimMaDonVi(madonvi, macongty);
                Session["bophan"]   = bp.DepName;
                Session["mabophan"] = bp.ID;
                Abcon lydokhongduyet = AbconDAO.LayPhieuKhongDuyetTheoPhieu(madonvi, maloaip, macongty, maphieu);
                abill loaiphieu      = abillBUS.SearchAbillByID(maloaip);
                aABC  douutien       = ABCDAO.TimDoUuTien(dout);
                if (douutien != null)
                {
                    lblDoUutien.Text = douutien.NameABC + "-" + douutien.NameABCTW;
                }
                string tenloaiphieuVN = loaiphieu.abname;
                string tenloaiphieuTW = loaiphieu.abnameTW;
                if (phieucu == null)
                {
                    idofPhieuCu.Visible = false;
                }
                else
                {
                    idofPhieuCu.Visible = true;
                }
                lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW;
                if (lydokhongduyet == null)
                {
                    lblLyDo.Visible     = false;
                    lblNhanLyDo.Visible = false;
                }
                else
                {
                    lblLyDo.Visible     = true;
                    lblNhanLyDo.Visible = true;
                    lblLyDo.Text        = lydokhongduyet.lydokhongduyet;
                }
                lblTieuDe.Text = dt.Rows[0]["mytitle"].ToString() + "-" + dt.Rows[0]["pdnsubject"].ToString();
                // string ngay = DateTime.Parse(phieu.CFMDate0.ToShortDateString()).ToString("dd/MM/yyyy");
                txtSoPhieu.Text = maphieu.ToString().Trim();
                string dinhdang = dt.Rows[0]["CFMDate0"].ToString();
                string thang    = dinhdang.Substring(3, 2);
                string ngay     = dinhdang.Substring(0, 2);
                string nam      = dinhdang.Substring(6, 4);
                lblNgaytao.Text       = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
                lbldonvidenghi.Text   = bp.DepName;
                lbSoPhieu.Text        = maphieu;
                lblMucDichSuDung.Text = dt.Rows[0]["UseIntent"].ToString();
            }
            List <Abcon> listchitietxetduyet = AbconBUS.QryChiTietXetDuyetTheoIdVanBan(maphieu, true);
            // Abcon captruoc = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(maphieu, macongty);

            {
                if (user0 != null)
                {
                    TextBox1.Text        = user0.USERID;
                    ImageLevel0.Width    = 100;
                    ImageLevel0.Height   = 100;
                    ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
                }
                else
                {
                    ImageLevel0.ImageUrl = null;
                }
            }
            //Abcon caphientai = AbconBUS.LayCapDuyetHienTaiCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);
            foreach (Abcon abcon in listchitietxetduyet)
            {
                if (abcon == null)
                {
                    ImageLevel1.ImageUrl = null;
                    ImageLevel2.ImageUrl = null;
                    ImageLevel3.ImageUrl = null;
                    ImageLevel4.ImageUrl = null;
                    ImageLevel5.ImageUrl = null;
                    ImageLevel6.ImageUrl = null;

                    return;
                }
                else
                {
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();

                    if (abcon.IDCapDuyet == 5 || abcon.IDCapDuyet == 6)
                    {
                        Busers2 nguoiduyet1 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        //ChucVu chuc = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox2.Text        = nguoiduyet1.USERID;
                            ImageLevel1.Width    = 100;
                            ImageLevel1.Height   = 100;
                            ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhoto1.ashx?USERID=" + TextBox2.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox2.Text        = nguoiduyet1.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel1.Width    = 100;
                                ImageLevel1.Height   = 100;
                                ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel1.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 7)
                    {
                        if (capduyet == null)
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox3.Text   = nguoiduyet2.USERID;
                                Image1.Width    = 100;
                                Image1.Height   = 100;
                                Image1.ImageUrl = "~/ProcessSignature/MyPhoto8.ashx?USERID=" + TextBox3.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    TextBox3.Text      = nguoiduyet2.USERID;
                                    txtKhongDuyet.Text = "027276";
                                    Image1.Width       = 100;
                                    Image1.Height      = 100;
                                    Image1.ImageUrl    = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    Image1.ImageUrl = null;
                                }
                            }
                            capduyet = abcon.IDCapDuyet.ToString();
                        }
                        else
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox4.Text        = nguoiduyet2.USERID;
                                ImageLevel2.Width    = 100;
                                ImageLevel2.Height   = 100;
                                ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhoto2.ashx?USERID=" + TextBox4.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    txtKhongDuyet.Text   = "027276";
                                    TextBox4.Text        = nguoiduyet2.USERID;
                                    ImageLevel2.Width    = 100;
                                    ImageLevel2.Height   = 100;
                                    ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    ImageLevel2.ImageUrl = null;
                                }
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 9)
                    {
                        Busers2 nguoiduyet3 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet3.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox5.Text        = nguoiduyet3.USERID;
                            ImageLevel3.Width    = 100;
                            ImageLevel3.Height   = 100;
                            ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhoto3.ashx?USERID=" + TextBox5.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox5.Text        = nguoiduyet3.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel3.Width    = 100;
                                ImageLevel3.Height   = 100;
                                ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel3.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 13)
                    {
                        Busers2 nguoiduyet4 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet4.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox6.Text        = nguoiduyet4.USERID;
                            ImageLevel4.Width    = 100;
                            ImageLevel4.Height   = 100;
                            ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhoto4.ashx?USERID=" + TextBox6.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox6.Text        = nguoiduyet4.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel4.Width    = 100;
                                ImageLevel4.Height   = 100;
                                ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel4.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 15 || abcon.IDCapDuyet == 14)
                    {
                        Busers2 nguoiduyet5 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet5.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox7.Text        = nguoiduyet5.USERID;
                            ImageLevel5.Width    = 100;
                            ImageLevel5.Height   = 100;
                            ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhoto5.ashx?USERID=" + TextBox7.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                txtKhongDuyet.Text   = "027276";
                                TextBox7.Text        = nguoiduyet5.USERID;
                                ImageLevel5.Width    = 100;
                                ImageLevel5.Height   = 100;
                                ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel5.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 16)
                    {
                        Busers2 nguoiduyet6 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox8.Text        = nguoiduyet6.USERID;
                            ImageLevel6.Width    = 100;
                            ImageLevel6.Height   = 100;
                            ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhoto6.ashx?USERID=" + TextBox8.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox8.Text        = nguoiduyet6.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel6.Width    = 100;
                                ImageLevel6.Height   = 100;
                                ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel6.ImageUrl = null;
                            }
                        }
                    }

                    else if (abcon.IDCapDuyet == 17)
                    {
                        Busers2 nguoiduyet7 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet7.IDChucVu, macongty);

                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox9.Text        = nguoiduyet7.USERID;
                            ImageLevel7.Width    = 100;
                            ImageLevel7.Height   = 100;
                            ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhoto7.ashx?USERID=" + TextBox9.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox9.Text        = nguoiduyet7.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel7.Width    = 100;
                                ImageLevel7.Height   = 100;
                                ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel7.ImageUrl = null;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        protected void btnAccep_Click(object sender, EventArgs e)
        {
            try
            {
                string  macongty       = Session["congty"].ToString();
                string  maphieu        = Session["maphieu"].ToString();
                string  ngonngu        = Session["languege"].ToString();
                string  manguoidung    = Session["user"].ToString();
                Busers2 KiemTraMatKhau = UserDAO.KiemTraMatKhauXetDuyetCuaNguoiDuyet(manguoidung, macongty, libraly.Encryption(txtSecure.Text));
                if (KiemTraMatKhau == null)
                {
                    if (ngonngu == "lbl_VN")
                    {
                        lbThongBao.Text = "Mật khẩu là không chính xác";
                    }
                    else if (ngonngu == "lbl_TW")
                    {
                        lbThongBao.Text = "密码不正确";
                    }
                    else if (ngonngu == "lbl_EN")
                    {
                        lbThongBao.Text = "The password is incorrect";
                    }
                }
                else
                {
                    Busers2 user = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                    //string abc = libraly.Encryption(txtSecure.Text);
                    if (user != null && libraly.Encryption(txtSecure.Text).Equals(user.Password2))
                    {
                        bool   duyet  = (rdApproval.Checked) ? true : ((rdNotApproval.Checked) ? false : true);
                        string ghichu = txtComment.Text;
                        //Task temp = Task.Factory.StartNew(() => Until.XetDuyet(maphieu, Until.uNhanVien, duyet, ghichu));
                        //{
                        //    if (temp != null)
                        //    {
                        //        lbThongBao.Text = "Approval success";

                        //    }
                        //}

                        //  temp.RunSynchronously();
                        //Task temp = Task.Factory.StartNew(() => Until.XetDuyet(maphieu, Until.uNhanVien, duyet, ghichu));
                        Until.XetDuyet(maphieu, user, duyet, ghichu, macongty);
                        // kiem tra : lay chi tiet theo nguoi duyet neu   nguoi.abresult==true  di qua trang khac nguoc lai khong xet duyet
                        Abcon chitietduyet = AbconBUS.LayChiTietXetDuyetTheoNhanVienDuyet(maphieu, manguoidung);

                        if (chitietduyet == null)
                        {
                            return;
                        }
                        else
                        {
                            if (chitietduyet.abrult == true)
                            {
                                if (ngonngu == "lbl_VN")
                                {
                                    lbThongBao.Text = "Bạn đã xét duyệt thành công";
                                }
                                else if (ngonngu == "lbl_TW")
                                {
                                    lbThongBao.Text = "审核成功";
                                }
                                else if (ngonngu == "lbl_EN")
                                {
                                    lbThongBao.Text = "Approval Success!";
                                }
                                if (chitietduyet.abtype == "PDN2")
                                {
                                    Response.Redirect("phieumuahangD.aspx");
                                }
                                else
                                {
                                    Response.Redirect("frmDetails2D.aspx");
                                }
                            }
                            else
                            {
                                if (chitietduyet.Yn == 2)
                                {
                                    if (ngonngu == "lbl_VN")
                                    {
                                        lbThongBao.Text = "Bạn đã không xét duyệt phiếu này";
                                    }
                                    else if (ngonngu == "lbl_TW")
                                    {
                                        lbThongBao.Text = "本单未审核";
                                    }
                                    else if (ngonngu == "lbl_EN")
                                    {
                                        lbThongBao.Text = "Not Approval ";
                                    }
                                    if (chitietduyet.abtype == "PDN2")
                                    {
                                        Response.Redirect("phieumuahangD.aspx");
                                    }
                                    else
                                    {
                                        Response.Redirect("frmDetails2D.aspx");
                                    }
                                }
                            }
                        }
                    }
                }
                //  Response.Redirect("frmDetails2.aspx");
            }
            catch (Exception ex)
            {
                lbthongbaoLoi.Text = "loi" + ex.Message;
            }
            // Response.Redirect("frmDetails2.aspx");
        }
Esempio n. 11
0
        protected void btnTrinhDuyet_Click(object sender, EventArgs e)
        {
            List <Abcon> ctxdlist = new List <Abcon>();
            pdna         phieudn  = new pdna();

            try
            {
                string maloai  = Session["loaiphieu"].ToString();
                string phieu   = Session["maphieu"].ToString();
                string bophan  = Session["bp"].ToString();
                string noidung = Session["noidung"].ToString();
                string tieude  = Session["tieude"].ToString();
                string congty  = Session["congty"].ToString();
                string user    = Session["user"].ToString();


                //string ngaytao = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd");
                pdna phieun = new pdna();
                {
                    phieun.GSBH       = congty;
                    phieun.pdno       = phieu;
                    phieun.pddepid    = bophan;
                    phieun.mytitle    = tieude;
                    phieun.pdmemovn   = noidung;
                    phieun.CFMDate0   = DateTime.Parse(DateTime.Now.ToShortDateString());
                    phieun.USERID     = user;
                    phieun.CFMID0     = user;
                    phieun.bixoa      = false;
                    phieun.YN         = 0;
                    phieun.USERDATE   = DateTime.Parse(DateTime.Now.ToShortDateString());
                    phieun.ABC        = Convert.ToInt32(DropUutien.SelectedValue.ToString());
                    phieun.LevelDoing = 1;
                }
                db.pdnas.InsertOnSubmit(phieun);
                db.SubmitChanges();
                for (int i = 0; i < TreeView1.Nodes[0].ChildNodes.Count; i++)
                {
                    TreeNode tn = TreeView1.Nodes[0].ChildNodes[i];
                    tn.Value = (i + 1).ToString();

                    foreach (TreeNode node in tn.ChildNodes)
                    {
                        Abcon vb = new Abcon();
                        if (ctxds.TryGetValue(tn.Text, out vb))
                        {
                            // vb.IDCT = MA_CTXetDuyet + (AbconBUS.DemSoLuongMaVanBan_CapDuyet() + 1).ToString();
                            vb.abde    = int.Parse(tn.Value.ToString());
                            vb.pdno    = phieu;
                            vb.cothutu = true;
                            vb.Abstep  = int.Parse(tn.Value.ToString());
                            AbconBUS.ThemChiTiet(vb);
                            ctxdlist.Add(vb);
                        }
                    }
                }
                foreach (string str in lstIdNguoiNhan)
                {
                    Abcon   temp        = AbconBUS.TimKiemVanBanDenTheoIdVanBan_IdNguoiNhan(phieudn.pdno, str, phieudn.CFMID0, false);
                    string  manguoidung = Session["user"].ToString();
                    string  macongty    = Session["congty"].ToString();
                    Busers2 nguoi       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                    if (temp != null)
                    {
                        continue;
                    }
                    Abcon vbd = new Abcon();
                    vbd.from_user = nguoi.USERID;
                    vbd.Auditor   = str;
                    //vbd.pdnoreceived = phieudn.pdno;
                    vbd.from_depart = phieudn.pddepid;
                    vbd.bixoa       = true;
                    AbconBUS.ThemChiTiet(vbd);
                }
            }
            catch (TimeoutException ex)
            {
                foreach (Abcon ct in ctxdlist)
                {
                    AbconBUS.XoaChiTiet(ct.IDCT, false);
                }
                string  manguoidung = Session["user"].ToString();
                string  macongty    = Session["congty"].ToString();
                Busers2 nguoi       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);

                pdnaBUS.XoaVanBan(phieudn, false);
                Until.WriteFileLogServer(nguoi.USERNAME + "\tTạo văn bản\t" + phieudn.pdno + "\tThất bại.");
                LbThongBao.Text = "Lỗi trong quá trình xử lý";
            }
            catch (Exception)
            {
                foreach (Abcon ct in ctxdlist)
                {
                    AbconBUS.XoaChiTiet(ct.IDCT, false);
                }

                string  manguoidung = Session["user"].ToString();
                string  macongty    = Session["congty"].ToString();
                Busers2 nguoi       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                pdnaBUS.XoaVanBan(phieudn, false);
                Until.WriteFileLogServer(nguoi.USERNAME + "\tTạo văn bản\t" + phieudn.pdno + "\tThất bại.");
                LbThongBao.Text = "Lỗi trong quá trình xử lý";
            }
        }
Esempio n. 12
0
        private void HienThi()
        {
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();
            //string bophan = Session["bophan"].ToString();
            //string loaiphieu = Session["loaiphieu"].ToString();
            string      macongty = Session["congty"].ToString();
            pdna        phieu    = pdnaBUS.TimVanBanTheoMa(maphieu, macongty, true);
            Busers2     users    = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);
            BDepartment bp       = BDepartmentDAO.TimMaDonVi(phieu.pddepid, macongty);

            Session["mabophan"] = bp.ID;
            Session["bophan"]   = bp.DepName;
            lbBoPhan.Text       = bp.DepName;
            lbSoPhieu.Text      = maphieu;
            lbNoiDung.Text      = phieu.pdmemovn;
            lbNoidungdich.Text  = phieu.NoiDungDich;
            //lbLoaiPhieu.Text = loaiphieu;
            // lbNgay.Text = phieu.CFMDate0.ToString();
            txtSoPhieu.Text = maphieu.ToString().Trim();
            string dinhdang = phieu.CFMDate0.ToString();
            string ngay     = dinhdang.Substring(3, 2);
            string thang    = dinhdang.Substring(0, 2);
            string nam      = dinhdang.Substring(6, 4);

            lbNgay.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
            //Abcon abcon6 = AbconBUS.LaymaVanBanTheoCapDuyet6(maphieu, 6);
            List <Abcon> listchitietxetduyet = AbconBUS.QryChiTietXetDuyetTheoIdVanBan(maphieu, true);
            // Abcon captruoc = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(maphieu, macongty);

            {
                if (user0 != null)
                {
                    TextBox1.Text        = user0.USERID;
                    ImageLevel0.Width    = 100;
                    ImageLevel0.Height   = 100;
                    ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
                }
                else
                {
                    ImageLevel0.ImageUrl = null;
                }
            }
            //Abcon caphientai = AbconBUS.LayCapDuyetHienTaiCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);
            foreach (Abcon abcon in listchitietxetduyet)
            {
                if (abcon == null)
                {
                    ImageLevel1.ImageUrl = null;
                    ImageLevel2.ImageUrl = null;
                    ImageLevel3.ImageUrl = null;
                    ImageLevel4.ImageUrl = null;
                    ImageLevel5.ImageUrl = null;
                    ImageLevel6.ImageUrl = null;

                    return;
                }
                else
                {
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();

                    if (abcon.IDCapDuyet == 5 || abcon.IDCapDuyet == 6)
                    {
                        Busers2 nguoiduyet1 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        //ChucVu chuc = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox2.Text        = nguoiduyet1.USERID;
                            ImageLevel1.Width    = 100;
                            ImageLevel1.Height   = 100;
                            ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhoto1.ashx?USERID=" + TextBox2.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox2.Text        = nguoiduyet1.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel1.Width    = 100;
                                ImageLevel1.Height   = 100;
                                ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel1.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 7)
                    {
                        if (capduyet == null)
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox3.Text   = nguoiduyet2.USERID;
                                Image1.Width    = 100;
                                Image1.Height   = 100;
                                Image1.ImageUrl = "~/ProcessSignature/MyPhoto8.ashx?USERID=" + TextBox3.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    TextBox3.Text      = nguoiduyet2.USERID;
                                    txtKhongDuyet.Text = "027276";
                                    Image1.Width       = 100;
                                    Image1.Height      = 100;
                                    Image1.ImageUrl    = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    Image1.ImageUrl = null;
                                }
                            }
                            capduyet = abcon.IDCapDuyet.ToString();
                        }
                        else
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox4.Text        = nguoiduyet2.USERID;
                                ImageLevel2.Width    = 100;
                                ImageLevel2.Height   = 100;
                                ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhoto2.ashx?USERID=" + TextBox4.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    //Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    //if (khongduyet != null)
                                    //{
                                    //    lblLyDo.Visible = true;
                                    //    lblLyDo.Text = khongduyet.lydokhongduyet;
                                    //}

                                    txtKhongDuyet.Text   = "027276";
                                    TextBox4.Text        = nguoiduyet2.USERID;
                                    ImageLevel2.Width    = 100;
                                    ImageLevel2.Height   = 100;
                                    ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    ImageLevel2.ImageUrl = null;
                                }
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 9)
                    {
                        Busers2 nguoiduyet3 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet3.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox5.Text        = nguoiduyet3.USERID;
                            ImageLevel3.Width    = 100;
                            ImageLevel3.Height   = 100;
                            ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhoto3.ashx?USERID=" + TextBox5.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                //Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                //if (khongduyet != null)
                                //{
                                //    lblLyDo.Visible = true;
                                //    lblLyDo.Text = khongduyet.lydokhongduyet;
                                //}

                                TextBox5.Text        = nguoiduyet3.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel3.Width    = 100;
                                ImageLevel3.Height   = 100;
                                ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel3.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 13)
                    {
                        Busers2 nguoiduyet4 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet4.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox6.Text        = nguoiduyet4.USERID;
                            ImageLevel4.Width    = 100;
                            ImageLevel4.Height   = 100;
                            ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhoto4.ashx?USERID=" + TextBox6.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                //Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                //if (khongduyet != null)
                                //{
                                //    lblLyDo.Visible = true;
                                //    lblLyDo.Text = khongduyet.lydokhongduyet;
                                //}

                                TextBox6.Text        = nguoiduyet4.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel4.Width    = 100;
                                ImageLevel4.Height   = 100;
                                ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel4.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 15 || abcon.IDCapDuyet == 14)
                    {
                        Busers2 nguoiduyet5 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet5.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox7.Text        = nguoiduyet5.USERID;
                            ImageLevel5.Width    = 100;
                            ImageLevel5.Height   = 100;
                            ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhoto5.ashx?USERID=" + TextBox7.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                txtKhongDuyet.Text   = "027276";
                                TextBox7.Text        = nguoiduyet5.USERID;
                                ImageLevel5.Width    = 100;
                                ImageLevel5.Height   = 100;
                                ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel5.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 16)
                    {
                        Busers2 nguoiduyet6 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox8.Text        = nguoiduyet6.USERID;
                            ImageLevel6.Width    = 100;
                            ImageLevel6.Height   = 100;
                            ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhoto6.ashx?USERID=" + TextBox8.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                //Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                //if (khongduyet != null)
                                //{
                                //    lblLyDo.Visible = true;
                                //    lblLyDo.Text = khongduyet.lydokhongduyet;
                                //}

                                TextBox8.Text        = nguoiduyet6.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel6.Width    = 100;
                                ImageLevel6.Height   = 100;
                                ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel6.ImageUrl = null;
                            }
                        }
                    }

                    else if (abcon.IDCapDuyet == 17)
                    {
                        Busers2 nguoiduyet7 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet7.IDChucVu, macongty);

                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox9.Text        = nguoiduyet7.USERID;
                            ImageLevel7.Width    = 100;
                            ImageLevel7.Height   = 100;
                            ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhoto7.ashx?USERID=" + TextBox9.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                //Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                //if (khongduyet != null)
                                //{
                                //    lblLyDo.Visible = true;
                                //    lblLyDo.Text = khongduyet.lydokhongduyet;
                                //}

                                TextBox9.Text        = nguoiduyet7.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel7.Width    = 100;
                                ImageLevel7.Height   = 100;
                                ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel7.ImageUrl = null;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 13
0
        private void HienThi()
        {
            string maphieu = Session["maphieu"].ToString();

            string macongty    = Session["congty"].ToString();
            string manguoidung = Session["user"].ToString();
            //pdna phieu = pnaDAO.TimKiemVanBanTheoMaNguoiTaoCongTy(maphieu, manguoidung, macongty, true);
            DataTable dt = dalP.TimPhieuTheoMaNguoiTao(maphieu, macongty, manguoidung);

            if (dt.Rows.Count > 0)
            {
                string      ngaythang   = dt.Rows[0]["CFMDate0"].ToString();
                string      madonvi     = dt.Rows[0]["pddepid"].ToString().Trim();
                string      maloaiphieu = dt.Rows[0]["Abtype"].ToString().Trim();
                string      noidung     = dt.Rows[0]["pdmemovn"].ToString().Trim();
                string      tieude      = dt.Rows[0]["mytitle"].ToString().Trim();
                string      tieudedich  = dt.Rows[0]["pdnsubject"].ToString().Trim();
                string      noidungdich = dt.Rows[0]["NoiDungDich"].ToString();
                int         Yn          = int.Parse(dt.Rows[0]["Yn"].ToString());
                BDepartment bophan      = BDepartmentDAO.TimMaDonVi(madonvi, macongty);
                abill       loaiphieu   = abillDAO.SearchAbillByID(maloaiphieu);
                Busers2     users       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                aABC        douutien    = ABCDAO.TimDoUuTien(int.Parse(dt.Rows[0]["ABC"].ToString()));
                if (douutien != null)
                {
                    lblDoUutien.Text = douutien.NameABC + "-" + douutien.NameABCTW;
                }
                string tenloaiphieuVN = loaiphieu.abname;
                string tenloaiphieuTW = loaiphieu.abnameTW;

                lbLoaiPhieu.Text   = tenloaiphieuVN + " " + tenloaiphieuTW;
                lblTieuDe.Text     = tieude + " " + tieudedich;
                lbBoPhan.Text      = bophan.DepName;
                lbSoPhieu.Text     = maphieu;
                lbNoiDung.Text     = noidung;
                LbNoiDungDich.Text = noidungdich;
                txtSoPhieu.Text    = maphieu.ToString().Trim();
                string dinhdang = ngaythang;
                string thang    = dinhdang.Substring(3, 2);
                string ngay     = dinhdang.Substring(0, 2);
                string nam      = dinhdang.Substring(6, 4);
                lbNgay.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
                Abcon timphieuchuaduyet = AbconDAO.TimPhieuChuaDuyet(maphieu, macongty);
                if (timphieuchuaduyet == null)
                {
                    btnHuy.Enabled = true;
                }
                else
                {
                    btnHuy.Enabled = false;
                }
            }

            //Abcon abcon6 = AbconBUS.LaymaVanBanTheoCapDuyet6(maphieu, 6);
            List <Abcon> listchitietxetduyet = AbconBUS.QryChiTietXetDuyetTheoIdVanBan(maphieu, true);
            // Abcon captruoc = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(maphieu, macongty);

            {
                if (user0 != null)
                {
                    TextBox1.Text        = user0.USERID;
                    ImageLevel0.Width    = 100;
                    ImageLevel0.Height   = 100;
                    ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
                }
                else
                {
                    ImageLevel0.ImageUrl = null;
                }
            }
            //Abcon caphientai = AbconBUS.LayCapDuyetHienTaiCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);
            foreach (Abcon abcon in listchitietxetduyet)
            {
                if (abcon == null)
                {
                    ImageLevel1.ImageUrl = null;
                    ImageLevel2.ImageUrl = null;
                    ImageLevel3.ImageUrl = null;
                    ImageLevel4.ImageUrl = null;
                    ImageLevel5.ImageUrl = null;
                    ImageLevel6.ImageUrl = null;

                    return;
                }
                else
                {
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();

                    if (abcon.IDCapDuyet == 5 || abcon.IDCapDuyet == 6)
                    {
                        Busers2 nguoiduyet1 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        //ChucVu chuc = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox2.Text        = nguoiduyet1.USERID;
                            ImageLevel1.Width    = 100;
                            ImageLevel1.Height   = 100;
                            ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhoto1.ashx?USERID=" + TextBox2.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox2.Text        = nguoiduyet1.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel1.Width    = 100;
                                ImageLevel1.Height   = 100;
                                ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel1.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 7)
                    {
                        if (capduyet == null)
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox3.Text   = nguoiduyet2.USERID;
                                Image1.Width    = 100;
                                Image1.Height   = 100;
                                Image1.ImageUrl = "~/ProcessSignature/MyPhoto8.ashx?USERID=" + TextBox3.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    TextBox3.Text      = nguoiduyet2.USERID;
                                    txtKhongDuyet.Text = "027276";
                                    Image1.Width       = 100;
                                    Image1.Height      = 100;
                                    Image1.ImageUrl    = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    Image1.ImageUrl = null;
                                }
                            }
                            capduyet = abcon.IDCapDuyet.ToString();
                        }
                        else
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox4.Text        = nguoiduyet2.USERID;
                                ImageLevel2.Width    = 100;
                                ImageLevel2.Height   = 100;
                                ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhoto2.ashx?USERID=" + TextBox4.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    txtKhongDuyet.Text   = "027276";
                                    TextBox4.Text        = nguoiduyet2.USERID;
                                    ImageLevel2.Width    = 100;
                                    ImageLevel2.Height   = 100;
                                    ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    ImageLevel2.ImageUrl = null;
                                }
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 9)
                    {
                        Busers2 nguoiduyet3 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet3.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox5.Text        = nguoiduyet3.USERID;
                            ImageLevel3.Width    = 100;
                            ImageLevel3.Height   = 100;
                            ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhoto3.ashx?USERID=" + TextBox5.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox5.Text        = nguoiduyet3.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel3.Width    = 100;
                                ImageLevel3.Height   = 100;
                                ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel3.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 13)
                    {
                        Busers2 nguoiduyet4 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet4.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox6.Text        = nguoiduyet4.USERID;
                            ImageLevel4.Width    = 100;
                            ImageLevel4.Height   = 100;
                            ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhoto4.ashx?USERID=" + TextBox6.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox6.Text        = nguoiduyet4.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel4.Width    = 100;
                                ImageLevel4.Height   = 100;
                                ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel4.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 15 || abcon.IDCapDuyet == 14)
                    {
                        Busers2 nguoiduyet5 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet5.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox7.Text        = nguoiduyet5.USERID;
                            ImageLevel5.Width    = 100;
                            ImageLevel5.Height   = 100;
                            ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhoto5.ashx?USERID=" + TextBox7.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                txtKhongDuyet.Text   = "027276";
                                TextBox7.Text        = nguoiduyet5.USERID;
                                ImageLevel5.Width    = 100;
                                ImageLevel5.Height   = 100;
                                ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel5.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 16)
                    {
                        Busers2 nguoiduyet6 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox8.Text        = nguoiduyet6.USERID;
                            ImageLevel6.Width    = 100;
                            ImageLevel6.Height   = 100;
                            ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhoto6.ashx?USERID=" + TextBox8.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox8.Text        = nguoiduyet6.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel6.Width    = 100;
                                ImageLevel6.Height   = 100;
                                ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel6.ImageUrl = null;
                            }
                        }
                    }

                    else if (abcon.IDCapDuyet == 17)
                    {
                        Busers2 nguoiduyet7 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet7.IDChucVu, macongty);

                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox9.Text        = nguoiduyet7.USERID;
                            ImageLevel7.Width    = 100;
                            ImageLevel7.Height   = 100;
                            ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhoto7.ashx?USERID=" + TextBox9.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox9.Text        = nguoiduyet7.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel7.Width    = 100;
                                ImageLevel7.Height   = 100;
                                ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel7.ImageUrl = null;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        private void HienThi()
        {
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();
            string bophan     = Session["bophan"].ToString();
            string loaiphieu  = Session["loaiphieu"].ToString();
            string macongty   = Session["congty"].ToString();

            var     list  = pdnaBUS.LayNoiDungVanBanTheoIDPhieuIDNhanVien(maphieu, nguoiduyet, macongty);
            Busers2 users = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);


            lbBoPhan.Text    = bophan;
            lbSoPhieu.Text   = maphieu;
            lbNoiDung.Text   = list.pdmemovn;
            lbLoaiPhieu.Text = loaiphieu;
            lbNgay.Text      = list.CFMDate0.ToString();
            //Abcon abcon6 = AbconBUS.LaymaVanBanTheoCapDuyet6(maphieu, 6);
            List <Abcon> listchitietxetduyet = AbconBUS.QryChiTietXetDuyetTheoIdVanBan(maphieu, true);
            // Abcon captruoc = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(maphieu, macongty);

            {
                if (user0 != null)
                {
                    TextBox1.Text        = user0.USERID;
                    ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
                }
                else
                {
                    ImageLevel0.ImageUrl = null;
                }
            }
            //Abcon caphientai = AbconBUS.LayCapDuyetHienTaiCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);
            foreach (Abcon abcon in listchitietxetduyet)
            {
                if (abcon == null)
                {
                    ImageLevel1.ImageUrl = null;
                    ImageLevel2.ImageUrl = null;
                    ImageLevel3.ImageUrl = null;
                    ImageLevel4.ImageUrl = null;
                    ImageLevel5.ImageUrl = null;
                    ImageLevel6.ImageUrl = null;

                    return;
                }
                else
                {
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();
                    //if (max == 5)
                    //{
                    //    ImageLevel1.Visible = false;

                    //}
                    //else
                    //{

                    //}
                    if (abcon.IDCapDuyet == 1)
                    {
                        Busers2 nguoiduyet1 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        //ChucVu chuc = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox1.Text        = nguoiduyet1.USERID;
                            ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhoto1.ashx?USERID=" + TextBox1.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox1.Text = "027276";

                                ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox1.Text;
                            }
                            else
                            {
                                ImageLevel1.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 2)
                    {
                        Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox2.Text        = nguoiduyet2.USERID;
                            ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhoto2.ashx?USERID=" + TextBox2.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox2.Text = "027276";

                                ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox2.Text;
                            }
                            else
                            {
                                ImageLevel2.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 3)
                    {
                        Busers2 nguoiduyet3 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet3.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox3.Text        = nguoiduyet3.USERID;
                            ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhoto3.ashx?USERID=" + TextBox3.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox3.Text = "027276";

                                ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox3.Text;
                            }
                            else
                            {
                                ImageLevel3.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 4)
                    {
                        Busers2 nguoiduyet4 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet4.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox4.Text        = nguoiduyet4.USERID;
                            ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhoto4.ashx?USERID=" + TextBox4.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox4.Text = "027276";

                                ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox4.Text;
                            }
                            else
                            {
                                ImageLevel4.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 5)
                    {
                        Busers2 nguoiduyet5 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet5.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 2)
                        {
                            TextBox5.Text        = nguoiduyet5.USERID;
                            ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhoto5.ashx?USERID=" + TextBox5.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox5.Text = "027276";

                                ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox5.Text;
                            }
                            else
                            {
                                ImageLevel5.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 6)
                    {
                        Busers2 nguoiduyet6 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox6.Text = nguoiduyet6.USERID;

                            ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhoto6.ashx?USERID=" + TextBox6.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox6.Text = "027276";

                                ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox6.Text;
                            }
                            else
                            {
                                ImageLevel6.ImageUrl = null;
                            }
                        }
                    }

                    else if (abcon.IDCapDuyet == 7)
                    {
                        Busers2 nguoiduyet7 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet7.IDChucVu, macongty);

                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox7.Text        = nguoiduyet7.USERID;
                            ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhoto7.ashx?USERID=" + TextBox7.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                TextBox7.Text = "027276";

                                ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + TextBox7.Text;
                            }
                            else
                            {
                                ImageLevel7.ImageUrl = null;
                            }
                        }
                    }
                }
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string macongty = DropCty.SelectedValue.ToString();

            string madonvi = DropDownLDonVi.SelectedValue.ToString();

            string manguoiduyet = txtNguoiDuyet.Text;

            int buocduyet = int.Parse(txtBucoDuyet.Text);

            BDepartment              donvi     = BDepartmentDAO.TimMaDonVi(madonvi, macongty);
            AbDepartmentType         loaidonvi = LoaiDonViDAO.TimMaLoaiDonVi(int.Parse(donvi.DepartmentTypeID.ToString()), macongty);
            QuyTrinhXetDuyetCuaCanBo quytrinh  = new QuyTrinhXetDuyetCuaCanBo();

            //quytrinh.IDQuyTrinh = maquytrinh + (QuyTrinhXetDuyetDAO.DemQuyTrinhXetDuyet() + 1).ToString();
            quytrinh.BADEPID    = madonvi;
            quytrinh.tendonviTW = donvi.DepName;
            quytrinh.GSBH       = macongty;
            //quytrinh.BuocDuyet = buocduyet;

            quytrinh.IDLoaiDonVi          = loaidonvi.DepartmentTypeID;
            quytrinh.DepartmentTypeNameTW = loaidonvi.DepartmentTypeNameTW;

            if (DropDownLoaiPhieu.SelectedValue.ToString().Trim() == "")
            {
                quytrinh.abtype = "PDN1";
                abill timloai = abillBUS.SearchAbillByID(quytrinh.abtype);
                quytrinh.abtypenameTW = timloai.abnameTW;
            }
            else
            {
                quytrinh.abtype = DropDownLoaiPhieu.SelectedValue.ToString();
                abill timloai = abillBUS.SearchAbillByID(DropDownLoaiPhieu.SelectedValue.ToString());
                quytrinh.abtypenameTW = timloai.abnameTW;
            }


            if (CheckThongQuaDonVi.Checked == true)
            {
                quytrinh.DonViThongQua = DropDownDonViThongQua.SelectedValue.ToString();
                BDepartment donvithongqua = BDepartmentDAO.TimMaDonVi(DropDownDonViThongQua.SelectedValue.ToString(), macongty);
                quytrinh.tendonvithongqua = donvithongqua.DepName;
                Busers2 timnguoi = UserDAO.TimMaNhanVienTheoBoPhan(txtNguoiDuyet.Text, donvithongqua.ID, macongty);
                if (timnguoi == null)
                {
                    quytrinh.NguoiDuyet = null;
                }
                else
                {
                    quytrinh.NguoiDuyet = txtNguoiDuyet.Text;
                    quytrinh.USERNAME   = timnguoi.USERNAME;
                    ChucVu chuc = ChucVuDAO.TimMaChucVu(timnguoi.IDChucVu, macongty);
                    quytrinh.IDChucVu         = chuc.IDChucVu;
                    quytrinh.tendonvithongqua = chuc.TenChucVuTiengHoa;
                    quytrinh.IDCapDuyet       = timnguoi.IDCapDuyet;
                }
            }
            else
            {
                quytrinh.DonViThongQua = null;
                quytrinh.NguoiDuyet    = txtNguoiDuyet.Text;
                Busers2 nguoi = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                quytrinh.USERNAME = nguoi.USERNAME;
                ChucVu chuc = ChucVuDAO.TimMaChucVu(nguoi.IDChucVu, macongty);
                quytrinh.IDChucVu         = chuc.IDChucVu;
                quytrinh.tendonvithongqua = chuc.TenChucVuTiengHoa;
                quytrinh.IDCapDuyet       = nguoi.IDCapDuyet;
            }

            #region ThemQuyTrinh
            List <QuyTrinhXetDuyetCuaCanBo> ListQT1 = QuyTrinhXetDuyetCuaCanBoDAO.LayDanhSachQuyTrinhTheoCapDuyet(quytrinh.BADEPID, quytrinh.GSBH, quytrinh.abtype);
            int max1 = (from ct1 in ListQT1
                        select int.Parse(ct1.BuocDuyet.ToString())).Max();
            quytrinh.BuocDuyet = max1 + 1;


            QuyTrinhXetDuyetCuaCanBo timquynguoi = QuyTrinhXetDuyetCuaCanBoDAO.TimNguoiTrongQuyTrinh(quytrinh.NguoiDuyet, quytrinh.abtype, quytrinh.BADEPID, quytrinh.GSBH);
            Busers2 timnguoiduyettrong           = UserDAO.TimNhanVienTheoMa(quytrinh.NguoiDuyet, quytrinh.GSBH);

            if (timquynguoi == null && quytrinh.NguoiDuyet != null)
            {
                QuyTrinhXetDuyetCuaCanBoDAO.ThemQuyTrinhXetDuyetCuaCanBo(quytrinh);// them quy trinh
                List <QuyTrinhXetDuyetCuaCanBo> ListQT = QuyTrinhXetDuyetCuaCanBoDAO.LayDanhSachQuyTrinhTheoCapDuyet(quytrinh.BADEPID, quytrinh.GSBH, quytrinh.abtype);
                int min = (from ct1 in ListQT
                           select int.Parse(ct1.BuocDuyet.ToString())).Min();
                int min1 = (from ct1 in ListQT
                            select int.Parse(ct1.IDCapDuyet.ToString())).Min();
                foreach (QuyTrinhXetDuyetCuaCanBo qt in ListQT)
                {
                    QuyTrinhXetDuyetCuaCanBo laynguoidautien = QuyTrinhXetDuyetCuaCanBoDAO.TimCapTiepTheoTrongQuyTrinh1(qt.BADEPID, qt.GSBH, qt.abtype, min1);
                    if (qt.NguoiDuyet == laynguoidautien.NguoiDuyet)
                    {
                        QuyTrinhXetDuyetCuaCanBo quy = new QuyTrinhXetDuyetCuaCanBo();
                        quy.BuocDuyet  = 1;
                        quy.IDQuyTrinh = qt.IDQuyTrinh;

                        buoc     = 1;
                        capduyet = int.Parse(qt.IDCapDuyet.ToString());
                        QuyTrinhXetDuyetCuaCanBoDAO.CapNhatQuyTrinh(quy);
                    }
                    else
                    {
                        //QuyTrinhXetDuyet laybuoc= QuyTrinhXetDuyetDAO.TimBuocTiepTheoTrongQuyTrinh1(qt.BADEPID, qt.GSBH, qt.abtype, int.Parse(qt.BuocDuyet.ToString()));
                        if (qt.DonViThongQua == null && capduyet == qt.IDCapDuyet)
                        {
                            QuyTrinhXetDuyetCuaCanBo quy = new QuyTrinhXetDuyetCuaCanBo();
                            quy.BuocDuyet  = buoc;
                            quy.IDQuyTrinh = qt.IDQuyTrinh;

                            buoc     = int.Parse(quy.BuocDuyet.ToString());
                            capduyet = int.Parse(qt.IDCapDuyet.ToString());
                            QuyTrinhXetDuyetCuaCanBoDAO.CapNhatQuyTrinh(quy);
                        }
                        else
                        {
                            QuyTrinhXetDuyetCuaCanBo quy = new QuyTrinhXetDuyetCuaCanBo();
                            quy.BuocDuyet  = buoc + 1;
                            quy.IDQuyTrinh = qt.IDQuyTrinh;

                            buoc     = int.Parse(quy.BuocDuyet.ToString());
                            capduyet = int.Parse(qt.IDCapDuyet.ToString());
                            QuyTrinhXetDuyetCuaCanBoDAO.CapNhatQuyTrinh(quy);
                        }
                    }
                }
            }
            #endregion
            ///////////////////////////////////// code by Mr Tuan
            QuyTrinhXetDuyetCuaCanBo timng = QuyTrinhXetDuyetCuaCanBoDAO.TimNguoiTrongQuyTrinh(manguoiduyet, quytrinh.abtype, madonvi, macongty);
            List <Abcon>             list  = AbconDAO.LayDanhSachPhieuTaiCapDuyetChuaDuyet(madonvi, quytrinh.abtype, macongty, int.Parse(timng.BuocDuyet.ToString()));
            foreach (Abcon l in list)
            {
                buocthemvao = l.abde;
                if (l.IDCapDuyet > timng.IDCapDuyet)
                {
                    List <Abcon> danh = AbconDAO.LayDanhSachPhieuTaiCapDuyetChuaDuyet1(l.from_depart, l.abtype, l.Gsbh, l.pdno, int.Parse(timng.BuocDuyet.ToString()));
                    foreach (Abcon aa in danh)
                    {
                        if (timng.BuocDuyet == aa.Abstep && timng.DonViThongQua == null && timng.IDCapDuyet == aa.IDCapDuyet)
                        {
                            Abcon aabcc = new Abcon();
                            aabcc.abtype = aa.abtype;
                            aabcc.pdno   = aa.pdno;
                            aabcc.Gsbh   = aa.Gsbh;
                            aabcc.IDCT   = aa.IDCT;
                            aabcc.Abstep = aa.Abstep;
                            aabcc.abde   = aa.abde + 1;
                            AbconDAO.CapNhatPhieuChuyen(aabcc);
                        }
                        else
                        {
                            Abcon aabcc = new Abcon();
                            aabcc.abtype = aa.abtype;
                            aabcc.pdno   = aa.pdno;
                            aabcc.Gsbh   = aa.Gsbh;
                            aabcc.IDCT   = aa.IDCT;
                            aabcc.Abstep = aa.Abstep + 1;
                            aabcc.abde   = aa.abde + 1;
                            AbconDAO.CapNhatPhieuChuyen(aabcc);
                        }
                    }
                }
                else
                {
                    if (l.IDCapDuyet == timng.IDCapDuyet && l.Abstep == timng.BuocDuyet)
                    {
                        List <Abcon> danh = AbconDAO.LayDanhSachPhieuTaiCapDuyetChuaDuyet1(l.from_depart, l.abtype, l.Gsbh, l.pdno, int.Parse(timng.BuocDuyet.ToString()));
                        foreach (Abcon aa in danh)
                        {
                            if (timng.BuocDuyet == aa.Abstep && timng.DonViThongQua == null && timng.IDCapDuyet == aa.IDCapDuyet)
                            {
                                Abcon aabcc = new Abcon();
                                aabcc.abtype = aa.abtype;
                                aabcc.pdno   = aa.pdno;
                                aabcc.Gsbh   = aa.Gsbh;
                                aabcc.IDCT   = aa.IDCT;
                                aabcc.Abstep = aa.Abstep;
                                aabcc.abde   = aa.abde + 1;
                                AbconDAO.CapNhatPhieuChuyen(aabcc);
                            }
                            else
                            {
                                Abcon aabcc = new Abcon();
                                aabcc.abtype = aa.abtype;
                                aabcc.pdno   = aa.pdno;
                                aabcc.Gsbh   = aa.Gsbh;
                                aabcc.IDCT   = aa.IDCT;
                                aabcc.Abstep = aa.Abstep + 1;
                                aabcc.abde   = aa.abde + 1;
                                AbconDAO.CapNhatPhieuChuyen(aabcc);
                            }
                        }
                    }
                    else
                    {
                        List <Abcon> danh = AbconDAO.LayDanhSachPhieuTaiCapDuyetChuaDuyet1(l.from_depart, l.abtype, l.Gsbh, l.pdno, int.Parse(timng.BuocDuyet.ToString()));
                        foreach (Abcon aa in danh)
                        {
                            if (timng.BuocDuyet == aa.Abstep && timng.DonViThongQua == null && timng.IDCapDuyet == aa.IDCapDuyet)
                            {
                                Abcon aabcc = new Abcon();
                                aabcc.abtype = aa.abtype;
                                aabcc.pdno   = aa.pdno;
                                aabcc.Gsbh   = aa.Gsbh;
                                aabcc.IDCT   = aa.IDCT;
                                aabcc.Abstep = aa.Abstep;
                                aabcc.abde   = aa.abde + 1;
                                AbconDAO.CapNhatPhieuChuyen(aabcc);
                            }
                            else
                            {
                                Abcon aabcc = new Abcon();
                                aabcc.abtype = aa.abtype;
                                aabcc.pdno   = aa.pdno;
                                aabcc.Gsbh   = aa.Gsbh;
                                aabcc.IDCT   = aa.IDCT;
                                aabcc.Abstep = aa.Abstep + 1;
                                aabcc.abde   = aa.abde + 1;
                                AbconDAO.CapNhatPhieuChuyen(aabcc);
                            }
                        }
                    }
                }
                //them phieu
                //kiemtamaphieu = l.pdno;
                Abcon abco = new Abcon();

                abco.ABC         = l.ABC;
                abco.abde        = buocthemvao;
                abco.ABJOB       = l.ABJOB;
                abco.abmomo      = l.abmomo;
                abco.Abstep      = int.Parse(timng.BuocDuyet.ToString());
                abco.abrult      = false;
                abco.abtype      = l.abtype;
                abco.Auditor     = timng.NguoiDuyet;
                abco.bixoa       = false;
                abco.boqua       = false;
                abco.cothutu     = true;
                abco.from_depart = l.from_depart;
                abco.from_user   = l.from_user;
                abco.Gsbh        = l.Gsbh;
                abco.Id_VB_CD    = l.Id_VB_CD;
                abco.IDCapDuyet  = timng.IDCapDuyet;
                abco.IDChiTiet   = l.IDChiTiet;

                abco.kytoanbo       = true;
                abco.lydokhongduyet = l.lydokhongduyet;
                abco.Maintitle      = l.Maintitle;
                abco.ncancel        = 0;
                abco.Nhom           = l.Nhom;
                abco.Password2      = null;
                abco.pdno           = l.pdno;
                abco.received       = l.received;
                abco.signatue       = null;
                abco.Userdate       = l.Userdate;
                abco.Yn             = 4;
                AbconBUS.ThemChiTiet(abco);
            }
            HienThiDanhSach();
        }
        private void HienThi()
        {
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();


            string macongty = Session["congty"].ToString();
            //string madonvi = Session["mabophan"].ToString();
            pdna        chitietduyet   = pnaDAO.LayPhieuTheoNguoiGui(maphieu, nguoiduyet, macongty);
            BDepartment timbophan      = BDepartmentDAO.TimMaDonVi(chitietduyet.pddepid, macongty);
            Busers2     users          = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);
            Abcon       lydokhongduyet = AbconDAO.LayPhieuKhongDuyetTheoPhieu(timbophan.ID, chitietduyet.Abtype, macongty, maphieu);

            if (lydokhongduyet == null)
            {
                lblLyDo.Visible     = false;
                lblNhanLyDo.Visible = false;
            }
            else
            {
                lblLyDo.Visible     = true;
                lblNhanLyDo.Visible = true;
                lblLyDo.Text        = lydokhongduyet.lydokhongduyet;
            }
            abill  loaiphieu      = abillBUS.SearchAbillByID(chitietduyet.Abtype);
            string tenloaiphieuVN = loaiphieu.abname;
            string tenloaiphieuTW = loaiphieu.abnameTW;

            lbLoaiPhieu.Text      = tenloaiphieuVN + " " + tenloaiphieuTW;
            lbldonvidenghi.Text   = timbophan.DepName;
            lbSoPhieu.Text        = maphieu;
            txtSoPhieu.Text       = maphieu.ToString().Trim();
            lblMucDichSuDung.Text = chitietduyet.UseIntent;
            lblTieuDe.Text        = chitietduyet.mytitle + chitietduyet.pdnsubject;
            // lbNgay.Text = chitietduyet.CFMDate0.ToString();
            string dinhdang = chitietduyet.CFMDate0.ToString();
            string thang    = dinhdang.Substring(3, 2);
            string ngay     = dinhdang.Substring(0, 2);
            string nam      = dinhdang.Substring(6, 4);

            lblNgaytao.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
            //Abcon abcon6 = AbconBUS.LaymaVanBanTheoCapDuyet6(maphieu, 6);
            List <Abcon> listchitietxetduyet = AbconBUS.QryChiTietXetDuyetTheoIdVanBan(maphieu, true);
            // Abcon captruoc = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(maphieu, macongty);

            {
                if (user0 != null)
                {
                    TextBox1.Text        = user0.USERID;
                    ImageLevel0.Width    = 100;
                    ImageLevel0.Height   = 100;
                    ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
                }
                else
                {
                    ImageLevel0.ImageUrl = null;
                }
            }
            //Abcon caphientai = AbconBUS.LayCapDuyetHienTaiCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);
            foreach (Abcon abcon in listchitietxetduyet)
            {
                if (abcon == null)
                {
                    ImageLevel1.ImageUrl = null;
                    ImageLevel2.ImageUrl = null;
                    ImageLevel3.ImageUrl = null;
                    ImageLevel4.ImageUrl = null;
                    ImageLevel5.ImageUrl = null;
                    ImageLevel6.ImageUrl = null;

                    return;
                }
                else
                {
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();

                    if (abcon.IDCapDuyet == 5 || abcon.IDCapDuyet == 6)
                    {
                        Busers2 nguoiduyet1 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        //ChucVu chuc = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox2.Text        = nguoiduyet1.USERID;
                            ImageLevel1.Width    = 100;
                            ImageLevel1.Height   = 100;
                            ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhoto1.ashx?USERID=" + TextBox2.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox2.Text        = nguoiduyet1.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel1.Width    = 100;
                                ImageLevel1.Height   = 100;
                                ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel1.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 7)
                    {
                        if (capduyet == null)
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox3.Text   = nguoiduyet2.USERID;
                                Image1.Width    = 100;
                                Image1.Height   = 100;
                                Image1.ImageUrl = "~/ProcessSignature/MyPhoto8.ashx?USERID=" + TextBox3.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    TextBox3.Text      = nguoiduyet2.USERID;
                                    txtKhongDuyet.Text = "027276";
                                    Image1.Width       = 100;
                                    Image1.Height      = 100;
                                    Image1.ImageUrl    = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    Image1.ImageUrl = null;
                                }
                            }
                            capduyet = abcon.IDCapDuyet.ToString();
                        }
                        else
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox4.Text        = nguoiduyet2.USERID;
                                ImageLevel2.Width    = 100;
                                ImageLevel2.Height   = 100;
                                ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhoto2.ashx?USERID=" + TextBox4.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    txtKhongDuyet.Text   = "027276";
                                    TextBox4.Text        = nguoiduyet2.USERID;
                                    ImageLevel2.Width    = 100;
                                    ImageLevel2.Height   = 100;
                                    ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    ImageLevel2.ImageUrl = null;
                                }
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 9)
                    {
                        Busers2 nguoiduyet3 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet3.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox5.Text        = nguoiduyet3.USERID;
                            ImageLevel3.Width    = 100;
                            ImageLevel3.Height   = 100;
                            ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhoto3.ashx?USERID=" + TextBox5.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox5.Text        = nguoiduyet3.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel3.Width    = 100;
                                ImageLevel3.Height   = 100;
                                ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel3.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 13)
                    {
                        Busers2 nguoiduyet4 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet4.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox6.Text        = nguoiduyet4.USERID;
                            ImageLevel4.Width    = 100;
                            ImageLevel4.Height   = 100;
                            ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhoto4.ashx?USERID=" + TextBox6.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox6.Text        = nguoiduyet4.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel4.Width    = 100;
                                ImageLevel4.Height   = 100;
                                ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel4.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 15 || abcon.IDCapDuyet == 14)
                    {
                        Busers2 nguoiduyet5 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet5.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox7.Text        = nguoiduyet5.USERID;
                            ImageLevel5.Width    = 100;
                            ImageLevel5.Height   = 100;
                            ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhoto5.ashx?USERID=" + TextBox7.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                txtKhongDuyet.Text   = "027276";
                                TextBox7.Text        = nguoiduyet5.USERID;
                                ImageLevel5.Width    = 100;
                                ImageLevel5.Height   = 100;
                                ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel5.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 16)
                    {
                        Busers2 nguoiduyet6 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox8.Text        = nguoiduyet6.USERID;
                            ImageLevel6.Width    = 100;
                            ImageLevel6.Height   = 100;
                            ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhoto6.ashx?USERID=" + TextBox8.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox8.Text        = nguoiduyet6.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel6.Width    = 100;
                                ImageLevel6.Height   = 100;
                                ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel6.ImageUrl = null;
                            }
                        }
                    }

                    else if (abcon.IDCapDuyet == 17)
                    {
                        Busers2 nguoiduyet7 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet7.IDChucVu, macongty);

                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox9.Text        = nguoiduyet7.USERID;
                            ImageLevel7.Width    = 100;
                            ImageLevel7.Height   = 100;
                            ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhoto7.ashx?USERID=" + TextBox9.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox9.Text        = nguoiduyet7.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel7.Width    = 100;
                                ImageLevel7.Height   = 100;
                                ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel7.ImageUrl = null;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnDetail.Visible = false;
                string UserID   = (string)Request["UserID"];
                string macongty = (string)Request["GSBH"];
                string pdno     = (string)Request["pdno"];
                string ngonngu  = (string)Request["languege"];
                if (UserID != null && macongty != null && pdno != null && ngonngu != null)
                {
                    Session["user"]     = UserID.ToString().Trim();
                    Session["UserID"]   = UserID.ToString().Trim();
                    Session["maphieu"]  = pdno.ToString().Trim();
                    Session["congty"]   = macongty.ToString().Trim();
                    Session["languege"] = ngonngu.ToString().Trim();
                }
                string    ghichu           = "";
                int       Yn               = 1;
                bool      duyet            = true;
                int       ynHoanThanh      = 8;
                Busers2   nhanVienHienHanh = UserBUS.TimNhanVienTheoMa(UserID, macongty);
                DataTable dt               = dal.QryHangTheoMaHang(pdno, macongty);
                string    strBody          = "<html>" +
                                             " <head>" +
                                             "<style>" +
                                             "table, th, td {" +
                                             " border: 1px solid black;" +
                                             "border-collapse: collapse" +
                                             "}" +
                                             "th, td {" +
                                             "   padding: 5px;" +
                                             " text-align: center;" +
                                             "}" +
                                             "</style>" +
                                             "</head>" +
                                             "<body>" +
                                             "<table style=" + " float:left;border: 1px solid black;border-collapse: collapse;>" +
                                             "<tr style=" + "text-align: center;>" +
                                             "<td>TÊN HÀNG 品名 </td> " +
                                             "<td>Size </td>" +
                                             " <td>QUY CÁCH- CHỦNG LOAI 規格  </td> " +
                                             " <td>Số Lượng 數量 </td> " +
                                             " <td>Ghi Chú 備註 </td></tr> " +
                                             "<br/>";

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        //pdn.Size, cl.dwbh, pdn.Qty,pdn.CLmemo,pdn.Memo0
                        strBody = strBody + "<tr><td>" + dr["Memo0"].ToString() + "</td>"; // ten hang
                        strBody = strBody + "<td>" + dr["Size"].ToString() + "</td>";      // Size
                        strBody = strBody + "<td>" + dr["dwbh"].ToString() + "</td>";      // Quy cachs
                        strBody = strBody + "<td>" + dr["Qty"].ToString() + "</td>";       // so luong
                        strBody = strBody + "<td>" + dr["CLmemo"].ToString() + "</td></tr>";
                    }
                }

                strBody += " </table> </body></html>";
                string beginDiv   = "<div style=\"border-style: solid; border-color: inherit; width:600px; border-width:1px;\"" + "><br/>";
                string endDiv     = "</div> <br/>";
                Abcon  timmaphieu = AbconDAO.TimPhieuTheoNguoiTao(pdno, macongty, UserID);
                if (timmaphieu != null && timmaphieu.Yn == 4)
                {
                    // cai nay
                    Dictionary <bool, Abcon> capDangDuyet = pnaDAO.LayCapDangDuyetCuaVanBan1(pdno, UserID, macongty, true, true);
                    Abcon cd = capDangDuyet.First().Value;
                    //abill1 capDuyetCuaNhanVien = UserDAO.LayCapDuyetCuaNhanVien(nhanVienHienHanh.USERID, idVanBanHienHanh);
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(pdno, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();
                    List <Abcon> lstChiTietXetDuyet = AbconDAO.QryChiTietXetDuyet1(cd.IDCT, true).ToList();
                    pdna         vb   = pnaDAO.TimVanBanTheoMa(pdno, macongty, true);
                    Busers2      nvkt = UserDAO.LayNhanVienKhoiTaoCuaVanBan(pdno, true);
                    List <Abcon> nguoiduyettrong1cap = AbconBUS.QryNguoiDuyetTrongCung1Cap(pdno, cd.Abstep);
                    int          maxABPS             = (from a in nguoiduyettrong1cap select a.abps).Max();
                    int          minASPS             = (from a in nguoiduyettrong1cap select a.abps).Min();
                    if (cd.Abstep == 1 && cd.abrult == false)
                    {
                        List <string> kq = CapNhatChiTietDuyet(cd, duyet, ghichu, true);
                        AbconDAO.SuaChiTiet1(cd, nhanVienHienHanh.USERID, ghichu, duyet, true);

                        // Cap nhat tinh trang xet duyet cho van ban
                        // pnaDAO.CapNhatTinhTrangVanBan(idVanBanHienHanh, (duyet) ? 1 : 2, true);

                        if (kq != null)
                        {
                            string thoigian = kq[3] + " " + kq[2];

                            string thongtin = duyet ? "ĐÃ ĐƯỢC DUYỆT 已经审核" : "KHÔNG ĐƯỢC DUYỆT 未签";
                            string noidung  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                            noidung += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                            noidung += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                            noidung += "- Người duyệt 审核者: " + nhanVienHienHanh.USERNAME + "<br/>";
                            noidung += "- Nội dung phiếu:" + vb.pdmemovn + "<br />";
                            noidung += "- Nội dung phiếu dịch:" + vb.NoiDungDich + "<br />";

                            Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản ", beginDiv + thongtin + noidung + endDiv);
                            if (duyet)
                            {
                                if (cd.abps != 0)
                                {
                                    if (cd.abps < maxABPS)
                                    {
                                        Abcon       ab   = AbconDAO.TimBuocKeTiepTrongCung1CapDuyet(pdno, macongty, cd.Abstep, cd.abps + 1);
                                        BDepartment bp   = BDepartmentDAO.TimMaDonVi(ab.from_depart, macongty);
                                        abill       loai = abillBUS.SearchAbillByID(vb.Abtype);

                                        Busers2 user           = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(ab.Auditor, ab.Gsbh);
                                        string  languege       = "lbl_TW";
                                        string  linkPDN        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDetails.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                        string  linkPMH        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/chitietphieumuahang.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                        string  linkDuyet      = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDuyetPhieuEmail.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">2. Đồng ý - 同意</a>" + "\n" + " <br/>";
                                        string  linkKhongDuyet = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmKhongDuyet.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">3. Không đồng ý - 不同意</a>" + "<br />";
                                        string  noidung2       = "Loại phiếu - 单别:" + loai.abname + loai.abnameTW + "<br/>";
                                        noidung2  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                                        noidung2 += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                                        noidung2 += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                                        noidung2 += "- Người trình duyệt 寄件者: " + nvkt.USERNAME + "<br/>";
                                        noidung2 += "- Đơn vị đề nghị - 提议单位:" + bp.DepName + "<br/>";
                                        noidung2 += "- Nội dung phiếu - 内容:" + vb.pdmemovn + "<br />";
                                        noidung2 += "- Nội dung phiếu dịch - 翻译内容:" + vb.NoiDungDich + "<br />";

                                        if (duyet)
                                        {
                                            dal.CapNhatLevel(pdno, macongty, cd.Abstep, user.USERID);
                                            if (vb.Abtype == "PDN2")
                                            {
                                                Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + ab.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + strBody + linkPMH + linkDuyet + linkKhongDuyet + endDiv);
                                            }
                                            else
                                            {
                                                Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + ab.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + linkPDN + linkDuyet + linkKhongDuyet + endDiv);
                                            }
                                        }
                                        else
                                        {
                                            Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为", beginDiv + thongtin + noidung + endDiv);
                                            ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                            TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                            dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                                        }
                                    }// nguoc lai buoc ke tiep = buoc hien tai
                                    else
                                    {
                                        if (cd.abps == maxABPS)
                                        {
                                            Abcon buocketiep = AbconBUS.LayBuocKeTiepCuaNhanVien(macongty, pdno, cd.Abstep + 1, minASPS);
                                            if (buocketiep.Abstep > cd.Abstep)
                                            {
                                                BDepartment bp   = BDepartmentDAO.TimMaDonVi(buocketiep.from_depart, macongty);
                                                abill       loai = abillBUS.SearchAbillByID(vb.Abtype);

                                                Busers2 user           = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(buocketiep.Auditor, buocketiep.Gsbh);
                                                string  languege       = "lbl_TW";
                                                string  linkPDN        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDetails.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                                string  linkPMH        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/chitietphieumuahang.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                                string  linkDuyet      = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDuyetPhieuEmail.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">2. Đồng ý - 同意</a>" + "\n" + " <br/>";
                                                string  linkKhongDuyet = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmKhongDuyet.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">3. Không đồng ý - 不同意</a>" + "<br />";
                                                string  noidung2       = "Loại phiếu - 单别:" + loai.abname + loai.abnameTW + "<br/>";
                                                noidung2  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                                                noidung2 += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                                                noidung2 += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                                                noidung2 += "- Người trình duyệt 寄件者: " + nvkt.USERNAME + "<br/>";
                                                noidung2 += "- Đơn vị đề nghị - 提议单位:" + bp.DepName + "<br/>";
                                                noidung2 += "- Nội dung phiếu - 内容:" + vb.pdmemovn + "<br />";
                                                noidung2 += "- Nội dung phiếu dịch - 翻译内容:" + vb.NoiDungDich + "<br />";

                                                if (duyet)
                                                {
                                                    dal.CapNhatLevel(pdno, macongty, cd.Abstep, user.USERID);
                                                    if (vb.Abtype == "PDN2")
                                                    {
                                                        Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + buocketiep.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + strBody + linkPMH + linkDuyet + linkKhongDuyet + endDiv);
                                                    }
                                                    else
                                                    {
                                                        Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + buocketiep.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + linkPDN + linkDuyet + linkKhongDuyet + endDiv);
                                                    }
                                                }
                                                else
                                                {
                                                    Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为", beginDiv + thongtin + noidung + endDiv);
                                                    ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                                    TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                                    dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                                                }
                                            }
                                        }
                                    }
                                }// chi co 1 nguoi duyet trong cung 1 cap
                                else
                                {
                                    Abcon laybuocke = AbconBUS.LayBuocKeTiepCuaNhanVienTrongCung1Cap(nhanVienHienHanh.USERID, pdno, cd.Abstep + 1, minASPS);
                                    if (laybuocke.Abstep >= cd.Abstep)
                                    {
                                        BDepartment bp   = BDepartmentDAO.TimMaDonVi(laybuocke.from_depart, macongty);
                                        abill       loai = abillBUS.SearchAbillByID(vb.Abtype);

                                        Busers2 user           = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(laybuocke.Auditor, laybuocke.Gsbh);
                                        string  languege       = "lbl_TW";
                                        string  linkPDN        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDetails.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                        string  linkPMH        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/chitietphieumuahang.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                        string  linkDuyet      = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDuyetPhieuEmail.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">2. Đồng ý - 同意</a>" + "\n" + " <br/>";
                                        string  linkKhongDuyet = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmKhongDuyet.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">3. Không đồng ý - 不同意</a>" + "<br />";
                                        string  noidung2       = "Loại phiếu - 单别:" + loai.abname + loai.abnameTW + "<br/>";
                                        noidung2  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                                        noidung2 += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                                        noidung2 += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                                        noidung2 += "- Người trình duyệt 寄件者: " + nvkt.USERNAME + "<br/>";
                                        noidung2 += "- Đơn vị đề nghị - 提议单位:" + bp.DepName + "<br/>";
                                        noidung2 += "- Nội dung phiếu - 内容:" + vb.pdmemovn + "<br />";
                                        noidung2 += "- Nội dung phiếu dịch - 翻译内容:" + vb.NoiDungDich + "<br />";
                                        if (duyet)
                                        {
                                            dal.CapNhatLevel(pdno, macongty, cd.Abstep, user.USERID);
                                            if (vb.Abtype == "PDN2")
                                            {
                                                Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + laybuocke.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + strBody + linkPMH + linkDuyet + linkKhongDuyet + endDiv);
                                            }
                                            else
                                            {
                                                Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + laybuocke.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + linkPDN + linkDuyet + linkKhongDuyet + endDiv);
                                            }
                                        }
                                        else
                                        {
                                            Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为", beginDiv + thongtin + noidung + endDiv);
                                            ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                            TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                            dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                                        }
                                    }
                                }


                                PDNSheetFlow PDNSheetFlow = PDNSheetFlowBUS.LayPDNSheetFlowTheoIdVanBanBuocKy(pdno, cd.abps);
                                PDNSheetFlowBUS.SuaPDNSheetFlow(PDNSheetFlow, duyet);
                                //ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(idVanBanHienHanh, macongty);
                                //TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                            }
                            else
                            {
                                PDNSheetFlow PDNSheetFlow = PDNSheetFlowBUS.LayPDNSheetFlowTheoIdVanBanBuocKy(pdno, cd.abps);
                                PDNSheetFlowBUS.SuaPDNSheetFlow(PDNSheetFlow, duyet);
                                ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                            }
                        }
                    }// buoc duyet > 1 keke
                    else
                    {
                        List <string> kq = CapNhatChiTietDuyet(cd, duyet, ghichu, true);
                        AbconDAO.SuaChiTiet1(cd, nhanVienHienHanh.USERID, ghichu, duyet, true);

                        // Cap nhat tinh trang xet duyet cho van ban
                        // pnaDAO.CapNhatTinhTrangVanBan(idVanBanHienHanh, (duyet) ? 1 : 2, true);

                        if (kq != null)
                        {
                            //string thoigian = kq[3] + " " + kq[2];

                            //List<Abcon> lstVanBanDen = AbconDAO.TimKiemVanBanDen(vb.pdno, vb.CFMID0, false).ToList();
                            //foreach (Abcon item in lstVanBanDen)
                            //{
                            //    if (duyet)
                            //        AbconDAO.CapNhatVanBanDen2(item);
                            //}

                            //  pnaDAO.UpdatePDNA(vb);

                            string thongtin = duyet ? "ĐÃ ĐƯỢC DUYỆT 已经审核" : "KHÔNG ĐƯỢC DUYỆT 未签" + "<br/>";
                            string noidung  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                            noidung += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                            noidung += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                            noidung += "- Người duyệt 审核者: " + nhanVienHienHanh.USERNAME + "<br/>";
                            noidung += "- Nội dung phiếu:" + vb.pdmemovn + "<br />";
                            noidung += "- Nội dung phiếu dịch:" + vb.NoiDungDich + "<br />";

                            Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản ", beginDiv + thongtin + noidung + endDiv);
                            if (duyet)
                            {
                                if (cd.Abstep == max)
                                {
                                    PDNSheetFlow PDNSheetFlow = PDNSheetFlowBUS.LayPDNSheetFlowTheoIdVanBanBuocKy(pdno, cd.Abstep);
                                    PDNSheetFlowBUS.SuaPDNSheetFlow(PDNSheetFlow, duyet);
                                    ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                    TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                    dal.CapNhatPhieuPDNA(pdno, macongty, ynHoanThanh, cd.Abstep, UserID);
                                    if (!duyet)
                                    {
                                        Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为 ", beginDiv + thongtin + noidung + endDiv);
                                    }
                                }
                                else
                                {
                                    if (cd.abps != 0)
                                    {
                                        if (cd.abps < maxABPS)
                                        {
                                            Abcon       ab   = AbconDAO.TimBuocKeTiepTrongCung1CapDuyet(pdno, macongty, cd.Abstep, cd.abps + 1);
                                            BDepartment bp   = BDepartmentDAO.TimMaDonVi(ab.from_depart, macongty);
                                            abill       loai = abillBUS.SearchAbillByID(vb.Abtype);

                                            Busers2 user           = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(ab.Auditor, ab.Gsbh);
                                            string  languege       = "lbl_TW";
                                            string  linkPDN        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDetails.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                            string  linkPMH        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/chitietphieumuahang.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                            string  linkDuyet      = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDuyetPhieuEmail.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">2. Đồng ý - 同意</a>" + "\n" + " <br/>";
                                            string  linkKhongDuyet = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmKhongDuyet.aspx" + "?UserID=" + "" + ab.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">3. Không đồng ý - 不同意</a>" + "<br />";
                                            string  noidung2       = "Loại phiếu - 单别:" + loai.abname + loai.abnameTW + "<br/>";
                                            noidung2  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                                            noidung2 += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                                            noidung2 += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                                            noidung2 += "- Người trình duyệt 寄件者: " + nvkt.USERNAME + "<br/>";
                                            noidung2 += "- Đơn vị đề nghị - 提议单位:" + bp.DepName + "<br/>";
                                            noidung2 += "- Nội dung phiếu - 内容:" + vb.pdmemovn + "<br />";
                                            noidung2 += "- Nội dung phiếu dịch - 翻译内容:" + vb.NoiDungDich + "<br />";

                                            if (duyet)
                                            {
                                                dal.CapNhatLevel(pdno, macongty, cd.Abstep, user.USERID);
                                                if (vb.Abtype == "PDN2")
                                                {
                                                    Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + ab.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + strBody + linkPMH + linkDuyet + linkKhongDuyet + endDiv);
                                                }
                                                else
                                                {
                                                    Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + ab.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + linkPDN + linkDuyet + linkKhongDuyet + endDiv);
                                                }
                                            }
                                            else
                                            {
                                                Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为", beginDiv + thongtin + noidung + endDiv);
                                                ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                                TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                                dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                                            }
                                        }// nguoc lai buoc ke tiep = buoc hien tai
                                        else
                                        {
                                            if (cd.abps == maxABPS)
                                            {
                                                Abcon buocketiep = AbconBUS.LayBuocKeTiepCuaNhanVien(macongty, pdno, cd.Abstep + 1, minASPS);
                                                if (buocketiep.Abstep > cd.Abstep)
                                                {
                                                    BDepartment bp   = BDepartmentDAO.TimMaDonVi(buocketiep.from_depart, macongty);
                                                    abill       loai = abillBUS.SearchAbillByID(vb.Abtype);

                                                    Busers2 user           = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(buocketiep.Auditor, buocketiep.Gsbh);
                                                    string  languege       = "lbl_TW";
                                                    string  linkPDN        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDetails.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                                    string  linkPMH        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/chitietphieumuahang.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                                    string  linkDuyet      = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDuyetPhieuEmail.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">2. Đồng ý - 同意</a>" + "\n" + " <br/>";
                                                    string  linkKhongDuyet = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmKhongDuyet.aspx" + "?UserID=" + "" + buocketiep.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">3. Không đồng ý - 不同意</a>" + "<br />";
                                                    string  noidung2       = "Loại phiếu - 单别:" + loai.abname + loai.abnameTW + "<br/>";
                                                    noidung2  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                                                    noidung2 += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                                                    noidung2 += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                                                    noidung2 += "- Người trình duyệt 寄件者: " + nvkt.USERNAME + "<br/>";
                                                    noidung2 += "- Đơn vị đề nghị - 提议单位:" + bp.DepName + "<br/>";
                                                    noidung2 += "- Nội dung phiếu - 内容:" + vb.pdmemovn + "<br />";
                                                    noidung2 += "- Nội dung phiếu dịch - 翻译内容:" + vb.NoiDungDich + "<br />";

                                                    if (duyet)
                                                    {
                                                        dal.CapNhatLevel(pdno, macongty, cd.Abstep, user.USERID);
                                                        if (vb.Abtype == "PDN2")
                                                        {
                                                            Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + buocketiep.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + strBody + linkPMH + linkDuyet + linkKhongDuyet + endDiv);
                                                        }
                                                        else
                                                        {
                                                            Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + buocketiep.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + linkPDN + linkDuyet + linkKhongDuyet + endDiv);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为", beginDiv + thongtin + noidung + endDiv);
                                                        ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                                        TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                                        dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                                                    }
                                                }
                                            }
                                        }
                                    }// trong 1 cap duyet chi co 1 nguoi
                                    else
                                    {
                                        Abcon laybuocke = AbconBUS.LayBuocKeTiepCuaNhanVienTrongCung1Cap(nhanVienHienHanh.USERID, pdno, cd.Abstep + 1, minASPS);
                                        if (laybuocke.Abstep >= cd.Abstep)
                                        {
                                            BDepartment bp   = BDepartmentDAO.TimMaDonVi(laybuocke.from_depart, macongty);
                                            abill       loai = abillBUS.SearchAbillByID(vb.Abtype);

                                            Busers2 user           = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(laybuocke.Auditor, laybuocke.Gsbh);
                                            string  languege       = "lbl_TW";
                                            string  linkPDN        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDetails.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                            string  linkPMH        = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/chitietphieumuahang.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "&languege=" + languege + "\">1. Vào đây xem chi tiết phiếu trên hệ thống- 按钮这里可以查看详细资料</a>" + "<br />";
                                            string  linkDuyet      = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmDuyetPhieuEmail.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">2. Đồng ý - 同意</a>" + "\n" + " <br/>";
                                            string  linkKhongDuyet = "<a href=\"http://192.168.11.8/pdn/presentationLayer/ApproveUser/frmKhongDuyet.aspx" + "?UserID=" + "" + laybuocke.Auditor + "" + "&GSBH=" + "" + macongty + "" + "&pdno=" + "" + vb.pdno + "\">3. Không đồng ý - 不同意</a>" + "<br />";
                                            string  noidung2       = "Loại phiếu - 单别:" + loai.abname + loai.abnameTW + "<br/>";
                                            noidung2  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                                            noidung2 += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                                            noidung2 += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                                            noidung2 += "- Người trình duyệt 寄件者: " + nvkt.USERNAME + "<br/>";
                                            noidung2 += "- Đơn vị đề nghị - 提议单位:" + bp.DepName + "<br/>";
                                            noidung2 += "- Nội dung phiếu - 内容:" + vb.pdmemovn + "<br />";
                                            noidung2 += "- Nội dung phiếu dịch - 翻译内容:" + vb.NoiDungDich + "<br />";
                                            if (duyet)
                                            {
                                                dal.CapNhatLevel(pdno, macongty, cd.Abstep, user.USERID);
                                                if (vb.Abtype == "PDN2")
                                                {
                                                    Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + laybuocke.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + strBody + linkPMH + linkDuyet + linkKhongDuyet + endDiv);
                                                }
                                                else
                                                {
                                                    Until.SendMailNguoiDuyet(nvkt.EMAIL, user.EMAIL, "[Ty Hung-eOffice][" + laybuocke.IDCT + "] Thông báo văn bản " + vb.mytitle + " đang chờ bạn duyệt.", beginDiv + noidung2 + linkPDN + linkDuyet + linkKhongDuyet + endDiv);
                                                }
                                            }
                                            else
                                            {
                                                Until.SendMailNguoiTao(nhanVienHienHanh.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为", beginDiv + thongtin + noidung + endDiv);
                                                ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                                TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                                dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                                            }
                                        }
                                    }
                                }
                            }// neu khong duyet thi cap nhat trang thai duyet vap ban chi tiet buoc
                            else
                            {
                                PDNSheetFlow PDNSheetFlow = PDNSheetFlowBUS.LayPDNSheetFlowTheoIdVanBanBuocKy(pdno, cd.abps);
                                PDNSheetFlowBUS.SuaPDNSheetFlow(PDNSheetFlow, duyet);
                                ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                                TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                                dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                            }
                        }
                    }
                    btnDetail.Visible         = true;
                    lblThongBao.Text          = "Bạn đã xét duyệt thành công - 审核成功";
                    Session["maloaiphieutam"] = timmaphieu.abtype.Trim();
                    // ket thuc cai nay
                }
                else
                {
                    Abcon timphieu = AbconDAO.TimPhieuTheoNguoiTao(pdno, macongty, UserID);
                    if (timphieu != null)
                    {
                        if (timphieu.Yn == 1 && timphieu.abrult == true)
                        {
                            btnDetail.Visible         = true;
                            Session["maloaiphieutam"] = timphieu.abtype.Trim();
                            lblThongBao.Text          = "Bạn đã duyệt phiếu này rồi - 您已经审核";
                        }
                    }
                }
            }
        }