コード例 #1
0
 private void BindExpenseData()
 {
     mEList = new List <TB_EXPENSE>();
     this.dgExpense.ItemsSource = null;
     try
     {
         if (this.rdoPersinal.IsChecked == true)
         {
             //个人报销
             TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", 0), new EqExpression("STATUS", 1));
             if (arr != null && arr.Length > 0)
             {
                 mEList = new List <TB_EXPENSE>(arr);
             }
         }
         else
         {
             //项目报销
             if (txtProj.Tag != null)
             {
                 TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", (txtProj.Tag as TB_PROJECT).Id), new EqExpression("STATUS", 1));
                 if (arr != null && arr.Length > 0)
                 {
                     mEList = new List <TB_EXPENSE>(arr);
                 }
             }
         }
         this.dgExpense.ItemsSource = screening(mEList);
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
コード例 #2
0
        public void refreshControl()
        {
            switch (Global.g_userrole)
            {
            case 1:
                break;

            case 2:
                break;

            case 3:
                txtCOMPANYNAME.IsEnabled = false;
                txtCONTRACTNO.IsEnabled  = false;
                dtpBeginDate.IsEnabled   = false;
                dtpEndDate.IsEnabled     = false;
                txtMoney.IsEnabled       = false;
                btnLeader.IsEnabled      = false;
                btnEdit.IsEnabled        = false;
                txtMemo.IsEnabled        = false;
                chkBillStatus.IsEnabled  = false;
                //drpObjectType.IsEditable = false;
                txtADDRESS.IsEnabled = false;
                btnBill.IsEnabled    = false;
                break;

            case 9:
                btnBill.IsEnabled = true;
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", mProj.Id), new EqExpression("STATUS", 1));
                if (arr.Length > 0)
                {
                    txtOBJECTNAME.IsEnabled = false;
                    txtCONTRACTNO.IsEnabled = false;
                    txtOBJECTNAME.IsEnabled = false;
                    txtADDRESS.IsEnabled    = false;
                    dtpBeginDate.IsEnabled  = false;
                    dtpEndDate.IsEnabled    = false;
                    txtMoney.IsEnabled      = false;
                    //txtZHKOU.IsEnabled = false;
                    chkyn.IsEnabled     = false;
                    chkyw.IsEnabled     = false;
                    chkwl.IsEnabled     = false;
                    chkzx.IsEnabled     = false;
                    chkwx.IsEnabled     = false;
                    chkwifi.IsEnabled   = false;
                    chk3D.IsEnabled     = false;
                    chk2D.IsEnabled     = false;
                    chkxwj.IsEnabled    = false;
                    chkqj.IsEnabled     = false;
                    chkjrl.IsEnabled    = false;
                    chkkfl.IsEnabled    = false;
                    chkfhl.IsEnabled    = false;
                    btnLeader.IsEnabled = false;
                    btnEdit.IsEnabled   = false;
                    txtMemo.IsEnabled   = false;
                }
                break;
            }
        }
コード例 #3
0
        private void BindExpenseData()
        {
            mEList = new List <TB_EXPENSE>();
            this.dgExpense.ItemsSource = null;
            try
            {
                if (this.rdoPersinal.IsChecked == true)
                {
                    //个人报销
                    TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", 0), new EqExpression("STATUS", 1));
                    if (arr != null && arr.Length > 0)
                    {
                        mEList = new List <TB_EXPENSE>(arr);
                        mEList = mEList.FindAll(a => a.RESPONSESTATUS != 2);
                    }
                }
                else
                {
                    //项目报销
                    if (txtProj.Tag != null)
                    {
                        if (Global.g_userrole == 8 || (txtProj.Tag as TB_PROJECT).CREATEUSER == Global.g_usercode)
                        {
                            this.chkQTCT.IsEnabled = true;
                        }
                        else
                        {
                            this.chkQTCT.IsEnabled = false;
                        }
                        TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", (txtProj.Tag as TB_PROJECT).Id), new EqExpression("STATUS", 1));
                        if (arr != null && arr.Length > 0)
                        {
                            mEList = new List <TB_EXPENSE>(arr);
                            mEList = mEList.FindAll(a => a.LEADERRESPONSESTATUS != 2 || a.RESPONSESTATUS != 2);
                        }
                    }
                }
                mEList = mEList.FindAll(a => a.MONTH == MONTH && a.YEAR == YEAR);
                this.dgExpense.ItemsSource = screening(mEList);

                decimal totalmoney = 0;
                this.labTotal.Content = "共: 0张   合计: 0.00元";
                if (this.dgExpense.ItemsSource != null)
                {
                    List <TB_EXPENSE> _ls = this.dgExpense.ItemsSource as List <TB_EXPENSE>;
                    for (int i = 0; i < _ls.Count; i++)
                    {
                        totalmoney += _ls[i].MONEY;
                    }
                    this.labTotal.Content = "共:" + _ls.Count + "张   合计:" + totalmoney.ToString() + "元";
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
        }
コード例 #4
0
 private void BindExpenseData2()
 {
     mEList = new List <TB_EXPENSE>();
     this.dgExpense.ItemsSource = null;
     try
     {
         if (mExp.OBJECTID == 0)
         {
             this.rdoPersinal.IsChecked = true;
             //个人报销
             TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", 0), new EqExpression("STATUS", 1));
             if (arr != null && arr.Length > 0)
             {
                 mEList = new List <TB_EXPENSE>(arr);
             }
         }
         else
         {
             this.jt.IsEnabled        = false;
             this.cb.IsEnabled        = false;
             this.qt.IsEnabled        = false;
             this.tx.IsEnabled        = false;
             this.rdoObject.IsChecked = true;
             TB_PROJECT proj = TB_PROJECTDAO.FindFirst(new EqExpression("Id", mExp.OBJECTID));
             if (proj != null)
             {
                 this.txtProj.Tag  = proj;
                 this.txtProj.Text = proj.OBJECTNAME;
                 //项目报销
                 TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", (txtProj.Tag as TB_PROJECT).Id), new EqExpression("STATUS", 1));
                 if (arr != null && arr.Length > 0)
                 {
                     mEList = new List <TB_EXPENSE>(arr);
                 }
             }
         }
         mEList = mEList.FindAll(a => a.MONTH == MONTH && a.YEAR == YEAR);
         this.dgExpense.ItemsSource = screening(mEList);
         this.txtMoney.Text         = this.mExp.MONEY.ToString();
         this.txtFPHM.Text          = this.mExp.BILLNO;
         this.cmbExprenseItem.Text  = mExp.EXPENS;
         this.txtComments.Text      = mExp.COMMENTS;
         if (mExp.ISQTCT == 1)
         {
             this.chkQTCT.IsEnabled = true;
             this.chkQTCT.IsChecked = true;
             this.txtCusName.Text   = mExp.OPNAME;
         }
         this.btnSubmit.Content = "修  改";
     }
     catch (Exception ex)
     {
         this.btnSubmit.Content = "新  增";
         MessageHelper.ShowMessage(ex.Message);
     }
 }
コード例 #5
0
ファイル: profileporcess.cs プロジェクト: H1LLStreaM/QTCT_3
        /// <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);
        }
コード例 #6
0
 private void BindExpenseData2()
 {
     mEList = new List <TB_EXPENSE>();
     this.dgExpense.ItemsSource = null;
     try
     {
         if (mExp.OBJECTID == 0)
         {
             this.rdoPersinal.IsChecked = true;
             //个人报销
             TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", 0), new EqExpression("STATUS", 1));
             if (arr != null && arr.Length > 0)
             {
                 mEList = new List <TB_EXPENSE>(arr);
             }
         }
         else
         {
             this.jt.IsEnabled        = false;
             this.cb.IsEnabled        = false;
             this.qt.IsEnabled        = false;
             this.tx.IsEnabled        = false;
             this.rdoObject.IsChecked = true;
             TB_PROJECT proj = TB_PROJECTDAO.FindFirst(new EqExpression("Id", mExp.OBJECTID));
             if (proj != null)
             {
                 this.txtProj.Tag  = proj;
                 this.txtProj.Text = proj.OBJECTNAME;
                 //项目报销
                 TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", (txtProj.Tag as TB_PROJECT).Id), new EqExpression("STATUS", 1));
                 if (arr != null && arr.Length > 0)
                 {
                     mEList = new List <TB_EXPENSE>(arr);
                 }
             }
         }
         this.dtpDate.DateTime      = mExp.CREATEDATE;
         this.dgExpense.ItemsSource = screening(mEList);
         this.txtMoney.Text         = this.mExp.MONEY.ToString();
         this.txtFPHM.Text          = this.mExp.BILLNO;
         this.cmbExprenseItem.Text  = mExp.EXPENS;
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
コード例 #7
0
ファイル: ucPreview.xaml.cs プロジェクト: H1LLStreaM/QTCT_3
 private void Query()
 {
     try
     {
         if (mprojID > 0)
         {
             mExparr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", mprojID), new EqExpression("STATUS", 1));
             if (mExparr.Length > 0)
             {
                 List <TB_EXPENSE> list = new List <TB_EXPENSE>(mExparr);
                 this.dgExpense.ItemsSource = list;
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
コード例 #8
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="uc"></param>
 void uc_DelSelectUser(uc_user uc)
 {
     foreach (UserControl _uc in warp.Children)
     {
         if ((_uc as uc_user).MUser.Id == uc.MUser.Id)
         {
             //判断是否有报销信息
             TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("STATUS", 1), new EqExpression("OPUID", uc.MUser.Id));
             if (arr.Length == 0)
             {
                 warp.Children.Remove(_uc);
                 break;
             }
             else
             {
                 MessageHelper.ShowMessage((_uc as uc_user).MUser.USER_NAME + "已有项目报销信息,不能删除");
             }
         }
     }
 }
コード例 #9
0
        private List <TB_EXPENSE> Query()
        {
            List <TB_EXPENSE> rtn = null;

            try
            {
                List <ICriterion> IClist = new List <ICriterion>();
                //IClist.Add(new EqExpression("OPNAME", usercode));
                IClist.Add(new EqExpression("STATUS", 1));
                //IClist.Add(new EqExpression("OBJECTID", objectId));
                if (txtProj.Tag != null)
                {
                    IClist.Add(new EqExpression("OBJECTID", (txtProj.Tag as TB_PROJECT).Id));
                }
                if (cmbExpenseType.SelectedIndex > 0)
                {
                    IClist.Add(new EqExpression("EXPENSETYPE", (cmbExpenseType.SelectedItem as PTS_TABLE_SRC).ID));
                }
                if (chk.IsChecked == true)
                {
                    BetweenExpression and1 = new BetweenExpression("CREATEDATE", dtpBeginDate.DateTime, DateTime.Parse(dtpEndDate.DateTime.ToString("yyyy-MM-dd 23:59:59")));
                    IClist.Add(and1);
                }
                if (txtUser.Tag != null)
                {
                    IClist.Add(new EqExpression("OPNAME", (txtUser.Tag as TB_User).USER_CODE));
                }
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(IClist.ToArray());
                if (arr != null && arr.Length > 0)
                {
                    rtn = new List <TB_EXPENSE>(arr);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
            return(rtn);
        }
コード例 #10
0
        /// <summary>
        /// 报销查询
        /// </summary>
        /// <param name="expenseType">报销类型 0:项目  1:个人</param>
        /// <param name="objectId">项目ID 为个人报销项目值为0</param>
        /// <param name="expenseType2">报销类型(餐费,旅行费等)</param>
        /// <param name="start">查询开始时间</param>
        /// <param name="end">查询结束时间</param>
        /// <returns></returns>
        public static List <TB_EXPENSE> QueryExpense(Object obj, int expenseType, int objectId, int expenseType2, int year, int month)
        {
            List <TB_EXPENSE> list = new List <TB_EXPENSE>();

            try
            {
                List <ICriterion> IClist = new List <ICriterion>();
                if (obj != null)
                {
                    IClist.Add(new EqExpression("OPNAME", (obj as TB_User).USER_CODE));
                }
                IClist.Add(new EqExpression("STATUS", 1));
                IClist.Add(new EqExpression("OBJECTID", objectId));
                IClist.Add(new EqExpression("YEAR", year));
                IClist.Add(new EqExpression("MONTH", month));
                IClist.Add(new EqExpression("ISCOMPLETE", 1)); //只能看到已提交的报销
                if (expenseType2 > 0)
                {
                    IClist.Add(new EqExpression("EXPENSTYPE", expenseType2));
                }
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(IClist.ToArray());
                if (arr != null && arr.Length > 0)
                {
                    list = new List <TB_EXPENSE>(arr);
                }
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].ISMEMBER == 1)
                    {
                        list[i].memeberstatus = "◎";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
            return(list);
        }
コード例 #11
0
        /// <summary>
        /// 报销提醒查询
        /// </summary>
        /// <param name="searchType">报销类型 0:个人  1:项目</param>
        /// <param name="objectId">项目ID 为个人报销项目值为0</param>
        /// <param name="expenseType2">报销类型(餐费,旅行费等)</param>
        /// <param name="start">查询开始时间</param>
        /// <param name="end">查询结束时间</param>
        /// <returns></returns>
        public static List <TB_EXPENSE> QueryExpenseAlert(int searchType, int year, int month)
        {
            List <TB_EXPENSE> list = new List <TB_EXPENSE>();

            try
            {
                List <ICriterion> IClist = new List <ICriterion>();
                IClist.Add(new EqExpression("STATUS", 1));
                IClist.Add(new EqExpression("YEAR", year));
                IClist.Add(new EqExpression("MONTH", month));
                IClist.Add(new EqExpression("ISCOMPLETE", 1)); //只能看到已提交的报销
                if (searchType > 0)
                {
                    IClist.Add(new NotExpression(new EqExpression("OBJECTID", 0)));
                }
                else
                {
                    IClist.Add(new EqExpression("OBJECTID", 0));
                }
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(IClist.ToArray());
                if (arr != null && arr.Length > 0)
                {
                    list = new List <TB_EXPENSE>(arr);
                }
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].ISMEMBER == 1)
                    {
                        list[i].memeberstatus = "◎";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
            return(list);
        }
コード例 #12
0
        /// <summary>
        /// 报销查询
        /// </summary>
        /// <param name="usercode">工号</param>
        /// <param name="expenseType">报销类型</param>
        /// <param name="objectId">项目ID</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <returns></returns>
        public static List <TB_EXPENSE> QueryExpense2(string usercode, int expenseType, int objectId, DateTime?start = null, DateTime?end = null)
        {
            List <TB_EXPENSE> list = new List <TB_EXPENSE>();

            try
            {
                List <ICriterion> IClist = new List <ICriterion>();
                IClist.Add(new EqExpression("STATUS", 1));
                if (!string.IsNullOrEmpty(usercode))
                {
                    IClist.Add(new EqExpression("OPNAME", usercode));
                }
                if (objectId > 0)
                {
                    IClist.Add(new EqExpression("OBJECTID", objectId));
                }
                if (expenseType > 0)
                {
                    IClist.Add(new EqExpression("EXPENSTYPE", expenseType));
                }
                if (start != null && end != null)
                {
                    BetweenExpression and1 = new BetweenExpression("CREATEDATE", start, end);
                    IClist.Add(and1);
                }
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(IClist.ToArray());
                if (arr != null && arr.Length > 0)
                {
                    list = new List <TB_EXPENSE>(arr);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
            return(list);
        }
コード例 #13
0
        public void refreshControl()
        {
            switch (Global.g_userrole)
            {
            case 1:
                break;

            case 2:
                break;

            case 3:
                txtCOMPANYNAME.IsEnabled = false;
                txtCONTRACTNO.IsEnabled  = false;
                dtpBeginDate.IsEnabled   = false;
                dtpEndDate.IsEnabled     = false;
                txtMoney.IsEnabled       = false;
                btnLeader.IsEnabled      = false;
                btnEdit.IsEnabled        = false;
                txtMemo.IsEnabled        = false;
                chkBillStatus.IsEnabled  = false;
                txtADDRESS.IsEnabled     = false;
                btnBill.IsEnabled        = false;
                break;

            case 9:      //财务
                this.btnSubmit.Visibility  = System.Windows.Visibility.Collapsed;
                this.btnSubmit2.Visibility = System.Windows.Visibility.Visible;
                btnBill.IsEnabled          = true;
                chkBillStatus.IsEnabled    = true;
                TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", mProj.Id), new EqExpression("STATUS", 1));
                if (arr.Length > 0)
                {
                    txtOBJECTNAME.IsEnabled = false;
                    txtCONTRACTNO.IsEnabled = false;
                    txtOBJECTNAME.IsEnabled = false;
                    txtADDRESS.IsEnabled    = false;
                    dtpBeginDate.IsEnabled  = false;
                    dtpEndDate.IsEnabled    = false;
                    txtMoney.IsEnabled      = false;
                    txtZHKOU.IsEnabled      = false;
                    chkyn.IsEnabled         = false;
                    chkyw.IsEnabled         = false;
                    chkwl.IsEnabled         = false;
                    chkzx.IsEnabled         = false;
                    chkwx.IsEnabled         = false;
                    chkwifi.IsEnabled       = false;
                    chk3D.IsEnabled         = false;
                    chk2D.IsEnabled         = false;
                    chkxwj.IsEnabled        = false;
                    chkqj.IsEnabled         = false;
                    chkjrl.IsEnabled        = false;
                    chkkfl.IsEnabled        = false;
                    chkfhl.IsEnabled        = false;
                    btnLeader.IsEnabled     = false;
                    btnEdit.IsEnabled       = false;
                    txtMemo.IsEnabled       = false;
                }
                break;
            }
            if (mProj.BILLSTATUS == "已结算")
            {
                #region
                txtCOMPANYNAME.IsEnabled = false;
                txtCONTRACTNO.IsEnabled  = false;
                dtpBeginDate.IsEnabled   = false;
                dtpEndDate.IsEnabled     = false;
                txtMoney.IsEnabled       = false;
                btnLeader.IsEnabled      = false;
                btnEdit.IsEnabled        = false;
                txtMemo.IsEnabled        = false;
                chkBillStatus.IsEnabled  = false;
                txtADDRESS.IsEnabled     = false;
                btnBill.IsEnabled        = false;
                txtOBJECTNAME.IsEnabled  = false;
                txtCONTRACTNO.IsEnabled  = false;
                txtOBJECTNAME.IsEnabled  = false;
                txtADDRESS.IsEnabled     = false;
                dtpBeginDate.IsEnabled   = false;
                dtpEndDate.IsEnabled     = false;
                txtMoney.IsEnabled       = false;
                txtZHKOU.IsEnabled       = false;
                chkyn.IsEnabled          = false;
                chkyw.IsEnabled          = false;
                chkwl.IsEnabled          = false;
                chkzx.IsEnabled          = false;
                chkwx.IsEnabled          = false;
                chkwifi.IsEnabled        = false;
                chk3D.IsEnabled          = false;
                chk2D.IsEnabled          = false;
                chkxwj.IsEnabled         = false;
                chkqj.IsEnabled          = false;
                chkjrl.IsEnabled         = false;
                chkkfl.IsEnabled         = false;
                chkfhl.IsEnabled         = false;
                btnLeader.IsEnabled      = false;
                btnEdit.IsEnabled        = false;
                txtMemo.IsEnabled        = false;

                this.btnSubmit.IsEnabled  = false;
                this.btnSubmit2.IsEnabled = false;
                #endregion
            }
        }
コード例 #14
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //获取提成全局设置信息:
                decimal ratio1 = Global.g_ratio1; //Utils.NvDecimal(PTS_TABLE_SRCDAO.FindFirst(new EqExpression("TABLE_ID", "PTS_TABLE_RATIO"), new EqExpression("TABLE_NAME", "固定均分提成比例")).TABLE_VALUE);
                decimal ratio2 = Global.g_ratio2; //Utils.NvDecimal(PTS_TABLE_SRCDAO.FindFirst(new EqExpression("TABLE_ID", "PTS_TABLE_RATIO"), new EqExpression("TABLE_NAME", "可分配提成比率")).TABLE_VALUE);
                if (mProj == null)                //新增工程信息
                {
                    //检查OBJECTNAME(工程名称)是否重复?
                    if (!string.IsNullOrEmpty(txtOBJECTNAME.Text))
                    {
                        TB_PROJECT[] existProj = TB_PROJECTDAO.FindAll(new EqExpression("STATUS", 1), new EqExpression("OBJECTNAME", this.txtOBJECTNAME.Text));
                        if (existProj.Length > 0)
                        {
                            MessageHelper.ShowMessage("项目名称有重复,请检查");
                            this.txtOBJECTNAME.Focus();
                            return;
                        }
                    }
                    else
                    {
                        MessageHelper.ShowMessage("请填写项目名称");
                        return;
                    }
                    TB_PROJECT proj = new TB_PROJECT();
                    proj.OBJECTNAME     = this.txtOBJECTNAME.Text;
                    proj.CONTRACTNO     = this.txtCONTRACTNO.Text;
                    proj.COMPANYNAME    = this.txtCOMPANYNAME.Text;
                    proj.ADDRESS        = this.txtADDRESS.Text;
                    proj.BEGINDATE      = this.dtpBeginDate.DateTime;
                    proj.ENDDATE        = this.dtpEndDate.DateTime;
                    proj.OBJECTTYPENAME = getProjidentity();
                    proj.MONEY          = decimal.Parse(this.txtMoney.Text);
                    //折扣
                    //proj.ZHEKOU = decimal.Parse(txtZHKOU.Text);
                    if (this.chkBillStatus.IsChecked == true)
                    {
                        proj.BILLSTATUS = "已结算";
                        proj.BILLDATE   = TableManager.DBServerTime();
                    }
                    //负责人
                    if (txtleder.Tag != null && (txtleder.Tag as TB_User).USER_NAME == txtleder.Text)
                    {
                        proj.TEAMLEDER     = (txtleder.Tag as TB_User).USER_CODE.ToString();
                        proj.TEAMLEDERNAME = (txtleder.Tag as TB_User).USER_NAME;
                    }

                    //成员
                    proj.TEAMMEMBER = getTeamMember();
                    //发票
                    proj.MEMO       = this.txtMemo.Text;
                    proj.CREATEUSER = Global.g_usercode;  //创建者
                    proj.RATIO1     = ratio1;
                    proj.RATIO2     = ratio2;
                    proj.Save();
                    #region  项目管理费
                    //根据工程金额保存管理费
                    TB_EXPENSE exp = new TB_EXPENSE();
                    exp.MONEY      = RatioBusiness.QueryProjCost(decimal.Parse(this.txtMoney.Text));
                    exp.EXPENS     = "管理费";
                    exp.EXPENSTYPE = 16;
                    exp.OPUID      = 0;
                    exp.OBJECTID   = TB_PROJECTDAO.FindFirst(new EqExpression("OBJECTNAME", proj.OBJECTNAME)).Id;
                    exp.Save();
                    #endregion
                    MessageHelper.ShowMessage("保存成功!");
                }
                else  //更新工程信息
                {
                    //判断是否已有报销信息,如果有报销信息项目不能再更新
                    TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", mProj.Id), new EqExpression("STATUS", 1));
                    if (arr.Length > 0 && Global.g_userrole != 9)
                    {
                        MessageHelper.ShowMessage("该项目已有报销信息,不能再更新项目信息!");
                        return;
                    }
                    else if (arr.Length == 0 && Global.g_userrole != 9)
                    {
                        mProj.OBJECTNAME     = this.txtOBJECTNAME.Text;
                        mProj.CONTRACTNO     = this.txtCONTRACTNO.Text;
                        mProj.COMPANYNAME    = this.txtCOMPANYNAME.Text;
                        mProj.ADDRESS        = this.txtADDRESS.Text;
                        mProj.BEGINDATE      = this.dtpBeginDate.DateTime;
                        mProj.ENDDATE        = this.dtpEndDate.DateTime;
                        mProj.OBJECTTYPENAME = getProjidentity();
                        mProj.MONEY          = decimal.Parse(this.txtMoney.Text);
                        //折扣
                        //mProj.ZHEKOU = decimal.Parse(txtZHKOU.Text);
                        if (this.chkBillStatus.IsChecked == true)
                        {
                            mProj.BILLSTATUS = "已结算";
                            mProj.BILLDATE   = TableManager.DBServerTime();
                        }
                        else
                        {
                            mProj.BILLSTATUS = "";
                        }
                        //负责人
                        if (txtleder.Tag != null && (txtleder.Tag as TB_User).USER_NAME == txtleder.Text)
                        {
                            mProj.TEAMLEDER     = (txtleder.Tag as TB_User).USER_CODE.ToString();
                            mProj.TEAMLEDERNAME = (txtleder.Tag as TB_User).USER_NAME;
                        }
                        //成员
                        mProj.TEAMMEMBER = getTeamMember();
                        //发票
                        mProj.MEMO   = this.txtMemo.Text;
                        mProj.RATIO1 = ratio1;
                        mProj.RATIO2 = ratio2;
                        mProj.Update();
                    }
                    MessageHelper.ShowMessage("保存成功!");
                }

                #region 发票信息处理
                //先把工程对应的所有发票全部作废,再重新新增
                TB_PROJECT     temp = TB_PROJECTDAO.FindFirst(new EqExpression("OBJECTNAME", txtOBJECTNAME.Text));
                BaseBusiness   bb   = new BaseBusiness();
                bool           rtn  = bb.DelALLItem("TB_BILL", "PROJECTID=" + temp.Id + "");
                List <TB_BILL> ls   = getBills();
                if (ls.Count > 0)
                {
                    if (rtn == true)
                    {
                        for (int i = 0; i < ls.Count; i++)
                        {
                            TB_BILL bill = new TB_BILL();
                            bill.CREATEDATE = ls[i].CREATEDATE;
                            bill.BILLNUMBER = ls[i].BILLNUMBER;
                            bill.PROJECTID  = temp.Id;
                            bill.MONEY      = ls[i].MONEY;
                            bill.STATUS     = 1;
                            bill.Save();
                        }
                    }
                    else
                    {
                        MessageHelper.ShowMessage("保存发票信息发生错误!");
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
        }