Пример #1
0
 /// <summary> 缓存员工登陆信息
 /// </summary>
 /// <param name="personnelInfo">员工对象</param>
 public static void Set(PersonnelInfo personnelInfo)
 {
     if (personnelInfo != null)
     {
         HttpContext.Current.Session[Key] = personnelInfo;
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="personnelInfo"></param>
        /// <param name="flag">true:有手续费;false:无手续费;</param>
        /// <returns></returns>
        public CostReckoningInfo AddCostReckoningInfo(CostReportInfo model, PersonnelInfo personnelInfo, bool flag)
        {
            var description = String.Format("[费用申报单据号:{0}][费用申报完成打款][{1}]", model.ReportNo, model.ReportName);

            if (flag && model.Poundage > 0)
            {
                description += "[手续费:" + model.Poundage + "]";
            }
            description = char.ConvertFromUtf32(10) + description + " [" + personnelInfo.RealName + ": " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]";
            var costReckoningInfo = new CostReckoningInfo
            {
                ReckoningId       = Guid.NewGuid(),
                FilialeId         = model.ReportFilialeId,
                AssumeFilialeId   = model.AssumeFilialeId,
                CompanyId         = model.CompanyId,
                TradeCode         = _codeManager.GetCode(CodeType.PY),
                DateCreated       = DateTime.Now,
                Description       = description,
                AccountReceivable = model.RealityCost,
                NonceTotalled     = _costReckoningDao.GetTotalled(model.CompanyId),
                ReckoningType     = model.RealityCost > 0 ? (int)ReckoningType.Income : (int)ReckoningType.Defray,
                ReckoningState    = (int)ReckoningStateType.Currently,
                IsChecked         = 0,
                AuditingState     = (int)AuditingState.Yes
            };

            costReckoningInfo.NonceTotalled += costReckoningInfo.AccountReceivable;
            return(costReckoningInfo);
        }
Пример #3
0
        protected void RadGridWasteBook_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            IList <WasteBookInfo> wasteBookList = new List <WasteBookInfo>();
            long recordCount = 0;

            if (IsPostBack)
            {
                PersonnelInfo info      = CurrentSession.Personnel.Get();
                var           startPage = RadGridWasteBook.CurrentPageIndex + 1;
                int           pageSize  = RadGridWasteBook.PageSize;
                if (FilialeId != Guid.Empty)
                {
                    wasteBookList = _wasteBookDao.GetWasteBookListBySaleFilialeIdToPage(FilialeId, StartDate, EndDate, CurrentReceiptType, CurrentAuditingState, MinIncome, MaxIncome, TradeCode, info.FilialeId, info.BranchId, info.PositionId, GlobalConfig.KeepYear, IsCheck, startPage, pageSize, out recordCount).ToList();
                    if (BankAccountsId != Guid.Empty && wasteBookList.Count == 0)
                    {
                        wasteBookList = wasteBookList.Where(act => act.BankAccountsId == BankAccountsId).ToList();
                    }
                }
                else
                {
                    if (BankAccountsId != Guid.Empty)
                    {
                        wasteBookList = _wasteBookDao.GetWasteBookListToPage(BankAccountsId, StartDate, EndDate, CurrentReceiptType,
                                                                             CurrentAuditingState, MinIncome, MaxIncome, TradeCode,
                                                                             info.FilialeId, info.BranchId, info.PositionId,
                                                                             GlobalConfig.KeepYear, IsCheck,
                                                                             startPage, pageSize, out recordCount).ToList();
                    }
                }
            }

            RadGridWasteBook.DataSource       = wasteBookList;
            RadGridWasteBook.VirtualItemCount = (int)recordCount;
        }
