public ActionResult ShiftFromIPD(IpdRegistrationMasterModel model)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            pro.InsertIPDShiftDetails(model);
            return(RedirectToAction("Index"));
        }
        public ActionResult PatientBillDetails(int id)
        {
            IpdPatientDeischargedModel    model = new IpdPatientDeischargedModel();
            IpdRegistrationMasterProvider pro   = new IpdRegistrationMasterProvider();
            BillingCounterProvider        Bpro  = new BillingCounterProvider();

            model.OpdID = HospitalManagementSystem.Utility.GetPatientOpdIdFromIpdId(id);

            model = pro.GetPatientBillDetails(id);
            model.IpdRegistrationID = id;

            //model.ObjPatientBillDetailsViewModelNew.AccsubgroupHeadId=
            int PatientAccountHeadId = HospitalManagementSystem.Utility.GetPatientAccHeadIdFromOpdId(model.OpdID);

            if (PatientAccountHeadId > 0)
            {
                model.ObjPatientBillDetailsViewModelNew.BalanceDeposit    = Bpro.getBalanceDeposit(Convert.ToInt32(PatientAccountHeadId));
                model.ObjPatientBillDetailsViewModelNew.AccsubgroupHeadId = PatientAccountHeadId;
            }
            else
            {
                model.ObjPatientBillDetailsViewModelNew.BalanceDeposit = Convert.ToDecimal(0);
            }


            return(View(model));
        }
        public ActionResult Search(IpdSearchResults model)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            model.IpdSearchResultList = pro.Search(model.WardNo, model.RoomType, model.RoomNo);
            return(View(model));
        }
        public ActionResult PatientForInfo(int id, int ipdregid, int romid)
        {
            IpdSearchResults model            = new IpdSearchResults();
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            model.IpdSearchResultList = pro.PatientForIpdAfterDischarge(id, ipdregid, romid);
            return(PartialView("_PatientInfo", model));
        }
        public ActionResult PatientForIpd(int id)
        {
            IpdSearchResults model            = new IpdSearchResults();
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            model.IpdSearchResultList = pro.PatientForIpd(id);
            return(PartialView("_SearchByName", model));
        }
        public ActionResult ShowIpdDetailForIpdMRCommonTest(string FirstName)
        {
            IpdSearchResults model            = new IpdSearchResults();
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            model.IpdSearchResultList = pro.SearchByPatientName(FirstName);
            return(PartialView("_OpdDetailsdata", model));
        }
        public ActionResult _SearchByNameData(string firstname)
        {
            IpdSearchResults model            = new IpdSearchResults();
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            model.IpdSearchResultList = pro.SearchByPatientName(firstname);
            return(PartialView("_SearchByName", model));
        }
        public ActionResult PaidPatientResistrationIndex()
        {
            IpdRegistrationMasterProvider  pro    = new IpdRegistrationMasterProvider();
            List <CentralizedBillingModel> query3 = pro.GetAllFromCentrBilling();

            ViewBag.Data = query3;
            return(View());
        }
        //sShow EntryBed Before
        public ActionResult _GetPatientDetails(int OpdNoEmergencyNo)
        {
            IpdRegistrationMasterProvider pro   = new IpdRegistrationMasterProvider();
            IpdRegistrationMasterModel    model = new IpdRegistrationMasterModel();

            ViewBag.DetailsData = pro.GetOpdModelList(OpdNoEmergencyNo);
            return(PartialView("_GetPatientDetails", model));
        }
        public ActionResult PatientBillDetails(IpdPatientDeischargedModel model)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            pro.InsertPatientBedDetailDischarge(model);
            return(RedirectToAction("Index"));
            //return RedirectToAction("PrintBillCb", "BillingCounter");
        }
        public ActionResult IpdWardDetails(IpdRegistrationMasterModel model)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            model.IPDWardDetailsViewModelList = new List <IPDWardDetailsViewModel>();
            model.IPDWardDetailsViewModelList = pro.GetIpdWardDetails(model);
            return(PartialView("_WardDetails", model));
        }
        public PartialViewResult GetDailyIPdReport(DateTime RegistrationDate)
        {
            IpdSearchResults model            = new IpdSearchResults();
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();
            EHMSEntities ent = new EHMSEntities();

            model = pro.GetDailyIpdReport(RegistrationDate);
            return(PartialView(model));
        }
        //subin Vital
        public ActionResult IpdVital(int id)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();
            int i = Utility.patientlogid(id);
            VitalForOthersModel model = new VitalForOthersModel();

            model.lstOfVitalForOthersModel = pro.GetListOfVitalWithPatientId(id);
            model.PatinetLogId             = i;
            model.OpdId = id;

            return(View(model));
        }
        public ActionResult CreateNewPatient(OpdModel model)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            if (ModelState.IsValid)
            {
                int i = pro.NewPatientInsert(model);
                return(RedirectToAction("Create", new { id = i }));
            }
            else
            {
                return(View(model));
            }
        }
        public ActionResult InsertFroCentralizeBillingInIPDResistrationMaster(IpdRegistrationMasterModel model)
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            if (ModelState.IsValid)
            {
                pro.InsertCeltralBillingPatientINIPDResistrationMaster(model);
                return(RedirectToAction("Index"));
            }

            else
            {
                return(RedirectToAction("InsertFroCentralizeBillingInIPDResistrationMaster"));
            }
        }
        public ActionResult EditVital(VitalForOthersModel model)
        {
            string str = "";
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            int i = pro.EditIpdVital(model);

            if (i != 0)
            {
                TempData["Success"] = UtilityMessage.edit;
            }
            else
            {
                TempData["Success"] = UtilityMessage.editfailed;
            }
            return(RedirectToAction("IpdVital", new { id = model.OpdId }));
        }
        public ActionResult Discharge(IpdDischargeModel model)
        {
            EHMSEntities ent = new EHMSEntities();

            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();
            int i = pro.InsertInDischarge(model);

            if (i != 0)
            {
                pro.PatientDischargeinIpd(model.ipdResistrationID);

                TempData["success"] = "Discharge Success";
                View(model);
                //return RedirectToAction("Index");
            }
            var data = ent.IpdDischarges.Where(m => m.ipdResistrationID == model.ipdResistrationID).Select(m => m.IpdDischargeID).FirstOrDefault();



            return(RedirectToAction("EditDischarged", "PatientDischarged", new { id = data, opdid = model.Opdid, ipdregid = model.ipdResistrationID, bedid = model.IpdPatientRoomDetailId }));
        }
        public ActionResult ShiftFromIPD(int id, int ipdid)
        {
            int OpdId             = id;
            int IpdRegistrationID = ipdid;
            IpdRegistrationMasterModel    model = new IpdRegistrationMasterModel();
            IpdRegistrationMasterProvider pro   = new IpdRegistrationMasterProvider();

            model.ObjShiftFromIPDViewModel = new ShiftFromIPDViewModel();
            model.OpdNoEmergencyNo         = id;
            model.IpdRegistrationID        = ipdid;

            if (pro.IsPatientAlreadyShiftedFromIPD(model.OpdNoEmergencyNo, model.IpdRegistrationID))
            {
                model = pro.GetIpdShiftDetailsOfPatient(id, ipdid);
                model.ObjShiftFromIPDViewModel.Status = true;
            }
            else
            {
                model.ObjShiftFromIPDViewModel.Status = false;
            }


            return(View(model));
        }
        public ActionResult SearchIpdPatientByName(string value)
        {
            EHMSEntities                  ent       = new EHMSEntities();
            IpdPartialDetails             IPDModel  = new IpdPartialDetails();
            List <IpdPartialDetails>      Opdmodel  = new List <IpdPartialDetails>();
            List <IpdPartialDetails>      Opdmodel1 = new List <IpdPartialDetails>();
            IpdRegistrationMasterProvider pro       = new IpdRegistrationMasterProvider();
            var OpdidData = ent.OpdMasters.Where(m => m.FirstName + " " + (m.MiddleName + " " ?? string.Empty) + m.LastName == value).Select(n => n.OpdID).ToList();

            foreach (var items in OpdidData)
            {
                var a  = items.ToString();
                var cc = pro.GetPatientlistByName(a);
                foreach (var itemss in cc)
                {
                    Opdmodel1.Add(itemss);
                }
            }

            IPDModel.IpdPartialDetailsList = Opdmodel1;


            return(View(IPDModel));
        }
        //by subin

        public ActionResult IpdVitalIndex()
        {
            IpdRegistrationMasterProvider pro = new IpdRegistrationMasterProvider();

            return(View());
        }