예제 #1
0
 private void BindProjectInfo()
 {
     try
     {
         if (mprojID > 0)
         {
             mproj = TB_PROJECTDAO.FindFirst(new EqExpression("Id", mprojID));
             if (mproj != null)
             {
                 this.labCustomer.Content = mproj.COMPANYNAME;
                 this.labLeader.Content   = mproj.TEAMLEDERNAME;
                 //this.labMoney.Content = mproj.MONEY;
                 this.labProjDate.Content = mproj.BEGINDATE.ToShortDateString() + "-" + mproj.ENDDATE.ToShortDateString();
                 this.labProjName.Content = mproj.OBJECTNAME;
                 this.labProjType.Content = Comments.Comment.setProjIdentity(mproj.OBJECTTYPENAME);
                 //this.labMember.Content = mproj.TEAMMEMBER.Replace('|', ' ');
                 //this.labJS.Content = mproj.BILLSTATUS;
                 //this.labJS.Visibility = System.Windows.Visibility.Visible;
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
예제 #2
0
 void Row_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         this.menuDel.IsEnabled = false;
         if (Global.g_userrole == 8)
         {
             this.menuDel.IsEnabled = true;
         }
         if (dgObject.SelectedItem != null)
         {
             TB_PROJECT proj = dgObject.SelectedItem as TB_PROJECT;
             if (proj.TEAMLEDER == Global.g_usercode || Global.g_userrole == 8)
             {
                 this.menuEdit.IsEnabled = true;
             }
             else
             {
                 this.menuEdit.IsEnabled = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
예제 #3
0
 /// <summary>
 /// 显示概览
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgObject_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (Global.g_userrole == 8)  //总经理可以看到所有信息
     {
         this.panel.Children.Clear();
         if (dgObject.SelectedItem == null)
         {
             return;
         }
         TB_PROJECT proj = dgObject.SelectedItem as TB_PROJECT;
         ucPreview2 uc   = new ucPreview2(proj.Id);
         uc.Loaded += uc_Loaded;
         uc.Width   = panel.Width;
         this.panel.Children.Add(uc);
     }
     else
     {
         this.panel.Children.Clear();
         if (dgObject.SelectedItem == null)
         {
             return;
         }
         TB_PROJECT proj = dgObject.SelectedItem as TB_PROJECT;
         ucPreview  uc   = new ucPreview(proj.Id);
         uc.Loaded += uc_Loaded;
         uc.Width   = panel.Width;
         //uc.IsEnabled = false;
         this.panel.Children.Add(uc);
     }
 }
예제 #4
0
        private void BindProjTeam(TB_PROJECT proj)
        {
            this.panel1.Children.Clear();
            this.panel2.Children.Clear();

            string leader = proj.TEAMLEDER;

            string[] members = proj.TEAMMEMBER.Split('|');

            if (!string.IsNullOrEmpty(leader))
            {
                ucRatio2 uc = new ucRatio2(leader, proj.Id);
                this.panel1.Children.Add(uc);
            }
            if (members.Length > 0)
            {
                for (int i = 0; i < members.Length; i++)
                {
                    if (!string.IsNullOrEmpty(members[i]))
                    {
                        ucRatio2 uc = new ucRatio2(members[i], proj.Id);
                        this.panel2.Children.Add(uc);
                    }
                }
            }
        }
예제 #5
0
 private void ExpendAnimal(double k1, double k2, Border b = null)
 {
     if (dgObject.SelectedItem != null)
     {
         TB_PROJECT proj = dgObject.SelectedItem as TB_PROJECT;
         ucPreview  uc   = new ucPreview(proj.Id);
         this.ExpenseListPanel.Children.Clear();
         this.ExpenseListPanel.Children.Add(uc);
         if (b == null)
         {
             if (this.spBorder.Width == k2)
             {
                 DoubleAnimation wAnimation = new DoubleAnimation(k1, k2, new Duration(TimeSpan.FromSeconds(0.3)));
                 this.spBorder.BeginAnimation(DockPanel.WidthProperty, wAnimation, HandoffBehavior.Compose);
             }
         }
         else
         {
             if (b.Width == k1)
             {
                 DoubleAnimation wAnimation = new DoubleAnimation(k1, k2, new Duration(TimeSpan.FromSeconds(0.3)));
                 b.BeginAnimation(DockPanel.WidthProperty, wAnimation, HandoffBehavior.Compose);
             }
             else if (this.spBorder.Width == k2)
             {
                 DoubleAnimation wAnimation = new DoubleAnimation(k2, k1, new Duration(TimeSpan.FromSeconds(0.3)));
                 this.spBorder.BeginAnimation(DockPanel.WidthProperty, wAnimation, HandoffBehavior.Compose);
             }
         }
     }
 }
예제 #6
0
        public frmObjectSearch(string proj)
            : this()
        {
            mProj = new TB_PROJECT();
            List <PTS_TABLE_SRC> srclist = new List <PTS_TABLE_SRC>();
            PTS_TABLE_SRC        tmp     = new PTS_TABLE_SRC();

            tmp.TABLE_NAME  = "请选择";
            tmp.TABLE_VALUE = "0";
            tmp.ID          = 0;
            PTS_TABLE_SRC[] arr = PTS_TABLE_SRCDAO.FindAll(new EqExpression("TABLE_ID", "PTS_TABLE_OBJECT_TYPE"));
            if (arr.Length > 0)
            {
                srclist = new List <PTS_TABLE_SRC>(arr);
                srclist.Insert(0, tmp);
            }
            this.cmbObjType.ItemsSource       = null;
            this.cmbObjType.ItemsSource       = srclist;
            this.cmbObjType.DisplayMemberPath = "TABLE_NAME";
            this.cmbObjType.SelectedIndex     = 0;
            this.txtObjName.Text = proj;
            TB_PROJECT[] _arr = TB_PROJECTDAO.FindAll(new LikeExpression("OBJECTNAME", "%" + this.txtObjName.Text + "%"), new EqExpression("STATUS", 1));
            if (_arr.Length > 0)
            {
                mList = new List <TB_PROJECT>(_arr);
            }
            this.dgObject.ItemsSource = screening(mList);
        }
예제 #7
0
 public frmRatioEdit(TB_PROJECT proj)
     : this()
 {
     mProj             = proj;
     this.txtProj.Tag  = mProj;
     this.txtProj.Text = mProj.OBJECTNAME;
     BindProjTeam(mProj);
 }
예제 #8
0
 private void menuEdit_Click(object sender, RoutedEventArgs e)
 {
     if (dgObject.SelectedItem != null)
     {
         TB_PROJECT   proj = dgObject.SelectedItem as TB_PROJECT;
         frmRatioEdit frm  = new frmRatioEdit(proj);
         frm.ShowDialog();
     }
 }
예제 #9
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);
     }
 }
예제 #10
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);
        }