Пример #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (CheckForm())
            {
                PersonnelInfo entity = new PersonnelInfo();
                entity.no                    = this.txtNo.Text.Trim();
                entity.name                  = this.txtName.Text.Trim();
                entity.id                    = this.iHumanID;
                entity.sex                   = this.radMan.Checked ? "男" : "女";
                entity.judgeMarry            = this.rad己婚.Checked ? "己婚" : "未婚";
                entity.politicalVisage       = this.txt政治.Text.Trim();
                entity.birthday              = this.dBirthday.Value;
                entity.tiptopDegree          = this.txt学位.Text.Trim();
                entity.specialty             = this.txt专业.Text.Trim();
                entity.competencyCertificate = this.txt资格证书.Text.Trim();
                entity.IDCard                = this.txt身份证.Text.Trim();
                entity.contactMethod         = this.txt联系方式.Text.Trim();
                entity.nationality           = this.txt民族.Text.Trim();
                entity.contractNo            = this.txt合同编号.Text.Trim();
                entity.address               = this.txt家庭住址.Text.Trim();
                entity.function              = this.txt职称.Text.Trim();
                entity.functionAssessDate    = this.d职称评定时间.Value;
                entity.nativePlace           = this.txt籍贯.Text.Trim();
                if (this.cbo部门.Text.Trim() != "")
                {
                    entity.dId = long.Parse(this.cbo部门.SelectedValue.ToString());
                }
                entity.startWorkDate      = this.d参加工作时间.Value;
                entity.salaryMethod       = this.rad月薪.Checked == false ? "日薪" : "月薪";
                entity.resume             = this.txt简历.Text;
                entity.hortationCastigate = this.txt奖惩.Text.Trim();
                entity.dimissionDate      = this.d离职时间.Value;
                entity.dimissionReason    = this.txt离职原因.Text.Trim();
                entity.workDate           = this.d入职时间.Value;
                entity.remark             = this.txt备注.Text;

                entity.inputMan  = this.UserName;
                entity.inputDate = DateTime.Now;
                entity.kind      = this.radEmployee.Checked ? true : false;
                if (this.cbo生产班组.Text.Trim() != "")
                {
                    entity.ptId = long.Parse(this.cbo生产班组.SelectedValue.ToString());
                }
                entity.mark        = this.rad纳税.Checked ? true : false;
                entity.basicSalary = decimal.Parse(this.txt基本工资.Text.Trim());
                if (this.cbo职位.Text.Trim() != "")
                {
                    entity.pId = long.Parse(this.cbo职位.SelectedValue.ToString());
                }

                new EmployeeLogic().Update(entity);
                //CommUI.MsgOK();
                this.Close();
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }
        }
Пример #5
0
        //费用申报(lmshop_CostReport)
        protected void EditCostReportModel(CostReportInfo model, PersonnelInfo personnelInfo)
        {
            model.ReportNo       = new CodeManager().GetCode(CodeType.RE);
            model.ReportKind     = (int)CostReportKind.FeeIncome;
            model.AssumeBranchId = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId  = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId   = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.CostsVarieties = string.IsNullOrEmpty(Hid_CostsClass.Value) ? -1 : int.Parse(Hid_CostsClass.Value);
            model.GoodsCode      = string.Empty;
            model.CompanyClassId = string.IsNullOrEmpty(ddl_CompanyClass.SelectedValue) ? Guid.Empty : new Guid(ddl_CompanyClass.SelectedValue);
            model.CompanyId      = string.IsNullOrEmpty(ddl_FeeType.SelectedValue) ? Guid.Empty : new Guid(ddl_FeeType.SelectedValue);
            model.UrgentOrDefer  = int.Parse(rbl_UrgentOrDefer.SelectedValue);
            model.UrgentReason   = model.UrgentOrDefer.Equals(1) ? txt_UrgentReason.Text : string.Empty;
            model.ReportName     = txt_ReportName.Text;
            model.StartTime      = DateTime.Parse(txt_StartTime.Text);
            model.EndTime        = DateTime.Parse(txt_EndTime.Text);
            model.PayCompany     = txt_PayCompany.Text;
            model.ReportCost     = Math.Abs(Decimal.Parse(txt_ReportCost.Text));
            model.RealityCost    = model.ReportCost;
            model.ApplyForCost   = model.ReportCost;
            model.ActualAmount   = model.ReportCost;
            model.CostType       = int.Parse(rbl_CostType.SelectedValue);
            model.Deposit        = 2;
            if (model.CostType.Equals(2))
            {
                model.BankAccountName = txt_BankName.Text.Trim() + "," + txt_SubBankName.Text.Trim();
            }
            model.InvoiceType      = (int)CostReportInvoiceType.WaitCheck;
            model.PayBankAccountId = string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue) ? Guid.Empty : new Guid(rcb_PayBankAccount.SelectedValue); //结算账号
            model.AssumeFilialeId  = string.IsNullOrEmpty(Hid_AssumeFiliale.Value) ? Guid.Empty : new Guid(Hid_AssumeFiliale.Value);                   //结算公司
            model.ReportMemo       = txt_ReportMemo.Text;

            model.ReportFilialeId   = personnelInfo.FilialeId;
            model.ReportBranchId    = personnelInfo.BranchId;
            model.ReportPersonnelId = personnelInfo.PersonnelId;
            model.State             = (int)CostReportState.Auditing;
            if (string.IsNullOrEmpty(Request.QueryString["ReportId"]))
            {
                model.ReportDate = DateTime.Now;
            }
            model.Memo        = WebControl.RetrunUserAndTime("[【费用收入】:" + txt_ReportMemo.Text + ";]");
            model.IsLastTime  = true;
            model.IsSystem    = false;
            model.ApplyNumber = 1;
            model.IsEnd       = false;

            if (!string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue))
            {
                var bankAccountInfo = _bankAccounts.GetBankAccounts(new Guid(rcb_PayBankAccount.SelectedValue));
                if (bankAccountInfo != null && bankAccountInfo.IsMain)
                {
                    model.IsOut = true;
                }
                else
                {
                    model.IsOut = false;
                }
            }
        }
