예제 #1
0
 private void bindProjectData()
 {
     try
     {
         //mProj
         this.txtOBJECTNAME.Text    = mProj.OBJECTNAME;
         this.txtCONTRACTNO.Text    = mProj.CONTRACTNO;
         this.txtCOMPANYNAME.Text   = mProj.COMPANYNAME;
         this.txtADDRESS.Text       = mProj.ADDRESS;
         this.dtpBeginDate.DateTime = mProj.BEGINDATE;
         this.dtpEndDate.DateTime   = mProj.ENDDATE;
         if (mProj.OBJECTTYPENAME != null)
         {
             setProjIdentity(mProj.OBJECTTYPENAME);
         }
         this.txtMoney.Text = mProj.MONEY.ToString();
         if (mProj.BILLSTATUS == "已结算")
         {
             this.chkBillStatus.IsChecked = true;
         }
         if (!string.IsNullOrEmpty(mProj.TEAMLEDER))
         {
             TB_User leader = TB_UserDao.FindFirst(new EqExpression("USER_CODE", mProj.TEAMLEDER));
             this.txtleder.Text = leader.USER_NAME;
             this.txtleder.Tag  = leader;
         }
         //绑定组员
         string menbers = mProj.TEAMMEMBER;
         if (!string.IsNullOrEmpty(menbers))
         {
             string[] arr = menbers.Split('|');
             if (arr.Length > 0)
             {
                 for (int i = 0; i < arr.Length; i++)
                 {
                     TB_User user = TB_UserDao.FindFirst(new EqExpression("USER_CODE", arr[i]));
                     uc_user uc   = new uc_user(user);
                     uc.DelSelectUser += uc_DelSelectUser;
                     this.warp.Children.Add(uc);
                 }
             }
             TB_BILL[] arr_bills = TB_BILLDAO.FindAll(new EqExpression("PROJECTID", mProj.Id), new EqExpression("STATUS", 1));
             if (arr_bills.Length > 0)
             {
                 //绑定发票信息
                 for (int i = 0; i < arr_bills.Length; i++)
                 {
                     uc_bill uc = new uc_bill(arr_bills[i]);
                     uc.DelSelectBill += uc_DelSelectBill;
                     this.warp2.Children.Add(uc);
                 }
             }
             this.txtMemo.Text = mProj.MEMO;
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
예제 #2
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);
        }
예제 #3
0
        private TB_BILL getBillInfo(int projId)
        {
            TB_BILL rtn = null;

            try
            {
                TB_BILL[] arr = TB_BILLDAO.FindAll(new EqExpression("PROJECTID", projId), new EqExpression("STATUS", 1));
                if (arr.Length > 0)
                {
                    rtn = arr[0];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(rtn);
        }
예제 #4
0
 private void QueryBillInfo()
 {
     try
     {
         if (mprojID > 0)
         {
             TB_BILL[] arr = TB_BILLDAO.FindAll(new EqExpression("STATUS", 1), new EqExpression("PROJECTID", mprojID));
             if (arr.Length > 0)
             {
                 List <TB_BILL> list = new List <TB_BILL>(arr);
                 this.dgBill.ItemsSource = null;
                 this.dgBill.ItemsSource = list;
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }