Esempio n. 1
0
    private void BindDropDown()
    {
        tbx_VolumeDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
        int    JXCDelayDays  = 0;
        string monthconditon = "";

        if ((int)ViewState["VolumeID"] == 0)
        {
            if ((int)ViewState["Type"] == 3)
            {
                JXCDelayDays = ConfigHelper.GetConfigInt("JXCDelayDays");       //门店销量填报延迟天数
            }
            else
            {
                JXCDelayDays             = ConfigHelper.GetConfigInt("DIJXCDelayDays"); //门店销量填报延迟天数
                monthconditon            = "'" + DateTime.Now.AddDays(-JXCDelayDays).ToString() + "'BETWEEN BeginDate AND EndDate OR  '" + DateTime.Now.ToString() + "' BETWEEN BeginDate AND EndDate";
                ddl_AccountMonth.Enabled = true;
            }
        }

        ddl_AccountMonth.DataSource = AC_AccountMonthBLL.GetModelList(monthconditon);
        ddl_AccountMonth.DataBind();
        ddl_AccountMonth.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(-JXCDelayDays)).ToString();
        if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1114, "AddSalesVolumeIN") && AC_AccountMonthBLL.GetCurrentMonth() > int.Parse(ddl_AccountMonth.SelectedValue))
        {
            tbx_VolumeDate.Text = new AC_AccountMonthBLL(int.Parse(ddl_AccountMonth.SelectedValue)).Model.EndDate.ToString("yyyy-MM-dd");
        }
    }
    private string GenarateSQL()
    {
        string searchstring = "";

        if (lbx_search.Items.Count > 0)
        {
            foreach (ListItem lt in lbx_search.Items)
            {
                if (lt.Value != "")
                {
                    searchstring += lt.Value + " AND ";
                }
            }

            if (searchstring.EndsWith("AND "))
            {
                searchstring = searchstring.Substring(0, searchstring.Length - 4);
            }
        }


        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 201, "ViewSelfClientByInfoCollectManID"))
        {
            searchstring += " And CU_Client.InfoCollectManID=" + Session["UserID"].ToString();
        }
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 201, "ViewSelefClientByINfoSource20"))  //仅查看来源于医务渠道的顾客
        {
            searchstring += " And CU_Client.InfoSource = 20";
        }
        #endregion
        return(searchstring);
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterClientScriptInclude("meizzDate", Page.ResolveClientUrl("~/App_Themes/basic/meizzDate.js"));
        if (!IsPostBack)
        {
            ViewState["OrganizeCity"] = Request.QueryString["OrganizeCity"] == null ? 0 : int.Parse(Request.QueryString["OrganizeCity"]);
            ViewState["Client"]       = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            ViewState["FeeType"]      = Request.QueryString["FeeType"] == null ? 0 : int.Parse(Request.QueryString["FeeType"]);

            if ((int)ViewState["OrganizeCity"] == 0 || Session["FeeWriteOffDetails"] == null)
            {
                Session["SuccessFlag"] = false;
                MessageBox.ShowAndClose(this, "参数错误!" + ViewState["OrganizeCity"].ToString());
            }

            select_Client.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?&OrganizeCity=" + ViewState["OrganizeCity"].ToString();

            BindDropDown();
            if ((int)ViewState["FeeType"] != 0)
            {
                ddl_FeeType.SelectedValue = ViewState["FeeType"].ToString(); ddl_FeeType.Enabled = false;
            }
            if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 4703, "Browse"))
            {
                //无查看营养教育费用权限
                ListItem item = ddl_FeeType.Items.FindByValue(ConfigHelper.GetConfigInt("CSOCostType").ToString());
                if (item != null)
                {
                    item.Enabled = false;
                }
            }
            BindFeeApplyNoWriteOff();
            BindGrid();
        }
    }
Esempio n. 4
0
    private void BindNotice()
    {
        IList <PN_Notice> notices = null;

        //无导和有导店看不同的公告
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "ViewALLNotice"))
        {
            //查看所有公告
            notices = PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N'  AND PN_Notice.InsertTime > '" +
                                                DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "' AND PN_Notice.ApproveFlag=1 " +
                                                " ORDER BY MCS_SYS.dbo.UF_Spilt(PN_Notice.ExtPropertys,'|',1) DESC, PN_Notice.InsertTime DESC");
        }
        else
        {
            notices = PN_NoticeBLL.GetNoticeByStaff((int)Session["UserID"]);
        }

        gv_Notice.BindGrid <PN_Notice>(notices.Where(p => p["Catalog"] == "" || int.Parse(p["Catalog"]) < 200).ToList());

        //获取特殊公告
        PN_Notice specialnotice = notices.FirstOrDefault(p => p["IsSpecial"] == "1");

        if (specialnotice != null)
        {
            lab_SpecialPN.Text = specialnotice.Content;
        }
    }
 protected void Page_LoadComplete(object sender, EventArgs e)
 {
     #region 检查门店销量
     if ((int)ViewState["Type"] == 3 && Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1103, "CheckSalesVolume"))
     {
         bt_BatchInput.Visible = true;
     }
     #endregion
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 300203, "LoginAssign"))
         {
             Response.Redirect("~/SubModule/desktop.aspx");
         }
         BindDropDown();
     }
 }
Esempio n. 7
0
    private void BindModuleTree()
    {
        lb_RoleName.Text = tr_Role.SelectedValue;
        IList <Right_Assign> list = Right_Assign_BLL.GetModelList("RoleName='" + tr_Role.SelectedValue + "'");

        ViewState["RightAssign"] = list;
        tr_Module.Nodes.Clear();
        BindModuleTree(tr_Module.Nodes, 1);

        ViewState["PageIndex"] = 0;
        BindGrid();
    }
    private void BindGrid()
    {
        string condition = "1=1";

        #region 组织查询条件
        //管理片区及所有下属管理片区
        if (tr_OrganizeCity.SelectValue != "1")
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue));
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys  += tr_OrganizeCity.SelectValue;
            condition += " AND FNA_FeeWriteOff.OrganizeCity IN (" + orgcitys + ")";
        }

        //会计月条件
        condition += " AND FNA_FeeWriteOff.AccountMonth BETWEEN " + ddl_Month.SelectedValue + " AND " + ddl_EndMonth.SelectedValue;

        //申请单号
        if (tbx_SheetCode.Text != "")
        {
            condition += " AND FNA_FeeWriteOff.SheetCode like '%" + tbx_SheetCode.Text + "%'";
        }

        //费用类型
        if (ddl_FeeType.SelectedValue != "0")
        {
            condition += " AND FNA_FeeWriteOff.FeeType = " + ddl_FeeType.SelectedValue;
        }
        if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 4703, "Browse"))
        {
            //无查看营养教育费用权限
            condition += " AND ISNULL(FNA_FeeWriteOff.FeeType,0) <> " + ConfigHelper.GetConfigInt("CSOCostType").ToString();
        }

        //审批状态
        if (ddl_State.SelectedValue != "0")
        {
            condition += " AND FNA_FeeWriteOff.State = " + ddl_State.SelectedValue;
        }

        if (select_Client.SelectValue != "")
        {
            condition += " AND FNA_FeeWriteOff.InsteadPayClient=" + select_Client.SelectValue;
        }
        #endregion

        gv_List.ConditionString = condition;
        gv_List.BindGrid();
    }
