function showDocument(&$drow) { global $ISSUE_TYPES, $auth_med; $docdate = $drow['docdate']; echo "<tr class='text docrow' id='" . htmlspecialchars($drow['id'], ENT_QUOTES) . "' title='" . htmlspecialchars(xl('View document'), ENT_QUOTES) . "'>\n"; // show date echo "<td>" . htmlspecialchars(oeFormatShortDate($docdate), ENT_NOQUOTES) . "</td>\n"; // show associated issue, if any echo "<td>"; if ($auth_med) { $irow = sqlQuery("SELECT type, title, begdate " . "FROM lists WHERE " . "id = ? " . "LIMIT 1", array($drow['list_id'])); if ($irow) { $tcode = $irow['type']; if ($ISSUE_TYPES[$tcode]) { $tcode = $ISSUE_TYPES[$tcode][2]; } echo htmlspecialchars("{$tcode}: " . $irow['title'], ENT_NOQUOTES); } } else { echo "(" . htmlspecialchars(xl('No access'), ENT_NOQUOTES) . ")"; } echo "</td>\n"; // show document name and category echo "<td colspan='3'>" . htmlspecialchars(xl('Document') . ": " . basename($drow['url']) . ' (' . xl_document_category($drow['name']) . ')', ENT_NOQUOTES) . "</td>\n"; // skip billing and insurance columns if (!$GLOBALS['athletic_team']) { echo "<td colspan=5> </td>\n"; } echo "</tr>\n"; }
function Forms2_Cardiology_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_Forms2_Cardiology", $id); if ($data) { print "<hr><table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } if ($value == "on") { $value = "yes"; } $key = ucwords(str_replace("_", " ", $key)); $mykey = $key . ": "; $myval = stripslashes($value); print "<td><span class=bold>" . xl("{$mykey}") . "</span><span class=text>" . xl("{$myval}") . "</span></td>"; $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table><hr>"; }
function getInterval() { if (is_null($this->interval) || is_null($this->intervalType)) { return null; } return xl($this->interval) . " x " . " " . xl($this->intervalType->lbl); }
function procedure_order_report($pid, $encounter, $cols, $id) { $cols = 1; // force always 1 column $count = 0; $data = sqlQuery("SELECT * " . "FROM procedure_order WHERE " . "procedure_order_id = '{$id}' AND activity = '1'"); if ($data) { print "<table cellpadding='0' cellspacing='0'>\n<tr>\n"; foreach ($data as $key => $value) { if ($key == "procedure_order_id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0" || $value == "0.00") { continue; } $key = ucwords(str_replace("_", " ", $key)); if ($key == "Order Priority") { print "<td valign='top'><span class='bold'>" . xl($key) . ": </span><span class='text'>" . generate_display_field(array('data_type' => '1', 'list_id' => 'ord_priority'), $value) . " </span></td>\n"; } else { if ($key == "Order Status") { print "<td valign='top'><span class='bold'>" . xl($key) . ": </span><span class='text'>" . generate_display_field(array('data_type' => '1', 'list_id' => 'ord_status'), $value) . " </span></td>\n"; } else { print "<td valign='top'><span class='bold'>" . xl($key) . ": </span><span class='text'>{$value} </span></td>\n"; } } $count++; if ($count == $cols) { $count = 0; print "</tr>\n<tr>\n"; } } print "</tr>\n</table>\n"; } }
function soap_report($pid, $encounter, $cols, $id) { $cols = 1; // force always 1 column $count = 0; $data = formFetch("form_soap", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } if ($value == "on") { $value = "yes"; } $key = ucwords(str_replace("_", " ", $key)); print "<td><span class=bold>" . xl($key) . ": </span><span class=text>{$value}</span></td>"; $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
function checkCreateCDB() { $globalsres = sqlStatement("SELECT gl_name, gl_index, gl_value FROM globals WHERE gl_name IN \n ('couchdb_host','couchdb_user','couchdb_pass','couchdb_port','couchdb_dbase','document_storage_method')"); $options = array(); while ($globalsrow = sqlFetchArray($globalsres)) { $GLOBALS[$globalsrow['gl_name']] = $globalsrow['gl_value']; } $directory_created = false; if ($GLOBALS['document_storage_method'] != 0) { // /documents/temp/ folder is required for CouchDB if (!is_dir($GLOBALS['OE_SITE_DIR'] . '/documents/temp/')) { $directory_created = mkdir($GLOBALS['OE_SITE_DIR'] . '/documents/temp/', 0777, true); if (!$directory_created) { echo htmlspecialchars(xl("Failed to create temporary folder. CouchDB will not work."), ENT_NOQUOTES); } } $couch = new CouchDB(); if (!$couch->check_connection()) { echo "<script type='text/javascript'>alert('" . addslashes(xl("CouchDB Connection Failed.")) . "');</script>"; return; } if ($GLOBALS['couchdb_host'] || $GLOBALS['couchdb_port'] || $GLOBALS['couchdb_dbase']) { $couch->createDB($GLOBALS['couchdb_dbase']); $couch->createView($GLOBALS['couchdb_dbase']); } } return true; }
function reviewofs_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_reviewofs", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } if ($value == "on") { $value = "yes"; } $key = ucwords(str_replace("_", " ", $key)); //modified by BM 07-2009 for internationalization if ($key == "Additional Notes") { print "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . text($value) . "</span></td>"; } else { print "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . xl($value) . "</span></td>"; } $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
private function optInStrategy($email) { $curl = curl_init('https://reg.open-emr.org/api/registration'); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array('email' => $email))); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $responseBodyRaw = curl_exec($curl); $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); switch ($responseCode) { case 201: $responseBodyParsed = json_decode($responseBodyRaw); sqlStatement('INSERT INTO product_registration (registration_id, email, opt_out) VALUES (?, ?, ?)', array($responseBodyParsed->productId, $email, false)); return $responseBodyParsed->productId; break; case 400: throw new InvalidEmailException($email . ' ' . xl("is not a valid email address")); break; case 409: throw new DuplicateRegistrationException(xl("Already registered")); break; default: throw new GenericProductRegistrationException(xl("Server error: try again later")); } }
/** * Display the patient reminder widget. * * @param integer $patient_id pid of selected patient * @param string $dateTarget target date (format Y-m-d H:i:s). If blank then will test with current date as target. */ function patient_reminder_widget($patient_id, $dateTarget = '') { // Set date to current if not set $dateTarget = $dateTarget ? $dateTarget : date('Y-m-d H:i:s'); // Update reminders for patient update_reminders($dateTarget, $patient_id); // Fetch the active reminders $listReminders = fetch_reminders($patient_id); if (empty($listReminders)) { // No reminders to show. echo htmlspecialchars(xl('No active patient reminders.'), ENT_NOQUOTES); return; } echo "<table cellpadding='0' cellspacing='0'>"; foreach ($listReminders as $reminder) { echo "<tr><td style='padding:0 1em 0 1em;'><span class='small'>"; // show reminder label echo generate_display_field(array('data_type' => '1', 'list_id' => 'rule_action_category'), $reminder['category']) . ": " . generate_display_field(array('data_type' => '1', 'list_id' => 'rule_action'), $reminder['item']); echo "</span></td><td style='padding:0 1em 0 1em;'><span class='small'>"; // show reminder due status echo generate_display_field(array('data_type' => '1', 'list_id' => 'rule_reminder_due_opt'), $reminder['due_status']); echo "</span></td><td style='padding:0 1em 0 1em;'><span class='small'>"; // show reminder sent date if (empty($reminder['date_sent'])) { echo htmlspecialchars(xl('Reminder Not Sent Yet'), ENT_NOQUOTES); } else { echo htmlspecialchars(xl('Reminder Sent On') . ": " . $reminder['date_sent'], ENT_NOQUOTES); } echo "</span></td></tr>"; } echo "</table>"; }
function endDoctor(&$docrow) { global $grand_total_charges, $grand_total_copays, $grand_total_encounters; if (!$docrow['docname']) { return; } echo " <tr class='report_totals'>\n"; echo " <td colspan='5'>\n"; echo " " . xl('Totals for', '', '', ' ') . $docrow['docname'] . "\n"; echo " </td>\n"; echo " <td align='right'>\n"; echo " " . $docrow['encounters'] . " \n"; echo " </td>\n"; echo " <td align='right'>\n"; echo " "; bucks($docrow['charges']); echo " \n"; echo " </td>\n"; echo " <td align='right'>\n"; echo " "; bucks($docrow['copays']); echo " \n"; echo " </td>\n"; echo " <td colspan='2'>\n"; echo " \n"; echo " </td>\n"; echo " </tr>\n"; $grand_total_charges += $docrow['charges']; $grand_total_copays += $docrow['copays']; $grand_total_encounters += $docrow['encounters']; $docrow['charges'] = 0; $docrow['copays'] = 0; $docrow['encounters'] = 0; }
function getType() { if ($this->type == "min") { return xl("Min"); } else { return xl("Max"); } }
function psychiatrisch_onderzoek_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_psychiatrisch_onderzoek", $id); if ($data) { print "<table>"; foreach ($data as $key => $value) { // here we check for current ???? what ? session ? if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } // larry :: ??? - is this for check box or select or what ? if ($value == "on") { $value = "yes"; } // Datum onderzoek if ($key == "datum_onderzoek") { print "<tr><td><span class=bold>" . xl('Examination Date') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Reden van aanmelding if ($key == "reden_van_aanmelding") { print "<tr><td><span class=bold>" . xl('Reason for Visit') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Conclusie van intake if ($key == "conclusie_van_intake") { print "<tr><td><span class=bold>" . xl('Intake Conclusion') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Medicatie if ($key == "medicatie") { print "<tr><td><span class=bold>" . xl('Medications') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Anamnese if ($key == "anamnese") { print "<tr><td><span class=bold>" . xl('History') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Psychiatrisch onderzoek i.e.z. if ($key == "psychiatrisch_onderzoek") { print "<tr><td><span class=bold>" . xl('Psychiatric Examination') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Beschrijvende conclusie if ($key == "beschrijvende_conclusie") { print "<tr><td><span class=bold>" . xl('Conclusions') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // Behandelvoorstel if ($key == "behandelvoorstel") { print "<tr><td><span class=bold>" . xl('Treatment Plan') . ": </span><span class=text>" . nl2br(stripslashes($value)) . "</span></td></tr>"; } // increment records counter $count++; // check if not at the end close/open new row if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
function is_clinic($code) { global $bcodes; $i = strpos($code, ':'); if ($i) { $code = substr($code, 0, $i); } return $bcodes['CPT4'][xl('Lab')][$code] || $bcodes['CPT4'][xl('Immunizations')][$code] || $bcodes['HCPCS'][xl('Therapeutic Injections')][$code]; }
function hsc_private_xl_or_warn($key) { if (function_exists('xl')) { return xl($key); } else { trigger_error('Translation via xl() was requested, but the xl()' . ' function is not defined, yet.', E_USER_WARNING); return $key; } }
function getRequirements() { $requirements .= xl("Completed") . ": "; $requirements .= $this->completed ? xl("Yes") : xl("No"); $requirements .= " | "; $requirements .= xl("Frequency") . ": "; $requirements .= $this->decodeComparator($this->frequencyComparator) . " " . $this->frequency . " "; return $requirements; }
function newpatient_report($pid, $encounter, $cols, $id) { $res = sqlStatement("select * from form_encounter where pid='{$pid}' and id='{$id}'"); print "<table><tr><td>\n"; while ($result = sqlFetchArray($res)) { print "<span class=bold>" . xl('Reason') . ": </span><span class=text>" . $result["reason"] . "<br>\n"; print "<span class=bold>" . xl('Facility') . ": </span><span class=text>" . $result["facility"] . "<br>\n"; } print "</td></tr></table>\n"; }
function smarty_function_xl($params, &$smarty) { if (empty($params['t'])) { $smarty->trigger_error("xk: missing 't' parameter"); return; } else { $translate = $params['t']; } xl($translate, 'e'); }
function LBFathv_javascript() { global $formid; echo "// Compute Body Mass Index.\nfunction athvComputeBMI() {\n var f = document.forms[0];\n var bmi = 0;\n var stat = '';\n var height = parseFloat(f.form_height_in.value);\n var weight = parseFloat(f.form_weight_lbs.value);\n if(isNaN(height) || isNaN(weight) || height <= 0 || weight <= 0) {\n bmi = '';\n }\n else {\n bmi = weight / height / height * 703;\n bmi = bmi.toFixed(1);\n if (bmi > 42 ) stat = '" . xl('Obesity III') . "';\n else if (bmi > 34 ) stat = '" . xl('Obesity II') . "';\n else if (bmi > 30 ) stat = '" . xl('Obesity I') . "';\n else if (bmi > 27 ) stat = '" . xl('Overweight') . "';\n else if (bmi > 18.5) stat = '" . xl('Normal') . "';\n else stat = '" . xl('Underweight') . "';\n }\n if (f.form_bmi) f.form_bmi.value = bmi;\n if (f.form_bmi_status) f.form_bmi_status.value = stat;\n}\n"; echo "// Height in cm has changed.\nfunction athv_height_cm_changed() {\n var f = document.forms[0];\n var cm = f.form_height_cm.value;\n if (cm == parseFloat(cm)) {\n inch = cm / 2.54;\n f.form_height_in.value = inch.toFixed(2);\n }\n else {\n f.form_height_in.value = '';\n }\n athvComputeBMI();\n}\n"; echo "// Height in inches has changed.\nfunction athv_height_in_changed() {\n var f = document.forms[0];\n var inch = f.form_height_in.value;\n if (inch == parseFloat(inch)) {\n cm = inch * 2.54;\n f.form_height_cm.value = cm.toFixed(2);\n }\n else {\n f.form_height_cm.value = '';\n }\n athvComputeBMI();\n}\n"; echo "// Weight in kg has changed.\nfunction athv_weight_kg_changed() {\n var f = document.forms[0];\n var kg = f.form_weight_kg.value;\n if (kg == parseFloat(kg)) {\n lbs = kg / 0.45359237;\n f.form_weight_lbs.value = lbs.toFixed(2);\n }\n else {\n f.form_weight_lbs.value = '';\n }\n athvComputeBMI();\n}\n"; echo "// Weight in lbs has changed.\nfunction athv_weight_lbs_changed() {\n var f = document.forms[0];\n var lbs = f.form_weight_lbs.value;\n if (lbs == parseFloat(lbs)) {\n kg = lbs * 0.45359237;\n f.form_weight_kg.value = kg.toFixed(2);\n }\n else {\n f.form_weight_kg.value = '';\n }\n athvComputeBMI();\n}\n"; echo "// Temperature in centigrade has changed.\nfunction athv_temperature_c_changed() {\n var f = document.forms[0];\n var tc = f.form_temperature_c.value;\n if (tc == parseFloat(tc)) {\n tf = tc * 9 / 5 + 32;\n f.form_temperature_f.value = tf.toFixed(2);\n }\n else {\n f.form_temperature_f.value = '';\n }\n}\n"; echo "// Temperature in farenheit has changed.\nfunction athv_temperature_f_changed() {\n var f = document.forms[0];\n var tf = f.form_temperature_f.value;\n if (tf == parseFloat(tf)) {\n tc = (tf - 32) * 5 / 9;\n f.form_temperature_c.value = tc.toFixed(2);\n }\n else {\n f.form_temperature_c.value = '';\n }\n}\n"; }
function __construct($c, $ct, $desc, $price, $category) { $this->code = $c; $this->code_type = $ct; $this->description = $desc; $this->price = $price; $this->category = $category; if ($price == null) { $this->price = xl("Not Specified"); } }
function getTableNameOptions() { $options = array(); $stmts = sqlStatement("SHOW TABLES"); for ($iter = 0; $row = sqlFetchArray($stmts); $iter++) { foreach ($row as $key => $value) { array_push($options, array("id" => out($value), "label" => out(xl($value)))); } } return $options; }
function getLayoutLabel($value, $form_id) { // get from layout_options $sql = sqlStatement("SELECT title from layout_options WHERE form_id = ? and field_id = ?", array($form_id, $value)); if (sqlNumRows($sql) > 0) { $result = sqlFetchArray($sql); return xl($result['title']); } // if not found, default to the passed-in value return $value; }
function image_widget($doc_id, $doc_catg) { global $pid, $web_root; $docobj = new Document($doc_id); $image_file = $docobj->get_url_file(); $extension = substr($image_file, strrpos($image_file, ".")); $viewable_types = array('.png', '.jpg', '.jpeg', '.png', '.bmp'); // image ext supported by fancybox viewer if (in_array($extention, $viewable_types) == 0) { // extention matches list $to_url = "<a href = {$web_root}" . "/controller.php?document&retrieve&patient_id={$pid}&document_id={$doc_id}" . "/tmp.{$extension}" . " onclick=top.restoreSession(); class='image_modal'>" . " <img src = {$web_root}" . "/controller.php?document&retrieve&patient_id={$pid}&document_id={$doc_id}" . " width=100 alt='{$doc_catg}:{$image_file}' align='center'>" . htmlspecialchars(" {$doc_catg}: {$image_file}") . " </a> <br /><br />"; } else { $to_url = "<a href='" . $web_root . "/controller.php?document&retrieve" . "&patient_id={$pid}&document_id={$doc_id}'" . " onclick='top.restoreSession()' class='css_button_small'>" . "<span>" . htmlspecialchars(xl("View"), ENT_QUOTES) . "</a> " . htmlspecialchars("{$doc_catg} - {$image_file}", ENT_QUOTES) . "</span> <br /><br />"; } echo $to_url; }
function generate_list_payment_category($tag_name, $list_id, $currvalue, $title, $empty_name = ' ', $class = '', $onchange = '', $PaymentType = 'insurance', $screen = 'new_payment') { $s = ''; $tag_name_esc = htmlspecialchars($tag_name, ENT_QUOTES); $s .= "<select name='{$tag_name_esc}' id='{$tag_name_esc}'"; if ($class) { $s .= " class='{$class}'"; } if ($onchange) { $s .= " onchange='{$onchange}'"; } $selectTitle = htmlspecialchars($title, ENT_QUOTES); $s .= " title='{$selectTitle}'>"; $selectEmptyName = htmlspecialchars(xl($empty_name), ENT_QUOTES); if ($empty_name) { $s .= "<option value=''>" . $selectEmptyName . "</option>"; } $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id)); $got_selected = FALSE; while ($lrow = sqlFetchArray($lres)) { $optionValue = htmlspecialchars($lrow['option_id'], ENT_QUOTES); $s .= "<option id='option_" . $lrow['option_id'] . "'" . " value='{$optionValue}'"; if (strlen($currvalue) == 0 && $lrow['is_default'] || strlen($currvalue) > 0 && $lrow['option_id'] == $currvalue || $lrow['option_id'] == 'insurance_payment' && $screen == 'new_payment') { $s .= " selected"; $got_selected = TRUE; } if (($PaymentType == 'insurance' || $screen == 'new_payment') && ($lrow['option_id'] == 'family_payment' || $lrow['option_id'] == 'patient_payment')) { $s .= " style='background-color:#DEDEDE' "; } if ($PaymentType == 'patient' && $lrow['option_id'] == 'insurance_payment') { $s .= " style='background-color:#DEDEDE' "; } $optionLabel = htmlspecialchars(xl_list_label($lrow['title']), ENT_QUOTES); $s .= ">{$optionLabel}</option>\n"; } if (!$got_selected && strlen($currvalue) > 0) { $currescaped = htmlspecialchars($currvalue, ENT_QUOTES); $s .= "<option value='{$currescaped}' selected>* {$currescaped} *</option>"; $s .= "</select>"; $fontTitle = htmlspecialchars(xl('Please choose a valid selection from the list.'), ENT_QUOTES); $fontText = htmlspecialchars(xl('Fix this'), ENT_QUOTES); $s .= " <font color='red' title='{$fontTitle}'>{$fontText}!</font>"; } else { $s .= "</select>"; } return $s; }
function LBFvbf_javascript() { global $formid; echo "// Compute Body Mass Index.\nfunction vbfComputeBMI() {\n var f = document.forms[0];\n var bmi = 0;\n var stat = '';\n var height = parseFloat(f.form_height_in.value);\n var weight = parseFloat(f.form_weight_lbs.value);\n if(isNaN(height) || isNaN(weight) || height <= 0 || weight <= 0) {\n bmi = '';\n }\n else {\n bmi = weight / height / height * 703;\n bmi = bmi.toFixed(1);\n if (bmi > 42 ) stat = '" . xl('Obesity III') . "';\n else if (bmi > 34 ) stat = '" . xl('Obesity II') . "';\n else if (bmi > 30 ) stat = '" . xl('Obesity I') . "';\n else if (bmi > 27 ) stat = '" . xl('Overweight') . "';\n else if (bmi > 18.5) stat = '" . xl('Normal') . "';\n else stat = '" . xl('Underweight') . "';\n }\n if (f.form_bmi) f.form_bmi.value = bmi;\n if (f.form_bmi_status) f.form_bmi_status.value = stat;\n}\n"; echo "// Height in cm has changed.\nfunction vbf_height_cm_changed() {\n var f = document.forms[0];\n var cm = f.form_height_cm.value;\n if (cm == parseFloat(cm)) {\n inch = cm / 2.54;\n f.form_height_in.value = inch.toFixed(2);\n }\n else {\n f.form_height_in.value = '';\n }\n vbfComputeBMI();\n}\n"; echo "// Height in inches has changed.\nfunction vbf_height_in_changed() {\n var f = document.forms[0];\n var inch = f.form_height_in.value;\n if (inch == parseFloat(inch)) {\n cm = inch * 2.54;\n f.form_height_cm.value = cm.toFixed(2);\n }\n else {\n f.form_height_cm.value = '';\n }\n vbfComputeBMI();\n}\n"; echo "// Weight in kg has changed.\nfunction vbf_weight_kg_changed() {\n var f = document.forms[0];\n var kg = f.form_weight_kg.value;\n if (kg == parseFloat(kg)) {\n lbs = kg / 0.45359237;\n f.form_weight_lbs.value = lbs.toFixed(2);\n }\n else {\n f.form_weight_lbs.value = '';\n }\n vbfComputeBMI();\n}\n"; echo "// Weight in lbs has changed.\nfunction vbf_weight_lbs_changed() {\n var f = document.forms[0];\n var lbs = f.form_weight_lbs.value;\n if (lbs == parseFloat(lbs)) {\n kg = lbs * 0.45359237;\n f.form_weight_kg.value = kg.toFixed(2);\n }\n else {\n f.form_weight_kg.value = '';\n }\n vbfComputeBMI();\n}\n"; echo "// Temperature in centigrade has changed.\nfunction vbf_temperature_c_changed() {\n var f = document.forms[0];\n var tc = f.form_temperature_c.value;\n if (tc == parseFloat(tc)) {\n tf = tc * 9 / 5 + 32;\n f.form_temperature_f.value = tf.toFixed(2);\n }\n else {\n f.form_temperature_f.value = '';\n }\n}\n"; echo "// Temperature in farenheit has changed.\nfunction vbf_temperature_f_changed() {\n var f = document.forms[0];\n var tf = f.form_temperature_f.value;\n if (tf == parseFloat(tf)) {\n tc = (tf - 32) * 5 / 9;\n f.form_temperature_c.value = tc.toFixed(2);\n }\n else {\n f.form_temperature_c.value = '';\n }\n}\n"; // Compute patient age and sex. $ptrow = sqlQuery("SELECT DOB, sex FROM patient_data WHERE " . "pid = '{$pid}' LIMIT 1"); $pt_age = 0 + getpatientAge($ptrow['DOB']); $pt_sex = strtoupper(substr($ptrow['sex'], 0, 1)) == 'F' ? 1 : 0; echo "// Compute Body Fat Percentage.\nfunction vbfComputeBF() {\n var f = document.forms[0];\n var age = {$pt_age}; // Patient age in years\n var sex = {$pt_sex}; // 0 = Male, 1 = Female\n if (!f.form_sf_sum || !f.form_body_fat) return;\n var sfsum = f.form_sf_sum.value;\n if (sfsum != parseFloat(sfsum) || sfsum <= 0) {\n f.form_body_fat.value = '';\n return;\n }\n var d = 0;\n var sflog = Math.LOG10E * Math.log(sfsum);\n if (sex == 0) {\n if (age < 17) d = 1.1533 - 0.0643 * sflog;\n else if (age < 20) d = 1.1620 - 0.0630 * sflog;\n else if (age < 30) d = 1.1631 - 0.0632 * sflog;\n else if (age < 40) d = 1.1422 - 0.0544 * sflog;\n else if (age < 50) d = 1.1620 - 0.0700 * sflog;\n else d = 1.1715 - 0.0779 * sflog;\n }\n else {\n if (age < 17) d = 1.1369 - 0.0598 * sflog;\n else if (age < 20) d = 1.1549 - 0.0678 * sflog;\n else if (age < 30) d = 1.1599 - 0.0717 * sflog;\n else if (age < 40) d = 1.1423 - 0.0632 * sflog;\n else if (age < 50) d = 1.1333 - 0.0612 * sflog;\n else d = 1.1339 - 0.0645 * sflog;\n }\n var bf = 495 / d - 450;\n f.form_body_fat.value = bf.toFixed(2);\n}\n"; echo "// Tally skin fold measurements.\nfunction vbfSFChanged() {\n var f = document.forms[0];\n var sum = 0;\n for (var i = 0; i < f.elements.length; ++i) {\n var e = f.elements[i];\n if (e.name.substring(0,8) == 'form_sf_' && e.name != 'form_sf_sum') {\n if (e.value == parseFloat(e.value)) sum += parseFloat(e.value);\n }\n }\n f.form_sf_sum.value = sum.toFixed(2);\n vbfComputeBF();\n}\n"; }
function cms_portal_call($args) { $portal_url = $GLOBALS['gbl_portal_cms_address'] . "/wp-content/plugins/sunset-patient-portal/webserve.php"; $args['login'] = $GLOBALS['gbl_portal_cms_username']; $args['password'] = $GLOBALS['gbl_portal_cms_password']; if (($phandle = curl_init($portal_url)) === FALSE) { die(text(xl('Unable to access URL') . " '{$portal_url}'")); } curl_setopt($phandle, CURLOPT_POST, TRUE); curl_setopt($phandle, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($phandle, CURLOPT_POSTFIELDS, $args); if (($presult = curl_exec($phandle)) === FALSE) { die(text(xl('curl_exec failed') . ': ' . curl_error($phandle))); } curl_close($phandle); // With JSON-over-HTTP we would use json_decode($presult,TRUE) here. return unserialize($presult); }
function send_email($subject, $body) { $recipient = $GLOBALS['practice_return_email_path']; if (empty($recipient)) { return; } $mail = new PHPMailer(); $mail->From = $recipient; $mail->FromName = 'In-House Pharmacy'; $mail->isMail(); $mail->Host = "localhost"; $mail->Mailer = "mail"; $mail->Body = $body; $mail->Subject = $subject; $mail->AddAddress($recipient); if (!$mail->Send()) { error_log(xl('There has been a mail error sending to', '', '', ' ') . $recipient . " " . $mail->ErrorInfo); } }
function physical_exam_report($pid, $encounter, $cols, $id) { global $pelines; $rows = array(); $res = sqlStatement("SELECT * FROM form_physical_exam WHERE forms_id = '{$id}'"); while ($row = sqlFetchArray($res)) { $rows[$row['line_id']] = $row; } echo "<table cellpadding='0' cellspacing='0'>\n"; foreach ($pelines as $sysname => $sysarray) { $sysnamedisp = xl($sysname); foreach ($sysarray as $line_id => $description) { $linedbrow = $rows[$line_id]; if (!($linedbrow['wnl'] || $linedbrow['abn'] || $linedbrow['diagnosis'] || $linedbrow['comments'])) { continue; } if ($sysname != '*') { // observation line echo " <tr>\n"; echo " <td class='text' align='center'>" . ($linedbrow['wnl'] ? "WNL" : "") . " </td>\n"; echo " <td class='text' align='center'>" . ($linedbrow['abn'] ? "ABN1" : "") . " </td>\n"; echo " <td class='text' nowrap>{$sysnamedisp} </td>\n"; echo " <td class='text' nowrap>{$description} </td>\n"; echo " <td class='text'>" . $linedbrow['diagnosis'] . " </td>\n"; echo " <td class='text'>" . htmlentities($linedbrow['comments']) . "</td>\n"; echo " </tr>\n"; } else { // treatment line echo " <tr>\n"; echo " <td class='text' align='center'>" . ($linedbrow['wnl'] ? "Y" : "") . " </td>\n"; echo " <td class='text' align='center'> </td>\n"; echo " <td class='text' colspan='2' nowrap>{$description} </td>\n"; echo " <td class='text' colspan='2'>" . htmlentities($linedbrow['comments']) . "</td>\n"; echo " </tr>\n"; } $sysnamedisp = ''; } // end of line } // end of system name echo "</table>\n"; }
function mergeTiffs() { global $faxcache; $msg = ''; $inames = ''; $tmp1 = array(); $tmp2 = 0; // form_images are the checkboxes to the right of the images. foreach ($_POST['form_images'] as $inbase) { $inames .= ' ' . escapeshellarg("{$inbase}.tif"); } if (!$inames) { die(xl("Internal error - no pages were selected!")); } $tmp0 = exec("cd '{$faxcache}'; tiffcp {$inames} temp.tif", $tmp1, $tmp2); if ($tmp2) { $msg .= "tiffcp returned {$tmp2}: {$tmp0} "; } return $msg; }
function genWarehouseList($tag_name, $currvalue, $title, $class = '') { global $drug_id; $drow = sqlQuery("SELECT allow_multiple FROM drugs WHERE drug_id = '{$drug_id}'"); $allow_multiple = $drow['allow_multiple']; $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = 'warehouse' ORDER BY seq, title"); echo "<select name='{$tag_name}' id='{$tag_name}'"; if ($class) { echo " class='{$class}'"; } echo " title='{$title}'>"; $got_selected = FALSE; $count = 0; if ($allow_multiple) { echo "<option value=''>" . xl('Unassigned') . "</option>"; ++$count; } while ($lrow = sqlFetchArray($lres)) { $whid = $lrow['option_id']; if ($whid != $currvalue && !$allow_multiple && checkWarehouseUsed($whid)) { continue; } echo "<option value='{$whid}'"; if (strlen($currvalue) == 0 && $lrow['is_default'] || strlen($currvalue) > 0 && $whid == $currvalue) { echo " selected"; $got_selected = TRUE; } echo ">" . $lrow['title'] . "</option>\n"; ++$count; } if (!$got_selected && strlen($currvalue) > 0) { $currescaped = htmlspecialchars($currvalue, ENT_QUOTES); echo "<option value='{$currescaped}' selected>* {$currescaped} *</option>"; echo "</select>"; echo " <font color='red' title='" . xl('Please choose a valid selection from the list.') . "'>" . xl('Fix this') . "!</font>"; } else { echo "</select>"; } return $count; }
function CAMOS_report($pid, $encounter, $cols, $id) { $data = formFetch("form_CAMOS", $id); if ($data) { //echo "(category) ".stripslashes($data['category'])." | "; //echo "(subcategory) ".stripslashes($data['subcategory'])." | "; //echo "(item) ".stripslashes($data['item']); echo "<div class='navigateLink'><a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?sigline=embossed' target=_new>" . xl('Rx') . "</a>\n"; echo " | "; echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?sigline=signed' target=_new>" . xl('Signed Rx') . "</a>\n"; echo "<br>"; echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?letterhead=true&signer=patient' target=_new>" . xl('Letterhead that patient signs') . "</a>\n"; echo " | "; echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?letterhead=true&signer=doctor' target=_new>" . xl('Letterhead that doctor signs') . "</a>\n"; echo "<br>"; echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/notegen.php?pid=" . $pid . "&encounter=" . $encounter . "' target=_new>" . xl('Print This Encounter') . "</a>\n"; echo " | "; echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/notegen.php' target=_new>" . xl('Print Any Encounter') . "</a></div>\n"; // echo "<pre>".wordwrap(stripslashes(content_parser($data['content'])))."</pre><hr>\n"; echo "<pre>" . wordwrap(stripslashes(replace($pid, $encounter, $data['content']))) . "</pre><hr>\n"; } }