예제 #11
0
 public frmProject(TB_PROJECT _proj)
 {
     InitializeComponent();
     mList = new List <PTS_OBJECT_TYPE_SRC>();
     bindStaticData(); // 绑定初始数据
     if (_proj != null)
     {
         mProj = _proj;
         bindProjectData();
     }
     refreshControl();
 }
예제 #12
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            frmObjectSearch frm = new frmObjectSearch(0);

            frm.ShowDialog();
            if (frm.mProj != null)
            {
                TB_PROJECT proj = frm.mProj;
                this.txtProj.Text = proj.OBJECTNAME;
                this.txtProj.Tag  = proj;
            }
            BindExpenseData();
        }
예제 #13
0
 private void menuEdit2_Click(object sender, RoutedEventArgs e)
 {
     if (dgObject.SelectedItem != null)
     {
         TB_PROJECT   proj = dgObject.SelectedItem as TB_PROJECT;
         frmProjRatio frm  = new frmProjRatio();
         frm.ShowDialog();
         if (frm.item != null)
         {
             proj.RATIO1 = frm.item.RATIO1;
             proj.RATIO2 = frm.item.RATIO2;
             proj.Update();
         }
     }
 }
예제 #14
0
        private void dgObject_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TB_PROJECT proj = dgObject.SelectedItem as TB_PROJECT;

            if (proj != null)
            {
                if (proj.CREATEUSER == Global.g_usercode || Global.g_userrole == 8 || Global.g_userrole == 9)
                {
                    frmProject frm = new frmProject(proj);
                    frm.ShowDialog();
                }
            }
            //刷新
            BindProjectData();
        }
        public frmCreateProject()
        {
            InitializeComponent();

            List <ModelProject> aryProjects = Dac.DacFactory.Current.Project.GetAllProject();

            TB_PROJECT.Rows.Clear();
            foreach (ModelProject project in aryProjects)
            {
                DataRow row = TB_PROJECT.NewRow();
                project.UpdataeData(row);
                TB_PROJECT.Rows.Add(row);
            }
            dataGridView1.Update();
        }