Esempio n. 9
0
    private void SaveRight(TreeNodeCollection TNC)
    {
        IList <Right_Assign> assignlist = (IList <Right_Assign>)ViewState["RightAssign"];

        foreach (TreeNode node in TNC)
        {
            int model  = 1;
            int action = 1;
            if (node.Value.StartsWith("M"))
            {
                model  = int.Parse(node.Value.Substring(1));
                action = 1;
            }
            else
            {
                action = int.Parse(node.Value.Substring(1));

                if (node.Parent != null)
                {
                    model = int.Parse(node.Parent.Value.Substring(1));
                }
            }

            Right_Assign assign = assignlist.FirstOrDefault(m => m.Module == model && m.Action == action);
            if (node.Checked)
            {
                if (assign == null)
                {
                    Right_Assign_BLL bll = new Right_Assign_BLL();
                    bll.Model.Module   = model;
                    bll.Model.Action   = action;
                    bll.Model.RoleName = tr_Role.SelectedValue;
                    bll.Model.Based_On = 2;
                    bll.Add();
                }
            }
            else
            {
                if (assign != null)
                {
                    Right_Assign_BLL bll = new Right_Assign_BLL(assign.ID);
                    bll.Delete();
                }
            }

            if (node.ChildNodes.Count > 0)
            {
                SaveRight(node.ChildNodes);
            }
        }
    }
Esempio n. 10
0
    protected void bt_SaveGridView_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in gv_list.Rows)
        {
            CheckBox cb_check = (CheckBox)row.FindControl("cb_check");

            if (cb_check.Checked)
            {
                Right_Assign_BLL bll = new Right_Assign_BLL((int)gv_list.DataKeys[row.RowIndex][0]);
                bll.Delete();
            }
        }
        BindModuleTree();
    }
    protected void bt_SaveGridView_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in gv_list.Rows)
        {
            CheckBox cb_check = (CheckBox)row.FindControl("cb_check");

            if (cb_check.Checked)
            {
                Right_Assign_BLL bll = new Right_Assign_BLL((int)gv_list.DataKeys[row.RowIndex][0]);
                bll.Delete();
            }
        }
        BindModuleTree();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["FeeType"]      = Request.QueryString["FeeType"] == null ? 0 : int.Parse(Request.QueryString["FeeType"]);
            ViewState["AccountTitle"] = Request.QueryString["AccountTitle"] == null ? 1 : int.Parse(Request.QueryString["AccountTitle"]);
            BindDropDown();

            if ((int)ViewState["FeeType"] > 0)
            {
                ddl_FeeType.SelectedValue = ViewState["FeeType"].ToString(); ddl_FeeType.Enabled = false;
            }

            if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 4703, "Browse"))
            {
                //无查看营养教育费用权限
                ListItem item = ddl_FeeType.Items.FindByValue(ConfigHelper.GetConfigInt("CSOCostType").ToString());
                if (item != null)
                {
                    item.Enabled = false;
                }
            }

            BindGrid();

            if ((int)ViewState["AccountTitle"] != 1)
            {
                if ((int)ViewState["AccountTitle"] != 73 && (int)ViewState["AccountTitle"] != 176)
                {
                    bt_Add_CL.Visible = false;
                }
                if ((int)ViewState["AccountTitle"] != 82)
                {
                    bt_Add_FL.Visible = false;
                }
                if ((int)ViewState["AccountTitle"] != 35)
                {
                    bt_Add_Gift.Visible = false;
                }
                if ((int)ViewState["AccountTitle"] != 47)
                {
                    bt_Add_Car.Visible = false;
                }
                //if ((int)ViewState["AccountTitle"] != 36) bt_Add_Promotor.Visible = false;
            }
        }
    }
Esempio n. 13
0
    protected void ud_Notice_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int          id   = int.Parse(ud_Notice.DataKeys[e.NewSelectedIndex]["ID"].ToString());
        PN_NoticeBLL _bll = new PN_NoticeBLL(id);

        if (_bll.Model.ApproveFlag == 1)
        {
            if (_bll.Model.InsertStaff != (int)Session["UserID"] && !Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "UnApproveNotice"))
            {
                MessageBox.Show(Page, "对不起,你没有撤销已审核的公告的权限");
                return;
            }
            _bll.Approve(2, (int)Session["UserID"]);
        }

        BindGrid();
    }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["ClientID"] = Request.QueryString["ClientID"] == null ? 0 : int.Parse(Request.QueryString["ClientID"]);

            if ((int)ViewState["ClientID"] == 0 && int.Parse(Session["AccountType"].ToString()) == 2)
            {
                ViewState["ClientID"] = Int32.Parse(Session["UserID"].ToString());
            }

            if (!Right_Assign_BLL.GetAccessRight((string)Session["Username"], 1101, "SetMapPosition") &&
                !Right_Assign_BLL.GetAccessRight((string)Session["Username"], 6101, "SetMapPosition"))
            {
                btn_snyc.Visible     = false;
                btn_addpoint.Visible = false;
                btn_OK.Visible       = false;
            }
        }
        CM_ClientBLL cm_client = new CM_ClientBLL((int)ViewState["ClientID"]);

        if (cm_client.Model != null)
        {
            lb_FullName.Text = cm_client.Model.FullName;
            lb_Address.Text  = cm_client.Model.Address;
            CM_ClientGeoInfo info = CM_ClientGeoInfoBLL.GetGeoInfoByClient((int)ViewState["ClientID"]);
            if (info != null)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "addComplexMarker(" + info.Longitude + ", " + info.Latitude + ",\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\");mapInit();initmethod(\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\")", true);
                ViewState["InfoID"] = info.ID;
            }
            else if (lngX.Value != "" && latY.Value != "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "addComplexMarker(" + lngX.Value + ", " + latY.Value + ",\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\");mapInit();initmethod(\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\")", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "mapInit();initmethod(\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\")", true);
            }
        }
        else
        {
            MessageBox.ShowAndClose(this, "请选择门店!");
        }
    }
Esempio n. 15
0
    private void BindNotice()
    {
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "ViewALLNotice"))
        {
            //查看所有公告
            gv_Notice.BindGrid <PN_Notice>(PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N'  AND PN_Notice.InsertTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") +
                                                                     "' AND PN_Notice.ApproveFlag=1 ORDER BY MCS_SYS.dbo.UF_Spilt(PN_Notice.ExtPropertys,'|',1) DESC, PN_Notice.InsertTime DESC"));
        }
        else
        {
            gv_Notice.BindGrid <PN_Notice>(PN_NoticeBLL.GetNoticeByStaff((int)Session["UserID"]));
        }
        //获取特殊公告
        IList <PN_Notice> pn = PN_NoticeBLL.GetModelList(" ID = (SELECT max(id) FROM [MCS_OA].[dbo].[PN_Notice] WHERE MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',2)=1 AND IsDelete='N')");

        if (pn.Count > 0)
        {
            lab_SpecialPN.Text = pn[0].Content;
        }
    }
Esempio n. 16
0
    private void BindDropDown()
    {
        Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true);

        tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity();

        if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0)
        {
            tr_OrganizeCity.RootValue   = "0";
            tr_OrganizeCity.SelectValue = "1";
        }
        else
        {
            tr_OrganizeCity.RootValue   = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString();
            tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString();
        }

        ddl_JournalType.DataSource = DictionaryBLL.GetDicCollections("OA_JournalType");
        ddl_JournalType.DataBind();
        ddl_JournalType.Items.Insert(0, new ListItem("请选择...", "0"));

        #region 绑定职位
        tr_Position.DataSource = Org_PositionBLL.GetAllPostion();
        tr_Position.DataBind();

        #region 如果非总部职位,其只能选择自己职位及以下职位
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 22, "ViewAllStaffJN"))
        {
            //有【查看所有员工工作日志】权限
            tr_Position.RootValue   = "0";
            tr_Position.SelectValue = "0";
        }
        else
        {
            tr_Position.RootValue   = staff.Model.Position.ToString();
            tr_Position.SelectValue = staff.Model.Position.ToString();
        }
        #endregion

        #endregion
    }
