public ActionResult RemoveForm(string keyValue) { FeeincomeBLL bll = new FeeincomeBLL(); string property_id = Utils.GetCookie("property_id"); int count = bll.IsQianFei(property_id, keyValue, 2); if (count > 0) { return(Error("该单元合同还有未收费用不能出户!")); } else { rentcontractbll.RemoveForm(keyValue); return(Success("删除成功。")); } }
public ActionResult SaveOutForm(string owner_id, string room_id) { if (!string.IsNullOrEmpty(owner_id) && !string.IsNullOrEmpty(room_id)) { FeeincomeBLL bll = new FeeincomeBLL(); int count = bll.IsQianFei(room_id, owner_id, 1); if (count > 0) { return(Error("该单元业主还有未收费用不能出户!")); } else { RoomBLL bll_r = new RoomBLL(); bll_r.SaveOutFrom(room_id, owner_id); return(Success("操作成功。")); } } else { return(Error("请选择出户单元!")); } }
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("操作成功。"); }