Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                VAN_OA.Dal.BaseInfo.Tb_InventoryService   invSer        = new VAN_OA.Dal.BaseInfo.Tb_InventoryService();
                List <VAN_OA.Model.BaseInfo.Tb_Inventory> InventoryList = invSer.GetListArrayToDdl("");
                InventoryList.Insert(0, new VAN_OA.Model.BaseInfo.Tb_Inventory());
                ddlInvs.DataSource = InventoryList;
                ddlInvs.DataBind();
                ddlInvs.DataTextField  = "InvName";
                ddlInvs.DataValueField = "ID";

                List <Tb_ExpInvsSumRep> Gusets = new List <Tb_ExpInvsSumRep>();
                this.gvList.DataSource = Gusets;
                this.gvList.DataBind();
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                btnOk.Visible = false;

                VAN_OA.Dal.BaseInfo.Tb_InventoryService   invSer        = new VAN_OA.Dal.BaseInfo.Tb_InventoryService();
                List <VAN_OA.Model.BaseInfo.Tb_Inventory> InventoryList = invSer.GetListArrayToDdl("");
                ddlInvs.DataSource = InventoryList;
                ddlInvs.DataBind();
                ddlInvs.DataTextField  = "InvName";
                ddlInvs.DataValueField = "ID";


                Session["ProInvs"]        = null;
                gvList.Columns[0].Visible = false;
                gvList.Columns[1].Visible = false;

                btnSave.Enabled   = false;
                btnCancel.Enabled = false;
                plProInvs.Visible = false;
                btnEdit.Visible   = false;
                if (base.Request["ProId"] != null)
                {
                    //加载基本数据
                    VAN_OA.Model.User use = Session["userInfo"] as VAN_OA.Model.User;
                    txtName.Text       = use.LoginName;
                    txtDepartMent.Text = use.LoginIPosition;


                    tb_EFormService eformSer = new tb_EFormService();
                    if (Request["allE_id"] == null)//单据增加
                    {
                        gvList.Columns[0].Visible = true;
                        gvList.Columns[1].Visible = true;
                        plProInvs.Visible         = true;

                        lblReturnTime.Visible = false;
                        txtReturnTime.Visible = false;
                        imgReturnTime.Visible = false;



                        //检查自己是否在请假单中流程设置中,来确定自己下一个审批人

                        lblResult.Visible       = false;
                        lblYiJian.Visible       = false;
                        ddlResult.Visible       = false;
                        txtResultRemark.Visible = false;

                        //加载初始数据

                        List <Tb_ExpInvs> proInvsList = new List <Tb_ExpInvs>();
                        Session["ProInvs"]        = proInvsList;
                        ViewState["ProInvsCount"] = proInvsList.Count;

                        gvList.DataSource = proInvsList;
                        gvList.DataBind();

                        if (eformSer.ifHasNodes(Convert.ToInt32(Request["ProId"])))
                        {
                            //获取审批人

                            int ids = 0;
                            List <A_Role_User> roleUserList = eformSer.getUsers(Convert.ToInt32(Session["currentUserId"].ToString()), Convert.ToInt32(Request["ProId"]), out ids);

                            ViewState["ids"] = ids;
                            if (roleUserList != null)
                            {
                                ddlPers.DataSource = roleUserList;
                                ddlPers.DataBind();
                                ddlPers.DataTextField  = "UserName";
                                ddlPers.DataValueField = "UserId";
                            }
                            else
                            {
                                lblPer.Visible  = false;
                                ddlPers.Visible = false;
                            }
                        }
                        else
                        {
                            lblPer.Visible  = false;
                            ddlPers.Visible = false;
                        }
                    }
                    else//单据审批
                    {
                        ViewState["ProInvsIds"] = "";

                        //加载已经审批的数据
                        tb_EFormsService eformsSer = new tb_EFormsService();
                        List <VAN_OA.Model.EFrom.tb_EForms> eforms = eformsSer.GetListArray(string.Format(" e_Id in (select id from tb_EForm where proId={0} and allE_id={1})",
                                                                                                          Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                        if (eforms.Count > 0)
                        {
                            string mess = @"<table cellpadding='0' cellspacing='0' width='100%' bordercolorlight='#999999' bordercolordark='#FFFFFF' border='1' ><tr><td colspan='6' style=' height:20px; background-color:#336699; color:White;'>流程图</td></tr>";


                            for (int i = 0; i < eforms.Count; i++)
                            {
                                string per = "";
                                if (eforms[i].consignor != null && eforms[i].consignor != 0)
                                {
                                    per = eforms[i].Consignor_Name + "(委托人:" + eforms[i].Audper_Name + ")";
                                }
                                else
                                {
                                    per = eforms[i].Audper_Name;
                                }
                                mess += string.Format("<tr><td align='center'>第{0}步</td><td>序号{0}:{1}</td><td><span style='color:red;'>{2}</span>[<span style='color:blue;'>{3} {4}</span>]<br/>意见:{5}</td></tr>",
                                                      i + 1, eforms[i].RoleName
                                                      , per, eforms[i].resultState, eforms[i].doTime, eforms[i].idea);
                            }
                            mess        += "</table>";
                            lblMess.Text = mess;
                        }

                        #region  加载 请假单数据
                        Tb_ExpInvService  paProInvSer  = new Tb_ExpInvService();
                        Tb_ExpInvsService sonProInvSer = new Tb_ExpInvsService();

                        Tb_ExpInv pProModel = paProInvSer.GetModel(Convert.ToInt32(Request["allE_id"]));
                        txtName.Text       = pProModel.LoginName;
                        txtCreateTime.Text = pProModel.ExpTime.ToString("yyyy-MM-dd");
                        txtDepartMent.Text = pProModel.DepartMent;
                        lblProNo.Text      = pProModel.ProNo;

                        if (pProModel.IfOutGoods)
                        {
                            lblOutState.Text = "已发货";
                        }
                        else
                        {
                            lblOutState.Text = "尚未发货";
                        }

                        if (pProModel.OutTime != null)
                        {
                            lblOutTime.Text = pProModel.OutTime.ToString();
                        }
                        lblEventNo.Text = pProModel.EventNo;

                        List <Tb_ExpInvs> proInvsList = sonProInvSer.GetListArray(" 1=1 and PId=" + Request["allE_id"]);

                        Session["ProInvs"]        = proInvsList;
                        ViewState["ProInvsCount"] = proInvsList.Count;

                        gvList.DataSource = proInvsList;
                        gvList.DataBind();



                        #endregion
                        //判断单据是否已经结束
                        if (eformSer.ifFinish(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                        {
                            btnSub.Visible          = false;
                            lblPer.Visible          = false;
                            ddlPers.Visible         = false;
                            lblResult.Visible       = false;
                            lblYiJian.Visible       = false;
                            ddlResult.Visible       = false;
                            txtResultRemark.Visible = false;
                            setEnable(false);
                        }
                        else
                        {
                            //是否为审核人
                            if (eformSer.ifAudiPer(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                            {
                                if (eformSer.ifLastNode(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                                {
                                    if (pProModel.IfOutGoods == false)
                                    {
                                        btnOk.Visible = true;
                                    }

                                    setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                                    lblPer.Visible  = false;
                                    ddlPers.Visible = false;
                                }
                                else
                                {
                                    int ids = 0;

                                    List <A_Role_User> roleUserList = eformSer.getUserToAdu(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]), out ids);

                                    ViewState["ids"] = ids;
                                    if (roleUserList != null)
                                    {
                                        ddlPers.DataSource = roleUserList;

                                        ddlPers.DataBind();
                                        ddlPers.DataTextField  = "UserName";
                                        ddlPers.DataValueField = "UserId";
                                    }
                                    setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                                }
                            }
                            else
                            {
                                //是否为代理人
                                if (eformSer.ifAudiPerByUserName(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                                {
                                    ViewState["ifConsignor"] = true;
                                    if (eformSer.ifLastNode(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                                    {
                                        if (pProModel.IfOutGoods == false)
                                        {
                                            btnOk.Visible = true;
                                        }

                                        lblPer.Visible  = false;
                                        ddlPers.Visible = false;
                                        setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                                    }
                                    else
                                    {
                                        int ids = 0;
                                        List <A_Role_User> roleUserList = eformSer.getUserToAdu(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]), out ids);
                                        ViewState["ids"] = ids;
                                        if (roleUserList != null)
                                        {
                                            ddlPers.DataSource = roleUserList;
                                            ddlPers.DataBind();
                                            ddlPers.DataTextField  = "UserName";
                                            ddlPers.DataValueField = "UserId";
                                        }
                                        setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                                    }
                                }
                                else
                                {
                                    btnSub.Visible  = false;
                                    lblPer.Visible  = false;
                                    ddlPers.Visible = false;

                                    lblResult.Visible       = false;
                                    lblYiJian.Visible       = false;
                                    ddlResult.Visible       = false;
                                    txtResultRemark.Visible = false;
                                    setEnable(false);
                                }
                            }


                            //判断是不是自己填写的单子
                            //if (pProModel.CreateUserId.ToString() == base.Session["currentUserId"].ToString())
                            //{
                            //    //gvList.Columns[0].Visible = true;
                            //    //gvList.Columns[1].Visible = true;

                            //    btnEdit.Visible = true;
                            //    plProInvs.Visible = true;
                            //    //setEnable(true);
                            //}
                        }
                    }
                }
            }
        }