Ejemplo n.º 1
0
        public void HienThiDropLoaiDonVi()
        {
            string macongty = Session["congty"].ToString();
            string ngonngu  = Session["languege"].ToString();

            //  string macongty = "LTY";


            if (ngonngu == "lbl_VN")
            {
                DropDownLoaiDonVi.DataSource     = LoaiDonViDAO.QryLoaiDonVi(macongty);
                DropDownLoaiDonVi.DataValueField = "DepartmentTypeID";
                DropDownLoaiDonVi.DataTextField  = "DepartmentTypeName";
                DropDownLoaiDonVi.DataBind();
            }
            else if (ngonngu == "lbl_TW")
            {
                DropDownLoaiDonVi.DataSource     = LoaiDonViDAO.QryLoaiDonVi(macongty);
                DropDownLoaiDonVi.DataValueField = "DepartmentTypeID";
                DropDownLoaiDonVi.DataTextField  = "DepartmentTypeNameTW";
                DropDownLoaiDonVi.DataBind();
            }
            else if (ngonngu == "lbl_EN")
            {
                DropDownLoaiDonVi.DataSource     = LoaiDonViDAO.QryLoaiDonVi(macongty);
                DropDownLoaiDonVi.DataValueField = "DepartmentTypeID";
                DropDownLoaiDonVi.DataTextField  = "DepartmentTypeName";
                DropDownLoaiDonVi.DataBind();
            }
        }
Ejemplo n.º 2
0
        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 (cbLoaiPhieu.Checked == true)
            {
                quytrinh.abtype = DropDownLoaiPhieu.SelectedValue.ToString();
                abill timloai = abillBUS.SearchAbillByID(DropDownLoaiPhieu.SelectedValue.ToString());
                quytrinh.abtypenameTW = timloai.abnameTW;
            }
            else
            {
                quytrinh.abtype = "PDN1";
            }
            if (CheckThongQuaDonVi.Checked == true)
            {
                quytrinh.DonViThongQua = DropDownDonViThongQua.SelectedValue.ToString();
                BDepartment donvithongqua = BDepartmentDAO.TimMaDonVi(DropDownDonViThongQua.SelectedValue.ToString(), macongty);
                quytrinh.tendonvithongqua = donvithongqua.DepName;
            }
            else
            {
                quytrinh.DonViThongQua = null;
            }
            if (txtNguoiDuyet.Text.Trim() == "")
            {
                quytrinh.NguoiDuyet = "MD";
            }
            else
            {
                quytrinh.NguoiDuyet = manguoiduyet;
                Busers2 nguoi = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                quytrinh.USERNAME = nguoi.USERNAME;
                ChucVu chuc = ChucVuDAO.TimMaChucVu(nguoi.IDChucVu, macongty);
                quytrinh.IDChucVu          = chuc.IDChucVu;
                quytrinh.TenChucVuTiengHoa = chuc.TenChucVuTiengHoa;
                quytrinh.IDCapDuyet        = nguoi.IDCapDuyet;
            }
            QuyTrinhXetDuyetCuaCanBoDAO.SuaQuyTrinhXetDuyetTheoCanBo(quytrinh);
            Response.Redirect("FQuyTrinhXetDuyetDanhChoCanBo.aspx");
        }
        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();
        }
Ejemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string manguoiduyet1 = Session["manguoiduyet"].ToString();
            int    id            = int.Parse(Session["id"].ToString());
            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.IDQuyTrinh = id;
            quytrinh.tendonviTW = donvi.DepName;
            quytrinh.GSBH       = macongty;
            //quytrinh.BuocDuyet = buocduyet;

            quytrinh.IDLoaiDonVi          = loaidonvi.DepartmentTypeID;
            quytrinh.DepartmentTypeNameTW = loaidonvi.DepartmentTypeNameTW;
            if (cbLoaiPhieu.Checked == true)
            {
                quytrinh.abtype = DropDownLoaiPhieu.SelectedValue.ToString();
                abill timloai = abillBUS.SearchAbillByID(DropDownLoaiPhieu.SelectedValue.ToString());
                quytrinh.abtypenameTW = timloai.abnameTW;
            }
            else
            {
                quytrinh.abtype = "PDN1";
            }
            if (CheckThongQuaDonVi.Checked == true)
            {
                quytrinh.DonViThongQua = DropDownDonViThongQua.SelectedValue.ToString();
                BDepartment donvithongqua = BDepartmentDAO.TimMaDonVi(DropDownDonViThongQua.SelectedValue.ToString(), macongty);
                quytrinh.tendonvithongqua = donvithongqua.DepName;
            }
            else
            {
                quytrinh.DonViThongQua = null;
            }
            if (txtNguoiDuyet.Text.Trim() == "")
            {
                quytrinh.NguoiDuyet = "MD";
            }
            else
            {
                quytrinh.NguoiDuyet = manguoiduyet;
                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;
            }
            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;
            QuyTrinhXetDuyetCuaCanBoDAO.SuaQuyTrinhXetDuyetTheoCanBo(quytrinh);

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

            if (timquynguoi != null)
            {
                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;
                        QuyTrinhXetDuyetCuaCanBoDAO.CapNhatQuyTrinh(quy);
                    }
                    else
                    {
                        QuyTrinhXetDuyetCuaCanBo quy = new QuyTrinhXetDuyetCuaCanBo();
                        quy.BuocDuyet  = buoc + 1;
                        quy.IDQuyTrinh = qt.IDQuyTrinh;
                        buoc           = int.Parse(quy.BuocDuyet.ToString());
                        QuyTrinhXetDuyetCuaCanBoDAO.CapNhatQuyTrinh(quy);
                    }
                }
            }
            List <Abcon> LayDanhSach = AbconDAO.LayDanhSachVanBanChuaDuyetTheoNguoiDuyet(madonvi, quytrinh.abtype, macongty, manguoiduyet1);

            if (manguoiduyet1 == manguoiduyet)
            {
            }
            else
            {
                Busers2 nguoi = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                foreach (Abcon ct in LayDanhSach)
                {
                    //Abcon tim = AbconDAO.TimNguoiDuyetTrongPhieu(madonvi, macongty, quytrinh.abtype, ct.pdno, manguoiduyet);
                    //int buockietiep=ct.abde+1
                    //Abcon kiemtra = AbconDAO.TimBuocKyTruocTrongPhieu(ct.from_depart, ct.Gsbh, ct.abtype, ct.pdno, buocketiep);
                    Abcon chitiet = new Abcon();
                    chitiet.IDCT        = ct.IDCT;
                    chitiet.Auditor     = manguoiduyet;
                    chitiet.Gsbh        = ct.Gsbh;
                    chitiet.pdno        = ct.pdno;
                    chitiet.abmomo      = ct.abmomo;
                    chitiet.abtype      = ct.abtype;
                    chitiet.abrult      = false;
                    chitiet.abde        = ct.abde;
                    chitiet.ABC         = ct.ABC;
                    chitiet.bixoa       = false;
                    chitiet.boqua       = false;
                    chitiet.cothutu     = true;
                    chitiet.from_depart = ct.from_depart;
                    chitiet.from_user   = ct.from_user;
                    chitiet.Id_VB_CD    = ct.Id_VB_CD;
                    chitiet.Maintitle   = ct.Maintitle;
                    chitiet.Yn          = 4;
                    chitiet.IDCapDuyet  = nguoi.IDCapDuyet;
                    AbconDAO.SuaChiTietXD1(chitiet, true);
                }
            }
            Response.Redirect("FQuyTrinhXetDuyet.aspx");
        }
