Beispiel #1
0
        /// <summary>
        /// 执行年终结算
        /// </summary>
        /// <param name="strYear">结算年份</param>
        /// <returns></returns>
        public void CaculateYearFee(string strYear)
        {
            decimal totalFee = 0;
            //获取欠费用户列表
            string          strWhere            = @" and PID is null and status=1 
                                 and beginChargeDate between '{0}-1-1 0:00:00' and '{0}-12-31 23:59:59'";
            List <Customer> arrearsCustomerList = new CustomerRule().GetList(string.Format(strWhere, strYear));

            foreach (Customer c in arrearsCustomerList)
            {
                totalFee = new ChargeRule().CaculateCustomerFee(c.ID);
                YearEndArrear yeaInfo = new YearEndArrear()
                {
                    ID         = Guid.NewGuid().ToString("N"),
                    CustomerID = c.ID,
                    Money      = totalFee,
                    Status     = 0,
                    Year       = Convert.ToInt32(strYear)
                };
                new YearEndArrearRule().Add(yeaInfo);
                //更新起始缴费时间
                c.BeginChargeDate = Convert.ToDateTime(string.Format("{0}-1-1", DateTime.Now.Year - 1));
                new CustomerRule().Update(c);
            }
        }
Beispiel #2
0
 public ActionResult ChargeSearch(string customerID)
 {
     if (string.IsNullOrEmpty(customerID))
     {
         return Json(new { total = 0, rows = "" }, JsonRequestBehavior.AllowGet);
     }
     List<dynamic> historyChargeList = new ChargeRule().ChargeSearch(customerID);
     if (historyChargeList != null)
     {
         return Json(new { total = historyChargeList.Count, rows = historyChargeList }, JsonRequestBehavior.AllowGet);
     }
     return Json(new { total = 0, rows = "" }, JsonRequestBehavior.AllowGet);
 }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
 /// <summary>
 /// 执行年终结算
 /// </summary>
 /// <param name="strYear">结算年份</param>
 /// <returns></returns>
 public void CaculateYearFee(string strYear)
 {
     decimal totalFee = 0;
     //获取欠费用户列表
     string strWhere = @" and PID is null and status=1
                          and beginChargeDate between '{0}-1-1 0:00:00' and '{0}-12-31 23:59:59'";
     List<Customer> arrearsCustomerList = new CustomerRule().GetList(string.Format(strWhere, strYear));
     foreach (Customer c in arrearsCustomerList)
     {
         totalFee = new ChargeRule().CaculateCustomerFee(c.ID);
         YearEndArrear yeaInfo = new YearEndArrear()
         {
             ID = Guid.NewGuid().ToString("N"),
             CustomerID = c.ID,
             Money = totalFee,
             Status = 0,
             Year = Convert.ToInt32(strYear)
         };
         new YearEndArrearRule().Add(yeaInfo);
         //更新起始缴费时间
         c.BeginChargeDate = Convert.ToDateTime(string.Format("{0}-1-1", DateTime.Now.Year - 1));
         new CustomerRule().Update(c);
     }
 }
Beispiel #5
0
 public ActionResult SaveFeeRecord(string customerId, int chargeMonth, decimal chargeMoney)
 {
     if (string.IsNullOrEmpty(customerId) || chargeMonth < 1 || chargeMoney < 0)
     {
         return Json(false, JsonRequestBehavior.AllowGet);
     }
     string msg = new ChargeRule().Charge(customerId, chargeMonth, chargeMoney, MyTicket.CurrentTicket.UserID);
     return Json(msg, JsonRequestBehavior.AllowGet);
 }
Beispiel #6
0
 public ActionResult CustomerChargeConfirmSearch(EasyUIGridParamModel param)
 {
     int count = 0;
     List<dynamic> chargeList = new ChargeRule().ChargeSearch("", param, out count);
     var showList = from charge in chargeList
                    select new
                    {
                        ID = charge.ID,
                        CustomerName = charge.CUSTOMERNAME,
                        Money = charge.MONEY,
                        CreateTime = charge.CREATEDATE,
                        OperName = charge.OPERATORNAME,
                        Detail = "查看详情"
                    };
     return Json(new { total = count, rows = showList }, JsonRequestBehavior.AllowGet);
 }
        public JsonResult CustomerDetail(string customerID)
        {
            if (!string.IsNullOrEmpty(customerID))
            {
                // 客户信息
                var customer = new CustomerRule().CustomerDetail(customerID);

                // 缴费项目信息
                List<dynamic> chargeItemList = new ChargeItemRule().SearchChargeItem(customerID);

                var chargeItem = from chargeItems in chargeItemList
                                 select new
                                 {
                                     Name = chargeItems.NAME,
                                     Price = chargeItems.UNITPRICE,
                                     Count = chargeItems.COUNT,
                                     AgreeMentMoney = chargeItems.AGREEMENTMONEY,
                                     ItemCount = 0
                                 };
                // 协议信息
                var agreements = new AgreementsRule().GetAgreementObjectByCustomerID(customerID);
                // 子客户信息
                var childCustomer = new CustomerRule().GetChildrenCustomer(customerID);
                // 缴费历史
                //int itemCount = 0;
                var chargeHistory = new ChargeRule().ChargeSearch(customerID);
                // 欠费记录
                var arrearRecord = new YearEndArrearRule().GetArrearRecordByCustomerID(customerID);
                //chargeHistory,
                return Json(new { customer, chargeItem, agreements, childCustomer, arrearRecord, chargeHistory }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new Ajax.Model.Customer());
            }
        }