Пример #1
0
 private void rationProcess()
 {
     if (mproj != null)
     {
         if (string.IsNullOrEmpty(mproj.BILLSTATUS))
         {
             labMyMoney.Content = "待结算";
             return;
         }
         profileporcess             pp   = new profileporcess();
         projProfileClass           ppc  = pp.getProfile(TB_PROJECTDAO.FindFirst(new EqExpression("Id", mprojID)));
         List <TB_PERSONAL_PROFILE> list = pp.personalProcess(ppc, mprojID);
         if (list.Count > 0)
         {
             List <TB_PERSONAL_PROFILE> rtn = list.FindAll(a => a.USERCODE == Global.g_usercode);  //数据过滤
             if (rtn.Count > 0)
             {
                 labMyMoney.Content = rtn[0].PROFILE1 + rtn[0].PROFILE2 + "元";
             }
             else
             {
                 labMyMoney.Content = "0元";
             }
         }
         else
         {
             labMyMoney.Content = "0元";
         }
     }
 }
Пример #2
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            this.dgProfile.ItemsSource = null;
            Decimal TotalMoney   = 0; //合同金额总计
            Decimal TotalCost    = 0; //成本金额总计
            Decimal TotalProfile = 0; //净利润金额合计
            //项目查询
            string            year1     = this.cmbYear.Text;
            string            month1    = this.cmbMonth.Text;
            string            year2     = this.cmbYear2.Text;
            string            month2    = this.cmbMonth2.Text;
            string            start     = year1 + "-" + month1 + "-1 00:00:00";
            string            end       = year2 + "-" + month2 + "-1 23:59:59";
            DateTime          startDate = DateTime.Parse(start);
            DateTime          endDate   = DateTime.Parse(end).AddMonths(1).AddDays(-1);
            List <TB_PROJECT> list      = Comments.Comment.QueryProject(0, "", "", startDate, endDate);

            if (list.Count > 0)
            {
                List <tmpProfile> ls = new List <tmpProfile>();
                for (int i = 0; i < list.Count; i++)
                {
                    tmpProfile tmp = new tmpProfile();
                    tmp.INDEX       = i + 1;
                    tmp.projName    = list[i].OBJECTNAME;
                    tmp.projDate    = list[i].BEGINDATE.ToShortDateString();
                    tmp.projAddress = list[i].ADDRESS;
                    tmp.LEADER      = list[i].TEAMLEDER;
                    tmp.SALER       = list[i].CREATEUSER;
                    tmp.MONEY       = list[i].MONEY;
                    TotalMoney     += tmp.MONEY;
                    tmp.COST        = ExpenseBusiness.getTotalExpense(list[i].Id);
                    TotalCost      += tmp.COST;
                    profileporcess   pp  = new profileporcess();
                    projProfileClass ppc = pp.getProfile(list[i]);
                    if (ppc != null)
                    {
                        tmp.JLR = ppc.xmjlr; //净利润
                        tmp.JLV = ppc.mlv;   //净利率
                    }
                    TB_BILL bill = getBillInfo(list[i].Id);
                    if (bill != null)
                    {
                        tmp.BILLDATE = bill.CREATEDATE.ToShortDateString();
                    }
                    if (list[i].BILLDATE != null && list[i].BILLSTATUS == "已结算")
                    {
                        tmp.COMPLETEDATE = list[i].BILLDATE.Year.ToString() + "年" + list[i].BILLDATE.Month.ToString() + "月";
                    }
                    ls.Add(tmp);
                }
                this.dgProfile.ItemsSource = ls;
                this.lab1.Content          = "合计发票金额:" + TotalMoney.ToString();
                this.lab2.Content          = "合计成本金额:" + TotalCost.ToString();
                this.lab3.Content          = "合计净利润金额:" + TotalProfile.ToString();
            }
        }
Пример #3
0
        /// <summary>
        /// 计算项目利润(公司)
        /// </summary>
        /// <param name="proj"></param>
        /// <returns></returns>
        public projProfileClass getProfile(TB_PROJECT proj)
        {
            projProfileClass profile = new projProfileClass();

            try
            {
                profile.projName       = proj.OBJECTNAME;
                profile.saler          = proj.CREATEUSER;
                profile.projDate       = proj.BEGINDATE.ToShortDateString();
                profile.contractNumber = proj.CONTRACTNO;
                profile.hshtj          = proj.MONEY;
                profile.whshtj         = Math.Round(proj.MONEY * decimal.Parse("0.94"), 2);
                TB_BILL[] billarr = TB_BILLDAO.FindAll(new EqExpression("PROJECTID", proj.Id), new EqExpression("STATUS", 1));
                if (billarr.Length > 0)
                {
                    profile.bills = billarr[0].BILLNUMBER;
                }
                //报销
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("STATUS", 1), new EqExpression("OBJECTID", proj.Id));
                if (arr.Length > 0)
                {
                    List <TB_EXPENSE> ls = new List <TB_EXPENSE>(arr);
                    profile.expens = new List <TB_EXPENSE>();
                    profile.expens = ls;
                }
                if (arr.Length > 0)
                {
                    profile.xmmlr = xmmlrProcess(new List <TB_EXPENSE>(arr), profile.whshtj);
                }
                else
                {
                    profile.xmmlr = profile.whshtj;
                }
                //毛利润
                profile.mlv = 0;
                if (profile.whshtj > 0)
                {
                    profile.mlv = Math.Round(profile.xmmlr / profile.whshtj * 100, 2);  //项目毛利润/未含税合同价(%)
                }
                //项目净利润
                profile.xmjlr = Math.Round(profile.xmmlr * Utils.NvDecimal("0.8"), 2);
                //项目工程师提成比率
                profile.xmgcstc = xmgcstcProcess(profile.mlv);
                //项目工程师提成金额
                profile.xmgcstje = Math.Round(profile.xmjlr * profile.xmgcstc / 100, 2);
                //公司留存
                profile.gslc = Math.Round(profile.xmjlr - profile.xmgcstje, 2);
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
            return(profile);
        }
