Beispiel #1
0
        public ActionResult AddCharge(int patientId, int caseId, string charge_Id)
        {
            try
            {
                int     chargeId = Convert.ToInt32(charge_Id);
                Charge  c        = hb.Charges.Find(chargeId);
                Patient patient  = hb.Patients.Find(patientId);
                Case    cases    = hb.Cases.Find(caseId);

                AddedCharge charge = new AddedCharge();
                charge.type   = c.type;
                charge.amount = c.amount;
                charge.caseId = caseId;

                cases.bill += c.amount;
                cases.due  += c.amount;


                hb.AddedCharges.Add(charge);

                hb.Entry(cases).State = EntityState.Modified;

                hb.SaveChanges();
                ViewBag.Error = "Case-Id(" + caseId + "): " + c.type + " - charge added.";
                return(RedirectToAction("ShowPatientBill", new { id = patientId }));
            }
            catch
            {
                ViewBag.Error = "Error While Creating Appointment , Try Again !!!";
                return(RedirectToAction("AllotWard", new { id = caseId, patientId = patientId }));
            }
        }
Beispiel #2
0
        public ActionResult PayBill(int patientId, int caseId, int amount)
        {
            try
            {
                Patient patient = hb.Patients.Find(patientId);
                Case    cases   = hb.Cases.Find(caseId);

                AddedCharge charge = new AddedCharge();
                charge.type   = "User-Payment";
                charge.amount = amount;
                charge.caseId = caseId;

                cases.paid += amount;
                cases.due  -= amount;


                hb.AddedCharges.Add(charge);

                hb.Entry(cases).State = EntityState.Modified;

                hb.SaveChanges();
                ViewBag.Error = "Case-Id(" + caseId + "): Rs." + amount + " Paid.";
                return(RedirectToAction("ShowPatientBill", new { id = patientId }));
            }
            catch
            {
                ViewBag.Error = "Error While Creating Appointment , Try Again !!!";
                return(RedirectToAction("AllotWard", new { id = caseId, patientId = patientId }));
            }
        }
Beispiel #3
0
        public ActionResult AllotWard(int patientId, int caseId, string room_Id)
        {
            try
            {
                int     roomId  = Convert.ToInt32(room_Id);
                Room    room    = hb.Rooms.Find(roomId);
                Patient patient = hb.Patients.Find(patientId);
                Case    cases   = hb.Cases.Find(caseId);

                room.status      = "Occupied";
                room.patientName = patient.name;
                room.caseId      = caseId.ToString();

                AddedCharge charge = new AddedCharge();
                charge.type   = "Room Booking ( " + room.type + " )";
                charge.amount = room.charge;
                charge.caseId = caseId;

                cases.bill       += room.charge;
                cases.due        += room.charge;
                cases.roombooking = "yes";

                hb.AddedCharges.Add(charge);
                hb.Entry(room).State  = EntityState.Modified;
                hb.Entry(cases).State = EntityState.Modified;

                hb.SaveChanges();
                ViewBag.Error = "Room Alloted";
                return(RedirectToAction("ShowWards"));
            }
            catch
            {
                ViewBag.Error = "Error While Creating Appointment , Try Again !!!";
                return(RedirectToAction("AllotWard", new { id = caseId, patientId = patientId }));
            }
        }
Beispiel #4
0
        public ActionResult BookAppointment([Bind(Include = "date")] Appointment app, int caseId, string staff_Id, int patientId)
        {
            try
            {
                int     staffId = Convert.ToInt32(staff_Id);
                Staff   staff   = hb.Staffs.Find(staffId);
                Case    cases   = hb.Cases.Find(caseId);
                Patient patient = hb.Patients.Find(patientId);

                AddedCharge c = new AddedCharge();
                c.type   = "Appointment ( Dr." + staff.name + " - " + staff.type + " )";
                c.amount = staff.appcharge;
                c.caseId = caseId;

                cases.bill += staff.appcharge;
                cases.due  += staff.appcharge;

                Appointment book = new Appointment();
                book.date        = app.date;
                book.caseId      = caseId;
                book.staffId     = staffId;
                book.patientname = patient.name;

                hb.Entry(cases).State = EntityState.Modified;
                hb.AddedCharges.Add(c);
                hb.Appointments.Add(book);
                hb.SaveChanges();
                ViewBag.Error = "Appointment Booked.";
                return(RedirectToAction("ShowPatientCase"));
            }
            catch
            {
                ViewBag.Error = "Error While Creating Appointment , Try Again !!!";
                return(RedirectToAction("ShowPatientCase"));
            }
        }