예제 #16
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);
        }
예제 #17
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);
     }
 }
예제 #18
0
        public frmObjectSearch(int type = 0)
        {
            InitializeComponent();
            mType = type;
            mProj = new TB_PROJECT();
            List <PTS_TABLE_SRC> srclist = new List <PTS_TABLE_SRC>();
            PTS_TABLE_SRC        tmp     = new PTS_TABLE_SRC();

            tmp.TABLE_NAME  = "请选择";
            tmp.TABLE_VALUE = "0";
            tmp.ID          = 0;
            PTS_TABLE_SRC[] arr = PTS_TABLE_SRCDAO.FindAll(new EqExpression("TABLE_ID", "PTS_TABLE_OBJECT_TYPE"));
            if (arr.Length > 0)
            {
                srclist = new List <PTS_TABLE_SRC>(arr);
                srclist.Insert(0, tmp);
            }
            this.cmbObjType.ItemsSource       = null;
            this.cmbObjType.ItemsSource       = srclist;
            this.cmbObjType.DisplayMemberPath = "TABLE_NAME";
            this.cmbObjType.SelectedIndex     = 0;
            TB_PROJECT[] _arr = null;
            //if(type==1)
            //    _arr = TB_PROJECTDAO.FindAll(new LikeExpression("OBJECTNAME", "%" + this.txtObjName.Text + "%"), new EqExpression("STATUS", 1), new NotExpression(new EqExpression("BILLSTATUS", "已结算")));
            //else
            _arr = TB_PROJECTDAO.FindAll(new LikeExpression("OBJECTNAME", "%" + this.txtObjName.Text + "%"), new EqExpression("STATUS", 1));

            if (_arr.Length > 0)
            {
                mList = new List <TB_PROJECT>(_arr);
                for (int i = 0; i < mList.Count; i++)
                {
                    if (!string.IsNullOrEmpty(mList[i].OBJECTTYPENAME))
                    {
                        string identity = Comment.setProjIdentity(mList[i].OBJECTTYPENAME);
                        mList[i].ProjIdentity = identity;
                    }
                }
                if (type == 1)
                {
                    mList = mList.FindAll(a => a.BILLSTATUS == "已结算");
                }
            }
            this.dgObject.ItemsSource = screening(mList);
        }
예제 #19
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;
         }
     }
 }
예제 #20
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);
     }
 }