Esempio n. 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["Staff"] != null)
            {
                Org_Staff staff = new Org_StaffBLL(int.Parse(Request.QueryString["Staff"])).Model;
                if (staff != null)
                {
                    MCSTabControl1.SelectedIndex = 1;
                    ViewState["Staff"]           = staff.ID;
                }
            }
            else
            {
                lb_Staff.Visible             = false;
                select_Staff.Visible         = false;
                MCSTabControl1.SelectedIndex = 0;
                ViewState["Staff"]           = (int)Session["UserID"];

                #region 如果非总部职位,其只能选择自己职位及以下职位
                if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 22, "ViewAllStaffJN"))
                {
                    //无【查看所有员工工作日志】权限
                    select_Staff.PageUrl += "?Position=" + new Org_StaffBLL((int)Session["UserID"]).Model.Position;
                }
                #endregion
            }
        }

        #region 注册脚本
        string script = "function OpenJournal(id){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('JournalDetail.aspx?ID='+id+'&tempid='+tempid, window, 'dialogWidth:860px;DialogHeight=600px;status:no');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OpenJournal", script, true);

        script  = "function NewJournal(d){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('JournalDetail.aspx?Day='+d+'&tempid='+tempid, window, 'dialogWidth:860px;DialogHeight=600px;status:no');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "NewJournal", script, true);
        #endregion
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["FeeType"] = Request.QueryString["FeeType"] == null ? 0 : int.Parse(Request.QueryString["FeeType"]);
            BindDropDown();

            if ((int)ViewState["FeeType"] > 0)
            {
                ddl_FeeType.SelectedValue = ViewState["FeeType"].ToString(); ddl_FeeType.Enabled = false;
            }
            if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 4703, "Browse"))
            {
                //无查看营养教育费用权限
                ListItem item = ddl_FeeType.Items.FindByValue(ConfigHelper.GetConfigInt("CSOCostType").ToString());
                if (item != null)
                {
                    item.Enabled = false;
                }
            }
            BindGrid();
        }
    }
    private void BindDropDown()
    {
        Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true);

        tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity();

        if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0)
        {
            tr_OrganizeCity.RootValue   = "0";
            tr_OrganizeCity.SelectValue = "1";
        }
        else
        {
            tr_OrganizeCity.RootValue   = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString();
            tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString();
        }

        #region 绑定职位
        tr_Position.DataSource = Org_PositionBLL.GetAllPostion();
        tr_Position.DataBind();

        #region 如果非总部职位,其只能选择自己职位及以下职位
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 22, "ViewAllStaffPlan"))
        {
            //有【查看所有员工工作计划】权限
            tr_Position.RootValue   = "0";
            tr_Position.SelectValue = "0";
        }
        else
        {
            tr_Position.RootValue   = staff.Model.Position.ToString();
            tr_Position.SelectValue = staff.Model.Position.ToString();
        }
        #endregion

        #endregion
    }
Esempio n. 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["OrganizeCity"] = Request.QueryString["OrganizeCity"] == null ? 0 : int.Parse(Request.QueryString["OrganizeCity"]);
            ViewState["AccountMonth"] = Request.QueryString["AccountMonth"] == null ? 0 : int.Parse(Request.QueryString["AccountMonth"]);
            if (Request.QueryString["State"] != null)
            {
                if (ddl_State.Items.FindByValue(Request.QueryString["State"]) != null)
                {
                    ddl_State.SelectedValue = Request.QueryString["State"];
                }
            }
            if (Request.QueryString["TabItem"] != null)
            {
                MCSTabControl1.SelectedIndex = int.Parse(Request.QueryString["TabItem"]);
                gv_List.Visible       = MCSTabControl1.SelectedIndex == 0;
                gv_ListDetail.Visible = !gv_List.Visible;
            }
            BindDropDown();

            if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 4703, "Browse"))
            {
                //无查看营养教育费用权限
                ListItem item = ddl_FeeType.Items.FindByValue(ConfigHelper.GetConfigInt("CSOCostType").ToString());
                if (item != null)
                {
                    item.Enabled = false;
                }
            }

            tr_AccountTitle.Enabled = gv_ListDetail.Visible;
            ddl_ApplyCostOP.Enabled = gv_ListDetail.Visible;
            tbx_ApplyCost.Enabled   = gv_ListDetail.Visible;
        }
    }
Esempio n. 21
0
    private void BindGrid()
    {
        IList <Right_Assign> list;

        if (tr_Module.SelectedValue != "")
        {
            DataTable dt  = TreeTableBLL.GetAllChildByNodes("MCS_SYS.dbo.Right_Module", "ID", "SuperID", tr_Module.SelectedValue.Substring(1));
            string    ids = tr_Module.SelectedValue.Substring(1) + ",";
            foreach (DataRow row in dt.Rows)
            {
                ids += row[0].ToString() + ",";
            }
            ids  = ids.Substring(0, ids.Length - 1);
            list = Right_Assign_BLL.GetModelList("RoleName='" + tr_Role.SelectedValue + "' AND Module in (" + ids + ")");
        }
        else
        {
            list = (IList <Right_Assign>)ViewState["RightAssign"];
        }

        gv_list.TotalRecordCount = list.Count;
        gv_list.PageIndex        = (int)ViewState["PageIndex"];
        gv_list.BindGrid <Right_Assign>(list);
    }
    private void BindGrid()
    {
        string ConditionStr = " 1=1 ";

        if ((int)Session["OwnerType"] == 2)
        {
            ConditionStr += @" AND CM_Client.ID IN (SELECT Client FROM MCS_CM.dbo.CM_ClientSupplierInfo INNER JOIN MCS_CM.dbo.CM_Client s ON
               CM_ClientSupplierInfo.Supplier = s.ID WHERE OwnerClient=" + Session["OwnerClient"].ToString() + " )";
        }
        else if ((int)Session["OwnerType"] == 3)
        {
            ConditionStr += @" AND CM_Client.ID IN (SELECT Client FROM MCS_CM.dbo.CM_ClientSupplierInfo WHERE Supplier=" + Session["OwnerClient"].ToString() + " )";
        }

        if (ddl_ClientType.SelectedValue != "0")
        {
            ConditionStr += " AND CM_Client.ClientType = " + ddl_ClientType.SelectedValue;
        }
        else
        {
            ConditionStr += " AND CM_Client.ClientType IN ( 0";
            foreach (ListItem item in ddl_ClientType.Items)
            {
                if (item.Enabled)
                {
                    ConditionStr += "," + item.Value;
                }
            }
            ConditionStr += " )";
        }

        if (tbx_Condition.Text.Trim() != "")
        {
            ConditionStr += " AND " + ddl_SearchType.SelectedValue + " LIKE '%" + this.tbx_Condition.Text.Trim() + "%'";
        }

        if (Request.QueryString["ExtCondition"] != null)
        {
            ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")";
        }

        #region 判断当前可查询的范围
        string orgcitys = "";
        if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != "1")
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue));
            orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += tr_OrganizeCity.SelectValue;

            #region 在选择仓库或经销商时,如果选择的是片区,则可以选择到其上级城市的经销商
            if ((ddl_ClientType.SelectedValue == "1" || ddl_ClientType.SelectedValue == "2") && Request.QueryString["NoParent"] == null)
            {
                DataTable dt_fullpath = orgcity.GetFullPath();
                if (dt_fullpath != null)
                {
                    for (int i = 0; i < dt_fullpath.Rows.Count; i++)
                    {
                        orgcitys += "," + dt_fullpath.Rows[i]["ID"].ToString();
                    }
                }
            }
            #endregion

            if (orgcitys != "")
            {
                ConditionStr += " AND CM_Client.ID IN (SELECT Client FROM MCS_CM.dbo.CM_ClientManufactInfo WHERE CM_ClientManufactInfo.OrganizeCity IN (" + orgcitys + ") )";
            }
        }
        #endregion



        if ((int)Session["AccountType"] == 1)
        {
            if (ddl_ClientType.SelectedValue == "3")
            {
                //是否有权限“仅查看自己的门店”,如果是,限制客户经理条件
                if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 11, "OlnyViewMyClient"))
                {
                    ConditionStr += " AND CM_Client.ID IN (SELECT Client FROM MCS_CM.dbo.CM_ClientManufactInfo WHERE CM_ClientManufactInfo.ClientManager = " + Session["UserID"].ToString() + " )";
                }
            }
        }



        ConditionStr += " Order by MCS_CM.dbo.CM_Client.FullName";

        gv_List.ConditionString = ConditionStr;
        gv_List.BindGrid();

        //Response.Write(ConditionStr);
    }
Esempio n. 23
0
    private void BindData()
    {
        int id = (int)ViewState["ID"];

        FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model;

        if (apply == null)
        {
            Response.Redirect("FeeApplyList.aspx");
        }

        ViewState["AccountMonth"]    = apply.AccountMonth;
        ViewState["OrganizeCity"]    = apply.OrganizeCity;
        ViewState["FeeType"]         = apply.FeeType;
        ViewState["AccountTitle2"]   = string.IsNullOrEmpty(apply["AccountTitle2"]) ? 0 : int.Parse(apply["AccountTitle2"]);
        ViewState["DicFeeType"]      = DictionaryBLL.GetDicCollections("FNA_FeeType")[ViewState["FeeType"].ToString()];
        ViewState["RelateCar"]       = string.IsNullOrEmpty(apply["RelateCar"]) ? 0 : int.Parse(apply["RelateCar"]);
        ViewState["GiftFeeClassify"] = string.IsNullOrEmpty(apply["GiftFeeClassify"]) ? 0 : int.Parse(apply["GiftFeeClassify"]);
        ViewState["FromGeneralFlow"] = string.IsNullOrEmpty(apply["FromGeneralFlow"]) ? "Y" : "N";

        pn_FeeApply.BindData(apply);

        if (apply.Client != 0)
        {
            cbx_NoInsteadPayClient.Visible = false;
        }

        UploadFile1.RelateID = (int)ViewState["ID"];

        if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
        {
            BindBudgetInfo();
        }
        else if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "FeeRateControl")
        {
            BindFeeRateInfo();
        }

        #region 根据审批状态控制页面
        bt_ViewWriteOff.Visible = false;
        if (apply.State == 1)
        {
            //未提交状态
            bt_ViewReport.Visible = false;

            tbx_Remark.Text    = apply["Remark"];
            tbl_Remark.Visible = true;
            gv_List.Columns[gv_List.Columns.Count - 1].Visible = true;  //删除按钮
        }

        if (apply.State != 1)
        {
            //非 未提交 状态
            bt_Delete.Visible    = false;
            bt_AddDetail.Visible = false;
            pn_FeeApply.SetPanelEnable("Panel_FNA_FeeApplyDetail_1", false);
            gv_List.Columns[gv_List.Columns.Count - 1].Visible = false;
            bt_Save.Visible   = false;
            bt_Submit.Visible = false;

            apply["Remark"] = apply["Remark"].Replace("\r", "<br/>");
            pn_Remark.BindData(apply);
            pn_Remark.Visible = true;

            cbx_NoInsteadPayClient.Visible = false;

            UploadFile1.CanDelete = false;

            if (apply.FeeType == 1)
            {
                bt_ViewReport.OnClientClick = "PopReport(" + apply.ID.ToString() + ")";
            }
            else
            {
                bt_ViewReport.Visible = false;
            }


            //可见调整金额及原因
            gv_List.Columns[gv_List.Columns.Count - 7].Visible  = true; //批复额
            gv_List.Columns[gv_List.Columns.Count - 10].Visible = true; //调整原因
            gv_List.Columns[gv_List.Columns.Count - 11].Visible = true; //调整金额
            if ((ViewState["Details"] as ListTable <FNA_FeeApplyDetail>).GetListItem().FirstOrDefault(p => p.AccountTitle == 82) != null)
            {
                gv_List.Columns[gv_List.Columns.Count - 6].Visible = true;  //批复额
                gv_List.Columns[gv_List.Columns.Count - 8].Visible = true;  //调整原因
                gv_List.Columns[gv_List.Columns.Count - 9].Visible = true;  //调整金额
            }
        }
        if ((ViewState["Details"] as ListTable <FNA_FeeApplyDetail>).GetListItem()[0].RelateContractDetail > 0)
        {
            gv_List.Columns[4].Visible = true;
        }

        if (apply.State == 2)
        {
            ///已提交状态,审批过程中,可以作金额调整
            ///审批过程中,可以作金额调整 Decision参数为在审批过程中传进来的参数
            if (Request.QueryString["Decision"] != "" && Request.QueryString["Decision"] == "Y")
            {
                gv_List.Columns[gv_List.Columns.Count - 2].Visible = true; //允许调整申请金额
                int fltype = ConfigHelper.GetConfigInt("ContractFeeType-FL");
                if (apply.FeeType == fltype)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单独审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_Pass').disabled='disabled'; </script>");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单条审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_bt_SaveDecisionComment').disabled='disabled'; </script>");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单条处理", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_WaitProcess').disabled='disabled'; </script>");
                    string[] allowdays = Addr_OrganizeCityParamBLL.GetValueByType(1, 9).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
                    if (!allowdays.Contains(DateTime.Now.Day.ToString()))
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "超时不能单独审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_NotPass').disabled='disabled'; </script>");
                    }
                }
            }
            bt_ViewWriteOff.Visible = false;
        }

        if (apply.State == 3)
        {
            //已审批
            bt_ViewWriteOff.Visible = true;
            gv_List.Columns[gv_List.Columns.Count - 3].Visible = true; //查看核销 链接
            gv_List.Columns[gv_List.Columns.Count - 4].Visible = true; //可报销额
            gv_List.Columns[gv_List.Columns.Count - 5].Visible = true; //报销标志

            bt_ViewWriteOff.OnClientClick = "PopWriteOffListByApplyID(" + id.ToString() + ")";
            if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1503, "CancelWirteOffDetail"))
            {
                bt_CancelWriteOff.Visible       = true;
                bt_CancelWriteOff.OnClientClick = "return confirm('是否确定取消选中的费用,取消后,该费用不可再次核销!\n【若需要再次核销则需要重新发起申请!】')";
                gv_List.Columns[0].Visible      = true;
            }
        }

        if (apply.InsertStaff != (int)Session["UserID"] || apply.State != 3)
        {
            bt_Cancel.Visible = false;
        }

        if (apply.InsertStaff != (int)Session["UserID"] || apply.State >= 3)
        {
            UploadFile1.CanUpload = false;
            UploadFile1.CanDelete = false;
        }

        if (apply.State != 8)
        {
            bt_Copy.Visible = false;    //只有审批未通过才可重新激活
        }

        #endregion

        if (apply["FromGeneralFlow"] == "N")
        {
            if (apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType") ||
                apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType-KA") ||
                apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType-FL")
                )
            {
                bt_AddDetail.Visible = false;
            }
        }
        #region 增加客户后的详细内容按钮
        if (apply.Client != 0)
        {
            //MCSSelectControl sc_Client = (MCSSelectControl)pn_FeeApply.FindControl("FNA_FeeApply_Client");
            //if (sc_Client != null)
            //{
            //    HyperLink hy_clientdetail = new HyperLink();
            //    hy_clientdetail.ImageUrl = "~/Images/Gif/gif-0818.gif";
            //    hy_clientdetail.NavigateUrl = "~/SubModule/CM/RT/RetailerAnalysis.aspx?ClientID=" + apply.Client.ToString();
            //    hy_clientdetail.Target = "_blank";
            //    sc_Client.Parent.Controls.Add(hy_clientdetail);
            //}
        }
        #endregion

        #region 增加关联活动链接
        int activityid = 0;

        if (int.TryParse(apply["ActivityID"], out activityid) && activityid > 0)
        {
            Label label = (Label)pn_FeeApply.FindControl("FNA_FeeApply_ActivityID");
            if (label != null)
            {
                HyperLink hy_activitydetail = new HyperLink();
                hy_activitydetail.Text        = " 查看活动详情";
                hy_activitydetail.ForeColor   = System.Drawing.Color.Blue;
                hy_activitydetail.NavigateUrl = "~/SubModule/CAT/CAT_ActivityDetail.aspx?ID=" + activityid.ToString();
                hy_activitydetail.Target      = "_blank";
                label.Parent.Controls.Add(hy_activitydetail);
            }
        }
        #endregion

        #region 增加关联HDM结算单链接
        int hdmbalance = 0;

        if (int.TryParse(apply["HDMBalance"], out hdmbalance) && hdmbalance > 0)
        {
            Label label = (Label)pn_FeeApply.FindControl("FNA_FeeApply_HDMBalance");
            if (label != null)
            {
                HyperLink hy_hdmbalance = new HyperLink();
                hy_hdmbalance.Text        = " 查看结算单详情";
                hy_hdmbalance.ForeColor   = System.Drawing.Color.Blue;
                hy_hdmbalance.NavigateUrl = "~/SubModule/CSO/CSO_OfferBalanceDetail.aspx?OfferBalanceID=" + hdmbalance.ToString();
                hy_hdmbalance.Target      = "_blank";
                label.Parent.Controls.Add(hy_hdmbalance);
            }
        }
        #endregion
        BindGrid();
    }
    private void SaveRight(TreeNodeCollection TNC)
    {
        IList<Right_Assign> assignlist = (IList<Right_Assign>)ViewState["RightAssign"];
        foreach (TreeNode node in TNC)
        {
            int model = 1;
            int action = 1;
            if (node.Value.StartsWith("M"))
            {
                model = int.Parse(node.Value.Substring(1));
                action = 1;
            }
            else
            {
                action = int.Parse(node.Value.Substring(1));

                if (node.Parent != null)
                    model = int.Parse(node.Parent.Value.Substring(1));
            }

            Right_Assign assign = assignlist.FirstOrDefault(m => m.Module == model && m.Action == action);
            if (node.Checked)
            {
                if (assign == null)
                {
                    Right_Assign_BLL bll = new Right_Assign_BLL();
                    bll.Model.Module = model;
                    bll.Model.Action = action;
                    bll.Model.RoleName = tr_Role.SelectedValue;
                    bll.Model.Based_On = 2;
                    bll.Add();
                }
            }
            else
            {
                if (assign != null)
                {
                    Right_Assign_BLL bll = new Right_Assign_BLL(assign.ID);
                    bll.Delete();
                }
            }

            if (node.ChildNodes.Count > 0)
            {
                SaveRight(node.ChildNodes);
            }
        }
    }
    private void BindGrid()
    {
        if (MCSTabControl1.SelectedIndex == 0)
        {
            tr1.Visible        = false;
            tr_Product.Visible = true;

            string condition = " 1 = 1 ";

            if (ddl_Brand.SelectedValue != "0")
            {
                if (ddl_Classify.SelectedValue == "0")
                {
                    condition = " Brand =" + ddl_Brand.SelectedValue;
                }
                else
                {
                    condition = " Classify =" + ddl_Classify.SelectedValue;
                }
            }

            condition += " ORDER BY PDT_Product.Code";

            PDT_StandardPriceBLL bll = new PDT_StandardPriceBLL((int)ViewState["PriceID"]);
            gv_List.BindGrid(bll.GetDetail(condition));

            if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 1410, "ModifyFactoryPrice"))
            {
                foreach (GridViewRow row in gv_List.Rows)
                {
                    TextBox tbx = (TextBox)row.FindControl("tbx_FactoryPrice");
                    if (tbx != null)
                    {
                        tbx.Enabled = false;
                    }
                }
            }
        }
        else
        {
            tr1.Visible        = true;
            tr_Product.Visible = false;

            //获取非价表产品列表
            string condition = "State=1 AND ID NOT IN (SELECT Product FROM PDT_StandardPrice_Detail WHERE StandardPrice=" + ViewState["PriceID"].ToString() + ")";

            if (ddl_Brand.SelectedValue == "0")
            {
                condition += " AND Brand in (SELECT ID FROM PDT_Brand WHERE IsOpponent in ('1'))";
            }
            else
            {
                if (ddl_Classify.SelectedValue == "0")
                {
                    condition += " AND Brand =" + ddl_Brand.SelectedValue;
                }
                else
                {
                    condition += " AND Classify =" + ddl_Classify.SelectedValue;
                }
            }

            IList <PDT_Product> products = PDT_ProductBLL.GetModelList(condition);

            gv_List_FacProd.BindGrid <PDT_Product>(products);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            #region 获取页面参数
            if (Request.QueryString["ClientID"] != null)
            {
                ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]);
                Session["ClientID"]   = ViewState["ClientID"];
            }
            else if (Session["ClientID"] != null)
            {
                ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString());
            }
            ViewState["ClientType"] = Request.QueryString["ClientType"] == null ? 0 : int.Parse(Request.QueryString["ClientType"]);

            select_Client.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=" +
                                    ViewState["ClientType"].ToString() + "&NoParent=Y";
            if ((int)ViewState["ClientType"] == 2)
            {
                Header.Attributes["WebPageSubCode"] = "ClientClassify=1";    //1:经销商
            }
            else if ((int)ViewState["ClientType"] == 2)
            {
                Header.Attributes["WebPageSubCode"] = "ClientClassify=3";    //3:促销门店
            }
            #endregion

            BindDropDown();

            if (Request.QueryString["ApproveFlag"] != null)
            {
                //查找过滤添加:0:所有 1:审核 2:未审核
                if (Request.QueryString["ClientClassify"] != null)
                {
                    ViewState["ClientClassify"] = int.Parse(Request.QueryString["ClientClassify"]);
                }
                else
                {
                    Response.Redirect("~/SubModule/Desktop.aspx");
                }

                Session["ClientID"]           = null;
                ViewState["ClientID"]         = null;
                rbl_ApproveFlag.SelectedValue = Request.QueryString["ApproveFlag"];

                ddl_BeginMonth.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddMonths(-1)).ToString();
                ddl_EndMonth.SelectedValue   = ddl_BeginMonth.SelectedValue;

                Header.Attributes["WebPageSubCode"] = "ClientClassify=" + ViewState["ClientClassify"].ToString();
            }
            else if (ViewState["ClientID"] != null)
            {
                CM_ClientBLL client = new CM_ClientBLL((int)ViewState["ClientID"]);
                if (client.Model["DIClassify"] == "2")
                {
                    Response.Redirect("JXCSummary_ListSub.aspx?ClientID=" + client.Model.ID.ToString() + "&ClientType=2");
                }

                if (Request.QueryString["ClientType"] != null && client.Model.ClientType != (int)ViewState["ClientType"])
                {
                    Session["ClientID"] = null;
                    Response.Redirect(Request.Url.PathAndQuery);
                }

                #region 载入客户信息
                ViewState["ClientType"] = client.Model.ClientType;

                select_Client.SelectValue = ViewState["ClientID"].ToString();
                select_Client.SelectText  = client.Model.FullName;
                select_Client.PageUrl     = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=" +
                                            client.Model.ClientType.ToString() + "&OrganizeCity=" + client.Model.OrganizeCity.ToString() + "&NoParent=Y";
                tr_OrganizeCity.SelectValue = client.Model.OrganizeCity.ToString();
                #endregion

                #region 判断传入客户参数的客户类别
                //if (client.Model.ClientType == 2 && client.Model["DIClassify"] == "1")
                //    Header.Attributes["WebPageSubCode"] = "ClientClassify=1";    //1:经销商
                //else if (client.Model.ClientType == 2 && client.Model["DIClassify"] != "1")
                //    Header.Attributes["WebPageSubCode"] = "ClientClassify=2";    //2:分销商
                //else if (client.Model.ClientType == 3 && client.Model["IsPromote"] == "1")
                //    Header.Attributes["WebPageSubCode"] = "ClientClassify=3";    //3:促销门店
                //else
                //    Header.Attributes["WebPageSubCode"] = "ClientClassify=4";    //4:非促销门店
                #endregion

                BindGrid();
            }
            else
            {
            }
            //else
            //{
            //    if ((int)ViewState["ClientType"] == 2)
            //        MessageBox.ShowAndRedirect(this, "请先在‘经销商列表’中选择要查看的经销商!", "../CM/DI/DistributorList.aspx?URL=" + Request.Url.PathAndQuery);
            //    else
            //        MessageBox.ShowAndRedirect(this, "请先在‘零售商列表’中选择要查看的零售商!", "../CM/RT/RetailerList.aspx?URL=" + Request.Url.PathAndQuery);

            //    return;
            //}

            #region 判断是否有权限查看出厂价的权限
            switch (Header.Attributes["WebPageSubCode"])
            {
            case "ClientClassify=1":
                if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 1220, "ViewFactoryPrice"))
                {
                    MCSTabControl1.SelectedIndex = 1;
                }
                break;

            case "ClientClassify=2":
                if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 1220, "ViewFactoryPrice2"))
                {
                    MCSTabControl1.SelectedIndex = 1;
                }
                break;

            case "ClientClassify=3":
                if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 1120, "ViewFactoryPrice"))
                {
                    MCSTabControl1.SelectedIndex = 1;
                }
                break;

            case "ClientClassify=4":
                if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 1120, "ViewFactoryPrice2"))
                {
                    MCSTabControl1.SelectedIndex = 1;
                }
                break;

            default:
                MCSTabControl1.SelectedIndex = 1;
                break;
            }
            #endregion
        }

        if ((int)ViewState["ClientType"] == 2)
        {
            MCSTabControl1.Items[1].Visible = false;
            MCSTabControl1.Items[2].Visible = false;   //经销商客户,不显示零售价
            MCSTabControl1.Items[3].Visible = true;
        }

        if ((int)ViewState["ClientType"] == 3)
        {
            gv_List.Columns[8].Visible = false;                              //本期签收
            gv_List.Columns[gv_List.Columns.Count - 2].Visible = false;      //下游买赠
            gv_List.Columns[gv_List.Columns.Count - 3].Visible = false;      //下游进货
            gv_List.Columns[gv_List.Columns.Count - 4].Visible = false;      //下游退货
        }
    }
    private void BindGrid()
    {
        string condition = "1=1";

        #region 组织查询条件
        //管理片区及所有下属管理片区
        if (tr_OrganizeCity.SelectValue != "1")
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue));
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += tr_OrganizeCity.SelectValue;

            condition += " AND FNA_FeeApply.OrganizeCity IN (" + orgcitys + ")";
        }

        //会计月条件

        if ((int)ViewState["AccountTitle"] == 82)
        {
            condition += " AND EXISTS (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE FNA_FeeApplyDetail.AccountTitle=82 AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID AND BeginMonth=" + ddl_Month.SelectedValue + ")";
        }
        else
        {
            condition += " AND FNA_FeeApply.AccountMonth = " + ddl_Month.SelectedValue;
        }
        //申请单号
        if (tbx_SheetCode.Text != "")
        {
            condition += " AND FNA_FeeApply.SheetCode like '%" + tbx_SheetCode.Text + "%'";
        }

        if (!string.IsNullOrEmpty(Select_InsertStaff.SelectValue))
        {
            condition += " AND FNA_FeeApply.InsertStaff=" + Select_InsertStaff.SelectValue;
        }
        if (!string.IsNullOrEmpty(select_ApplyClient.SelectValue))
        {
            condition += " AND FNA_FeeApply.Client=" + select_ApplyClient.SelectValue;
        }

        //费用类型
        if (ddl_FeeType.SelectedValue != "0")
        {
            condition += " AND FNA_FeeApply.FeeType = " + ddl_FeeType.SelectedValue;
        }
        if (!Right_Assign_BLL.GetAccessRight((string)Session["UserName"], 4703, "Browse"))
        {
            //无查看营养教育费用权限
            condition += " AND FNA_FeeApply.FeeType <> " + ConfigHelper.GetConfigInt("CSOCostType").ToString();
        }

        //审批状态
        if (ddl_State.SelectedValue != "0")
        {
            condition += " AND FNA_FeeApply.State = " + ddl_State.SelectedValue;
        }

        //核销状态
        if (ddl_WriteOffState.SelectedValue == "1")
        {
            condition += " AND FNA_FeeApply.State=3 AND FNA_FeeApply.ID IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE AvailCost > 0 AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID)";
        }
        else if (ddl_WriteOffState.SelectedValue == "2")
        {
            condition += " AND FNA_FeeApply.State=3 AND FNA_FeeApply.ID NOT IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE AvailCost > 0 AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID)";
        }

        //会计科目
        int accounttile = 0;

        if (int.TryParse(tr_AccountTitle.SelectValue, out accounttile) && accounttile > 1)
        {
            DataTable dt  = TreeTableBLL.GetAllChildByNodes("MCS_PUB.dbo.AC_AccountTitle", "ID", "SuperID", accounttile.ToString());
            string    ids = "";
            foreach (DataRow dr in dt.Rows)
            {
                ids += dr["ID"].ToString() + ",";
            }
            ids += accounttile.ToString();

            condition += " AND FNA_FeeApply.ID IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE AccountTitle IN(" + ids + ") AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID)";
        }

        //标题
        if (tbx_Title.Text != "")
        {
            condition += " AND MCS_SYS.dbo.UF_Spilt(FNA_FeeApply.ExtPropertys,'|',4) LIKE '%" + tbx_Title.Text + "%'";
        }
        #endregion

        gv_List.ConditionString = condition;
        gv_List.BindGrid();
    }