Пример #4
0
        private void profileProcess(projProfileClass ppc)
        {
            this.labHTZJ.Content = mproj.MONEY;
            this.labZHJ.Content  = ppc.whshtj; //折后含税合同价
            decimal totalExpense = 0;

            for (int i = 0; i < ppc.expens.Count; i++)
            {
                totalExpense += ppc.expens[i].MONEY;
            }
            labExpense.Content = totalExpense.ToString();
            labMoney3.Content  = ppc.xmmlr;    //毛利润
            labMLV.Content     = ppc.mlv;      //毛利率
            labJLR.Content     = ppc.xmjlr;    //项目净利润
            labRatio.Content   = ppc.xmgcstc;  //提成百分比
            labTCJE.Content    = ppc.xmgcstje; //提成金额
            labztcje.Content   = ppc.xmgcstje; //提成金额
            ////获取静态提成区间配置
            //getStaticRatio();
            //if (mproj != null)
            //{
            //    this.labHTZJ.Content = mproj.MONEY;
            //    this.labZHJ.Content = Math.Round((mproj.MONEY * decimal.Parse("0.94")),2); //折后含税合同价
            //     //报销费用合计
            //    decimal totalExpense=0;
            //    for (int i = 0; i < mExparr.Length; i++)
            //    {
            //        totalExpense += mExparr[i].MONEY;
            //    }
            //    labExpense.Content = totalExpense.ToString();
            //    labMoney3.Content = Math.Round((mproj.MONEY * decimal.Parse("0.94")) - totalExpense,2);  //毛利润
            //    decimal mlv = Math.Round(((((mproj.MONEY * decimal.Parse("0.94")) - totalExpense) / (mproj.MONEY * decimal.Parse("0.94"))) * 100),2); //毛利率
            //    labMLV.Content = Math.Round(((((mproj.MONEY * decimal.Parse("0.94")) - totalExpense) / (mproj.MONEY * decimal.Parse("0.94"))) * 100),2).ToString() + "%";  //毛利率
            //    labJLR.Content = Math.Round((((mproj.MONEY * decimal.Parse("0.94")) - totalExpense) * decimal.Parse("0.8")),2);  //项目净利润

            //    labRatio.Content = RatioBusiness.QueryRatio(pts_proj_ratioDao.FindAll(), mlv).ToString();
            //    //if (mlv > 40)
            //    //{
            //    //    labRatio.Content = staticRatio1;
            //    //}
            //    //else if (mlv > 30 && mlv < 40)
            //    //{
            //    //    labRatio.Content = staticRatio2;
            //    //}
            //    //else if (mlv < 30)
            //    //{
            //    //    labRatio.Content = staticRatio3;
            //    //}
            //    labTCJE.Content = Math.Round(Utils.NvDecimal(labJLR.Content)*(Utils.NvDecimal(labRatio.Content)/100),2);
            //    labztcje.Content = Math.Round(Utils.NvDecimal(labJLR.Content) * (Utils.NvDecimal(labRatio.Content) / 100), 2);
            //}
        }
