Ejemplo n.º 1
0
        /// <summary>
        /// 计算业务员的业绩数据
        /// </summary>
        /// <param name="YearMonth">所在月度</param>
        /// <param name="salesId">业务员Id</param>
        /// <returns>当月业绩</returns>
        public Salestarget CalcCommission(DateTime YearMonth, int salesId)
        {
            //计算 提成,返回计算结果

            Salestarget st = new Salestarget();

            st.Load(YearMonth, salesId);

            //读取销售业绩
            DataTable dt = GetSalesData(YearMonth, salesId).Tables[0];

            //st.Target =

            st.Finish         = CommenClass.MathTools.ToDouble(dt.Compute("Sum(SumMoney)", "true").ToString());                               //总销售业绩
            st.GrossProfit    = CommenClass.MathTools.ToDouble(dt.Compute("Sum(GrossProfit)", "true").ToString());                            //总销售毛利
            st.NewCustomer    = CommenClass.MathTools.ToDouble(dt.Compute("Sum(SumMoney)", "DiffMonth<=12 and IsSPAssess=0").ToString());     //新客户销售业绩
            st.NewGrossProfit = CommenClass.MathTools.ToDouble(dt.Compute("Sum(GrossProfit)", "DiffMonth<=12  and IsSPAssess=0").ToString()); //新客户销售毛利
            st.OldCustormer   = CommenClass.MathTools.ToDouble(dt.Compute("Sum(SumMoney)", "DiffMonth>12  and IsSPAssess=0").ToString());     //老客户销售业绩
            st.OldGrossProfit = CommenClass.MathTools.ToDouble(dt.Compute("Sum(GrossProfit)", "DiffMonth >12  and IsSPAssess=0").ToString()); //老客户销售毛利

            SalesTargetFactor stf = new SalesTargetFactor(st);

            st.Finish       = stf.Finish;
            st.FinishRatio  = stf.FinishRatio;
            st.ProfitFactor = stf.ProfitFactor;
            st.ProfitRatio  = stf.ProfitRatio;
            st.Commission   = stf.Commission;
            return(st);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存销售目标
        /// </summary>
        /// <param name="targets"></param>
        /// <returns></returns>
        public int SaveSalesTarget(Salestarget[] targets)
        {
            int OK = 0;

            for (int i = 0; i < targets.Length; i++)
            {
                Salestarget st = new Salestarget();
                st.Id = targets[i].Id;
                st.Load();
                st.Target = targets[i].Target;
                st.Save();
                OK += 1;
            }
            return(OK);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存销售费用
        /// </summary>
        /// <param name="targets"></param>
        /// <returns></returns>
        public int SaveSalesCost(Salestarget[] targets)
        {
            int OK = 0;

            for (int i = 0; i < targets.Length; i++)
            {
                Salestarget st = new Salestarget();
                st.Id = targets[i].Id;
                st.Load();
                st.NormalCost = targets[i].NormalCost;
                st.DLHSCost   = targets[i].DLHSCost;
                st.SaleCost   = targets[i].SaleCost;
                st.Save();
                OK += 1;
            }
            return(OK);
        }