Пример #6
0
 /// <summary>
 /// 行验证之后,更新行记录.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dtgList_RowValidated(object sender, DataGridViewCellEventArgs e)
 {
     if ((sender as DataGridView).ContainsFocus)
     {
         PersonnelInfo entity = this.dtgList.Rows[e.RowIndex].DataBoundItem as PersonnelInfo;
         new EmployeeLogic().Update(entity);
     }
 }
Пример #7
0
 /// <summary>
 /// 添加新员工
 /// </summary>
 /// <param name="entity"></param>
 public void Insert(PersonnelInfo entity)
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         oContext.PersonnelInfo.InsertOnSubmit(entity);
         oContext.SubmitChanges();
     }
 }
Пример #8
0
        /// <summary>
        /// 返回资金流Model
        /// </summary>
        /// <param name="model"></param>
        /// <param name="personnelInfo"></param>
        /// <param name="flag">true:有手续费;false:无手续费;</param>
        /// <returns></returns>
        public WasteBookInfo AddWasteBookInfo(CostReportInfo model, PersonnelInfo personnelInfo, bool flag)
        {
            decimal income;

            if (flag && model.Poundage > 0)
            {
                income = model.Poundage;
            }
            else
            {
                income = model.RealityCost;
            }
            string auditingMan        = _personnelManager.GetName(personnelInfo.PersonnelId);
            string reportMan          = _personnelManager.GetName(model.ReportPersonnelId);
            var    dateTime           = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            var    wasteBookTradeCode = _codeManager.GetCode(CodeType.RD);
            int    wasteBookType;
            string strMan, strDes;

            if (income > 0)
            {
                wasteBookType = (int)WasteBookType.Decrease;
                strMan        = "收款";
                strDes        = "减少";
            }
            else
            {
                wasteBookType = (int)WasteBookType.Increase;
                strMan        = "付款";
                strDes        = "增加";
            }

            bool isDeposit = (model.ReportKind == (int)CostReportKind.FeeIncome && !string.IsNullOrEmpty(model.DepositNo));

            var wasteBookDescription = string.Format("[费用申报(申报编号:{0};费用名称:{1};申报人:{2};" + strMan + "单位:{3};完成打款人:{4};手续费:{5};交易流水号:{6};资金" + strDes + ",{7}" + (isDeposit ? "【押金回收】" : "") + ")]", model.ReportNo, model.ReportName, reportMan, model.PayCompany, auditingMan, model.Poundage.ToString("#0.00"), model.TradeNo, dateTime);

            var bankInfo      = _bankAccountsDao.GetBankAccounts(model.PayBankAccountId);
            var wasteBookInfo = new WasteBookInfo(
                Guid.NewGuid(),
                model.PayBankAccountId,
                wasteBookTradeCode,
                wasteBookDescription,
                -income,                         //金额
                (Int32)AuditingState.Yes,
                wasteBookType,
                model.AssumeFilialeId)
            {
                LinkTradeCode = model.ReportNo,
                LinkTradeType = (int)WasteBookLinkTradeType.CostReport,
                BankTradeCode = string.Empty,
                State         = (int)WasteBookState.Currently,
                IsOut         = bankInfo.IsMain
            };

            return(wasteBookInfo);
        }
Пример #9
0
        /// <summary>获取责任人名称
        /// </summary>
        /// <param name="personId"></param>
        /// <returns></returns>
        protected string GetPersonName(Guid personId)
        {
            string        personName = "-";
            PersonnelInfo info       = PersonnelList.FirstOrDefault(w => w.PersonnelId == personId);

            if (info != null)
            {
                personName = info.RealName;
            }
            return(personName);
        }
Пример #10
0
        public PersonnelInfo GetInfoPersonnel(int id)
        {
            string    query = "USP_GetInfoPersonnel @id";
            DataTable data  = DataProvider.Instance.ExcuteQuery(query, new object[] { id });

            foreach (DataRow item in data.Rows)
            {
                PersonnelInfo per = new PersonnelInfo(item);
                return(per);
            }
            return(null);
        }
Пример #11
0
        public List <PersonnelInfo> GetListStaff()
        {
            List <PersonnelInfo> list = new List <PersonnelInfo>();

            DataTable data = DataProvider.Instance.ExcuteQuery("USP_GetListStaff");

            foreach (DataRow item in  data.Rows)
            {
                PersonnelInfo pi = new PersonnelInfo(item);
                list.Add(pi);
            }
            return(list);
        }
Пример #12
0
 /// <summary>
 /// 增加员工
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public string Add(PersonnelInfo entity)
 {
     if (oData.IsExistByNo(entity.no))
     {
         return("职工编号己经存在!");
     }
     if (oData.IsExistByName(entity.name))
     {
         return("职工名称己经存在!");
     }
     oData.Insert(entity);
     return(null);
 }