Ejemplo n.º 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (lbThongBao.Text != "")
            {
                lbThongBao.Text = "";
            }
            string manguoiduyet1 = Session["manguoiduyet"].ToString();
            int    id            = int.Parse(Session["id"].ToString());

            if (lbThongBao.Text.Trim() != "")
            {
                lbThongBao.Text = "";
            }
            string macongty = DropCty.SelectedValue.ToString();

            string madonvi = DropDownLDonVi.SelectedValue.ToString();

            string   manguoiduyet = txtNguoiDuyet.Text;
            int      AbStep       = int.Parse(DropDownABStep.SelectedValue);
            int      ABPS         = int.Parse(DropDownABPS.SelectedValue);
            QPDNFlow quytrinh     = new QPDNFlow();

            if (manguoiduyet == "ZZZZZZ")
            {
                quytrinh.ABPS   = 1;
                quytrinh.ABstep = 1;
                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;
                }
                quytrinh.BADEPID = "All";
                quytrinh.DepartmentTypeNameTW = "间接单位";
                quytrinh.GSBH              = macongty;
                quytrinh.IDCapDuyet        = 7;
                quytrinh.IDChucVu          = "CQDV";
                quytrinh.IDLoaiDonVi       = 2;
                quytrinh.NguoiDuyet        = "ZZZZZZ";
                quytrinh.USERNAME          = "";
                quytrinh.TenChucVuTiengHoa = "单位主管";
                quytrinh.tendonviTW        = "All";

                dal.CapNhatQuyTrinh(macongty, quytrinh.abtype, madonvi, AbStep, ABPS, quytrinh.NguoiDuyet, quytrinh.USERNAME, quytrinh.abtypenameTW, quytrinh.tendonviTW, int.Parse(quytrinh.IDLoaiDonVi.ToString()), quytrinh.DepartmentTypeNameTW, int.Parse(quytrinh.IDCapDuyet.ToString()));
            }
            else
            {
                if (madonvi == "All")
                {
                    quytrinh.BADEPID              = "All";
                    quytrinh.tendonviTW           = "All";
                    quytrinh.GSBH                 = macongty;
                    quytrinh.IDLoaiDonVi          = 2;
                    quytrinh.DepartmentTypeNameTW = "间接单位";
                }
                else
                {
                    BDepartment      donvi     = BDepartmentDAO.TimMaDonVi(madonvi, macongty);
                    AbDepartmentType loaidonvi = LoaiDonViDAO.TimMaLoaiDonVi(int.Parse(donvi.DepartmentTypeID.ToString()), macongty);

                    quytrinh.BADEPID              = madonvi;
                    quytrinh.tendonviTW           = donvi.DepName;
                    quytrinh.GSBH                 = macongty;
                    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;
                }
                quytrinh.DonViThongQua = null;
                quytrinh.NguoiDuyet    = txtNguoiDuyet.Text;
                Busers2 nguoi      = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                int     idcapduyet = int.Parse(nguoi.IDCapDuyet.ToString());
                quytrinh.USERNAME = nguoi.USERNAME;
                ChucVu chuc = ChucVuDAO.TimMaChucVu(nguoi.IDChucVu, macongty);
                quytrinh.IDChucVu         = chuc.IDChucVu;
                quytrinh.tendonvithongqua = chuc.TenChucVuTiengHoa;
                quytrinh.IDCapDuyet       = nguoi.IDCapDuyet;
                quytrinh.ABstep           = AbStep;
                quytrinh.ABPS             = ABPS;

                QPDNFlow tim = QPDNFlowDAO.TimNguoiTrongQuyTrinh(nguoi.USERID, quytrinh.abtype, quytrinh.BADEPID, macongty);
                if (tim != null)
                {
                    dal.CapNhatQuyABPS(macongty, quytrinh.abtype, madonvi, id, AbStep, ABPS);
                }
                else
                {
                    QPDNFlow timbuoccansua = QPDNFlowDAO.TimBuocKyCanSua(macongty, quytrinh.abtype, quytrinh.BADEPID, AbStep, ABPS);
                    if (timbuoccansua != null)
                    {
                        dal.CapNhatQuyTrinh(macongty, quytrinh.abtype, madonvi, AbStep, ABPS, quytrinh.NguoiDuyet, quytrinh.USERNAME, quytrinh.abtypenameTW, quytrinh.tendonviTW, int.Parse(quytrinh.IDLoaiDonVi.ToString()), quytrinh.DepartmentTypeNameTW, int.Parse(quytrinh.IDCapDuyet.ToString()));
                    }
                    List <Abcon> dsPhieuChuaDuyet = AbconDAO.dsPhieuChuaDuyetTheoBuocDuyetCapDuyet(macongty, madonvi, quytrinh.abtype, AbStep, ABPS);
                    foreach (Abcon phieu in dsPhieuChuaDuyet)
                    {
                        Abcon timnguoi = AbconDAO.TimNguoiDuyetTrongPhieu(madonvi, macongty, quytrinh.abtype, phieu.pdno, nguoi.USERID);
                        if (timnguoi == null)
                        {
                            dalabcon.CapNhatAbcon(macongty, quytrinh.abtype, phieu.pdno, nguoi.USERID, phieu.IDCT, AbStep, idcapduyet, ABPS);
                        }
                    }
                }
            }
            Response.Redirect("FQPDNFlow.aspx");
        }