示例#1
0
        // GET: PatientLog/Edit/5
        public ActionResult Detail(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BillingDetailsViewModel viewM = new BillingDetailsViewModel();

            viewM.BillingRecord = db.Billings.Find(id);
            if (viewM.BillingRecord == null)
            {
                return(HttpNotFound());
            }
            viewM.Patient = db.PatientLogs.Find(viewM.BillingRecord.PLRecord);
            if (viewM.Patient == null)
            {
                return(HttpNotFound());
            }

            List <int> idList = (List <int>)Session["billingListOfID"];

            //Populates index variables that the view uses to set up previous/next logic
            for (int i = 0; i < idList.Count; i++)
            {
                if (id == idList[i])
                {
                    viewM.Indexer = i;
                    break;
                }
            }
            viewM.IndexerDisplay = viewM.Indexer + 1;
            if (idList.Count() == 1)
            {
                viewM.SafeIndexerPrev = 0;
                viewM.SafeIndexerNext = 0;
            }
            else
            {
                if (viewM.Indexer == 0)
                {
                    viewM.SafeIndexerPrev = 1;
                }
                else
                {
                    viewM.SafeIndexerPrev = viewM.Indexer - 1;
                }
                if (viewM.Indexer == (idList.Count() - 1))
                {
                    viewM.SafeIndexerNext = viewM.Indexer - 1;
                }
                else
                {
                    viewM.SafeIndexerNext = viewM.Indexer + 1;
                }
            }

            viewM.CPTCodesList = DataCollections.getCPTCodesList(db);
            viewM.MODCodesList = DataCollections.getMODCodesList(db);
            viewM.POSCodesList = DataCollections.getPOSCodesList(db);
            viewM.DXCodesList  = DataCollections.getDXCodesList(db);

            return(View(viewM));
        }