예제 #21
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            List <TB_EXPENSE> ls   = new List <TB_EXPENSE>();
            TB_PROJECT        proj = this.txtProj.Tag as TB_PROJECT;                    //工程类型
            PTS_TABLE_SRC     src  = this.cmbExpenseType.SelectedItem as PTS_TABLE_SRC; //报销类型
            //查询条件
            int expenxeType  = 0;
            int expenxeType2 = 0;
            int objectID     = 0;

            if (txtProj.Tag != null)
            {
                objectID = (txtProj.Tag as TB_PROJECT).Id;
            }
            string userCode = string.Empty;

            if (txtUser.Tag != null)
            {
                userCode = (txtUser.Tag as TB_User).USER_CODE;
            }
            if (src != null)
            {
                expenxeType2 = src.ID;
            }
            //ls = Comments.Comment.QueryExpense2(userCode, expenxeType, objectls = Comments.Comment.QueryExpense2(userCode, expenxeType, objectID);

            ls = Comments.Comment.QueryExpense(Global.g_usercode, expenxeType, objectID, expenxeType2, int.Parse(cmbYear.Text), int.Parse(cmbMonth.Text));
            this.dgExpense.ItemsSource = null;
            for (int i = 0; i < ls.Count; i++)
            {
                if (ls[i].RESPONSESTATUS == 1)
                {
                    ls[i].StrResponseStatus = "驳回/修改";
                }
                else if (ls[i].RESPONSESTATUS == 2)
                {
                    ls[i].StrResponseStatus = "已更正";
                }
            }
            this.dgExpense.ItemsSource = ls;
        }
예제 #22
0
        private void menuDel_Click(object sender, RoutedEventArgs e)
        {
            //删除工程
            TB_PROJECT  proj = dgObject.SelectedItem as TB_PROJECT;
            UserMessage msg  = new UserMessage();

            msg.Button = System.Windows.Forms.MessageBoxButtons.YesNo;
            msg.Icon   = System.Windows.Forms.MessageBoxIcon.Information;
            msg.Text   = "是否确定删除?";
            msg.Type   = EnmMessageLevel.确认;
            if (proj.BILLSTATUS == "已结算")
            {
                MessageHelper.ShowMessage("项目已结算,不能删除!");
                return;
            }
            if (MessageBox.Show("是否确认删除" + proj.OBJECTNAME + "?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                proj.STATUS = 0;
                proj.Update();
            }
            BindProjectData();
        }
예제 #23
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);
     }
 }
예제 #24
0
        private void Row_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            menuEdit.Visibility  = System.Windows.Visibility.Collapsed;
            menuPass.Visibility  = System.Windows.Visibility.Collapsed;
            menuEdit2.Visibility = System.Windows.Visibility.Collapsed;
            menuPass2.Visibility = System.Windows.Visibility.Collapsed;

            TB_EXPENSE expense = (TB_EXPENSE)dgExpense.SelectedItem;

            if (expense != null)
            {
                //TB_PROJECT proj = this.txtProj.Tag as TB_PROJECT; //工程
                TB_PROJECT proj = TB_PROJECTDAO.FindFirst(new EqExpression("Id", expense.OBJECTID));
                if (proj != null)  //项目报销
                {
                    //总经理
                    if (Global.g_userrole == 8 || Global.g_usercode == proj.CREATEUSER)
                    {
                        menuEdit2.Visibility = System.Windows.Visibility.Visible;
                        menuPass2.Visibility = System.Windows.Visibility.Visible;
                    }
                    else if (Global.g_userrole == 9)
                    {
                        menuEdit.Visibility = System.Windows.Visibility.Visible;
                        menuPass.Visibility = System.Windows.Visibility.Visible;
                    }
                }
                else  //个人报销
                {
                    if (Global.g_userrole == 9)
                    {
                        menuEdit.Visibility = System.Windows.Visibility.Visible;
                        menuPass.Visibility = System.Windows.Visibility.Visible;
                    }
                }
            }
        }
예제 #25
0
 private void dgObject_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     mProj = dgObject.SelectedItem as TB_PROJECT;
     this.Close();
 }