Esempio n. 28
0
    private void BindGrid()
    {
        int       month          = int.Parse(ddl_Month.SelectedValue);
        int       organizecity   = int.Parse(tr_OrganizeCity.SelectValue);
        DataTable dtSummary      = new DataTable();
        int       state          = int.Parse(ddl_State.SelectedValue);
        string    accountname    = ddl_Month.SelectedItem.Text;
        string    preaccountname = DateTime.Parse(accountname + "-01").AddMonths(-3).ToString("yyyy-MM");

        switch (MCSTabControl1.SelectedTabItem.Value)
        {
        case "0":
        {
            dtSummary = FNA_FeeApplyBLL.GetDiaplayFeeSummary(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "责任人员", "行政属性" },
                                           new string[] { "RTChannel", "DisplayFeeType", "Title" }, "Summary", true, false);
            MatrixTable.TableAddRowSubTotal_Matric(dtSummary, new string[] { "责任人员" }, 3, new string[] { "RTChannel", "DisplayFeeType", "Title" }, false);

            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[0].ToString().EndsWith("计") || dr[2].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("费率%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→2.陈列费总计(元/月)→A.我司承担") &&
                                        dtSummary.Columns.Contains(title + "→3.销量及费率→C." + accountname + "预计销量(元/月)") &&
                                        (decimal)dr[title + "→3.销量及费率→C." + accountname + "预计销量(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→2.陈列费总计(元/月)→A.我司承担"] / (decimal)dr[title + "→3.销量及费率→C." + accountname + "预计销量(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                            if (dc.ColumnName.EndsWith("E.费率(较" + preaccountname + ")%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→2.陈列费总计(元/月)→A.我司承担") &&
                                        dtSummary.Columns.Contains(title + "→3.销量及费率→A." + preaccountname + "实际销量(元/月)") &&
                                        (decimal)dr[title + "→3.销量及费率→A." + preaccountname + "实际销量(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→2.陈列费总计(元/月)→A.我司承担"] / (decimal)dr[title + "→3.销量及费率→A." + preaccountname + "实际销量(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
        break;

        case "1":
        {
            dtSummary = FNA_FeeApplyBLL.GetDiaplayFeeByDisplay(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "责任人员" },
                                           new string[] { "DisplayMode", "Title" }, "Summary", true, false);
            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[0].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("费率%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→B.我司费用") &&
                                        dtSummary.Columns.Contains(title + "→D." + accountname + "预计销量(元/月)") &&
                                        (decimal)dr[title + "→D." + accountname + "预计销量(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→B.我司费用"] / (decimal)dr[title + "→D." + accountname + "预计销量(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
        break;

        case "2":
        {
            dtSummary = FNA_FeeApplyBLL.GetByPayMode(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "责任人员" },
                                           new string[] { "付款周期", "Title" }, "Summary", true, false);
            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[0].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("比"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→我司费用") &&
                                        dtSummary.Columns.Contains("总计→我司费用") &&
                                        (decimal)dr["总计→我司费用"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→我司费用"] / (decimal)dr["总计→我司费用"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
        break;
        }


        gv_List.DataSource = dtSummary;
        gv_List.DataBind();

        if (dtSummary.Columns.Count >= 24)
        {
            gv_List.Width = new Unit(dtSummary.Columns.Count * 65);
        }
        else
        {
            gv_List.Width = new Unit(100, UnitType.Percentage);
        }

        MatrixTable.GridViewMatric(gv_List);

        MatrixTable.GridViewMergSampeValueRow(gv_List, 0);

        MatrixTable.GridViewMergSampeValueRow(gv_List, 1);

        #region 是否可以批量审批
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1509, "BatApproveFee"))
        {
            bt_Approve.Visible   = (ddl_State.SelectedValue == "1");
            bt_UnApprove.Visible = (ddl_State.SelectedValue == "1");
            bt_Approve.Enabled   = (ddl_State.SelectedValue == "1");
            bt_UnApprove.Enabled = (ddl_State.SelectedValue == "1");
            #region 判断费用申请进度
            if (ddl_State.SelectedValue == "1")
            {
                Org_StaffBLL _staff = new Org_StaffBLL((int)Session["UserID"]);
                DataTable    dt     = _staff.GetLowerPositionTask(1, organizecity, month);

                if (dt.Rows.Count > 0)
                {
                    bt_Approve.Enabled = false;
                    //bt_UnApprove.Enabled = false;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/Pop_ShowLowerPositionTask.aspx") +
                                                            "?Type=1&StaffID=0&Month=" + ddl_Month.SelectedValue + "&City=" + tr_OrganizeCity.SelectValue + "&tempid='+tempid, window, 'dialogWidth:520px;DialogHeight=600px;status:yes;resizable=no');</script>", false);
                }
            }
            #endregion
        }
        else
        {
            bt_Approve.Visible   = false;
            bt_UnApprove.Visible = false;
        }
        #endregion
    }
Esempio n. 29
0
    protected void ud_Notice_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int          id   = int.Parse(ud_Notice.DataKeys[e.RowIndex]["ID"].ToString());
        PN_NoticeBLL _bll = new PN_NoticeBLL(id);

        if (_bll.Model.InsertStaff != (int)Session["UserID"] && _bll.Model.ApproveFlag == 1 && !Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "DelNotice"))
        {
            MessageBox.Show(Page, "对不起,你没有删除已审核公告的权限");
            return;
        }
        _bll.SetIsDeleted();

        BindGrid();
    }
    private void BindDropDown()
    {
        ddl_ClientType.DataSource = DictionaryBLL.GetDicCollections("CM_ClientType");
        ddl_ClientType.DataBind();
        ddl_ClientType.Items.Insert(0, new ListItem("请选择...", "0"));

        //if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 17, "ViewStoreInPopSearch"))
        //{
        //    //在弹出窗口中查看仓库列表
        //    if (ddl_ClientType.Items.FindByValue("1") != null) ddl_ClientType.Items.FindByValue("1").Enabled = false;
        //}

        if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 12, "ViewDIInPopSearch"))
        {
            //在弹出窗口中查看经销商列表
            if (ddl_ClientType.Items.FindByValue("2") != null)
            {
                ddl_ClientType.Items.FindByValue("2").Enabled = false;
            }
        }

        if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 11, "ViewRTInPopSearch") && (int)Session["OwnerType"] != 3)
        {
            //在弹出窗口中查看门店列表
            if (ddl_ClientType.Items.FindByValue("3") != null)
            {
                ddl_ClientType.Items.FindByValue("3").Enabled = false;
            }
        }

        if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 801, "ViewHPInPopSearch"))
        {
            //在弹出窗口中查看医院列表
            if (ddl_ClientType.Items.FindByValue("5") != null)
            {
                ddl_ClientType.Items.FindByValue("5").Enabled = false;
            }
        }


        #region 绑定用户可管辖的管理片区
        if ((int)Session["AccountType"] == 1)
        {
            Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]);
            tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity();

            if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0)
            {
                tr_OrganizeCity.RootValue   = "0";
                tr_OrganizeCity.SelectValue = "1";
            }
            else
            {
                tr_OrganizeCity.RootValue   = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString();
                tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString();
            }

            #region 获取当前员工的关联经销商
            int _relateclient = 0;
            if (staff.Model["RelateClient"] != "" && int.TryParse(staff.Model["RelateClient"], out _relateclient))
            {
                ViewState["RelateClient"] = _relateclient;
            }
            #endregion
        }
        else if ((int)Session["AccountType"] == 2)
        {
            CM_ClientBLL client = new CM_ClientBLL((int)Session["UserID"]);
            if (client.Model != null)
            {
                int city = client.GetManufactInfo(client.Model.OwnerClient).OrganizeCity;
                Addr_OrganizeCityBLL citybll = new Addr_OrganizeCityBLL(city);
                tr_OrganizeCity.DataSource  = citybll.GetAllChildNodeIncludeSelf();
                tr_OrganizeCity.RootValue   = citybll.Model.SuperID.ToString();
                tr_OrganizeCity.SelectValue = city.ToString();
            }
        }
        #endregion
    }