Пример #13
0
        /// <summary>
        /// 更新员工
        /// </summary>
        /// <param name="entity"></param>
        public void Update(PersonnelInfo entity)
        {
            using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
            {
                PersonnelInfo ori = (from p in oContext.PersonnelInfo
                                     where p.id == entity.id
                                     select p).First();
                ori.no                    = entity.no;
                ori.name                  = entity.name;
                ori.address               = entity.address;
                ori.basicSalary           = entity.basicSalary;
                ori.birthday              = entity.birthday;
                ori.competencyCertificate = entity.competencyCertificate;
                ori.contactMethod         = entity.contactMethod;
                ori.contractNo            = entity.contractNo;
                ori.dId                   = entity.dId;
                ori.dimissionDate         = entity.dimissionDate;
                ori.dimissionReason       = entity.dimissionReason;
                ori.function              = entity.function;
                ori.functionAssessDate    = entity.functionAssessDate;
                ori.hortationCastigate    = entity.hortationCastigate;
                ori.IDCard                = entity.IDCard;
                ori.judgeMarry            = entity.judgeMarry;
                ori.kind                  = entity.kind;
                ori.mark                  = entity.mark;
                ori.nationality           = entity.nationality;
                ori.nativePlace           = entity.nativePlace;
                ori.pId                   = entity.pId;
                ori.politicalVisage       = entity.politicalVisage;
                ori.ptId                  = entity.ptId;
                ori.remark                = entity.remark;
                ori.resume                = entity.resume;
                ori.salaryMethod          = entity.salaryMethod;
                ori.sex                   = entity.sex;
                ori.specialty             = entity.specialty;
                ori.startWorkDate         = entity.startWorkDate;
                ori.tiptopDegree          = entity.tiptopDegree;
                ori.workDate              = entity.workDate;

                try
                {
                    oContext.SubmitChanges();
                }
                catch (System.Data.Linq.ChangeConflictException)
                {
                    throw;
                }
            }
        }
Пример #14
0
        public List <PersonnelInfo> GetListFiredStaff()
        {
            List <PersonnelInfo> list = new List <PersonnelInfo>();

            string query = "USP_GetListStaffFired";

            DataTable data = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                PersonnelInfo per = new PersonnelInfo(item);
                list.Add(per);
            }
            return(list);
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowCopyright();

            PersonnelInfo personnelInfo = CurrentSession.Personnel.Get();

            if (personnelInfo == null)
            {
                Response.Redirect("~/Error.aspx?Errmsg=" + "登陆已无效,请重新登陆!");
                Page.Response.End();
            }

            if (personnelInfo == null)
            {
                Response.Redirect("~/Error.aspx?Errmsg=" + "登陆已无效,请重新登陆!");
                Page.Response.End();
            }
        }
Пример #16
0
        /// <summary>
        /// 遍历选中的行,返回 身份证号 例:xxxx|xxxx|xxx
        /// </summary>
        /// <returns></returns>
        private string GetChecked_IDCard()
        {
            string checkedStr = string.Empty;

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                PersonnelInfo pi = new PersonnelInfo();
                if (dataGridView1.Rows[i].Cells["CheckRow"].Value.PaseToBoolean())
                {
                    pi.IDCard   = dataGridView1.Rows[i].Cells["IDCard"].Value.ToString();
                    checkedStr += "|" + pi.IDCard;
                }
            }
            if (!string.IsNullOrEmpty(checkedStr))
            {
                checkedStr = checkedStr.Substring(1);
            }
            return(checkedStr);
        }
