/// <summary> /// 修改或添加个人计划 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-01</remarks> public bool Update(E_UserPlan data) { int ReturnValue; SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@EPUserTMRID", SqlDbType.Int), new SqlParameter("@YearMonth", SqlDbType.SmallDateTime), new SqlParameter("@NewAmount", SqlDbType.Int), new SqlParameter("@ContactAmount", SqlDbType.Int), new SqlParameter("@TradedAmount", SqlDbType.Int), new SqlParameter("@TradedMoney", SqlDbType.Money) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.EPUserTMRID; parms[2].Value = data.YearMonty; parms[3].Value = data.NewAmount; parms[4].Value = data.ContactAmount; parms[5].Value = data.TradedAmount; parms[6].Value = data.TradedMoney; DbHelperSQL.RunProcedures("ProcEP_B_UserPlan_Update", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 数据绑定 /// </summary> protected void databind() { E_UserPlan data = new E_UserPlan(); data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; rpList.DataSource = new T_UserPlan().UserMonth(data); rpList.DataBind(); }
/// <summary> /// 点击确定按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(lblYearMonth.Text)) { MLMGC.COMP.Jscript.ShowMsg("请选择年月", this); return; } else if (string.IsNullOrWhiteSpace(txtNewAmount.Text)) { MLMGC.COMP.Jscript.ShowMsg("请输入每日新增名录数", this); return; } else if (string.IsNullOrWhiteSpace(txtTradedMoney.Text)) { MLMGC.COMP.Jscript.ShowMsg("请输入每日沟通名录数", this); return; } else if (string.IsNullOrWhiteSpace(txtTradedAmount.Text)) { MLMGC.COMP.Jscript.ShowMsg("请输入交易数量", this); return; } else if (string.IsNullOrWhiteSpace(txtTradedMoney.Text)) { MLMGC.COMP.Jscript.ShowMsg("请输入交易金额", this); return; } E_UserPlan data = new E_UserPlan(); data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; data.NewAmount = Convert.ToInt32(txtNewAmount.Text); data.ContactAmount = Convert.ToInt32(txtContactAmount.Text); data.YearMonty = Convert.ToDateTime(lblYearMonth.Text); data.TradedAmount = Convert.ToInt32(txtTradedAmount.Text); data.TradedMoney = Convert.ToSingle(txtTradedMoney.Text); bool flag = new T_UserPlan().Update(data); if (flag) { //添加操作日志 new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "管理计划", IP = MLMGC.COMP.Requests.GetRealIP() }); MLMGC.COMP.Jscript.ShowMsg("操作成功", this); } else { MLMGC.COMP.Jscript.ShowMsg("操作失败", this); } }
/// <summary> /// 获取用户指定月的数据 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-11-09</remarks> public DataTable UserMonth(E_UserPlan data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@EPUserTMRID", SqlDbType.Int) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.EPUserTMRID; return(DbHelperSQL.RunProcedureTable("ProcEP_B_UserPlanS_Month", parms)); }
/// <summary> /// 获取用户指定天的数据 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-11-09</remarks> public DataTable UserDaily(E_UserPlan data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@EPUserTMRID", SqlDbType.Int), new SqlParameter("@Date", SqlDbType.SmallDateTime) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.EPUserTMRID; parms[2].Value = data.YearMonty; return(DbHelperSQL.RunProcedureTable("ProcEP_B_UserPlanS_Daily", parms)); }
/// <summary> /// 获取用户指定月的详细数据 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-10</remarks> public DataTable UserMonthDetail(E_UserPlan data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@EPUserTMRID", SqlDbType.Int), new SqlParameter("@YearMonth", SqlDbType.VarChar, 8) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.EPUserTMRID; parms[2].Value = data.YearMonty.ToString("yyyy/MM", System.Globalization.DateTimeFormatInfo.InvariantInfo); return(DbHelperSQL.RunProcedureTable("ProcEP_B_UserPlanS_MonthDetail", parms)); }
/// <summary> /// 数据绑定 /// </summary> protected void databind() { E_UserPlan data = new E_UserPlan(); data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; data.YearMonty = DateTime.Now; data = new T_UserPlan().GetModel(data); if (data == null) { return; } txtNewAmount.Text = data.NewAmount.ToString(); txtContactAmount.Text = data.ContactAmount.ToString(); txtTradedAmount.Text = data.TradedAmount.ToString(); txtTradedMoney.Text = data.TradedMoney.ToString("F2"); }
/// <summary> /// 查询个人计划 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-01</remarks> public E_UserPlan GetModel(E_UserPlan data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@EPUserTMRID", SqlDbType.Int), new SqlParameter("@YearMonth", SqlDbType.SmallDateTime) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.EPUserTMRID; parms[2].Value = data.YearMonty; DataTable dt = DbHelperSQL.RunProcedureTable("ProcEP_B_UserPlan_Select", parms); if (dt != null && dt.Rows.Count == 1) { data.NewAmount = Convert.ToInt32(dt.Rows[0]["NewAmount"]); data.ContactAmount = Convert.ToInt32(dt.Rows[0]["ContactAmount"]); data.TradedAmount = Convert.ToInt32(dt.Rows[0]["TradedAmount"]); data.TradedMoney = Convert.ToSingle(dt.Rows[0]["TradedMoney"]); return(data); } return(null); }
protected void databind() { DateTime dtTime; if (!DateTime.TryParse(txtDate.Text, out dtTime)) { MLMGC.COMP.Jscript.ShowMsg("日期错误", this); return; } if (dtTime > DateTime.Now) { MLMGC.COMP.Jscript.ShowMsg("不能超过今天", this); return; } phNoPlan.Visible = false; //获取指定月计划 T_UserPlan bll = new T_UserPlan(); E_UserPlan data = new E_UserPlan() { EnterpriseID = EnterpriceID, EPUserTMRID = EPUserTMRID, YearMonty = dtTime }; E_UserPlan dataPlan = bll.GetModel(data); //获取最低指标 E_Standard dataStandard = new T_Standard().GetModel(new E_Standard() { EnterpriseID = EnterpriceID }); //获取当天数据 DataTable dt = bll.UserDaily(data); int realNewAmount = 0, realExchAmount = 0; if (dt != null && dt.Rows.Count == 1) { realNewAmount = int.Parse(dt.Rows[0]["NewAmount"].ToString()); realExchAmount = int.Parse(dt.Rows[0]["ExchangeAmount"].ToString()); } ltRealNew.Text = realNewAmount.ToString(); ltRealExchange.Text = realExchAmount.ToString(); //---------设置显示月计划及百分比 if (dataPlan != null)//是否制定该用计划 { //实际数据 ltPlanNew.Text = dataPlan.NewAmount.ToString(); ltPlanExchange.Text = dataPlan.ContactAmount.ToString(); //百分比数据 ltPercentNew.Text = GetPercent(realNewAmount, data.NewAmount); ltPercentExchange.Text = GetPercent(realExchAmount, data.ContactAmount); } else { //计划数量 phNoPlan.Visible = true; ltPlanNew.Text = "0"; ltPlanExchange.Text = "0"; //百分比 ltPercentNew.Text = "0"; ltPercentExchange.Text = "0"; } //---------最低指标 if (dataStandard != null)//领导是否调制最低指标 { //指标 ltStandardNew.Text = dataStandard.NewAmount.ToString(); ltStandardExchange.Text = dataStandard.CommAmount.ToString(); //差值 int num = dataStandard.NewAmount - realNewAmount; ltDifferNew.Text = (num > 0?"-":"+") + Math.Abs(num).ToString(); num = dataStandard.CommAmount - realExchAmount; ltDifferExchange.Text = (num > 0 ? "-" : "+") + Math.Abs(num).ToString(); } else { //指标 ltStandardNew.Text = "0"; ltStandardExchange.Text = "0"; //差值 ltDifferNew.Text = "0"; ltDifferExchange.Text = "0"; } }
/// <summary> /// 获取用户指定月的详细数据 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-10</remarks> public DataTable UserMonthDetail(E_UserPlan data) { return(dal.UserMonthDetail(data)); }
/// <summary> /// 获取用户指定天的数据 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-11-09</remarks> public DataTable UserDaily(E_UserPlan data) { return(dal.UserDaily(data)); }
/// <summary> /// 查询个人计划 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-01</remarks> public E_UserPlan GetModel(E_UserPlan data) { return(dal.GetModel(data)); }
/// <summary> /// 修改或添加个人计划 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-01</remarks> public bool Update(E_UserPlan data) { return(dal.Update(data)); }
/// <summary> /// 数据绑定 /// </summary> protected void databind(DateTime yearmonth) { E_UserPlan data = new E_UserPlan(); data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; data.YearMonty = yearmonth; //获取该月的天数 int dayNum = DateTime.DaysInMonth(yearmonth.Year, yearmonth.Month); DataTable dt = new T_UserPlan().UserMonthDetail(data); int planNew = 0, realNew = 0, planContact = 0, realContact = 0, planTrade = 0, realTrade = 0; float planMoney = 0f, realMoney = 0f; if (dt != null && dt.Rows.Count == 1) { DataRow row = dt.Rows[0]; planNew = Convert.ToInt32(row["NewAmount"]); ltPlanNew.Text = (planNew * dayNum).ToString(); planContact = Convert.ToInt32(row["ContactAmount"]); ltPlanContact.Text = (planContact * dayNum).ToString(); planTrade = Convert.ToInt32(row["TradedAmount"]); ltPlanTrade.Text = planTrade.ToString(); planMoney = Convert.ToSingle(row["TradedMoney"]); ltPlanMoney.Text = planMoney.ToString("f2"); realNew = Convert.ToInt32(row["RealNewAmount"]); ltRealNew.Text = realNew.ToString(); realContact = Convert.ToInt32(row["RealExchAmount"]); ltRealContact.Text = realContact.ToString(); realTrade = Convert.ToInt32(row["RealTradedAmount"]); ltRealTrade.Text = realTrade.ToString(); realMoney = Convert.ToSingle(row["RealTradedMoney"]); ltRealMoney.Text = realMoney.ToString("f2"); //---------设置显示月计划及百分比 ltPercentNew.Text = GetPercent(realNew, planNew * dayNum); ltPercentContact.Text = GetPercent(realContact, planContact * dayNum); ltPercentTrade.Text = GetPercent(realTrade, planTrade); ltPercentMoney.Text = GetPercent(realMoney, planMoney); } //获取最低指标 E_Standard dataStandard = new T_Standard().GetModel(new E_Standard() { EnterpriseID = EnterpriceID }); //---------最低指标 if (dataStandard != null)//领导是否调制最低指标 { //指标 ltStandardNew.Text = dataStandard.NewAmount.ToString(); ltStandardContact.Text = dataStandard.CommAmount.ToString(); ltStandardTrade.Text = dataStandard.TradedAmount.ToString(); ltStandardMoney.Text = dataStandard.TradedMoney.ToString("f2"); //差值 int num = dataStandard.NewAmount - realNew; ltDifferNew.Text = (num > 0 ? "-" : "+") + Math.Abs(num).ToString(); num = dataStandard.CommAmount - realContact; ltDifferContact.Text = (num > 0 ? "-" : "+") + Math.Abs(num).ToString(); num = dataStandard.TradedAmount - realTrade; ltDifferTrade.Text = (num > 0 ? "-" : "+") + Math.Abs(num).ToString(); float money = dataStandard.TradedMoney - realMoney; ltDifferMoney.Text = (money > 0 ? "-" : "+") + Math.Abs(money).ToString("f2"); } else { //指标 ltStandardNew.Text = "0"; ltStandardContact.Text = "0"; ltStandardTrade.Text = "0"; ltStandardMoney.Text = "0.00"; //差值 ltDifferNew.Text = "0"; ltDifferContact.Text = "0"; ltDifferTrade.Text = "0"; ltDifferMoney.Text = "0.00"; } }