public ActionResult SaveForm(string keyValue, FeeticketEntity entity, int codeend) { int codebegin = Convert.ToInt32(entity.ticket_code); // 设置前面几个零 string temp = string.Empty; if (entity.ticket_code.Length > codebegin.ToString().Length) { for (int i = 0; i < (entity.ticket_code.Length - codebegin.ToString().Length); i++) { temp += "0"; } } // 逐条根据编码区间, 循环添加每一个 for (int i = codebegin; i <= codeend; i++) { entity.ticket_id = entity.ticket_type + i; // 主键为发票类型拼当前输入code entity.ticket_code = temp + i.ToString(); // 本身编码是输入的值 entity.ticket_status = 0; entity.lasttime = DateTime.Now; entity.lastoperate = OperatorProvider.Provider.Current().UserName; feeticketbll.SaveForm(keyValue, entity); } return(Success("操作成功。")); }
/// <summary> /// 缴费确定 /// </summary> /// <param name="list">费用应收实体对象</param> /// <param name="ent_ft">发票领用实体对象</param> /// <param name="list_fe">费用实收实体对象</param> /// <param name="list_fK">收费核销实体对象</param> public void FixedCost(List <FeeincomeEntity> list, FeeticketEntity ent_ft, List <FeereceiveEntity> list_fe, List <FeecheckEntity> list_fK) { try { service.FixedCost(list, ent_ft, list_fe, list_fK); } catch (Exception) { throw; } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <param name="entryList">子实体对象</param> /// <returns></returns> public string SavesForm(string keyValue, OtherincomeEntity entity, List <OtherincomeitemEntity> entryList) { IRepository db = new RepositoryFactory().BaseRepository().BeginTrans(); try { if (!string.IsNullOrEmpty(keyValue)) { //主表 entity.Modify(keyValue); db.Update(entity); //明细 db.Delete <OtherincomeitemEntity>(t => t.incomeid.Equals(keyValue)); foreach (OtherincomeitemEntity item in entryList) { item.Create(); item.incomeid = entity.incomeid; db.Insert(item); } } else { //主表 //entity.Create(); entity.incomeid = entity.property_id + GetMaxID(8, "wy_otherincome", "incomeid", 8); db.Insert(entity); //发票状态 FeeticketEntity ent_fee = new FeeticketEntity(); ent_fee.ticket_id = entity.ticketid; ent_fee.ticket_status = 1; db.Update(ent_fee); int maxid = GetMaxID(0, "wy_otherincomeitem", "incomeitem_id", 8).ToInt(); //明细 foreach (OtherincomeitemEntity item in entryList) { item.incomeitem_id = entity.property_id + Utils.SupplementZero(maxid.ToString(), 8); item.incomeid = entity.incomeid; db.Insert(item); maxid++; } } db.Commit(); return(entity.incomeid); } catch (Exception) { db.Rollback(); throw; } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, FeeticketEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, FeeticketEntity entity) { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); this.BaseRepository().Update(entity); } else { this.BaseRepository().Insert(entity); } }
public ActionResult ToVoidForm(string keyValue, int Type) { FeeticketBLL bll_f = new FeeticketBLL(); FeeticketEntity Fent = bll_f.GetEntity(keyValue); string DepartmentId = OperatorProvider.Provider.Current().DepartmentId; if (Fent == null) { return(Error("操作错误!")); } else if (Fent.ticket_status == 2) { return(Error("发票已经归档无法作废,请与财务部联系!")); } else if ((Fent.ticket_status != 1) && (Fent.ticket_status != 10)) { return(Error("发票尚未使用无法作废,请与财务部联系!")); } else if (Fent.dept_id != DepartmentId) { return(Error("发票不属于本部门无法作废,请与财务部联系!!")); } else { string name = OperatorProvider.Provider.Current().UserName; if (Type == 0) { if (feereceivebll.ToVoidForm(1, keyValue, name) > 0) { return(Success("操作成功。")); } else { return(Error("操作失败。")); } } else { OtherincomeBLL bll_o = new OtherincomeBLL(); bll_o.ToVoidForm(name, keyValue); return(Success("操作成功。")); } } }
public ActionResult RemoveForm(string keyValue) { FeeticketEntity ent = feeticketbll.GetEntity(keyValue); if (ent != null) { if (ent.ticket_status == 2) { return(Error("发票已归档,不能进行退领操作!")); } else { //发票状态为1是已使用 feeticketbll.RemoveForm(keyValue); return(Success("发票退领成功")); } } else { return(Error("操作失败,请刷新页面再操作!")); } }
/// <summary> /// 缴费确定 /// </summary> /// <param name="list">费用应收实体对象</param> /// <param name="ent_ft">发票领用实体对象</param> /// <param name="list_fe">费用实收实体对象</param> /// <param name="list_fK">收费核销实体对象</param> public void FixedCost(List <FeeincomeEntity> list, FeeticketEntity ent_ft, List <FeereceiveEntity> list_fe, List <FeecheckEntity> list_fK) { lock (locker) { FeeticketEntity ticket = new RepositoryFactory().BaseRepository().FindEntity <FeeticketEntity>(w => w.ticket_id == ent_ft.ticket_id); if (ticket != null && ticket.ticket_status == 0) { IRepository db = new RepositoryFactory().BaseRepository().BeginTrans(); try { foreach (FeeincomeEntity item in list) { db.Update(item); } db.Update(ent_ft); foreach (FeereceiveEntity item in list_fe) { db.Insert(item); } foreach (FeecheckEntity item in list_fK) { db.Insert(item); } db.Commit(); } catch (Exception) { db.Rollback(); throw; } } } }
/// <summary> /// 修改发票状态 /// </summary> /// <param name="keyValue">主键值</param> /// <param name="State">状态:100是作废发票,2是已归档,1是已使用</param> public void UpdateState(string keyValue, Int16 State) { if (!string.IsNullOrEmpty(keyValue)) { if (keyValue.IndexOf(',') == -1) { FeeticketEntity feeticketEntity = new FeeticketEntity(); feeticketEntity.Modify(keyValue); feeticketEntity.ticket_status = State; feeticketEntity.lasttime = DateTime.Now; feeticketEntity.lastoperate = OperatorProvider.Provider.Current().UserName; this.BaseRepository().Update(feeticketEntity); } else { string[] keyValues = keyValue.Split(','); string str = ""; foreach (string item in keyValues) { str += "'" + item + "',"; } if (!string.IsNullOrEmpty(str)) { str = str.Substring(0, str.Length - 1); } StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE wy_feeticket SET ticket_status=@State,lasttime=GETDATE(),lastoperate=@lastoperate WHERE ticket_id IN (" + str + ")"); DbParameter[] parameter = { DbParameters.CreateDbParameter("@State", State), DbParameters.CreateDbParameter("@lastoperate", OperatorProvider.Provider.Current().UserName) }; this.BaseRepository().ExecuteBySql(strSql.ToString(), parameter); } } }
public ActionResult FixedCost(string keyValue, string ticket_id, string FeeincomeEntryJson) { string property_id = ""; if (!string.IsNullOrEmpty(Utils.GetCookie("property_id"))) { property_id = Utils.GetCookie("property_id"); } var FeeincomeEntryList = FeeincomeEntryJson.ToList <FeeincomeAdjustEntity>(); List <FeeincomeEntity> list_f = new List <FeeincomeEntity>(); FeeticketEntity end_ft = new FeeticketEntity(); List <FeereceiveEntity> list_fe = new List <FeereceiveEntity>(); List <FeecheckEntity> list_fK = new List <FeecheckEntity>(); #region 费用实收 int maxid = new FeereceiveBLL().GetMaxID(0).ToInt(); FeeincomeAdjustEntity entity = FeeincomeEntryList[0]; FeereceiveEntity ent_fe = new FeereceiveEntity(); ent_fe.receive_id = property_id + Utils.SupplementZero(maxid.ToString(), 8); ent_fe.property_id = property_id; ent_fe.receive_date = entity.receive_date; ent_fe.ticket_id = ticket_id; ent_fe.owner_id = entity.owner_id; ent_fe.rentcontract_id = entity.rentcontract_id; ent_fe.fee_money = entity.fee_income; ent_fe.userid = Code.OperatorProvider.Provider.Current().UserName; ent_fe.inputtime = DateTime.Now; ent_fe.room_id = entity.room_id; if (entity.isprint == "1") { ent_fe.isprint = entity.isprint; ent_fe.printname = entity.printname; } list_fe.Add(ent_fe); #endregion int maxid_f = new FeecheckBLL().GetMaxID(0).ToInt(); for (int i = 0; i < FeeincomeEntryList.Count; i++) { FeeincomeAdjustEntity item = FeeincomeEntryList[i]; #region 费用应收 FeeincomeEntity mod_f = new FeeincomeEntity(); mod_f.fee_already = item.fee_already; mod_f.fee_date = item.receive_date; mod_f.userid = Code.OperatorProvider.Provider.Current().UserName; mod_f.inputtime = DateTime.Now; mod_f.income_id = item.income_id; list_f.Add(mod_f); #endregion #region 收费核销 FeecheckEntity ent_fk = new FeecheckEntity(); ent_fk.check_id = property_id + Utils.SupplementZero(maxid_f.ToString(), 8); ent_fk.receive_id = ent_fe.receive_id; ent_fk.income_id = item.income_id; ent_fk.check_money = item.fee_income; list_fK.Add(ent_fk); maxid_f++; #endregion // 归总金额 if (i > 0) { ent_fe.fee_money += item.fee_income; } } #region 发票领用 end_ft.ticket_id = ticket_id; end_ft.ticket_status = 1; #endregion feeincomebll.FixedCost(list_f, end_ft, list_fe, list_fK); return(Success("操作成功。")); }
public string Post(PostBody model) { string keyValue = model.keyValue; string ticket_id = model.ticket_id; string FeeincomeEntryJson = model.FeeincomeEntryJson; string property_id = ""; if (!string.IsNullOrEmpty(Utils.GetCookie("property_id"))) { property_id = Utils.GetCookie("property_id"); } var FeeincomeEntryList = FeeincomeEntryJson.ToList <FeeincomeAdjustEntity>(); List <FeeincomeEntity> list_f = new List <FeeincomeEntity>(); FeeticketEntity end_ft = new FeeticketEntity(); List <FeereceiveEntity> list_fe = new List <FeereceiveEntity>(); List <FeecheckEntity> list_fK = new List <FeecheckEntity>(); FeereceiveBLL bll = new FeereceiveBLL(); int maxid = bll.GetMaxID(0).ToInt(); FeecheckBLL bll_f = new FeecheckBLL(); int maxid_f = bll_f.GetMaxID(0).ToInt(); foreach (FeeincomeAdjustEntity item in FeeincomeEntryList) { #region 费用应收 FeeincomeEntity mod_f = new FeeincomeEntity(); mod_f.fee_already = item.fee_already + item.fee_income; mod_f.fee_date = item.receive_date; mod_f.userid = "李俊"; mod_f.inputtime = DateTime.Now; mod_f.income_id = item.income_id; list_f.Add(mod_f); #endregion #region 费用实收 FeereceiveEntity ent_fe = new FeereceiveEntity(); ent_fe.receive_id = property_id + Utils.SupplementZero(maxid.ToString(), 8); ent_fe.property_id = property_id; ent_fe.receive_date = item.receive_date; ent_fe.ticket_id = ticket_id; ent_fe.owner_id = item.owner_id; ent_fe.rentcontract_id = item.rentcontract_id; ent_fe.fee_money = item.fee_income; ent_fe.userid = "李俊"; ent_fe.inputtime = DateTime.Now; ent_fe.room_id = item.room_id; if (item.isprint == "1") { ent_fe.isprint = item.isprint; ent_fe.printname = item.printname; } list_fe.Add(ent_fe); #endregion #region 收费核销 FeecheckEntity ent_fk = new FeecheckEntity(); ent_fk.check_id = property_id + Utils.SupplementZero(maxid_f.ToString(), 8); ent_fk.receive_id = ent_fe.receive_id; ent_fk.income_id = item.income_id; ent_fk.check_money = item.fee_income; list_fK.Add(ent_fk); #endregion maxid++; maxid_f++; } #region 发票领用 end_ft.ticket_id = ticket_id; end_ft.ticket_status = 1; #endregion FeeincomeBLL feeincomebll = new FeeincomeBLL(); feeincomebll.FixedCost(list_f, end_ft, list_fe, list_fK); return("操作成功。"); }