Exemplo n.º 1
0
 private void setUpdateField()
 {
     try
     {
         PropertyInfo[] props = this.GetType().GetProperties();
         foreach (PropertyInfo p in props)
         {
             if ("updatetime".Equals(p.Name.ToLower()))
             {
                 p.SetValue(this, TableManager.DBServerTime(), null);
             }
             else if ("updateuserid".Equals(p.Name.ToLower()))
             {
                 p.SetValue(this, Global.g_userid, null);
             }
             else if ("updateuser".Equals(p.Name.ToLower()))
             {
                 p.SetValue(this, Global.g_username, null);
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
 }
Exemplo n.º 2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            DateTime time = TableManager.DBServerTime();

            this.cmbYear.Text  = time.Year.ToString();
            this.cmbMonth.Text = time.Month.ToString();
        }
Exemplo n.º 3
0
        public static void delCableAllinfo(int cableId)
        {
            using (DbHelper db = new DbHelper())
            {
                try
                {
                    db.TrnStart();
                    string        sql    = "Update cable set Isdeleted=@del where id =@id";
                    DbParameter[] parmar = { db.CreateParameter("@del", (int)EnmIsdeleted.已删除), db.CreateParameter("@id", cableId) };
                    db.ExecuteNonQuery(sql, parmar);  //电路代码
                    DateTime endtime = TableManager.DBServerTime().Date;
                    sql = "Update commission set endTime=@endTime,Isdeleted=@del where cableid=@id";

                    DbParameter[] parmar2 = { db.CreateParameter("@del",     (int)EnmIsdeleted.已删除), db.CreateParameter("@id", cableId),
                                              db.CreateParameter("@endTime", endtime) };
                    db.ExecuteNonQuery(sql, parmar2);  //提成比率
                    db.TrnCommit();
                    MessageHelper.ShowMessage("I002");
                }
                catch (Exception ex)
                {
                    db.TrnRollBack();
                    Log.Error(ex.Message);
                    MessageHelper.ShowMessage("E999", "电路代码删除失败。");
                }
            }
        }
Exemplo n.º 4
0
        public ucNewExpense(TB_EXPENSE exp)
            : this()
        {
            mExp = exp;
            this.rdoPersinal.IsChecked = true;
            rdoPersinal.Checked       += rdoPersinal_Checked;
            rdoObject.Checked         += rdoObject_Checked;
            mList  = new List <PTS_TABLE_SRC>();
            mEList = new List <TB_EXPENSE>();
            DateTime sysDate = TableManager.DBServerTime();

            MONTH = sysDate.Month;
            YEAR  = sysDate.Year;
            BindStaticData();   //绑定静态数据
            BindExpenseData2(); //绑定报销数据
            this.rdoPersinal.Focus();
        }
Exemplo n.º 5
0
        public ucNewExpense()
        {
            InitializeComponent();
            this.rdoPersinal.IsChecked = true;
            rdoPersinal.Checked       += rdoPersinal_Checked;
            rdoObject.Checked         += rdoObject_Checked;
            mList  = new List <PTS_TABLE_SRC>();
            mEList = new List <TB_EXPENSE>();
            DateTime sysDate = TableManager.DBServerTime();

            MONTH = sysDate.Month;
            YEAR  = sysDate.Year;
            BindStaticData();
            BindExpenseData();
            this.rdoPersinal.Focus();
            //if (Global.g_userrole == 8)
            //    this.chkQTCT.IsEnabled = true;
        }
Exemplo n.º 6
0
 public static bool delAllSaler(int cableId)
 {
     try
     {
         DateTime end = TableManager.DBServerTime().Date;
         using (DbHelper db = new DbHelper())
         {
             string        sql       = "Update commission set Isdeleted = @isDeleted,EndTime=@endtime where EndTime is not null and cableid=@cableid";
             DbParameter[] paramlist = { db.CreateParameter("@isDeleted", (int)EnmIsdeleted.已删除), db.CreateParameter("@endtime", end),
                                         db.CreateParameter("cableid",    cableId) };
             db.ExecuteNonQuery(sql, paramlist);
             return(true);
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message);
         MessageHelper.ShowMessage("E999", "更新提成比率发生错误!");
         return(false);
     }
 }
Exemplo n.º 7
0
        public static int isHavebusinessAlert()
        {
            try
            {
                using (DbHelper db = new DbHelper())
                {
                    DateTime serverTime = TableManager.DBServerTime().Date;
                    string   sql        = "select COUNT(1) "
                                          + " from cable as c left join tb_user u on c.userid=u.id and c.userRemindTime<='" + serverTime + "' "
                                          + " left join customer as cu on c.customerid=cu.id where c.isDeleted =@del and u.isdeleted=@del and cu.isdeleted=@del "
                                          + "And Controluserid=@Controluserid";

                    DbParameter[] paramlist = { db.CreateParameter("@del", (int)EnmIsdeleted.使用中), db.CreateParameter("Controluserid", Global.g_userid) };

                    return(Utils.NvInt(db.GetDataSet(sql, paramlist).Tables[0].Rows[0][0].ToString()));
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowMessage("E999", "获取电路到期提醒信息失败。");
                return(-1);
            }
        }
Exemplo n.º 8
0
        public static DataTable managerAlert()
        {
            try
            {
                using (DbHelper db = new DbHelper())
                {
                    DateTime serverTime = TableManager.DBServerTime().Date;
                    string   sql        = "select c.id as 电路id,cablenumber as 电路代码,completeTime as 完工日期,(case paytype when " + (int)EnmPayType.一次性付 + " then '一次性付' when " + (int)EnmPayType.季付 + " then '季付' when " + (int)EnmPayType.半年付 + " then '半年付' "
                                          + " when " + (int)EnmPayType.月付 + " then '月付' end) as 付款类型,cu.customerName as 客户名称,u.name as 销售渠道,limitTime as 合同截止日 "
                                          + " from cable as c left join tb_user u on c.userid=u.id and c.ManagerRemindTime<'" + serverTime + "' "
                                          + " left join customer as cu on c.customerid=cu.id where c.isDeleted =" + (int)EnmIsdeleted.使用中 + " and u.isdeleted=" + (int)EnmIsdeleted.使用中 + " and cu.isdeleted=" + (int)EnmIsdeleted.使用中 + "";

                    DbParameter[] paramlist = { };
                    DataTable     tb        = db.GetDataSet(sql, paramlist).Tables[0]; //销售渠道数据
                    return(tb);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                MessageHelper.ShowMessage("E999", "总监提醒功能发生错误!");
                return(new DataTable());
            }
        }
Exemplo n.º 9
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);
     }
 }
Exemplo n.º 10
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (this.rdoObject.IsChecked == false && this.rdoPersinal.IsChecked == false)
     {
         MessageHelper.ShowMessage("请选择项目报销或个人报销");
         if (this.rdoObject.IsChecked == true && this.txtProj.Tag == null)
         {
             MessageHelper.ShowMessage("请选择报销所对应的工程项目");
         }
     }
     else
     {
         try
         {
             int ISMEMBER       = 0;
             int RESPONSESTATUS = 0;  //默认审核通过
             //int ISCOMPLETE = 0; //默认提交状态
             PTS_TABLE_SRC src         = this.cmbExprenseItem.SelectedItem as PTS_TABLE_SRC;
             DateTime      sysDate     = TableManager.DBServerTime();
             DateTime      expenseDate = this.dtpDate.DateTime;
             if (expenseDate < sysDate.AddMonths(-6))
             {
                 MessageHelper.ShowMessage("发票日期不能超过半年!");
                 return;
             }
             if (string.IsNullOrEmpty(txtFPHM.Text))
             {
                 MessageHelper.ShowMessage("请填写发票号码!");
                 return;
             }
             if (src.ID == 0)
             {
                 MessageHelper.ShowMessage("请选择报销类型!");
                 return;
             }
             else
             {
                 if (this.rdoObject.IsChecked == true)
                 {
                     if (chkQTCT.IsChecked == true && String.IsNullOrEmpty(txtCusName.Text))
                     {
                         MessageHelper.ShowMessage("公司账户填报必须填写客户名称!");
                         txtCusName.Focus();
                         return;
                     }
                     //判断报销填报人员是否是项目内的成员
                     if (this.chkQTCT.IsChecked == false && Global.g_usercode != (txtProj.Tag as TB_PROJECT).TEAMLEDER && ((txtProj.Tag as TB_PROJECT).TEAMMEMBER).IndexOf(Global.g_usercode) < 0)
                     {
                         if (MessageBox.Show("您不属于" + txtProj.Text + "项目的成员,是否需要保存报销信息?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                         {
                             return;
                         }
                         else
                         {
                             ISMEMBER       = 1;
                             RESPONSESTATUS = 0;
                         }
                     }
                 }
                 else
                 {
                     RESPONSESTATUS = 0;
                 }
                 decimal money = -1;
                 if (!String.IsNullOrEmpty(txtMoney.Text))
                 {
                     decimal.TryParse(txtMoney.Text, out money);
                 }
                 if (money <= 0)
                 {
                     MessageHelper.ShowMessage("报销填报金额格式错误!");
                     return;
                 }
                 if (mExp == null)
                 {
                     DateTime date = DateTime.Parse(new BaseBusiness().date());
                     {
                         int day = date.Day;
                         if (day > 26)
                         {
                             MessageHelper.ShowMessage("每月报销25日截止!");
                             return;
                         }
                     }
                     TB_EXPENSE expense = new TB_EXPENSE();
                     expense.OBJECTID = 0;
                     if (txtProj.Tag != null)
                     {
                         expense.OBJECTID   = (txtProj.Tag as TB_PROJECT).Id;
                         expense.OBJECTNAME = txtProj.Text;
                     }
                     expense.OPUID          = Global.g_userid;
                     expense.OPNAME         = Global.g_usercode; //工号
                     expense.EXPENS         = src.TABLE_NAME;    //报销类型名称
                     expense.EXPENSTYPE     = src.ID;            //报销类型ID
                     expense.MONEY          = money;
                     expense.ISMEMBER       = ISMEMBER;
                     expense.CREATEDATE     = this.dtpDate.DateTime; //当前系统时间
                     expense.BILLNO         = txtFPHM.Text;
                     expense.COMMENTS       = txtComments.Text;
                     expense.RESPONSESTATUS = RESPONSESTATUS;
                     expense.ISCOMPLETE     = 0; //提交状态 默认未提交
                     expense.STATUS         = 1;
                     BaseBusiness bs      = new BaseBusiness();
                     string       strTime = bs.date();
                     DateTime     time    = DateTime.Parse(strTime);
                     expense.YEAR  = time.Year;
                     expense.MONTH = time.Month;
                     expense.LEADERRESPONSESTATUS = RESPONSESTATUS;
                     if (chkQTCT.IsChecked == true && !String.IsNullOrEmpty(txtCusName.Text))
                     {
                         expense.OPNAME               = txtCusName.Text;
                         expense.ISQTCT               = 1;
                         expense.RESPONSESTATUS       = 0;
                         expense.LEADERRESPONSESTATUS = 0;
                     }
                     expense.Save(); //新增报销
                 }
                 else //update
                 {
                     mExp.OBJECTID = 0;
                     if (txtProj.Tag != null)
                     {
                         mExp.OBJECTID   = (txtProj.Tag as TB_PROJECT).Id;
                         mExp.OBJECTNAME = txtProj.Text;
                     }
                     mExp.OPUID      = Global.g_userid;
                     mExp.OPNAME     = Global.g_usercode; //工号
                     mExp.EXPENS     = src.TABLE_NAME;    //报销类型名称
                     mExp.EXPENSTYPE = src.ID;            //报销类型ID
                     mExp.MONEY      = money;
                     mExp.ISMEMBER   = ISMEMBER;
                     mExp.CREATEDATE = this.dtpDate.DateTime;  //当前系统时间
                     mExp.BILLNO     = txtFPHM.Text;
                     mExp.COMMENTS   = txtComments.Text;
                     mExp.STATUS     = 1;
                     if (mExp.RESPONSESTATUS == 1)
                     {
                         mExp.RESPONSESTATUS = 0;  //待审
                     }
                     if (mExp.LEADERRESPONSESTATUS == 1)
                     {
                         mExp.LEADERRESPONSESTATUS = 0;  //待审
                     }
                     if (chkQTCT.IsChecked == true && !String.IsNullOrEmpty(txtCusName.Text))
                     {
                         mExp.OPNAME               = txtCusName.Text;
                         mExp.ISQTCT               = 1;
                         mExp.RESPONSESTATUS       = 2;
                         mExp.LEADERRESPONSESTATUS = 2;
                     }
                     mExp.Update();
                     this.btnSubmit.Content = "新  增";
                     mExp = null;
                 }
                 refreshForm();
             }
         }
         catch (Exception ex)
         {
             MessageHelper.ShowMessage(ex.Message);
         }
     }
     BindExpenseData();
 }
Exemplo n.º 11
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);
            }
        }