/// <summary> /// 批量登记付款 /// </summary> /// <param name="info">付款批量登记信息业务实体</param> /// <returns></returns> public int BatchRegisterExpense(EyouSoft.Model.FinanceStructure.MBatchRegisterExpenseInfo info) { //<ROOT><Info TourId="计划编号" /></ROOT> StringBuilder xml = new StringBuilder(); xml.Append("<ROOT>"); foreach (var id in info.TourIds) { xml.AppendFormat("<Info TourId=\"{0}\" />", id); } xml.Append("</ROOT>"); DbCommand cmd = this._db.GetStoredProcCommand("proc_BatchRegisterExpense"); this._db.AddInParameter(cmd, "PaymentTime", DbType.DateTime, info.PaymentTime); this._db.AddInParameter(cmd, "PaymentType", DbType.Byte, info.PaymentType); this._db.AddInParameter(cmd, "PayerId", DbType.Int32, info.PayerId); this._db.AddInParameter(cmd, "Payer", DbType.String, info.Payer); this._db.AddInParameter(cmd, "Remark", DbType.String, info.Remark); this._db.AddInParameter(cmd, "OperatorId", DbType.Int32, info.OperatorId); this._db.AddInParameter(cmd, "CompanyId", DbType.Int32, info.CompanyId); this._db.AddInParameter(cmd, "TourIdsXML", DbType.String, xml.ToString()); this._db.AddOutParameter(cmd, "Result", DbType.Int32, 4); this._db.AddInParameter(cmd, "GysName", DbType.String, info.SearchGYSName); if (info.SearchGYSType.HasValue) { _db.AddInParameter(cmd, "GysType", DbType.Byte, info.SearchGYSType.Value); } else { _db.AddInParameter(cmd, "GysType", DbType.Byte, 255); } int sqlExceptionCode = 0; try { DbHelper.RunProcedure(cmd, this._db); } catch (System.Data.SqlClient.SqlException e) { sqlExceptionCode = 0 - e.Number; } if (sqlExceptionCode < 0) { return(sqlExceptionCode); } return(Convert.ToInt32(this._db.GetParameterValue(cmd, "Result"))); }
/// <summary> /// 批量登记付款 /// </summary> /// <param name="info">付款批量登记信息业务实体</param> /// <returns></returns> public int BatchRegisterExpense(EyouSoft.Model.FinanceStructure.MBatchRegisterExpenseInfo info) { if (info == null || info.OperatorId <= 0 || info.CompanyId <= 0 || info.PaymentTime == DateTime.MinValue || info.TourIds == null || info.TourIds.Count < 1) { throw new System.Exception("请传递正确的参数。"); } int dalRetCode = dal.BatchRegisterExpense(info); #region LGWR if (dalRetCode == 1) { StringBuilder s = new StringBuilder(); s.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "{0}在" + EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.财务管理_团款支出.ToString() + "做批量付款登记"); s.Append(",登记的团队编号为:"); foreach (var tourId in info.TourIds) { s.Append(tourId + "、"); } s.Append(",供应商查询条件为:" + info.SearchGYSName + "。"); EyouSoft.Model.CompanyStructure.SysHandleLogs logInfo = new EyouSoft.Model.CompanyStructure.SysHandleLogs(); logInfo.CompanyId = 0; logInfo.DepatId = 0; logInfo.EventCode = EyouSoft.Model.CompanyStructure.SysHandleLogsNO.EventCode; logInfo.EventIp = string.Empty; logInfo.EventMessage = s.ToString(); logInfo.EventTime = DateTime.Now; logInfo.EventTitle = "批量付款登记"; logInfo.ModuleId = EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.财务管理_团款支出; logInfo.OperatorId = 0; new EyouSoft.BLL.CompanyStructure.SysHandleLogs().Add(logInfo); } #endregion return(dalRetCode); }
/// <summary> /// 批量操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnSave_Click(object sender, EventArgs e) { EyouSoft.Model.FinanceStructure.MBatchRegisterExpenseInfo model = new EyouSoft.Model.FinanceStructure.MBatchRegisterExpenseInfo(); model.CompanyId = CurrentUserCompanyID; /*int comType = Utils.GetInt(Utils.GetQueryStringValue("comType")); * if (comType == 0) * { * model.ExpenseType = null; * } * else * { * model.ExpenseType = (EyouSoft.Model.EnumType.FinanceStructure.OutPlanType)comType; * }*/ model.PaymentType = (EyouSoft.Model.EnumType.TourStructure.RefundType)(Utils.GetInt(Utils.GetFormValue("ddlPayType"))); model.OperatorId = SiteUserInfo.ID; model.Payer = txtStaffName.Text; model.PayerId = 0; model.PaymentTime = Utils.GetDateTime(txtPayDate.Text, DateTime.Now); model.Remark = t_desc.Value; model.SearchGYSName = Utils.GetQueryStringValue("gysName"); model.SearchGYSType = (EyouSoft.Model.EnumType.CompanyStructure.SupplierType?)Utils.GetEnumValue(typeof(EyouSoft.Model.EnumType.CompanyStructure.SupplierType), Utils.GetQueryStringValue("comType"), null); IList <string> ls = new List <string>(); string[] tourids = Utils.GetQueryStringValue("tourids").Split(','); for (int i = 0; i < tourids.Length; i++) { ls.Add(tourids[i]); } model.TourIds = ls; EyouSoft.BLL.FinanceStructure.BSpendRegister bll = new EyouSoft.BLL.FinanceStructure.BSpendRegister(); if (bll.BatchRegisterExpense(model) > 0) { Utils.ShowMsgAndCloseBoxy("登记成功!", Utils.GetQueryStringValue("IframeId"), true); } else { Response.Write("<script>alert('登记失败!');</script>"); } }