function todaysEncounterCheck($patient_id, $enc_date = '', $reason = '', $fac_id = '', $billing_fac = '', $provider = '', $cat = '', $return_existing = true) { global $today; $encounter = todaysEncounterIf($patient_id); if ($encounter) { if ($return_existing) { return $encounter; } else { return 0; } } $dos = $enc_date ? $enc_date : $today; $visit_reason = $reason ? $reason : 'Please indicate visit reason'; $tmprow = sqlQuery("SELECT username, facility, facility_id FROM users WHERE id = ?", array($_SESSION["authUserID"])); $username = $tmprow['username']; $facility = $tmprow['facility']; $facility_id = $fac_id ? (int) $fac_id : $tmprow['facility_id']; $billing_facility = $billing_fac ? (int) $billing_fac : $tmprow['facility_id']; $visit_provider = $provider ? (int) $provider : '(NULL)'; $visit_cat = $cat ? $cat : '(NULL)'; $conn = $GLOBALS['adodb']['db']; $encounter = $conn->GenID("sequences"); addForm($encounter, "New Patient Encounter", sqlInsert("INSERT INTO form_encounter SET " . "date = ?, " . "reason = ?, " . "facility = ?, " . "facility_id = ?, " . "billing_facility = ?, " . "provider_id = ?, " . "pid = ?, " . "encounter = ?," . "pc_catid = ?", array($dos, $visit_reason, $facility, $facility_id, $billing_facility, $visit_provider, $patient_id, $encounter, $visit_cat)), "newpatient", $patient_id, "1", "NOW()", $username); return $encounter; }
<td><?php echo text($payrow['user']); ?> </td> </tr> </table> <div id='hideonprint'> <p> <input type='button' value='<?php echo xla('Print'); ?> ' onclick='printme()' /> <?php $todaysenc = todaysEncounterIf($pid); if ($todaysenc && $todaysenc != $encounter) { echo " <input type='button' " . "value='" . xla('Open Today`s Visit') . "' " . "onclick='toencounter({$todaysenc},\"{$today}\",opener.top)' />\n"; } ?> <?php if (acl_check('admin', 'super')) { ?> <input type='button' value='<?php xl('Delete', 'e'); ?> ' style='color:red' onclick='deleteme()' /> <?php }
function todaysEncounter($patient_id) { global $today; $encounter = todaysEncounterIf($patient_id); if ($encounter) { return $encounter; } $tmprow = sqlQuery("SELECT username, facility, facility_id FROM users " . "WHERE id = '" . $_SESSION["authUserID"] . "'"); $username = $tmprow['username']; $facility = $tmprow['facility']; $facility_id = $tmprow['facility_id']; $conn = $GLOBALS['adodb']['db']; $encounter = $conn->GenID("sequences"); addForm($encounter, "New Patient Encounter", sqlInsert("INSERT INTO form_encounter SET " . "date = '{$today}', " . "onset_date = '{$today}', " . "reason = 'Please indicate visit reason', " . "facility = '{$facility}', " . "facility_id = '{$facility_id}', " . "pid = '{$patient_id}', " . "encounter = '{$encounter}'"), "newpatient", $patient_id, "1", "NOW()", $username); return $encounter; }