예제 #26
0
        private void bindExpenseData()
        {
            this.labTotal.Content = string.Empty;
            List <TB_EXPENSE> _ls  = new List <TB_EXPENSE>();
            TB_PROJECT        proj = this.txtProj.Tag as TB_PROJECT; //工程类型
            //PTS_TABLE_SRC src = this.cmbType.SelectedItem as PTS_TABLE_SRC;  //报销类型
            //查询条件
            int expenxeType  = 0; //个人或项目
            int expenxeType2 = 0; //报销科目
            int objectID     = 0;

            if (this.rdo2.IsChecked == true)  //项目报销
            {
                expenxeType = 1;
                if (proj != null)
                {
                    objectID = proj.Id;
                }
                else
                {
                    MessageHelper.ShowMessage("请选择需要查询的项目");
                    return;
                }
            }
            _ls = Comments.Comment.QueryExpense(txtUser.Tag, expenxeType, objectID, expenxeType2, int.Parse(cmbYear.Text), int.Parse(cmbMonth.Text));
            this.dgExpense.ItemsSource = null;
            summeryExpenseDteail(_ls);
            #region
            //List<TB_EXPENSE> ls = new List<TB_EXPENSE>();
            //if (proj != null && (proj.CREATEUSER != Global.g_usercode || Global.g_userrole == 8 || Global.g_userrole == 9))
            //    ls = screening(_ls);
            //else
            //    ls = _ls;

            //var sortedList = from items in ls orderby items.GROUPNO, items.Id descending select items;
            //ls = sortedList.ToList(); //这个时候会排序

            //decimal totalmoney = 0;
            //int _groupno = -1;
            //List<string> kmls = new List<string>();  //科目名称
            //for (int i = 0; i < ls.Count; i++)
            //{
            //    string _km = ls[i].EXPENS;
            //    if (!kmls.Contains(_km))
            //        kmls.Add(_km);
            //    //处理成组
            //    if (ls[i].GROUPNO > 0 && _groupno != ls[i].GROUPNO)
            //    {
            //        _groupno = ls[i].GROUPNO;
            //        ls[i].STRGROUPNO = "┓";
            //        ls[i].grouptotal = getGroupTotal(ls, _groupno);
            //    }
            //    else if (_groupno == ls[i].GROUPNO)
            //    {
            //        ls[i].STRGROUPNO = "┃";
            //        if (i + 1 < ls.Count && _groupno != ls[i + 1].GROUPNO)
            //        {
            //            ls[i].STRGROUPNO = "┛";
            //        }
            //        if (i + 1 == ls.Count)
            //        {
            //            ls[i].STRGROUPNO = "┛";
            //        }
            //    }
            //    if (ls[i].GROUPNO==0)
            //        ls[i].STRGROUPNO = "";

            //    totalmoney += ls[i].MONEY;
            //    if (ls[i].RESPONSESTATUS == 1)
            //        ls[i].StrResponseStatus = "驳回";
            //    else if (ls[i].RESPONSESTATUS == 0)
            //        ls[i].StrResponseStatus = "待审";
            //    else if (ls[i].RESPONSESTATUS == 2)
            //        ls[i].StrResponseStatus = "已审";

            //    if (_ls[i].LEADERRESPONSESTATUS == 1)
            //        _ls[i].StrLeaderResponseStatus = "驳回";
            //    else if (_ls[i].LEADERRESPONSESTATUS == 0)
            //        _ls[i].StrLeaderResponseStatus = "待审";
            //    else if (_ls[i].LEADERRESPONSESTATUS == 2)
            //        _ls[i].StrLeaderResponseStatus = "已审";
            //}
            //this.dgExpense.ItemsSource = ls;
            //if (ls != null)
            //{
            //    dgExpense.SelectedIndex = 0;
            //}
            //string foot = "";
            //for (int i = 0; i < kmls.Count; i++)
            //{
            //    string _km = kmls[i];
            //    List<TB_EXPENSE> _expls = ls.FindAll(a=>a.EXPENS==_km);
            //    if (_expls.Count > 0)
            //    {
            //        int counts = _expls.Count;
            //        decimal kmtotal = 0;
            //        for (int j = 0; j < _expls.Count; j++)
            //        {
            //            kmtotal += _expls[j].MONEY;
            //        }
            //        foot += "  " + _km + ": 共" + counts.ToString() + "张 合计金额" + kmtotal.ToString() + "元;";
            //    }
            //}
            //this.labFoot.Content = foot;

            //this.labTotal.Content = "共:" + ls.Count + "张   合计:" + totalmoney.ToString() + "元";
            #endregion
        }