Esempio n. 31
0
    private void BindGrid()
    {
        int      approveflag = 1;
        DateTime dtBegin     = DateTime.Parse(this.tbx_begin.Text);
        DateTime dtEnd       = DateTime.Parse(this.tbx_end.Text).AddDays(1);

        #region 列表列隐藏
        if (MCSTabControl1.SelectedIndex == 0)
        {
            //已审核公告
            approveflag = 1;

            //是否有权限撤销公告
            ud_Notice.Columns[ud_Notice.Columns.Count - 2].Visible = Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "UnApproveNotice");

            //是否有权限删除公告
            ud_Notice.Columns[ud_Notice.Columns.Count - 1].Visible = Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "DelNotice");
        }
        else if (MCSTabControl1.SelectedIndex == 1)
        {
            //未审核公告
            approveflag = 2;
            ud_Notice.Columns[ud_Notice.Columns.Count - 2].Visible = false;
            ud_Notice.Columns[ud_Notice.Columns.Count - 1].Visible = true;
        }
        else
        {
            //我的公告
            ud_Notice.Columns[ud_Notice.Columns.Count - 2].Visible = true;
            ud_Notice.Columns[ud_Notice.Columns.Count - 1].Visible = true;
        }
        #endregion

        IList <PN_Notice> notices = null;
        if (MCSTabControl1.SelectedIndex < 2)
        {
            if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "ViewALLNotice"))
            {
                //查看所有公告
                notices = PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N'  AND PN_Notice.InsertTime BETWEEN '" + tbx_begin.Text + "' AND '"
                                                    + tbx_end.Text + " 23:59' AND PN_Notice.ApproveFlag=" + approveflag.ToString()
                                                    + " ORDER BY MCS_SYS.dbo.UF_Spilt(PN_Notice.ExtPropertys,'|',1) DESC, PN_Notice.InsertTime DESC");
            }
            else
            {
                notices = PN_NoticeBLL.GetNoticeByStaff((int)Session["UserID"], dtBegin, dtEnd, approveflag);
            }
        }
        else
        {
            //我发布的公告
            notices = PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N'  AND PN_Notice.InsertTime BETWEEN '" + tbx_begin.Text + "' AND '"
                                                + tbx_end.Text + " 23:59' AND PN_Notice.InsertStaff=" + (int)Session["UserID"] + " Order BY  PN_Notice.InsertTime desc");
        }

        if (tbx_Search.Text.Trim() != "")
        {
            notices = notices.Where(p => p.KeyWord.Contains(tbx_Search.Text.Trim()) || p.Topic.Contains(tbx_Search.Text.Trim())).ToList();
        }
        if ((int)ViewState["Catalog"] > 1)
        {
            notices = notices.Where(p => p["Catalog"] == ViewState["Catalog"].ToString()).ToList();
        }
        else
        {
            notices = notices.Where(p => p["Catalog"] == "" || p["Catalog"] == "1").ToList();
        }
        ud_Notice.BindGrid(notices);
        return;
    }
