/// <summary> /// 获取欠费详细信息 /// </summary> /// <param name="customerIDList"></param> /// <returns></returns> public JsonResult GetArrearInfo(string customerIDs) { CustomerRule cusRule = new CustomerRule(); AgreementsRule agreeRule = new AgreementsRule(); ChargeRule chRule = new ChargeRule(); ChargeItemRule chargeItemRule = new ChargeItemRule(); List <object> arrearList = new List <object>(); string[] customerIDArray = customerIDs.Split(','); foreach (string customerID in customerIDArray) { // 客户信息 var customer = cusRule.CustomerDetail(customerID); // 协议信息 var agreements = agreeRule.GetAgreementObjectByCustomerID(customerID); decimal totalFee = chRule.CaculateCustomerFee(customerID); //缴费总月份 Ajax.Model.Customer c = new CustomerRule().GetModel(customerID); int monthCount = chRule.GetMonthCount(Convert.ToDateTime(c.BeginChargeDate)); // 缴费项目信息 List <dynamic> chargeItemList = new ChargeItemRule().SearchChargeItem(customerID); var chargeItem = from chargeItems in chargeItemList select new { Name = chargeItems.NAME, Price = chargeItemRule.GetPriceByItemID(chargeItems.ID, Convert.ToDecimal(chargeItems.COUNT), customerID), Count = chargeItems.COUNT, AgreeMentMoney = chargeItems.AGREEMENTMONEY, ItemCount = monthCount * CaculateItemCount(chargeItems.AGREEMENTMONEY, Convert.ToString(chargeItemRule.GetPriceByItemID(chargeItems.ID, Convert.ToDecimal(chargeItems.COUNT), customerID)), chargeItems.COUNT) }; //子客户费用信息 List <Ajax.Model.Customer> customerChildrenList = new CustomerRule().GetChildrenCustomer(customerID); var childrenCustomer = from childC in customerChildrenList select new { Name = childC.Name, Fee = chRule.CaculateCustomerFee(childC.ID, false) }; arrearList.Add(new { customer, agreements, monthCount, totalFee, chargeItem, childrenCustomer }); } return(Json(arrearList, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 欠费统计 /// </summary> /// <returns></returns> public ActionResult FeeStastics() { ChargeRule cRule = new ChargeRule(); AreaRule aRule = new AreaRule(); var customerArrearList = cRule.GetArrearList("", ""); var stasticsList = from f in customerArrearList select new { // <th width="10" field="ID" checkbox="true">ID </th> //<th width="10" field="NAME">客户名称 </th> //<th width="10" field="CODE">客户编号 </th> //<th width="10" field="CONTACTOR">联系人 </th> //<th width="10" field="PHONE">电话 </th> //<th width="10" field="MOBILEPHONE">手机 </th> //<th width="10" field="ADDRESS">地址 </th> //<th width="10" field="BEGINCHARGEDATE">开始缴费时间 </th> //<th width="10" field="TYPENAME">客户类型 </th> //<th width="10" field="AREANAME">所在区域 </th> name = f.NAME, CODE = f.CODE, CONTACTOR = f.CONTACTOR, PHONE = f.PHONE, MOBILEPHONE = f.MOBILEPHONE, ADDRESS = f.ADDRESS, BEGINCHARGEDATE = f.BEGINCHARGEDATE, TYPENAME = f.TYPENAME, areaName = f.AREANAME, fee = cRule.CaculateCustomerFee(f.ID), areaID = f.AREAID }; List <Area> areaList = new AreaRule().GetList(@" and Pid in(select ID from T_area where PID is null) "); var areaFirstLevel = from area in areaList select new { ID = area.ID, Name = area.Name, childrenIDs = string.Join(",", aRule.GetAllChildrenID(area.ID)) }; return(Json(new { stasticsList = stasticsList, areaList = areaFirstLevel }, JsonRequestBehavior.AllowGet)); }