예제 #27
0
        private void dgSummery_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (dgSummery.SelectedItem != null)
            {
                TB_EXPENSE_SUMMERY item = dgSummery.SelectedItem as TB_EXPENSE_SUMMERY;
                foreach (KeyValuePair <TB_EXPENSE_SUMMERY, List <TB_EXPENSE> > kvp in dic)
                {
                    if (kvp.Key as TB_EXPENSE_SUMMERY == item)
                    {
                        TB_PROJECT        proj = this.txtProj.Tag as TB_PROJECT; //工程类型
                        List <TB_EXPENSE> ls   = new List <TB_EXPENSE>();
                        if (proj != null && (proj.CREATEUSER != Global.g_usercode || Global.g_userrole == 8 || Global.g_userrole == 9))
                        {
                            ls = screening(kvp.Value as List <TB_EXPENSE>);
                        }
                        else
                        {
                            ls = kvp.Value as List <TB_EXPENSE>;
                        }

                        var sortedList = from items in ls orderby items.GROUPNO, items.Id descending select items;
                        ls = sortedList.ToList(); //这个时候会排序

                        decimal       totalmoney = 0;
                        int           _groupno   = -1;
                        List <string> kmls       = new List <string>(); //科目名称
                        for (int i = 0; i < ls.Count; i++)
                        {
                            string _km = ls[i].EXPENS;
                            if (!kmls.Contains(_km))
                            {
                                kmls.Add(_km);
                            }
                            //处理成组
                            if (ls[i].GROUPNO > 0 && _groupno != ls[i].GROUPNO)
                            {
                                _groupno         = ls[i].GROUPNO;
                                ls[i].STRGROUPNO = "┓";
                                ls[i].grouptotal = getGroupTotal(ls, _groupno);
                            }
                            else if (_groupno == ls[i].GROUPNO)
                            {
                                ls[i].STRGROUPNO = "┃";
                                if (i + 1 < ls.Count && _groupno != ls[i + 1].GROUPNO)
                                {
                                    ls[i].STRGROUPNO = "┛";
                                }
                                if (i + 1 == ls.Count)
                                {
                                    ls[i].STRGROUPNO = "┛";
                                }
                            }
                            if (ls[i].GROUPNO == 0)
                            {
                                ls[i].STRGROUPNO = "";
                            }

                            totalmoney += ls[i].MONEY;
                            if (ls[i].RESPONSESTATUS == 1)
                            {
                                ls[i].StrResponseStatus = "驳回";
                            }
                            else if (ls[i].RESPONSESTATUS == 0)
                            {
                                ls[i].StrResponseStatus = "待审";
                            }
                            else if (ls[i].RESPONSESTATUS == 2)
                            {
                                ls[i].StrResponseStatus = "已审";
                            }

                            if (ls[i].LEADERRESPONSESTATUS == 1)
                            {
                                ls[i].StrLeaderResponseStatus = "驳回";
                            }
                            else if (ls[i].LEADERRESPONSESTATUS == 0)
                            {
                                ls[i].StrLeaderResponseStatus = "待审";
                            }
                            else if (ls[i].LEADERRESPONSESTATUS == 2)
                            {
                                ls[i].StrLeaderResponseStatus = "已审";
                            }
                        }
                        this.dgExpense.ItemsSource = ls;
                        if (ls != null)
                        {
                            dgExpense.SelectedIndex = 0;
                        }
                        string foot = "";
                        for (int i = 0; i < kmls.Count; i++)
                        {
                            string            _km    = kmls[i];
                            List <TB_EXPENSE> _expls = ls.FindAll(a => a.EXPENS == _km);
                            if (_expls.Count > 0)
                            {
                                int     counts  = _expls.Count;
                                decimal kmtotal = 0;
                                for (int j = 0; j < _expls.Count; j++)
                                {
                                    kmtotal += _expls[j].MONEY;
                                }
                                foot += "  " + _km + ": 共" + counts.ToString() + "张 合计金额" + kmtotal.ToString() + "元;";
                            }
                        }
                        this.labFoot.Content  = foot;
                        this.labTotal.Content = "共:" + ls.Count + "张   合计:" + totalmoney.ToString() + "元";
                    }
                }
            }
        }
