Beispiel #1
0
        public ActionResult PrintDetails(int?id)
        {
            using (db_lendingEntities db = new db_lendingEntities())
            {
                tbl_end_of_day_transactions tbl = db.tbl_end_of_day_transactions.Find(id);
                DateTime?date = null;
                if (tbl != null)
                {
                    ViewBag.CashBeginning = String.Format("{0:n}", decimal.Round((decimal)tbl.cash_begin, 2, MidpointRounding.AwayFromZero));

                    ViewBag.CashCollection = String.Format("{0:n}", decimal.Round((decimal)tbl.cash_collected, 2, MidpointRounding.AwayFromZero));

                    ViewBag.CashEnd = String.Format("{0:n}", decimal.Round((decimal)tbl.cash_end, 2, MidpointRounding.AwayFromZero));

                    ViewBag.CashRelease = String.Format("{0:n}", decimal.Round((decimal)tbl.cash_release, 2, MidpointRounding.AwayFromZero));

                    ViewBag.CashReplenished = String.Format("{0:n}", decimal.Round((decimal)tbl.cash_replenished, 2, MidpointRounding.AwayFromZero));

                    ViewBag.CashPullOut = String.Format("{0:n}", decimal.Round((decimal)tbl.cash_pulled_out, 2, MidpointRounding.AwayFromZero));

                    date = tbl.date_trans;
                }
                ViewBag.dateString = String.Format("{0:MMMM dd, yyyy}", date);
                var result1 = db.tbl_loan_processing.Where(d => d.status == "Released" && (d.loan_date >= date && d.loan_date <= date)).ToList();
                ViewBag.ReleaseList = result1;

                var result2 = db.tbl_payment.Where(d => (d.date_trans >= date && d.date_trans <= date)).ToList();
                ViewBag.CollectionList = result2;
            }

            return(PartialView("PrintDetails"));
        }
Beispiel #2
0
        public ActionResult Save(tbl_end_of_day_transactions model)
        {
            try
            {
                db_lendingEntities db = new db_lendingEntities();
                var datetimenow       = DateTime.Now;
                var datenow           = datetimenow.Date;

                var result = from d in db.tbl_end_of_day_transactions where (d.date_trans >= datenow && d.date_trans <= datenow) orderby d.autonum ascending select d;
                if (result.Count() == 0)
                {
                    tbl_end_of_day_transactions tbl = new tbl_end_of_day_transactions();

                    tbl.date_trans       = model.date_trans;
                    tbl.cash_begin       = model.cash_begin;
                    tbl.cash_release     = model.cash_release;
                    tbl.cash_collected   = model.cash_collected;
                    tbl.cash_replenished = model.cash_replenished;
                    tbl.cash_pulled_out  = model.cash_pulled_out;
                    tbl.cash_end         = model.cash_end;
                    tbl.created_by       = Session["UserName"].ToString();
                    tbl.date_created     = DateTime.Now;

                    db.tbl_end_of_day_transactions.Add(tbl);

                    db.SaveChanges();
                    return(Json("Success", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    //"date_trans", "cash_begin", "cash_release", "cash_collected", "cash_pulled_out", "cash_end"
                    var update = db.tbl_end_of_day_transactions.SingleOrDefault(d => d.date_trans >= datenow && d.date_trans <= datenow);
                    if (TryUpdateModel(update, "",
                                       new string[] { "date_trans", "cash_begin", "cash_release", "cash_collected", "cash_replenished", "cash_pulled_out", "cash_end" }))
                    {
                        db.SaveChanges();
                    }
                }
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json("Failed", JsonRequestBehavior.DenyGet));

                throw ex;
            }
        }
Beispiel #3
0
        public ActionResult Print(int?id)
        {
            try
            {
                using (db_lendingEntities db = new db_lendingEntities())
                {
                    tbl_end_of_day_transactions tbl_end_of_day_transactions = db.tbl_end_of_day_transactions.Find(id);

                    if (Session["UserId"] != null)
                    {
                        return(View(tbl_end_of_day_transactions));
                    }
                    else
                    {
                        return(RedirectToAction("Login", "Account"));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }