示例#1
0
        public ActionResult DeleteCommission(_FinalCommission model)
        {
            int?   projectid = model.ProjectID;
            string sale      = model.TargetNameEN;

            CH.Delete <FinalCommission>(model.ID);
            var list = Finance_Logical._PreCommissionBLL.GetFinalCommission(projectid, sale);
            var data = list.OrderBy(p => p.TargetNameEN).ToList();

            return(View(new GridModel(data)));
        }
示例#2
0
        public ActionResult InsertCommission(_FinalCommission model)
        {
            FinalCommission newmodel = new FinalCommission();

            newmodel.TargetNameEN       = model.TargetNameEN;
            newmodel.TargetNameCN       = model.TargetNameCN;
            newmodel.ProjectID          = model.ProjectID;
            newmodel.InOut              = model.InOut;
            newmodel.DelegateLessIncome = model.DelegateLessIncome;
            newmodel.DelegateMoreCount  = model.DelegateMoreCount;
            newmodel.DelegateMoreIncome = model.DelegateMoreIncome;
            newmodel.SponsorIncome      = model.SponsorIncome;
            newmodel.Income             = model.Income;
            newmodel.CommissionRate     = model.CommissionRate;
            newmodel.Commission         = model.CommissionA;
            newmodel.Tax              = model.Tax;
            newmodel.Bonus            = model.Bonus;
            newmodel.ActualCommission = model.ActualCommission;

            newmodel.DelegateLessRate       = model.DelegateLessRate;
            newmodel.DelegateLessCommission = model.DelegateLessCommission;
            newmodel.DelegateMoreRate       = model.DelegateMoreRate;
            newmodel.DelegateMoreCommission = model.DelegateMoreCommission;
            newmodel.SponsorRate            = model.SponsorRate;
            newmodel.SponsorCommission      = model.SponsorCommission;
            newmodel.TotalCommission        = model.TotalCommission;

            newmodel.DelegateLessPayed = model.DelegateLessPayed;
            newmodel.DelegateMorePayed = model.DelegateMorePayed;
            newmodel.SponsorPayed      = model.SponsorPayed;
            newmodel.CommissionPayed   = model.CommissionPayed;

            newmodel.DelegateIncome     = model.DelegateIncome;
            newmodel.DelegateRate       = model.DelegateRate;
            newmodel.DelegateCommission = model.DelegateCommission;
            newmodel.DelegatePayed      = model.DelegatePayed;

            var procode = CH.GetDataById <Project>(model.ProjectID).ProjectCode;

            newmodel.CommID = procode + "-" + model.TargetNameEN + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            CH.Create <FinalCommission>(newmodel);
            var list = Finance_Logical._PreCommissionBLL.GetFinalCommission(model.ProjectID, model.TargetNameEN);
            var data = list.OrderBy(p => p.TargetNameEN).ToList();

            return(View(new GridModel(data)));
        }
示例#3
0
        public ActionResult SaveCommission(_FinalCommission model)
        {
            FinalCommission newmodel = new FinalCommission();

            newmodel = CH.GetDataById <FinalCommission>(model.ID);
            newmodel.TargetNameEN       = model.TargetNameEN;
            newmodel.TargetNameCN       = model.TargetNameCN;
            newmodel.ProjectID          = model.ProjectID;
            newmodel.InOut              = model.InOut;
            newmodel.DelegateLessIncome = model.DelegateLessIncome;
            newmodel.DelegateMoreCount  = model.DelegateMoreCount;
            newmodel.DelegateMoreIncome = model.DelegateMoreIncome;
            newmodel.SponsorIncome      = model.SponsorIncome;
            newmodel.Income             = model.Income;
            newmodel.CommissionRate     = model.CommissionRate;
            newmodel.Commission         = model.CommissionA;
            newmodel.Tax              = model.Tax;
            newmodel.Bonus            = model.Bonus;
            newmodel.ActualCommission = model.ActualCommission;

            newmodel.DelegateLessRate       = model.DelegateLessRate;
            newmodel.DelegateLessCommission = model.DelegateLessCommission;
            newmodel.DelegateMoreRate       = model.DelegateMoreRate;
            newmodel.DelegateMoreCommission = model.DelegateMoreCommission;
            newmodel.SponsorRate            = model.SponsorRate;
            newmodel.SponsorCommission      = model.SponsorCommission;
            newmodel.TotalCommission        = model.TotalCommission;

            newmodel.DelegateLessPayed = model.DelegateLessPayed;
            newmodel.DelegateMorePayed = model.DelegateMorePayed;
            newmodel.SponsorPayed      = model.SponsorPayed;
            newmodel.CommissionPayed   = model.CommissionPayed;

            newmodel.DelegateIncome     = model.DelegateIncome;
            newmodel.DelegateRate       = model.DelegateRate;
            newmodel.DelegateCommission = model.DelegateCommission;
            newmodel.DelegatePayed      = model.DelegatePayed;

            CH.Edit <FinalCommission>(newmodel);
            var list = Finance_Logical._PreCommissionBLL.GetFinalCommission(model.ProjectID, model.TargetNameEN);
            var data = list.OrderBy(p => p.TargetNameEN).ToList();

            return(View(new GridModel(data)));
        }
示例#4
0
            public static _FinalCommission GetPreCommByProSales(int projectid, string sale)
            {
                var year  = DateTime.Now.Year;
                var deals = from d in CH.DB.Deals.Where(o => o.ProjectID == projectid && o.Abandoned == false && o.Income > 0 && o.Sales == sale)
                            select d;
                var precommissions = from pre in CH.DB.PreCommissions.Where(p => p.ProjectID == projectid && p.TargetNameEN == sale)
                                     select pre;
                var    username    = sale;
                var    emps        = CH.DB.EmployeeRoles.Where(w => w.AccountName == username);
                var    displayname = emps.Select(s => s.AccountNameCN).FirstOrDefault();
                var    roleid      = emps.Select(s => s.RoleID).FirstOrDefault();
                string inout       = "海外";

                if (roleid != null)
                {
                    var name = CH.GetDataById <Role>(roleid).Name;
                    if (name.Contains("国内"))
                    {
                        inout = "国内";
                    }
                }
                decimal standard = 3000;
                var     lps      = new _FinalCommission()
                {
                    RoleLevel          = 1,
                    ID                 = 0,
                    Income             = deals.Sum(s => (decimal?)s.Income),
                    TargetNameEN       = sale,
                    TargetNameCN       = displayname,
                    InOut              = inout,
                    DelegateLessIncome = inout == "海外" ? 0 : deals.Where(w => w.Poll > 0 && w.Income / w.Poll < standard).Sum(s => (decimal?)s.Income),
                    DelegateLessPayed  = precommissions.Sum(w => (decimal?)w.DelegateLessCommission),
                    DelegateMoreCount  = inout == "海外" ? 0 : deals.Where(w => w.Poll > 0 && w.Income / w.Poll > standard).Sum(s => (int?)s.Poll),
                    DelegateMoreIncome = inout == "海外" ? 0 : deals.Where(w => w.Poll > 0 && w.Income / w.Poll >= standard).Sum(s => (decimal?)s.Income),
                    DelegateMorePayed  = precommissions.Sum(w => (decimal?)w.DelegateMoreCommission),
                    SponsorIncome      = deals.Where(w => w.Poll == 0).Sum(s => (decimal?)s.Income),
                    SponsorPayed       = precommissions.Sum(w => (decimal?)w.SponsorCommission),
                    DelegateIncome     = inout == "海外" ? deals.Where(w => w.Poll > 0).Sum(s => (int?)s.Income) : 0,
                    DelegatePayed      = precommissions.Sum(w => (decimal?)w.DelegateCommission)
                };

                return(lps);
            }