From 4b01436f7c0c38b017166a085efbc642802c35cc Mon Sep 17 00:00:00 2001 From: Rod Roark Date: Mon, 22 Nov 2010 15:49:24 -0800 Subject: [PATCH] Fixes for switching encounters This fixes a couple of bugs where switching to a new encounter fails to properly record that fact into the left_nav frame, with the result that subsequent encounter switches will not cause frames having information from the old encounter to be refreshed. Also a button was added to the payment receipt display to allow switching to the current day's emcounter. --- interface/forms/newpatient/save.php | 10 ++++--- interface/patient_file/front_payment.php | 43 ++++++++++++++++++++++++--- interface/patient_file/history/encounters.php | 2 +- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/interface/forms/newpatient/save.php b/interface/forms/newpatient/save.php index a8f9ef4b3..49edfcea0 100644 --- a/interface/forms/newpatient/save.php +++ b/interface/forms/newpatient/save.php @@ -31,7 +31,7 @@ $mode = $_POST['mode']; $referral_source = $_POST['form_referral_source']; if ($GLOBALS['concurrent_layout']) - $normalurl = "$rootdir/patient_file/encounter/encounter_top.php"; + $normalurl = "patient_file/encounter/encounter_top.php"; else $normalurl = "$rootdir/patient_file/encounter/patient_encounter.php"; @@ -113,7 +113,7 @@ if ($mode == 'new' && $GLOBALS['default_new_encounter_form'] == 'football_injury "lists.title NOT LIKE '%Illness%'"); if (mysql_num_rows($lres)) { - $nexturl = "$rootdir/patient_file/encounter/load_form.php?formname=" . + $nexturl = "patient_file/encounter/load_form.php?formname=" . $GLOBALS['default_new_encounter_form']; while ($lrow = sqlFetchArray($lres)) { $frow = sqlQuery("SELECT count(*) AS count " . @@ -153,12 +153,14 @@ $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_catego ?> top.window.parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray); + top.restoreSession(); parent.left_nav.setEncounter(); parent.left_nav.setRadio(window.name, 'enc'); - - top.restoreSession(); + parent.left_nav.loadFrame('enc2', window.name, ''); + window.location=""; + diff --git a/interface/patient_file/front_payment.php b/interface/patient_file/front_payment.php index d509fbd56..a1627800c 100644 --- a/interface/patient_file/front_payment.php +++ b/interface/patient_file/front_payment.php @@ -89,17 +89,24 @@ function frontPayment($patient_id, $encounter, $method, $source, $amount1, $amou return $payid; } -// Get the patient's encounter ID for today, creating it if there is none. +// Get the patient's encounter ID for today, if it exists. // In the case of more than one encounter today, pick the last one. // -function todaysEncounter($patient_id) { +function todaysEncounterIf($patient_id) { global $today; - $tmprow = sqlQuery("SELECT encounter FROM form_encounter WHERE " . "pid = '$patient_id' AND date = '$today 00:00:00' " . "ORDER BY encounter DESC LIMIT 1"); + return empty($tmprow['encounter']) ? 0 : $tmprow['encounter']; +} + +// Get the patient's encounter ID for today, creating it if there is none. +// +function todaysEncounter($patient_id) { + global $today; - if (!empty($tmprow['encounter'])) return $tmprow['encounter']; + $encounter = todaysEncounterIf($patient_id); + if ($encounter) return $encounter; $tmprow = sqlQuery("SELECT username, facility, facility_id FROM users " . "WHERE id = '" . $_SESSION["authUserID"] . "'"); @@ -306,6 +313,25 @@ if ($_POST['form_save'] || $_REQUEST['receipt']) { window.close(); } + // Called to switch to the specified encounter having the specified DOS. + // This also closes the popup window. + function toencounter(enc, datestr, topframe) { + topframe.restoreSession(); + + // Hard-coding of RBot for this purpose is awkward, but since this is a + // pop-up and our openemr is left_nav, we have no good clue as to whether + // the top frame is more appropriate. + topframe.left_nav.forceDual(); + topframe.left_nav.setEncounter(datestr, enc, ''); + topframe.left_nav.setRadio('RBot', 'enc'); + topframe.left_nav.loadFrame('enc2', 'RBot', 'patient_file/encounter/encounter_top.php?set_encounter=' + enc); + + topframe.Title.location.href = 'encounter/encounter_title.php?set_encounter=' + enc; + topframe.Main.location.href = 'encounter/patient_encounter.php?set_encounter=' + enc; + + window.close(); + } + @@ -356,6 +382,15 @@ if ($_POST['form_save'] || $_REQUEST['receipt']) {

' onclick='printme()' /> +\n"; + } +?> +   ' style='color:red' onclick='deleteme()' /> diff --git a/interface/patient_file/history/encounters.php b/interface/patient_file/history/encounters.php index 397a1d7aa..a1d55d9d5 100644 --- a/interface/patient_file/history/encounters.php +++ b/interface/patient_file/history/encounters.php @@ -120,7 +120,7 @@ function toencounter(rawdata) { parent.left_nav.setEncounter(datestr, enc, window.name); parent.left_nav.setRadio(window.name, 'enc'); - location.href = '../encounter/encounter_top.php?set_encounter=' + enc; + parent.left_nav.loadFrame('enc2', window.name, 'patient_file/encounter/encounter_top.php?set_encounter=' + enc); top.Title.location.href = '../encounter/encounter_title.php?set_encounter=' + enc; top.Main.location.href = '../encounter/patient_encounter.php?set_encounter=' + enc; -- 2.11.4.GIT