Пример #17
0
        /// <summary>
        /// 注册人员基本信息
        /// </summary>
        /// <param name="PInfo"></param>
        /// <returns></returns>
        public int RegisterPersonnelInfo(PersonnelInfo PInfo)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(" if not exists (select IDCard from Personnel where flag=1 and IDCard=@IDCard ) ");
            sql.Append(" INSERT INTO dbo.Personnel ");
            sql.Append(" (Name, IDCard, Flag, CreateDate, LastModifyDate, PersonType, FaceImage, Address,Gender,Nation,BirthDate) ");
            sql.Append(" VALUES ");
            sql.Append(" (@Name, @IDCard,1, @CreateDate, @LastModifyDate, @PersonType, @FaceImage, @Address,@Gender,@Nation,@BirthDate) ");

            sql.Append(" else ");

            sql.Append(" UPDATE dbo.Personnel SET ");
            sql.Append(" Name = @Name, ");
            sql.Append(" LastModifyDate = @LastModifyDate, ");
            sql.Append(" FaceImage = @FaceImage, ");
            sql.Append(" Address = @Address, ");
            sql.Append(" Gender = @Gender, ");
            sql.Append(" Nation = @Nation, ");
            sql.Append(" BirthDate = @BirthDate ");
            sql.Append(" WHERE Flag=1 ");
            sql.Append(" AND IDCard=@IDCard ");

            List <SqlParameter> paramList = new List <SqlParameter>();

            paramList.Add(new SqlParameter("@Name", PInfo.Name));
            paramList.Add(new SqlParameter("@IDCard", PInfo.IDCard));
            //paramList.Add(new SqlParameter("@Phone", PInfo.Phone));
            paramList.Add(new SqlParameter("@CreateDate", DateTime.Now));
            paramList.Add(new SqlParameter("@LastModifyDate", DateTime.Now));
            paramList.Add(new SqlParameter("@PersonType", PInfo.PersonType));
            paramList.Add(new SqlParameter("@FaceImage", PInfo.FaceImage));
            paramList.Add(new SqlParameter("@Address", PInfo.Address));
            paramList.Add(new SqlParameter("@Gender", PInfo.Gender));
            paramList.Add(new SqlParameter("@Nation", PInfo.Nation));
            paramList.Add(new SqlParameter("@BirthDate", PInfo.BirthDate));

            return(db.ExecuteNonQuery(sql.ToString(), paramList.ToArray(), connectionStr));
        }
Пример #18
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //bll.RegisterWhiteList();

            PersonnelInfo PInfo = new PersonnelInfo();

            if (ZKSIdRead.ReadCard(ref PInfo))
            {
                PInfo.PersonType = "PersonType_00";//0 访客 | 1 白名单 | 2 黑名单
                PInfoList.Add(PInfo);
                DataRow dr = wlDt.NewRow();
                dr["Name"]      = PInfo.Name;
                dr["IDCard"]    = PInfo.IDCard;
                dr["FaceImage"] = PInfo.FaceImage;
                dr["Address"]   = PInfo.Address;
                dr["Gender"]    = PInfo.Gender;
                dr["Nation"]    = PInfo.Nation;
                dr["BirthDate"] = PInfo.BirthDate;
                wlDt.Rows.Add(dr);
                dataGridView_List.DataSource = wlDt;
                this.label_count.Text        = string.Format("共{0}条", PInfoList.Count);
            }
        }
Пример #19
0
        void LoadInfoPersonnel()
        {
            try
            {
                int           id   = Convert.ToInt32(lv_Staff.SelectedItems[0].Text);
                PersonnelInfo data = PersonnelInfoDAO.Instance.GetInfoPersonnel(id);

                txt_Name.Text    = data.Name;
                txt_Address.Text = data.Address;
                txt_CMND.Text    = data.CMND;
                txt_Salary.Text  = data.SalaryPerHours.ToString();

                DateTime bornDay = data.BornDay;
                dtp_NgaySinh.Value = bornDay;

                DateTime dateAtWork = data.DateAtWork;
                dtp_DateAtWork.Value = dateAtWork;

                LoadWorkPlaceByidPersonnel(id);
                LoadPositionByIdPersonnel(id);

                int sex = data.Sex;
                if (sex == 1)
                {
                    cb_Sex.Checked = true;
                }
                else
                {
                    cb_Sex.Checked = false;
                }
            }
            catch
            {
                return;
            }
        }
Пример #20
0
        /// <summary>验证页面是否有权限访问
        /// </summary>
        /// <param name="context"></param>
        /// <param name="pageUrl"></param>
        /// <param name="isWindowPage"></param>
        /// <param name="personnelInfo"></param>
        public static void VerifyPermission(HttpContext context, string pageUrl, bool isWindowPage, out PersonnelInfo personnelInfo)
        {
            personnelInfo = null;

            //验证是否可访问此页面
            var token = context.Request.QueryString["token"];

            if (string.IsNullOrEmpty(token))
            {
                var tokenCookie = context.Request.Cookies.Get("token");
                if (tokenCookie != null)
                {
                    token = tokenCookie.Value;
                }
            }
            else
            {
                context.Response.SetCookie(new HttpCookie("token", token));
            }

            if (!string.IsNullOrEmpty(token))
            {
                var resultInfo = PermissionSao.VerifyLoginToken(token);
                if (resultInfo.IsSuccess)
                {
                    personnelInfo = resultInfo.PersonnelInfo;
                    if (personnelInfo != null)
                    {
                        if (!isWindowPage)
                        {
                            //验证是否可访问此页面
                            if (personnelInfo.RealName != "admin")
                            {
                                var isCanVisit = PermissionSao.VerifyIsAllowVisitPage(personnelInfo.PersonnelId,
                                                                                      CurrentSession.System.ID,
                                                                                      pageUrl);
                                if (!isCanVisit)
                                {
                                    context.Response.Write("系统提示:当前页面无权浏览!");
                                    context.Response.End();
                                }
                            }
                        }
                    }
                    else
                    {
                        LogInOutUrl(context, "系统提示:登录状态失效,请重新登录!");
                    }
                }
                else
                {
                    LogInOutUrl(context, resultInfo.FailMessage);
                }
            }
            else
            {
#if release
                LogInOutUrl(context, "系统提示:登录状态失效,请重新登录!");
#endif
            }
        }
