コード例 #1
0
    private void BindRelateActivity()
    {
        DateTime JournalDate  = DateTime.Parse(tbx_begindate.Text);
        int      OrganizeCity = new Org_StaffBLL((int)Session["UserID"], true).Model.OrganizeCity;

        string ConditionStr = "PlanBeginDate BETWEEN '" + JournalDate.AddDays(-15).ToString("yyyy-MM-dd") + "' AND '"
                              + JournalDate.AddDays(15).ToString("yyyy-MM-dd") + "' ";

        if (OrganizeCity != 1)
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(OrganizeCity, true);
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += OrganizeCity.ToString();

            if (orgcitys != "")
            {
                ConditionStr += " AND OrganizeCity IN (" + orgcitys + ") ";
            }
        }
        //if(ddl_RelateActivity!=null)
        //{
        //ddl_RelateActivity.DataSource = CAT_ActivityBLL.GetModelList(ConditionStr);
        //ddl_RelateActivity.DataBind();
        //ddl_RelateActivity.Items.Insert(0, new ListItem("请选择您参与举办的活动...", "0"));
        //ddl_RelateActivity_SelectedIndexChanged(null, null);
        //}
    }
コード例 #2
0
    private void BindData()
    {
        FNA_BudgetExtraApply m = new FNA_BudgetExtraApplyBLL((int)ViewState["ID"]).Model;

        if (m != null)
        {
            pl_detail.BindData(m);

            if (m.ApproveTask > 0 || m.ApproveFlag == 1 || m.InsertStaff != (int)Session["UserID"])
            {
                lb_ApproveAmount.Text = (m.ExtraAmount - m.AdjustAmount).ToString("0.##");
                pl_detail.SetControlsEnable(false);
                bt_OK.Visible     = false;
                bt_Submit.Visible = false;

                //允许调整审批金额
                if (m.ApproveTask > 0 && m.ApproveFlag == 2 &&
                    Request.QueryString["Decision"] != null && Request.QueryString["Decision"] == "Y")
                {
                    TextBox tbx_AdjustAmount = (TextBox)pl_detail.FindControl("FNA_BudgetExtraApply_AdjustAmount");
                    tbx_AdjustAmount.Enabled = true;
                    bt_SaveAdjust.Visible    = true;
                }
            }

            if (!string.IsNullOrEmpty(m.ApproveTask.ToString()) && m.ApproveTask != 0)
            {
                bt_Submit.Visible = false;
            }

            if (m.ApproveFlag == 2)
            {
                tbl_BudgetInfo.Visible = true;
                BindBudget(m.AccountMonth, m.OrganizeCity, m.FeeType);
            }

            #region 获取当月该费用类型累计已批复扩增金额
            //lb_SumExtraInfo.Text = new Addr_OrganizeCityBLL(m.OrganizeCity).Model.Name +
            //    ":<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetExtraAmount(m.AccountMonth, m.OrganizeCity, m.FeeType, false).ToString("0.##") + "</b></font>  ";

            //int staffcity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
            //if (staffcity == 0) staffcity = 1;
            //if (staffcity != 1)
            //{
            //    staffcity = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OrganizeCity", m.OrganizeCity, new Addr_OrganizeCityBLL(staffcity).Model.Level);
            //}

            //lb_SumExtraInfo.Text += new Addr_OrganizeCityBLL(staffcity).Model.Name +
            //    ":<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetExtraAmount(m.AccountMonth, staffcity, m.FeeType, true).ToString("0.##") + "</b></font>";
            #endregion

            #region 显示各扩增类型已批复扩增金额
            DropDownList ddl_ExtraType = (DropDownList)pl_detail.FindControl("FNA_BudgetExtraApply_ExtraType");
            foreach (ListItem item in ddl_ExtraType.Items)
            {
                if (item.Value != "0")
                {
                    lb_SumExtraInfo1.Text += item.Text + "总计:<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetModelList("").Where(p => p.ApproveFlag == 1 && p.AccountMonth == m.AccountMonth && p.OrganizeCity == m.OrganizeCity && p.FeeType == m.FeeType && p["ExtraType"] == item.Value).Select(p => p.ExtraAmount - p.AdjustAmount).Sum().ToString() + "</b></font>  ";
                }
            }
            int staffcity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
            if (staffcity == 0)
            {
                staffcity = 1;
            }
            if (staffcity != 1)
            {
                staffcity = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OrganizeCity", m.OrganizeCity, new Addr_OrganizeCityBLL(staffcity).Model.Level);
            }
            foreach (ListItem item in ddl_ExtraType.Items)
            {
                if (item.Value != "0")
                {
                    lb_SumExtraInfo2.Text += item.Text + "总计:<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetModelList(" MCS_SYS.dbo.UF_IsChildOrganizeCity(" + staffcity.ToString() + ",OrganizeCity)=0").Where(p => p.ApproveFlag == 1 && p.AccountMonth == m.AccountMonth && p.OrganizeCity == m.OrganizeCity && p.FeeType == m.FeeType && p["ExtraType"] == item.Value).Select(p => p.ExtraAmount - p.AdjustAmount).Sum().ToString() + "</b></font>  ";
                }
            }
            #endregion
        }
    }