Пример #5
0
        public List <TB_PERSONAL_PROFILE> personalProcess(projProfileClass ppc, int projId)
        {
            decimal money = ppc.xmgcstje; //总项目工程师提成金额
            List <TB_PERSONAL_PROFILE> rtn = new List <TB_PERSONAL_PROFILE>();

            try
            {
                TB_PROJECT proj = TB_PROJECTDAO.FindFirst(new EqExpression("Id", projId));
                if (proj != null)
                {
                    TB_RATIO[] arr = TB_RATIODAO.FindAll(new EqExpression("PROJECTID", projId), new EqExpression("STATUS", 1));
                    if (arr.Length > 0)
                    {
                        decimal totalAmount = 0;
                        for (int i = 0; i < arr.Length; i++)
                        {
                            totalAmount += arr[i].RATIO;
                        }
                        //全局提成比率
                        decimal ratio1 = proj.RATIO1 / 100;
                        decimal ratio2 = proj.RATIO2 / 100;
                        //分配全局
                        decimal _money60   = Math.Round(money * ratio1, 2);
                        decimal _money40   = Math.Round(money * ratio2, 2);
                        decimal avgmoney60 = Math.Round(_money60 / arr.Length, 2);  //均分提成
                        //个人提成份额
                        for (int i = 0; i < arr.Length; i++)
                        {
                            TB_PERSONAL_PROFILE tpp = new TB_PERSONAL_PROFILE();
                            tpp.USERCODE = arr[i].USERCODE;
                            tpp.AMOUNT   = arr[i].RATIO;
                            tpp.PROFILE1 = avgmoney60;
                            tpp.PROFILE2 = Math.Round(_money40 / totalAmount * arr[i].RATIO, 2);
                            rtn.Add(tpp);
                        }
                    }
                }
                else
                {
                    return(rtn);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
            return(rtn);
        }
Пример #6
0
 public void Print(projProfileClass ppc, TB_PROJECT proj)
 {
     try
     {
         list = new List <projProfileClass>();
         list.Add(ppc);
         List <TB_EXPENSE> detial = new List <TB_EXPENSE>();
         detial = ppc.expens;
         for (int i = 0; i < detial.Count; i++)
         {
             detial[i].Index = i + 1;
         }
         reportPrint(list, detial);
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
Пример #7
0
 /// <summary>
 /// 查询已结算项目的成员提成
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSearch_Click(object sender, RoutedEventArgs e)
 {
     dgProfile.ItemsSource = null;
     if (this.txtProj.Tag == null)
     {
         MessageHelper.ShowMessage("请选择需要查询的项目");
         return;
     }
     else
     {
         TB_PROJECT proj = this.txtProj.Tag as TB_PROJECT;
         if (proj.BILLSTATUS == "已结算")
         {
             profileporcess             pp    = new profileporcess();
             projProfileClass           ppc   = pp.getProfile(TB_PROJECTDAO.FindFirst(new EqExpression("Id", proj.Id)));
             List <TB_PERSONAL_PROFILE> list  = pp.personalProcess(ppc, proj.Id);
             List <TB_PERSONAL_PROFILE> _list = new List <TB_PERSONAL_PROFILE>();
             if (txtUser.Tag == null)
             {
                 _list = list;
             }
             else
             {
                 TB_User user = txtUser.Tag as TB_User;
                 _list = list.FindAll(a => a.USERCODE == user.USER_CODE);
             }
             if (_list.Count > 0)
             {
                 for (int i = 0; i < _list.Count; i++)
                 {
                     _list[i].INDEX    = i + 1;
                     _list[i].USERNAME = TB_UserDao.FindFirst(new EqExpression("USER_CODE", _list[i].USERCODE)).USER_NAME;
                 }
                 dgProfile.ItemsSource = list;
             }
         }
         else
         {
             MessageHelper.ShowMessage("该项目未结算");
             return;
         }
     }
 }
Пример #8
0
        public ucPreview2(int _projectID)
        {
            InitializeComponent();
            if (_projectID == 0)
            {
                return;
            }
            mprojID = _projectID;
            this.dgExpense.ItemsSource = null;
            Query(); //报销信息查询
            BindProjectInfo();
            QueryBillInfo();
            profileporcess   pp  = new profileporcess();
            projProfileClass ppc = pp.getProfile(TB_PROJECTDAO.FindFirst(new EqExpression("Id", mprojID)));

            profileProcess(ppc); //项目利润计算
            this.panel.Children.Clear();
            rationProcess(ppc);  //个人提成计算
        }
Пример #9
0
 private void brnPrint_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.dgObject.SelectedItem != null)
         {
             TB_PROJECT       proj  = this.dgObject.SelectedItem as TB_PROJECT;
             profileporcess   proce = new profileporcess();
             projProfileClass ppc   = proce.getProfile(proj); //公司项目利润
             if (ppc != null)
             {
                 ppc.expens = ExpenseProcess(ppc.expens);  //合并
                 ProfilePrint print = new ProfilePrint();
                 print.Print(ppc, proj);
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
Пример #10
0
        private void rationProcess(projProfileClass ppc)
        {
            decimal profile = ppc.xmgcstje; //利润金额
            decimal ratio1  = mproj.RATIO1; //固定均分比率
            decimal ratio2  = mproj.RATIO2; //可分配比率

            labratio1.Content = ratio1.ToString() + "%";
            labratio2.Content = ratio2.ToString() + "%";

            labfpje1.Content = Math.Round((profile * ratio1) / 100, 2);
            labfpje2.Content = Math.Round((profile * ratio2) / 100, 2);

            TB_RATIO[] arr = TB_RATIODAO.FindAll(new EqExpression("PROJECTID", mproj.Id), new EqExpression("STATUS", 1));
            if (arr.Length > 0)
            {
                decimal profile1 = Math.Round(Utils.NvDecimal(labfpje1.Content) / arr.Length, 2);
                for (int i = 0; i < arr.Length; i++)
                {
                    ucPersonalRatio uc = new ucPersonalRatio(profile1, Utils.NvDecimal(labfpje2.Content), arr[i]);
                    this.panel.Children.Add(uc);
                }
            }
        }