public ActionResult GetPayments(AccountModel account) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var d = TempData["id"]; TempData.Keep("id"); if (account.patient_ID != 0) { TempData["id"] = account.patient_ID; } if (account.patient_ID != 0) { var paymentsModel = patientApi.GetPatientPayments(account.patient_ID); return(View("~/Views/Administrator/AdminViewPayments.cshtml", paymentsModel.OrderBy(p => p.bill_ID))); } else { var paymentsModel = patientApi.GetPatientPayments((int)d); return(View("~/Views/Administrator/AdminViewPayments.cshtml", paymentsModel.OrderBy(p => p.bill_ID))); } }
public ActionResult GetPaymentsWithBillID(PaymentModel p) { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]).Where(b => b.bill_ID == p.bill_ID); if (paymentsModel.Count() != 0) { ViewBag.totalAmount = paymentsModel.Last().total_Amount; ViewBag.paidAmount = paymentsModel.Last().paid_Amount; double totalPaidAmount = 0; foreach (var pp in paymentsModel) { totalPaidAmount = totalPaidAmount + pp.paid_Amount; } ViewBag.TotalPaid = totalPaidAmount; ViewBag.PendingAmount = ViewBag.totalAmount - totalPaidAmount; } else { return(Redirect("PayPayments")); } return(View("~/Views/Patient/PayPayments.cshtml", paymentsModel)); }
public ActionResult PayPayments() { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]); return(View("~/Views/Patient/PatientPayments.cshtml", paymentsModel)); }
public ActionResult SelectPatientsForPayments(AppointmentModel app) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments(app.paitent_ID).GroupBy(g => g.bill_ID).Select(pa => pa.First()).ToList(); PaymentModel p = new PaymentModel(); foreach (var pay in paymentsModel) { p.billList.Add(new SelectListItem { Text = pay.bill_ID.ToString(), Value = pay.bill_ID.ToString() }); } return(View("~/Views/Administrator/AdminSelectBillID.cshtml", p)); }
public ActionResult GetPayments() { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]).GroupBy(g => g.bill_ID).Select(pa => pa.First()).ToList(); PaymentModel p = new PaymentModel(); foreach (var pay in paymentsModel) { p.billList.Add(new SelectListItem { Text = pay.bill_ID.ToString(), Value = pay.bill_ID.ToString() }); } return(View("~/Views/Patient/SelectBillID.cshtml", p)); }
public ActionResult GetPaymentsWithID(int id) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); Account_Api accApi = new Account_Api(); AccountModel accModel = new AccountModel(); accModel.patient_ID = (int)Session["UserId"]; var model = accApi.GetAccountsByBillID(accModel); var billingID = model.Where(a => a.appointment_ID == id).FirstOrDefault(); if (billingID != null) { var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]); List <PaymentModel> pay = null; if (paymentsModel.Count() != 0) { var pp = paymentsModel.Where(p => p.bill_ID == billingID.bill_ID).FirstOrDefault(); if (pp != null) { pay.Add(pp); return(View("~/Views/Patient/PatientViewPayments.cshtml", pay)); } ViewBag.info = "Billing is not yet generated"; return(View("~/Views/Patient/NoReports.cshtml")); } ViewBag.info = "Billing is not yet generated"; return(View("~/Views/Patient/NoReports.cshtml")); } ViewBag.info = "Billing is not yet generated"; return(View("~/Views/Patient/NoReports.cshtml")); }