예제 #28
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                decimal zhekou = -1;
                decimal.TryParse(txtZHKOU.Text, out zhekou);
                this.txtZHKOU.Text = zhekou.ToString();

                //固定/可分配提成比例
                decimal             ratio1 = 60;
                decimal             ratio2 = 40;
                PTS_OBJECT_TYPE_SRC src    = PTS_OBJECT_TYPE_SRCDAO.FindFirst(new EqExpression("STATUS", 1));
                if (src != null)
                {
                    ratio1 = src.RATIO1;
                    ratio2 = src.RATIO2;
                }
                if (mProj == null)  //新增工程信息
                {
                    // 检查OBJECTNAME(工程名称)是否重复?
                    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();
                    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)
                    //{
                    //    if (arr.Length == 1 && arr[0].EXPENS == "管理费")
                    //    { }
                    //    else
                    //    {
                    //        MessageHelper.ShowMessage("该项目已有报销信息,不能再更新项目信息!");
                    //        return;
                    //    }
                    //}
                    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 (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);
            }
        }
예제 #29
0
 /// <summary>
 /// 财务更新工程按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubmit2_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         TB_PROJECT tempProj = TB_PROJECTDAO.FindFirst(new EqExpression("OBJECTNAME", txtOBJECTNAME.Text), new EqExpression("STATUS", 1));
         //更新发票信息
         #region 发票信息处理
         //先把工程对应的所有发票全部作废,再重新新增
         BaseBusiness   bb  = new BaseBusiness();
         bool           rtn = bb.DelALLItem("TB_BILL", "PROJECTID=" + tempProj.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  = tempProj.Id;
                     bill.MONEY      = ls[i].MONEY;
                     bill.STATUS     = 1;
                     bill.Save();
                 }
             }
             else
             {
                 MessageHelper.ShowMessage("保存发票信息发生错误!");
                 return;
             }
         }
         #endregion
         //更新结算信息
         if (this.chkBillStatus.IsChecked == true)
         {
             if (MessageBox.Show("是否确定该项目执行结算?\n如果确定结算,该项目不能再做任何操作!", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
             {
                 tempProj.BILLSTATUS = "已结算";
                 tempProj.BILLDATE   = TableManager.DBServerTime();
                 tempProj.Update();
                 //根据合同价计算项目管理费用
                 decimal    cost    = RatioBusiness.QueryProjCost(tempProj.MONEY); //项目成本金额
                 TB_EXPENSE expense = new TB_EXPENSE();
                 expense.MONEY          = cost;
                 expense.EXPENS         = "项目管理成本";
                 expense.OBJECTID       = tempProj.Id;
                 expense.OBJECTNAME     = tempProj.OBJECTNAME;
                 expense.EXPENSTYPE     = 99;
                 expense.OPUID          = 99;
                 expense.OPNAME         = "乾唐通信";
                 expense.RESPONSESTATUS = 2;
                 expense.CREATEDATE     = TableManager.DBServerTime();
                 expense.Save();
                 //保存组员提成金额
             }
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
예제 #30
0
 public frmBILL(TB_PROJECT proj)
 {
     InitializeComponent();
     mProj = proj;
 }