コード例 #3
0
    protected void bt_Create_Click(object sender, EventArgs e)
    {
        DateTime begindate = DateTime.Parse(tbx_begindate.Text);
        DateTime enddate   = DateTime.Parse(tbx_enddate.Text);

        #region 规则校验
        if (select_PlanStaff.SelectValue == "")
        {
            MessageBox.Show(this, "请正确选择要填报计划的员工!");
            return;
        }
        if (begindate < DateTime.Today)
        {
            MessageBox.Show(this, "开始日期不能小于今天!");
            return;
        }

        if (enddate < begindate)
        {
            MessageBox.Show(this, "截止日期必须大于开始日期!");
            return;
        }

        if ((enddate - begindate).Days > 31)
        {
            MessageBox.Show(this, "日期范围不能超过一个月!");
            return;
        }

        if (JN_WorkingPlanBLL.GetModelList("Staff = " + select_PlanStaff.SelectValue +
                                           " AND ( (BeginDate BETWEEN '" + begindate.ToString("yyyy-MM-dd") + "' AND '" + enddate.ToString("yyyy-MM-dd") +
                                           "') OR ('" + begindate.ToString("yyyy-MM-dd") + "' BETWEEN BeginDate AND EndDate) )").Count > 0)
        {
            MessageBox.Show(this, "日期范围与系统中已填报的计划有日期重叠!");
            return;
        }
        #endregion

        InitGridView(begindate, enddate);
        DataTable dt = GenareateDataTable(begindate, enddate);

        #region 页面控件使能控制
        tr_adddetail.Visible     = true;
        tbx_begindate.Enabled    = false;
        tbx_enddate.Enabled      = false;
        select_PlanStaff.Enabled = false;
        tr_OrganizeCity.Enabled  = false;

        cbx_GenarateSynergetic.Visible = false;
        bt_Create.Visible = false;
        bt_Save.Visible   = true;
        #endregion

        #region 载入该操作员所有负责客户,加入客户拜访记录计划中
        IList <CM_Client> clients = CM_ClientBLL.GetModelList("ClientManager=" + select_PlanStaff.SelectValue + " AND ActiveFlag=1 AND ApproveFlag=1");

        foreach (CM_Client client in clients)
        {
            DataRow dr = dt.NewRow();

            dr["WorkingClassify"]     = "1";
            dr["WorkingClassifyName"] = DictionaryBLL.GetDicCollections("OA_WorkingClassify")["1"].Name;

            dr["RelateClient"]     = client.ID;
            dr["RelateClientName"] = client.FullName;

            dr["RelateStaff"]     = 0;
            dr["RelateStaffName"] = "";

            dr["OfficialCity"] = client.OfficalCity;
            if (client.OfficalCity > 0)
            {
                dr["OfficialCityName"] = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", client.OfficalCity).Replace("->", " ");
            }

            dt.Rows.Add(dr);
        }
        #endregion

        #region 加入协同拜访工作项,管理片区非总部员工,将所有下级员工加入
        if (cbx_GenarateSynergetic.Checked && int.Parse(tr_OrganizeCity.SelectValue) > 1)
        {
            #region 所有下级职位(不含本级职位)
            string    positions          = "";
            int       position           = new Org_StaffBLL(int.Parse(select_PlanStaff.SelectValue)).Model.Position;
            DataTable dtAllChilePosition = TreeTableBLL.GetAllChildByNodes("MCS_SYS.dbo.Org_Position", "ID", "SuperID", position.ToString());
            for (int i = 0; i < dtAllChilePosition.Rows.Count; i++)
            {
                positions += dtAllChilePosition.Rows[i]["ID"].ToString();
                if (i != dtAllChilePosition.Rows.Count - 1)
                {
                    positions += ",";
                }
            }
            #endregion

            #region 所有本级及下级管理片区
            string orgcitys = "";
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true);
            orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += tr_OrganizeCity.SelectValue;
            #endregion

            if (positions != "" && orgcitys != "")
            {
                IList <Org_Staff> staffs = Org_StaffBLL.GetStaffList("OrganizeCity IN (" + orgcitys + ") AND Position IN (" + positions + ") AND Dimission=1 AND ApproveFlag=1");

                foreach (Org_Staff staff in staffs)
                {
                    DataRow dr = dt.NewRow();

                    dr["WorkingClassify"]     = "2";
                    dr["WorkingClassifyName"] = DictionaryBLL.GetDicCollections("OA_WorkingClassify")["2"].Name;

                    dr["RelateClient"]     = 0;
                    dr["RelateClientName"] = "";

                    dr["RelateStaff"]     = staff.ID;
                    dr["RelateStaffName"] = staff.RealName;

                    dr["OfficialCity"] = staff.OfficialCity;
                    if (staff.OfficialCity > 0)
                    {
                        dr["OfficialCityName"] = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", staff.OfficialCity).Replace("->", " ");
                    }

                    dt.Rows.Add(dr);
                }
            }
        }
        #endregion

        #region 加入除客户拜访以外的工作项
        foreach (ListItem item in ddl_WorkingClassify.Items)
        {
            if (int.Parse(item.Value) >= 3)
            {
                DataRow dr = dt.NewRow();
                dr["WorkingClassify"]     = int.Parse(item.Value);
                dr["WorkingClassifyName"] = item.Text;
                dr["Description"]         = "";
                dr["RelateClient"]        = 0;
                dr["RelateClientName"]    = "";

                dr["RelateStaff"]     = 0;
                dr["RelateStaffName"] = "";

                dr["OfficialCity"] = (int)ViewState["StaffOfficialCity"];
                if (ViewState["StaffOfficialCity"] != null && (int)ViewState["StaffOfficialCity"] != 0)
                {
                    dr["OfficialCityName"] = new Addr_OfficialCityBLL((int)ViewState["StaffOfficialCity"]).Model.Name;
                }
                else
                {
                    dr["OfficialCity"] = 0;
                }

                dr["Cost1"] = 0;
                dr["Cost2"] = 0;
                dt.Rows.Add(dr);
            }
        }
        #endregion

        ViewState["WorkingPlanData"] = dt;
        ViewState["BeginDate"]       = begindate;
        ViewState["EndDate"]         = enddate;

        BindGrid();
    }