Esempio n. 32
0
    private void BindGrid()
    {
        int month        = int.Parse(ddl_Month.SelectedValue);
        int organizecity = int.Parse(tr_OrganizeCity.SelectValue);
        int state        = int.Parse(ddl_State.SelectedValue);

        if (MCSTabControl1.SelectedTabItem.Value == "0")
        {
            #region 显示汇总数据
            gv_List.Visible = true; gv_DetailList.Visible = false;
            DataTable dtSummary = FNA_FeeApplyBLL.GetFLFeeSummary(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "行政属性" },
                                           new string[] { "RTChannel", "DisplayFeeType", "Title" }, "Summary", true, false);
            MatrixTable.TableAddRowSubTotal_Matric(dtSummary, new string[] { "管理片区名称" }, 2, new string[] { "RTChannel", "DisplayFeeType", "Title" }, false);

            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[1].ToString().EndsWith("计") || dr[2].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("费率%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→1.返利费总计(元/月)→A.我司承担") &&
                                        dtSummary.Columns.Contains(title + "→2.销量及费率→A.实际进货(元/月)") &&
                                        (decimal)dr[title + "→2.销量及费率→A.实际进货(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→1.返利费总计(元/月)→A.我司承担"] / (decimal)dr[title + "→2.销量及费率→A.实际进货(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            gv_List.DataSource = dtSummary;
            gv_List.DataBind();

            if (dtSummary.Columns.Count >= 24)
            {
                gv_List.Width = new Unit(dtSummary.Columns.Count * 65);
            }
            else
            {
                gv_List.Width = new Unit(100, UnitType.Percentage);
            }

            MatrixTable.GridViewMatric(gv_List);

            MatrixTable.GridViewMergSampeValueRow(gv_List, 0);
            MatrixTable.GridViewMergSampeValueRow(gv_List, 1);

            #endregion
        }
        else
        {
            gv_List.Visible = false; gv_DetailList.Visible = true;
            if (ddl_State.SelectedValue == "1" && Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1510, "BatApproveFee"))
            {
                bt_Approve.Visible         = false;
                bt_UnApprove.Visible       = true;
                bt_Approve.OnClientClick   = "return confirm('是否确认将所选中所有申请单批量设为审批通过?注意该操作可能耗时较长,请耐心等待!')";
                bt_UnApprove.OnClientClick = "return confirm('是否确认将所选中所有申请单批量设为审批不通过?注意该操作可能耗时较长,请耐心等待!')";
            }
            #region 组织明细查询条件
            string condition = "";
            condition += @"FNA_FeeApply.FeeType=7 AND EXISTS(SELECT 1 FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE FNA_FeeApplyDetail.AccountTitle=82
                AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID AND BeginMonth=" + ddl_Month.SelectedValue + ")";
            if (tr_OrganizeCity.SelectValue != "1")
            {
                Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(organizecity);
                string orgcitys = orgcity.GetAllChildNodeIDs();
                if (orgcitys != "")
                {
                    orgcitys += ",";
                }
                orgcitys += organizecity;

                condition += " AND FNA_FeeApply.OrganizeCity IN (" + orgcitys + ")";
            }
            if (state == 0)
            {
                condition += " AND FNA_FeeApply.State IN (2,3) ";
            }
            else if (state == 1)
            {
                condition +=
                    @" AND	FNA_FeeApply.State = 2 AND 
			EXISTS (
				SELECT EWF_Task_Job.Task
				FROM  MCS_EWF.dbo.EWF_Task_JobDecision INNER JOIN
					MCS_EWF.dbo.EWF_Task_Job ON EWF_Task_JobDecision.Job = EWF_Task_Job.ID 
					 INNER JOIN MCS_EWF.dbo.EWF_Task ON	 EWF_Task_Job.Task= EWF_Task.ID AND EWF_Task.App='4eb9e905-3502-4caf-88d0-aadcfec6e4dd'
				WHERE EWF_Task_JobDecision.RecipientStaff="                 + Session["UserID"].ToString() + @" AND
					EWF_Task_JobDecision.DecisionResult=1 and EWF_Task_Job.Status=3 AND FNA_FeeApply.ApproveTask=EWF_Task_Job.Task)"                    ;
            }
            else if (state == 2)
            {
                condition += " AND FNA_FeeApply.State = 3 ";
            }
            else if (state == 3)
            {
                AC_AccountMonth m = new AC_AccountMonthBLL(month).Model;
                condition +=
                    @" AND FNA_FeeApply.State IN (2,3) AND EXISTS 
            (SELECT EWF_Task_Job.Task FROM  MCS_EWF.dbo.EWF_Task_JobDecision INNER JOIN
	        MCS_EWF.dbo.EWF_Task_Job ON EWF_Task_JobDecision.Job = EWF_Task_Job.ID 
            INNER JOIN MCS_EWF.dbo.EWF_Task ON=EWF_Task_Job.Task=EWF_Task.ID AND EWF_Task.App='4eb9e905-3502-4caf-88d0-aadcfec6e4dd'
            WHERE EWF_Task_JobDecision.RecipientStaff=" + Session["UserID"].ToString() + @" AND
	            EWF_Task_JobDecision.DecisionResult IN(2,5,6) AND FNA_FeeApply.ApproveTask=EWF_Task_Job.Task)"    ;
            }
            #endregion
            gv_DetailList.ConditionString = condition;
            gv_DetailList.BindGrid();
        }


        #region 是否可以批量审批
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1510, "BatApproveFee"))
        {
            bt_Approve.Visible   = (ddl_State.SelectedValue == "1");
            bt_UnApprove.Visible = (ddl_State.SelectedValue == "1");
            bt_Approve.Enabled   = (ddl_State.SelectedValue == "1");
            bt_UnApprove.Enabled = (ddl_State.SelectedValue == "1");

            #region 判断费用申请进度
            if (ddl_State.SelectedValue == "1")
            {
                Org_StaffBLL _staff = new Org_StaffBLL((int)Session["UserID"]);
                DataTable    dt     = _staff.GetLowerPositionTask(2, int.Parse(tr_OrganizeCity.SelectValue), month);
                if (AC_AccountMonthBLL.GetCurrentMonth() - 1 <= int.Parse(ddl_Month.SelectedValue))
                {
                    string[] allowdays1 = Addr_OrganizeCityParamBLL.GetValueByType(1, 5).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
                    string[] allowdays2 = Addr_OrganizeCityParamBLL.GetValueByType(1, 6).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
                    string   date       = DateTime.Now.Day.ToString();
                    if (allowdays1.Contains(date))
                    {
                        bt_Approve.Enabled = false;
                    }
                    else if (allowdays2.Contains(date))
                    {
                        DataTable dt2 = new DataTable();
                        if (_staff.Model.Position == 210)
                        {
                            dt2 = _staff.GetFillProcessDetail(2);
                        }
                        if (dt.Rows.Count > 0 || dt2.Rows.Count > 0)
                        {
                            bt_Approve.Enabled = false;
                        }
                    }
                    else
                    {
                        bt_UnApprove.Enabled = false;
                    }
                }
                else
                {
                    bt_UnApprove.Enabled = false;
                }
                if (dt.Rows.Count > 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/Pop_ShowLowerPositionTask.aspx") +
                                                            "?Type=2&StaffID=0&Month=" + ddl_Month.SelectedValue + "&City=" + tr_OrganizeCity.SelectValue + "&tempid='+tempid, window, 'dialogWidth:520px;DialogHeight=600px;status:yes;resizable=no');</script>", false);
                    bt_Approve.Enabled = false;
                }
            }
            #endregion
        }
        else
        {
            bt_Approve.Visible   = false;
            bt_UnApprove.Visible = false;
        }
        #endregion
    }