Пример #21
0
 /// <summary>
 /// 更新员工信息
 /// </summary>
 /// <param name="entity"></param>
 public void Update(PersonnelInfo entity)
 {
     this.oData.Update(entity);
 }
Пример #22
0
        // 采购中
        protected void IbnPurchasing_Click(object sender, EventArgs eventArgs)
        {
            bool isHave      = false;
            var  codeManager = new CodeManager();

            foreach (GridDataItem dataItem in RG_DebitNote.Items)
            {
                var purchasingId      = new Guid(dataItem.GetDataKeyValue("PurchasingId").ToString());
                var personResponsible = new Guid(dataItem.GetDataKeyValue("PersonResponsible").ToString());
                var cbCheck           = (CheckBox)dataItem.FindControl("CB_Check");
                if (cbCheck.Checked)
                {
                    using (var ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        isHave = true;
                        _debitNoteDao.UpdateDebitNoteStateByPurchasingId(purchasingId, (int)DebitNoteState.Purchasing);
                        //生成采购单
                        DebitNoteInfo debitNoteInfo = _debitNoteDao.GetDebitNoteInfo(purchasingId) ?? new DebitNoteInfo();
                        IList <DebitNoteDetailInfo> debitNoteDetailList = _debitNoteDao.GetDebitNoteDetailList(purchasingId);
                        CompanyCussentInfo          companyCussentInfo  = CompanyCussentList.FirstOrDefault(w => w.CompanyId == debitNoteInfo.CompanyId);
                        //var warehouseInfo = WarehouseManager.Get(debitNoteInfo.WarehouseId);
                        PersonnelInfo  personnelInfo     = PersonnelList.FirstOrDefault(w => w.PersonnelId == debitNoteInfo.PersonResponsible) ?? new PersonnelInfo(null);
                        PurchasingInfo oldPurchasingInfo = _purchasing.GetPurchasingById(purchasingId);
                        var            realName          = CurrentSession.Personnel.Get().RealName;
                        var            filialeId         = string.IsNullOrWhiteSpace(debitNoteInfo.PurchasingNo) || debitNoteInfo.PurchasingNo == "-"?FilialeManager.GetHeadList().First(ent => ent.Name.Contains("可得")).ID
                            : _purchasing.GetPurchasingList(debitNoteInfo.PurchasingNo).FilialeID;
                        var pInfo = new PurchasingInfo
                        {
                            PurchasingID    = Guid.NewGuid(),
                            PurchasingNo    = codeManager.GetCode(CodeType.PH),
                            CompanyID       = debitNoteInfo.CompanyId,
                            CompanyName     = companyCussentInfo == null ? "" : companyCussentInfo.CompanyName,
                            FilialeID       = filialeId,
                            WarehouseID     = debitNoteInfo.WarehouseId,
                            PurchasingState = (int)PurchasingState.Purchasing,
                            PurchasingType  = (int)PurchasingType.Custom,
                            StartTime       = DateTime.Now,
                            EndTime         = DateTime.MaxValue,
                            //Description = "[采购类别:{0}赠品借记单][对应采购单号" + debitNoteInfo.PurchasingNo + "]" + CurrentSession.Personnel.Get().RealName,
                            Description         = string.Format("[采购类别:{0},赠品借记单对应采购单号{1};采购人:{2}]", EnumAttribute.GetKeyName(PurchasingType.Custom), debitNoteInfo.PurchasingNo, realName),
                            PmId                = personnelInfo.PersonnelId,
                            PmName              = personnelInfo.RealName,
                            ArrivalTime         = oldPurchasingInfo.ArrivalTime,
                            PersonResponsible   = personResponsible,
                            PurchasingFilialeId = filialeId
                        };
                        IList <PurchasingDetailInfo> purchasingDetailList = new List <PurchasingDetailInfo>();
                        if (debitNoteDetailList.Count > 0)
                        {
                            List <Guid> goodsIdOrRealGoodsIdList  = debitNoteDetailList.Select(w => w.GoodsId).Distinct().ToList();
                            Dictionary <Guid, GoodsInfo> dicGoods = _goodsCenterSao.GetGoodsBaseListByGoodsIdOrRealGoodsIdList(goodsIdOrRealGoodsIdList);
                            if (dicGoods != null && dicGoods.Count > 0)
                            {
                                foreach (var debitNoteDetailInfo in debitNoteDetailList)
                                {
                                    bool hasKey = dicGoods.ContainsKey(debitNoteDetailInfo.GoodsId);
                                    if (hasKey)
                                    {
                                        GoodsInfo goodsBaseInfo = dicGoods.FirstOrDefault(w => w.Key == debitNoteDetailInfo.GoodsId).Value;
                                        // 获取商品的60、30、11天销量
                                        var purchasingDetailInfo = _purchasingDetail.GetChildGoodsSale(debitNoteDetailInfo.GoodsId, debitNoteInfo.WarehouseId, DateTime.Now, pInfo.PurchasingFilialeId) ?? new PurchasingDetailInfo();
                                        var durchasingDetailInfo = new PurchasingDetailInfo
                                        {
                                            PurchasingID        = pInfo.PurchasingID,
                                            PurchasingGoodsID   = Guid.NewGuid(),
                                            GoodsID             = debitNoteDetailInfo.GoodsId,
                                            GoodsName           = debitNoteDetailInfo.GoodsName,
                                            GoodsCode           = goodsBaseInfo.GoodsCode,
                                            Specification       = debitNoteDetailInfo.Specification,
                                            CompanyID           = pInfo.CompanyID,
                                            Price               = debitNoteDetailInfo.Price,
                                            PlanQuantity        = debitNoteDetailInfo.GivingCount,
                                            RealityQuantity     = 0,
                                            State               = 0,
                                            Description         = "",
                                            Units               = goodsBaseInfo.Units,
                                            PurchasingGoodsType = (int)PurchasingGoodsType.Gift,
                                            SixtyDaySales       = purchasingDetailInfo.SixtyDaySales,
                                            ThirtyDaySales      = purchasingDetailInfo.ThirtyDaySales,
                                            ElevenDaySales      = purchasingDetailInfo.ElevenDaySales == 0 ? 0 : purchasingDetailInfo.ElevenDaySales, // 11 //日均销量(11天)
                                            CPrice              = debitNoteDetailInfo.Price
                                        };
                                        purchasingDetailList.Add(durchasingDetailInfo);
                                    }
                                }
                            }
                        }
                        if (purchasingDetailList.Count > 0)
                        {
                            _debitNoteDao.UpdateDebitNoteNewPurchasingIdByPurchasingId(purchasingId, pInfo.PurchasingID);
                            _purchasing.PurchasingInsert(pInfo);
                            _purchasing.PurchasingUpdateIsOut(pInfo.PurchasingID);
                            //报备管理生成采购单操作记录添加
                            WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, pInfo.PurchasingID, pInfo.PurchasingNo,
                                                       OperationPoint.ReportManage.DebitToAddPurchasingList.GetBusinessInfo(), string.Empty);
                            var purchasingDetailManager = new PurchasingDetailManager(_purchasingDetail, _purchasing);
                            purchasingDetailManager.Save(purchasingDetailList);
                        }
                        ts.Complete();
                    }
                }
            }
            if (isHave == false)
            {
                RAM.Alert("未勾选借记单!");
            }
            else
            {
                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
        protected bool ExecuteFinishHandle(CostReportInfo model, PersonnelInfo personnelInfo, out string errorMsg)
        {
            errorMsg = string.Empty;
            if (model.ReportKind.Equals((int)CostReportKind.FeeIncome))
            {
                model.RealityCost = -model.RealityCost;
            }

            var costReportBll = new BLL.Implement.Inventory.CostReport(_bankAccounts, _personnelSao, _costReckoning);

            #region 新增资金流
            var wasteBookInfo = costReportBll.AddWasteBookInfo(model, personnelInfo, false);
            if (_wasteBook.Insert(wasteBookInfo) <= 0)
            {
                errorMsg = "新增资金流失败!";
                return(false);
            }
            #endregion

            #region 新增帐务记录
            var costReckoningInfo = costReportBll.AddCostReckoningInfo(model, personnelInfo, false);
            if (_costReckoning.Insert(costReckoningInfo) <= 0)
            {
                errorMsg = "新增帐务记录失败!";
                return(false);
            }
            #endregion

            #region 与门店费用交互
            if (model.AssumeBranchId == new Guid(ShopBranchId) && !model.AssumeShopId.Equals(Guid.Empty))
            {
                string strErrorMsg;
                var    description = string.Format("费用申报{0}{1}可用余额!", model.ReceiptNo, model.RealityCost < 0 ? "添加" : "扣除");
                var    parentId    = FilialeManager.GetShopHeadFilialeId(model.AssumeShopId);//获取门店所属公司
                if (!ShopSao.DeductBalance(parentId, model.AssumeShopId, model.RealityCost, description, out strErrorMsg))
                {
                    errorMsg = strErrorMsg;
                    return(false);
                }

                var costRecordDto = costReportBll.AddCostRecordDto(model);
                if (!ShopSao.InsertCostRecord(parentId, costRecordDto))
                {
                    errorMsg = "扣除门店费用失败!";
                    return(false);
                }
            }
            #endregion

            #region 新增资金流(手续费)
            if (model.RealityCost >= 0 && model.Poundage > 0 && !model.ReportKind.Equals((int)CostReportKind.FeeIncome))
            {
                var wasteBookInfoPoundage = costReportBll.AddWasteBookInfo(model, personnelInfo, true);
                if (_wasteBook.Insert(wasteBookInfoPoundage) <= 0)
                {
                    errorMsg = "新增手续费失败!";
                    return(false);
                }
            }
            #endregion

            return(true);
        }
Пример #24
0
        /// <summary>
        /// 更改供应商的操作
        /// </summary>
        /// <param name="purasingId"></param>
        /// <param name="purasingGoodsId"></param>
        /// <param name="companyId"></param>
        /// <param name="companyName"></param>
        /// <param name="personnelInfo">当前操作人信息</param>
        /// <returns></returns>
        public string UpdatePurchsingCompany(Guid purasingId, Guid purasingGoodsId, Guid companyId, string companyName, PersonnelInfo personnelInfo)
        {
            PurchasingInfo       pInfo = _purchasingDao.GetPurchasingById(purasingId);
            PurchasingDetailInfo dInfo = _purchasingDetailDao.GetPurchGoodsId(purasingId, purasingGoodsId);
            //查出未提交下的该仓库下的类别下的未提交订单下的供应商
            IList <PurchasingInfo> dlist = _purchasingDao.GetPurchasingList(DateTime.MinValue, DateTime.MinValue, companyId, pInfo.WarehouseID, pInfo.PurchasingFilialeId,
                                                                            PurchasingState.NoSubmit, (PurchasingType)System.Enum.Parse(typeof(PurchasingType), string.Format("{0}", pInfo.PurchasingType)), "", Guid.Empty, Guid.Empty).Where(act => act.FilialeID == pInfo.FilialeID).ToList();

            if (dlist.Count >= 1)//如果存在改供应商的采购单就往改采购单里面添加商品
            {
                //如果存在多个默认取第一个
                PurchasingInfo oldPinfo             = dlist[0];
                IList <PurchasingDetailInfo> pdList = _purchasingDetailDao.Select(oldPinfo.PurchasingID);//获取该采购单下面的商品集合
                bool flag = false;
                foreach (PurchasingDetailInfo detailInfo in pdList)
                {
                    try
                    {
                        //如果该采购单下存在同商品id同价格同规格的商品那就累加数量
                        if (dInfo.GoodsID == detailInfo.GoodsID && dInfo.GoodsCode == detailInfo.GoodsCode && dInfo.Specification == detailInfo.Specification && dInfo.Price == detailInfo.Price)
                        {
                            detailInfo.PlanQuantity = detailInfo.PlanQuantity + dInfo.PlanQuantity - dInfo.RealityQuantity;
                            _purchasingDetailDao.UpdateRealQuantity(detailInfo, detailInfo.PurchasingGoodsID);
                            flag = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        SAL.LogCenter.LogService.LogError(string.Format("采购单更新供应商异常!purasingId={0}, purasingGoodsId={1}, companyId={2}, companyName={3}", purasingId, purasingGoodsId, companyId, companyName), "采购管理", ex);
                    }
                }
                if (flag == false)
                {
                    _purchasingDetailDao.DeleteByGoodsId(dInfo.PurchasingID, dInfo.GoodsID, dInfo.PurchasingGoodsID);
                    dInfo.PurchasingID = oldPinfo.PurchasingID;
                    dInfo.CompanyID    = companyId;
                    //没有改商品直接插入改商品
                    Insert(dInfo);
                }
            }
            else
            {
                Guid pid   = Guid.NewGuid();
                var  sInfo = new PurchasingInfo(pid, new CodeManager().GetCode(CodeType.PH), companyId, companyName, pInfo.FilialeID, pInfo.WarehouseID, (int)PurchasingState.NoSubmit
                                                , pInfo.PurchasingType, DateTime.Now, DateTime.MaxValue, "[更改供应商,操作人:" + personnelInfo.RealName + "]")
                {
                    PmId                = pInfo.PmId,
                    ArrivalTime         = pInfo.ArrivalTime,
                    Director            = pInfo.Director,
                    PersonResponsible   = personnelInfo.PersonnelId,
                    PurchasingFilialeId = pInfo.PurchasingFilialeId,
                    //IsOut = true
                };
                _purchasingDao.PurchasingInsert(sInfo);
                _purchasingDetailDao.DeleteByGoodsId(dInfo.PurchasingID, dInfo.GoodsID, dInfo.PurchasingGoodsID);
                dInfo.PurchasingID = pid;
                dInfo.CompanyID    = companyId;
                Insert(dInfo);
            }
            return("");
        }