コード例 #4
0
    private void BindRelateActivity()
    {
        DateTime JournalDate = DateTime.Parse(tbx_begindate.Text);
        int OrganizeCity = new Org_StaffBLL((int)Session["UserID"], true).Model.OrganizeCity;

        string ConditionStr = "PlanBeginDate BETWEEN '" + JournalDate.AddDays(-15).ToString("yyyy-MM-dd") + "' AND '"
                    + JournalDate.AddDays(15).ToString("yyyy-MM-dd") + "' ";

        if (OrganizeCity != 1)
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(OrganizeCity, true);
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "") orgcitys += ",";
            orgcitys += OrganizeCity.ToString();

            if (orgcitys != "") ConditionStr += " AND OrganizeCity IN (" + orgcitys + ") ";
        }
        //if(ddl_RelateActivity!=null)
        //{
        //ddl_RelateActivity.DataSource = CAT_ActivityBLL.GetModelList(ConditionStr);
        //ddl_RelateActivity.DataBind();
        //ddl_RelateActivity.Items.Insert(0, new ListItem("请选择您参与举办的活动...", "0"));
        //ddl_RelateActivity_SelectedIndexChanged(null, null);
        //}
    }
コード例 #5
0
    private void BindData()
    {
        FNA_BudgetExtraApply m = new FNA_BudgetExtraApplyBLL((int)ViewState["ID"]).Model;
        if (m != null)
        {
            pl_detail.BindData(m);

            if (m.ApproveTask > 0 || m.ApproveFlag == 1 || m.InsertStaff != (int)Session["UserID"])
            {
                lb_ApproveAmount.Text = (m.ExtraAmount - m.AdjustAmount).ToString("0.##");
                pl_detail.SetControlsEnable(false);
                bt_OK.Visible = false;
                bt_Submit.Visible = false;

                //允许调整审批金额
                if (m.ApproveTask > 0 && m.ApproveFlag == 2 &&
                    Request.QueryString["Decision"] != null && Request.QueryString["Decision"] == "Y")
                {
                    TextBox tbx_AdjustAmount = (TextBox)pl_detail.FindControl("FNA_BudgetExtraApply_AdjustAmount");
                    tbx_AdjustAmount.Enabled = true;
                    bt_SaveAdjust.Visible = true;
                }
            }

            if (!string.IsNullOrEmpty(m.ApproveTask.ToString()) && m.ApproveTask != 0)
            {
                bt_Submit.Visible = false;
            }

            if (m.ApproveFlag == 2)
            {
                tbl_BudgetInfo.Visible = true;
                BindBudget(m.AccountMonth, m.OrganizeCity, m.FeeType);
            }

            #region 获取当月该费用类型累计已批复扩增金额
            //lb_SumExtraInfo.Text = new Addr_OrganizeCityBLL(m.OrganizeCity).Model.Name +
            //    ":<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetExtraAmount(m.AccountMonth, m.OrganizeCity, m.FeeType, false).ToString("0.##") + "</b></font>  ";

            //int staffcity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
            //if (staffcity == 0) staffcity = 1;
            //if (staffcity != 1)
            //{
            //    staffcity = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OrganizeCity", m.OrganizeCity, new Addr_OrganizeCityBLL(staffcity).Model.Level);
            //}

            //lb_SumExtraInfo.Text += new Addr_OrganizeCityBLL(staffcity).Model.Name +
            //    ":<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetExtraAmount(m.AccountMonth, staffcity, m.FeeType, true).ToString("0.##") + "</b></font>";
            #endregion

            #region 显示各扩增类型已批复扩增金额
            DropDownList ddl_ExtraType = (DropDownList)pl_detail.FindControl("FNA_BudgetExtraApply_ExtraType");
            foreach (ListItem item in ddl_ExtraType.Items)
            {
                if (item .Value!="0")
                lb_SumExtraInfo1.Text += item.Text + "总计:<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetModelList("").Where(p => p.ApproveFlag == 1 && p.AccountMonth == m.AccountMonth && p.OrganizeCity == m.OrganizeCity && p.FeeType == m.FeeType && p["ExtraType"] == item.Value).Select(p => p.ExtraAmount - p.AdjustAmount).Sum().ToString() + "</b></font>  ";
            }
            int staffcity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
            if (staffcity == 0) staffcity = 1;
            if (staffcity != 1)
            staffcity = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OrganizeCity", m.OrganizeCity, new Addr_OrganizeCityBLL(staffcity).Model.Level);
            foreach (ListItem item in ddl_ExtraType.Items)
            {
                if (item.Value != "0")
                lb_SumExtraInfo2.Text += item.Text + "总计:<b><font color=red>" + FNA_BudgetExtraApplyBLL.GetModelList(" MCS_SYS.dbo.UF_IsChildOrganizeCity(" + staffcity.ToString() + ",OrganizeCity)=0").Where(p => p.ApproveFlag == 1 && p.AccountMonth == m.AccountMonth && p.OrganizeCity == m.OrganizeCity && p.FeeType == m.FeeType && p["ExtraType"] == item.Value).Select(p => p.ExtraAmount - p.AdjustAmount).Sum().ToString() + "</b></font>  ";
            }
            #endregion
        }
    }