/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, FeeincomeEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public ActionResult SavesForm(string keyValue, 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>(); List <FeechangelogEntity> list_fl = new List <FeechangelogEntity>(); List <FeeincomeCutEntity> list_fc = new List <FeeincomeCutEntity>(); FeechangelogBLL bll = new FeechangelogBLL(); int maxid = bll.GetMaxID(0).ToInt(); foreach (FeeincomeAdjustEntity item in FeeincomeEntryList) { if (item.price < 0) { item.price = 0; } #region 费用应收表 FeeincomeEntity ent_f = new FeeincomeEntity(); ent_f.income_id = item.income_id; ent_f.fee_income = item.price; list_f.Add(ent_f); #endregion #region 费用调整日志 //新增日志 FeechangelogEntity mod_log = new FeechangelogEntity(); mod_log.itemid = property_id + Utils.SupplementZero(maxid.ToString(), 8); mod_log.property_id = property_id; mod_log.room_id = item.room_id; mod_log.contract_id = item.rentcontract_id; mod_log.owner_id = item.owner_id; mod_log.source_money = item.fee_income.ToDouble(); mod_log.new_money = item.price.ToDouble(); mod_log.feeitem_id = item.feeitem_id; mod_log.operatetime = DateTime.Now; mod_log.operatername = Code.OperatorProvider.Provider.Current().UserName; mod_log.income_date = (item.fee_year + "-" + item.fee_month + "-01").ToDate(); mod_log.memo = item.memo; list_fl.Add(mod_log); #endregion #region 费用减免记录 FeeincomeCutEntity mod_fc = new FeeincomeCutEntity(); mod_fc.property_id = property_id; mod_fc.room_id = item.room_id; mod_fc.owner_id = item.owner_id; mod_fc.contract_id = item.rentcontract_id; mod_fc.feeitem_id = item.feeitem_id; mod_fc.fee_year = item.fee_year; mod_fc.fee_month = item.fee_month; mod_fc.fee_cutmoney = (item.fee_income - item.price).ToDouble(); mod_fc.inputtime = DateTime.Now; mod_fc.inputempid = Code.OperatorProvider.Provider.Current().UserName; list_fc.Add(mod_fc); #endregion maxid++; } feeincomebll.SavesForm(list_f, list_fl, list_fc); return(Success("操作成功。")); }
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 ActionResult SaveForm(string keyValue, FeeincomeEntity entity) { feeincomebll.SaveForm(keyValue, entity); return(Success("操作成功。")); }
public ActionResult RemoveForm(string keyValue) { string property_id = ""; if (!string.IsNullOrEmpty(Utils.GetCookie("property_id"))) { property_id = Utils.GetCookie("property_id"); } FeechangelogBLL bll = new FeechangelogBLL(); List <FeechangelogEntity> list = new List <FeechangelogEntity>(); if (keyValue.IndexOf(',') == -1) { #region 单个 FeeincomeEntity model = feeincomebll.GetEntity(keyValue); FeechangelogEntity mod_log = new FeechangelogEntity(); mod_log.itemid = property_id + bll.GetMaxID(8); mod_log.property_id = property_id; mod_log.room_id = model.room_id; mod_log.contract_id = model.rentcontract_id; mod_log.owner_id = model.owner_id; mod_log.source_money = model.fee_income.ToDouble(); mod_log.new_money = 0; mod_log.feeitem_id = model.feeitem_id; mod_log.operatetime = DateTime.Now; mod_log.operatername = Code.OperatorProvider.Provider.Current().Account; mod_log.income_date = (model.fee_year + "-" + model.fee_month + "-01").ToDate(); mod_log.memo = "删除"; list.Add(mod_log); #endregion } else { #region 多个 string[] keyValues = keyValue.Split(','); string str = ""; foreach (string item in keyValues) { str += "'" + item + "',"; } if (str != "") { str = str.Substring(0, str.Length - 1); } int maxid = bll.GetMaxID(0).ToInt(); IEnumerable <FeeincomeEntity> ie = feeincomebll.GetLists(str); if (ie.Count() > 0) { foreach (FeeincomeEntity item in ie) { //新增日志 FeechangelogEntity mod_log = new FeechangelogEntity(); mod_log.itemid = property_id + Utils.SupplementZero(maxid.ToString(), 8); mod_log.property_id = property_id; mod_log.room_id = item.room_id; mod_log.contract_id = item.rentcontract_id; mod_log.owner_id = item.owner_id; mod_log.source_money = item.fee_income.ToDouble(); mod_log.new_money = 0; mod_log.feeitem_id = item.feeitem_id; mod_log.operatetime = DateTime.Now; mod_log.operatername = Code.OperatorProvider.Provider.Current().UserName; mod_log.income_date = (item.fee_year + "-" + item.fee_month + "-01").ToDate(); mod_log.memo = "删除"; list.Add(mod_log); maxid++; } } #endregion } feeincomebll.RemoveForm(keyValue, list); return(Success("删除成功。")); }
public ActionResult SaveOwnerFrom(string queryJson) { FeeincomeEntity ent = new FeeincomeEntity(); int type = 0; #region 赋值 var queryParam = queryJson.ToJObject(); if (!queryParam["fee_year"].IsEmpty()) { ent.fee_year = Convert.ToInt16(queryParam["fee_year"]); } if (!queryParam["fee_month"].IsEmpty()) { ent.fee_month = Convert.ToInt16(queryParam["fee_month"]); } if (!queryParam["type"].IsEmpty()) { type = queryParam["type"].ToInt(); } if (type == 1) { if (!queryParam["building_id"].IsEmpty()) { ent.building_id = queryParam["building_id"].ToString(); } if (!queryParam["owner_id"].IsEmpty()) { string[] owner_id = queryParam["owner_id"].ToString().Split('|'); ent.owner_id = owner_id[1]; ent.room_id = owner_id[0]; } } else { if (!queryParam["rentcontract_id"].IsEmpty()) { ent.rentcontract_id = queryParam["rentcontract_id"].ToString(); } } if (!queryParam["feeitem_id"].IsEmpty()) { ent.feeitem_id = queryParam["feeitem_id"].ToString(); } if (!queryParam["fee_income"].IsEmpty()) { ent.fee_income = queryParam["fee_income"].ToDecimal(); } if (!queryParam["notes"].IsEmpty()) { ent.notes = queryParam["notes"].ToString(); } if (!queryParam["pay_enddate"].IsEmpty()) { ent.pay_enddate = queryParam["pay_enddate"].ToDate(); } ent.property_id = Utils.GetCookie("property_id"); ent.start_date = (ent.fee_year + "-" + ent.fee_month + "-01").ToDate(); ent.end_date = (ent.fee_year + "-" + ent.fee_month + "-25").ToDate(); ent.userid = Code.OperatorProvider.Provider.Current().UserName; ent.inputtime = DateTime.Now; ent.fee_already = 0; #endregion DateTime endtime = ent.pay_enddate.ToDate(); if (ent.fee_year.ToInt() == endtime.Year) { if (endtime.Month < ent.fee_month) { return(Error("应收截止日期不能小于记帐月份!")); } else { if (endtime.Month - ent.fee_month.ToInt() > 1) { return(Error("应收截止日期不能大于2个月!")); } } } else { if (((endtime.Year - ent.fee_year.ToInt() != 1) && ent.fee_month != 1) && (ent.fee_month != 12)) { return(Error("应收截止日期不能大于2个月!")); } } FeeincomeBLL feeincomebll = new FeeincomeBLL(); // 业主费用登记和租户费用登记查询的条件不一样 update by:Jery.Li Time:2017/11/29 string operateId = ent.room_id; if (type == 2) { operateId = ent.rentcontract_id; } //判断是否存在 var data = feeincomebll.GetList(ent.feeitem_id, operateId, ent.fee_year.ToInt(), ent.fee_month.ToInt(), type); if (data != null && data.Count() > 0) { Busines.FinanceManage.FeeitemBLL bll = new Busines.FinanceManage.FeeitemBLL(); Entity.FinanceManage.FeeitemEntity fen_ent = bll.GetEntity(ent.feeitem_id); if (fen_ent.allowreply == false) { return(Error("该费用[ " + queryParam["feeitemname"] + " ]已经生成过,请设置新的日期!。")); } } feeincomebll.SaveForm("", ent); return(Success("操作成功。")); }
public ActionResult SevaFeeFrom(string queryJson) { //try //{ FeeincomeEntity ent = new FeeincomeEntity(); int type = 0; string building_id = ""; int selectdecimal = 2; string FeeManageEntryJson = ""; #region 赋值 var queryParam = queryJson.ToJObject(); if (!queryParam["fee_year"].IsEmpty()) { ent.fee_year = Convert.ToInt16(queryParam["fee_year"]); } if (!queryParam["fee_month"].IsEmpty()) { ent.fee_month = Convert.ToInt16(queryParam["fee_month"]); } if (!queryParam["type"].IsEmpty()) { type = queryParam["type"].ToInt(); } if (!queryParam["feeitem_id"].IsEmpty()) { ent.feeitem_id = queryParam["feeitem_id"].ToString(); } if (!queryParam["pay_enddate"].IsEmpty()) { ent.pay_enddate = queryParam["pay_enddate"].ToDate(); } ent.notes = "批量导入"; ent.property_id = Utils.GetCookie("property_id"); ent.start_date = (ent.fee_year + "-" + ent.fee_month + "-01").ToDate(); ent.end_date = (ent.fee_year + "-" + ent.fee_month + "-25").ToDate(); ent.userid = Code.OperatorProvider.Provider.Current().UserName; ent.inputtime = DateTime.Now; ent.fee_already = 0; if (!queryParam["building_id"].IsEmpty()) { building_id = queryParam["building_id"].ToString(); } if (!queryParam["selectdecimal"].IsEmpty()) { selectdecimal = queryParam["selectdecimal"].ToInt(); } if (!queryParam["file"].IsEmpty()) { FeeManageEntryJson = queryParam["file"].ToString(); } #endregion #region 判断 DateTime endtime = ent.pay_enddate.ToDate(); if (ent.fee_year.ToInt() == endtime.Year) { if (endtime.Month < ent.fee_month) { return(Error("应收截止日期不能小于记帐月份!")); } else { if (endtime.Month - ent.fee_month.ToInt() > 1) { return(Error("应收截止日期不能大于2个月!")); } } } else { if (((endtime.Year - ent.fee_year.ToInt() != 1) && ent.fee_month != 1) && (ent.fee_month != 12)) { return(Error("应收截止日期不能大于2个月!")); } } #endregion #region 判断文件格式 if (string.IsNullOrEmpty(FeeManageEntryJson)) { return(Error("请选择上传费用导出EXCEL文件!")); } DataTable dt = Util.Offices.ExcelHelper.ExcelImport(Utils.GetMapPath(FeeManageEntryJson)); List <FeeincomeEntity> list = new List <FeeincomeEntity>(); string ids = ""; if (dt != null && dt.Rows.Count > 0) { if (dt.Columns.Count < 6) { return(Error("请选择按照导出文档模版填写金额!")); } for (int i = dt.Rows.Count - 1; i >= 0; i--) { //单元代码编号和金额不能为空 if (!string.IsNullOrEmpty(dt.Rows[i][1].ToString()) && !string.IsNullOrEmpty(dt.Rows[i][5].ToString())) { ids += dt.Rows[i][1] + ","; } else { dt.Rows.RemoveAt(i); } } if (dt == null || dt.Rows.Count == 0) { return(Error("请选择按照导出文档模版填写金额!")); } } else { return(Error("请选择上传有效的费用文件!")); } #endregion #region 子表赋值 if (!string.IsNullOrEmpty(ids)) { ids = ids.Substring(0, ids.Length - 1); } FeeincomeBLL feeincomebll = new FeeincomeBLL(); HuRongClub.Util.Log.log4netHelper.Info(ent.feeitem_id + "|" + ids + "|" + ent.fee_year + "|" + ent.fee_month + "|" + type); var data = feeincomebll.GetList(ent.feeitem_id, ids, ent.fee_year.ToInt(), ent.fee_month.ToInt(), type); int Total = data.Count(); Busines.FinanceManage.FeeitemBLL blls = new Busines.FinanceManage.FeeitemBLL(); Entity.FinanceManage.FeeitemEntity fen_ent = blls.GetEntity(ent.feeitem_id); // mapper setting Mapper.Initialize(cfg => { cfg.CreateMap <FeeincomeEntity, FeeincomeEntity>(); }); for (int i = 0; i < dt.Rows.Count; i++) { FeeincomeEntity Fent = new FeeincomeEntity(); bool bl = false; if (Total == 0) { HuRongClub.Util.Log.log4netHelper.Info("不存在费用记录1"); bl = true; } else { //租户和业主区分 int rowcount = 0; if (type == 1) { rowcount = data.Where(t => t.room_id == dt.Rows[i][1].ToString()).Count(); } else { rowcount = data.Where(t => t.rentcontract_id == dt.Rows[i][1].ToString()).Count(); } if (rowcount == 0) { // HuRongClub.Util.Log.log4netHelper.Info("不存在费用记录2|" + dt.Rows[i][1].ToString()); bl = true; } else { // HuRongClub.Util.Log.log4netHelper.Info("存在,判断是否允许重复"); if (fen_ent.allowreply == true) { HuRongClub.Util.Log.log4netHelper.Info("允许重复|" + fen_ent.feeitem_id + "|" + fen_ent.allowreply.ToString()); bl = true; } } } if (bl == true) { //Fent = ent; Fent = Mapper.Map <FeeincomeEntity>(ent); if (type == 1) { //owner_id 第一列不能为空 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { Fent.building_id = building_id; Fent.owner_id = dt.Rows[i][0].ToString(); Fent.room_id = dt.Rows[i][1].ToString(); } } else { Fent.rentcontract_id = dt.Rows[i][1].ToString(); } Fent.fee_income = Math.Round(dt.Rows[i][5].ToDecimal(), selectdecimal); list.Add(Fent); } } #endregion if (list.Count == 0) { return(Error("该费用[ " + queryParam["feeitemname"] + " ]已经生成过,请设置新的日期!。")); } else { feeincomebll.FeeManage(list); } return(Success("操作成功。")); //} //catch (Exception) //{ // return Error("操作失败,请检查导入模版是否正确。"); //} }
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("操作成功。"); }