// GET: Collecting
        public ActionResult Index(int?pageNO)
        {
            int _pageNo    = pageNO ?? 1;
            var pIncomings = db.Payments.OfType <PIncoming>().OrderByDescending(o => o.CreateTime).ToPagedList <PIncoming>(_pageNo, 11);

            CollectingIndexModel model = new CollectingIndexModel()
            {
                PIncomings   = pIncomings,
                customers    = db.Customers.Where(w => w.CustomerActive == true).ToList(),
                CashAccounts = db.CashAccounts.ToList(),
            };

            return(View(model));
        }
        public ActionResult Create(CollectingIndexModel model)
        {
            var customerName = db.Customers.Find(model.PIncoming.CustomerId).UserName;

            if (model != null)
            {
                var PIncoming = new PIncoming()
                {
                    CreateTime       = model.PIncoming.CreateTime,
                    Total            = model.PIncoming.Total,
                    WhichSafe        = db.CashAccounts.Find(model.CashAccountId).AccountName,
                    Description      = model.PIncoming.Description,
                    CustomerId       = model.PIncoming.CustomerId,
                    CustomerUserName = customerName,
                    WhoUser          = "******",
                    CashAccountId    = model.CashAccountId,
                };
                db.Payments.Add(PIncoming);
                db.SaveChanges();
            }

            return(RedirectToAction("Index", "Collecting"));
        }