//计算区域管理人服务费 public void jisuanQuyuGuanliFuwufei(Model.Income incomes) { //当月个人订单不足1000,次月停发推广服务费及管理服务费 if (incomes.LastMonthMoney < 1000) { incomes.RegionServiceMoney = (decimal)0; return; } //初级代理商计算0 if (incomes.Rank == "D1") { incomes.RegionServiceMoney = 0; } //高级代理商计算一级5% else if (incomes.Rank == "D2") { incomes.RegionServiceMoney = incomes.OneMoney * (decimal)0.05; } //区域代理商一级5%、二级2% else if (incomes.Rank == "D3") { incomes.RegionServiceMoney = incomes.OneMoney * (decimal)0.05 + incomes.TwoMoney * (decimal)0.02; } //高级区域代理商一级5%、二级3%、三级1% else if (incomes.Rank == "D4") { incomes.RegionServiceMoney = incomes.OneMoney * (decimal)0.05 + incomes.TwoMoney * (decimal)0.02 + incomes.ThreeMoney * (decimal)0.01; } //总代理商一级5 %、二级4%、三级3% else if (incomes.Rank == "D5") { incomes.RegionServiceMoney = incomes.OneMoney * (decimal)0.05 + incomes.TwoMoney * (decimal)0.04 + incomes.ThreeMoney * (decimal)0.03; } }
//计算推荐人VIP奖金 public void jisuanTuijianrenVipJiangjin(Model.Income income_t, OleDbTransaction tr) { income_t.SalesServiceMoney = income_t.SalesMoney * (decimal)0.1; //如果是S2级别,且连续三个月订单为0,则奖金减半(需要判断是不是新进来的代理人,如果是新进来的,则不看前三个月的订单) if (income_t.Rank == "S2" && income_t.NearlyThreeMonthsMoney == 0) { //判断本月之前的正常订单数,如果订单数为0则表示是新进来的代理人 int count = new BLL.OrdersBLL().getFirstOrderYearMonth(income_t.AgencyId, MyData.Utils.getYearMonth(), tr); if (count > 0) { income_t.SalesServiceMoney = income_t.SalesServiceMoney * (decimal)0.5; } } }
//修改当前会员的职级和事业状态(代理人) public void UpdateAgents(Model.Agents agents, Model.Income income, OleDbTransaction tr) { //判断是否为代理人 if (agents.Rank == "S1" || agents.Rank == "S2") { if (income.AllMonthMoney >= 2500) { agents.CareerStatus = "A"; if (income.AllMonthMoney >= 10000) { agents.Rank = "S2"; } else { agents.Rank = "S1"; } } else { agents.Rank = "S1"; } new DAL.AgentsDal().UpdateAgents(agents); } }
//计算市场推广服务费 public void jisuanShichangTuiguangFuwufei(Model.Income income_s) { //当月个人订单不足1000,次月停发推广服务费及管理服务费 if (income_s.LastMonthMoney < 1000) { income_s.MarketServiceMoney = (decimal)0; return; } //1k - 1w 10 % if (income_s.MarketMoney >= 1000 && income_s.MarketMoney < 10000) { income_s.MarketServiceMoney = income_s.MarketMoney * (decimal)0.1; } //1w-3w 15% else if (income_s.MarketMoney >= 10000 && income_s.MarketMoney < 30000) { income_s.MarketServiceMoney = income_s.MarketMoney * (decimal)0.15; } //3w以上20% else if (income_s.MarketMoney >= 30000) { income_s.MarketServiceMoney = income_s.MarketMoney * (decimal)0.2; } }
//计算个人订单分成 public void jisuanGerenDingdanFencheng(Model.Income income) { //VIP顾客无个人订单返利 if (income.Rank == "S1") { income.PersonalServiceMoney = 0; if (income.AllMonthMoney >= 10000)//当累计订单金额达到10000,rank变为S2,计算个人订单返利,此处只计算个人订单返利 { income.Rank = "S2"; income.PersonalServiceMoney = (income.AllMonthMoney - 10000) * (decimal)0.1; } } else//其他级别一般情况下都是10% { if (income.AllMonthMoney >= 10000) { if (income.AllMonthMoney - income.PersonalMoney >= 10000) { income.PersonalServiceMoney = income.PersonalMoney * (decimal)0.1; } else { income.PersonalServiceMoney = (income.AllMonthMoney - 10000) * (decimal)0.1; } } else { income.PersonalServiceMoney = 0; } if (income.AllMonthMoney < 10000 && income.Rank.StartsWith("S")) { income.Rank = "S1"; } } }
public void InsertOrUpdateIncome(OleDbTransaction tr, Model.Income income, bool isInsert) { if (isInsert) { String sql = @"INSERT INTO [dbo].[Income] ([YearMonth] ,[AgentId] ,[AgentName] ,[CareerStatus] ,[Rank] ,[RefereeId] ,[RefereeName] ,[AgencyId] ,[AgencyName] ,[CreateTime] ,[CreatePerson] ,[UpdateTime] ,[UpdatePerson] ,[State] ,[AllMonthMoney] ,[LastMonthMoney] ,[NearlyThreeMonthsMoney] ,[NearlySixMonthsMoney] ,[SalesMoney] ,[SalesServiceMoney] ,[PersonalMoney] ,[PersonalServiceMoney] ,[MarketMoney] ,[MarketServiceMoney] ,[OneMoney] ,[TwoMoney] ,[ThreeMoney] ,[RegionServiceMoney] ,[RegionYum] ,[RegionServiceYum] ,[IncomeMoney],[AllSalesMoney]) VALUES ({0} ,'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}' ,'{11}','{12}',{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31});"; sql = String.Format(sql, income.YearMonth , income.AgentId , income.AgentName , income.CareerStatus , income.Rank , income.RefereeId , income.RefereeName , income.AgencyId , income.AgencyName , income.CreateTime , income.CreatePerson , income.UpdateTime , income.UpdatePerson , income.State , income.AllMonthMoney , income.LastMonthMoney , income.NearlyThreeMonthsMoney , income.NearlySixMonthsMoney , income.SalesMoney , income.SalesServiceMoney , income.PersonalMoney , income.PersonalServiceMoney , income.MarketMoney , income.MarketServiceMoney , income.OneMoney , income.TwoMoney , income.ThreeMoney , income.RegionServiceMoney , income.RegionYum , income.RegionServiceYum , income.IncomeMoney, income.AllSalesMoney); DataBase.Base_cmd(sql, tr); } else { String sql = @"UPDATE [dbo].[Income] SET [AgentName] = '{0}' ,[CareerStatus] = '{1}' ,[Rank] = '{2}' ,[RefereeId] = '{3}' ,[RefereeName] = '{4}' ,[AgencyId] = '{5}' ,[AgencyName] = '{6}' ,[CreateTime] = '{7}' ,[CreatePerson] = '{8}' ,[UpdateTime] = '{9}' ,[UpdatePerson] = '{10}' ,[State] = {11} ,[AllMonthMoney] = {12} ,[LastMonthMoney] = {13} ,[NearlyThreeMonthsMoney] = {14} ,[NearlySixMonthsMoney] = {15} ,[SalesMoney] = {16} ,[SalesServiceMoney] = {17} ,[PersonalMoney] = {18} ,[PersonalServiceMoney] = {19} ,[MarketMoney] = {20} ,[MarketServiceMoney] = {21} ,[OneMoney] = {22} ,[TwoMoney] = {23} ,[ThreeMoney] = {24} ,[RegionServiceMoney] = {25} ,[RegionYum] = {26} ,[RegionServiceYum] = {27} ,[IncomeMoney] = {28} ,[AllSalesMoney]={29} WHERE YearMonth=" + income.YearMonth + " and AgentId='" + income.AgentId + "'"; sql = String.Format(sql, income.AgentName , income.CareerStatus , income.Rank , income.RefereeId , income.RefereeName , income.AgencyId , income.AgencyName , income.CreateTime , income.CreatePerson , income.UpdateTime , income.UpdatePerson , income.State , income.AllMonthMoney , income.LastMonthMoney , income.NearlyThreeMonthsMoney , income.NearlySixMonthsMoney , income.SalesMoney , income.SalesServiceMoney , income.PersonalMoney , income.PersonalServiceMoney , income.MarketMoney , income.MarketServiceMoney , income.OneMoney , income.TwoMoney , income.ThreeMoney , income.RegionServiceMoney , income.RegionYum , income.RegionServiceYum , income.IncomeMoney, income.AllSalesMoney); DataBase.Base_cmd(sql, tr); } }