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)); //Updated by Sherwin 10/24/2016 print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . nl2br(text($value)) . "</span></td>"; $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
function note_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_note", $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 "<tr>\n"; print "<tr>\n"; if ($key == "Note Type") { print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . xlt($value) . "</span></td>"; } else { print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . text($value) . "</span></td>"; } $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
function care_plan_report($pid, $encounter, $cols, $id) { $count = 0; $sql = "SELECT * FROM `form_care_plan` WHERE id=? AND pid = ? AND encounter = ?"; $res = sqlStatement($sql, array($id, $_SESSION["pid"], $_SESSION["encounter"])); for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $data[$iter] = $row; } if ($data) { ?> <table style='border-collapse:collapse;border-spacing:0;width: 100%;'> <tr> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Code'); ?> </span></td> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Code Text'); ?> </span></td> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Description'); ?> </span></td> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Date'); ?> </span></td> </tr> <?php foreach ($data as $key => $value) { ?> <tr> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['code']); ?> </span></td> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['codetext']); ?> </span></td> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['description']); ?> </span></td> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['date']); ?> </span></td> </tr> <?php } ?> </table> <?php } }
function newpatient_report($pid, $encounter, $cols, $id) { $res = sqlStatement("select * from form_encounter where pid=? and id=?", array($pid, $id)); print "<table><tr><td>\n"; while ($result = sqlFetchArray($res)) { print "<span class=bold>" . xlt('Facility') . ": </span><span class=text>" . text($result["facility"]) . "</span><br>\n"; print "<span class=bold>" . xlt('Reason') . ": </span><span class=text>" . nl2br(text($result["reason"])) . "</span><br>\n"; } print "</td></tr></table>\n"; }
function observation_report($pid, $encounter, $cols, $id) { $count = 0; $sql = "SELECT * FROM `form_observation` WHERE id=? AND pid = ? AND encounter = ?"; $res = sqlStatement($sql, array($id, $_SESSION["pid"], $_SESSION["encounter"])); for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $data[$iter] = $row; } if ($data) { print "<table style='border-collapse:collapse;border-spacing:0;width: 100%;'>\n <tr>\n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Code') . "</span></td>\n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Description') . "</span></td>\n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Code Type') . "</span></td> \n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Table Code') . "</span></td> \n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Value') . "</span></td>\n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Unit') . "</span></td>\n <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold>" . xlt('Date') . "</span></td>\n </tr>"; foreach ($data as $key => $value) { if ($value['code'] == 'SS003') { if ($value['ob_value'] == '261QE0002X') { $value['ob_value'] = 'Emergency Care'; } else { if ($value['ob_value'] == '261QM2500X') { $value['ob_value'] = 'Medical Specialty'; } else { if ($value['ob_value'] == '261QP2300X') { $value['ob_value'] = 'Primary Care'; } else { if ($value['ob_value'] == '261QU0200X') { $value['ob_value'] = 'Urgent Care'; } } } } } if ($value['code'] == '21612-7') { if ($value['ob_unit'] == 'd') { $value['ob_unit'] = 'Day'; } else { if ($value['ob_unit'] == 'mo') { $value['ob_unit'] = 'Month'; } else { if ($value['ob_unit'] == 'UNK') { $value['ob_unit'] = 'Unknown'; } else { if ($value['ob_unit'] == 'wk') { $value['ob_unit'] = 'Week'; } else { if ($value['ob_unit'] == 'a') { $value['ob_unit'] = 'Year'; } } } } } } print "<tr>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['code']) . "</span></td>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['description']) . "</span></td>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['code_type']) . "</span></td>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['table_code']) . "</span></td>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['ob_value']) . "</span></td>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['ob_unit']) . "</span></td>\n <td style='border:1px solid #ccc;padding:4px;'><span class=text>" . text($value['date']) . "</span></td>\n </tr>"; print "\n"; } print "</table>"; } }
function lookup_openemr_patient($wp_login) { if (empty($wp_login)) { die(xlt('The patient was not logged in when submitting this form')); } $ptres = sqlStatement("SELECT pid FROM patient_data WHERE cmsportal_login = ?", array($wp_login)); if (sqlNumRows($ptres) < 1) { die(xlt('There is no patient with portal login') . " '{$wp_login}'"); } if (sqlNumRows($ptres) > 1) { die(xlt('There are multiple patients with portal login') . " '{$wp_login}'"); } $ptrow = sqlFetchArray($ptres); return $ptrow['pid']; }
function printAmendment($amendmentID, $lastAmendment) { $query = "SELECT lo.title AS 'amendmentFrom', lo1.title AS 'amendmentStatus',a.* FROM amendments a \n\t\tLEFT JOIN list_options lo ON a.amendment_by = lo.option_id AND lo.list_id = 'amendment_from' AND lo.activity = 1\n\t\tLEFT JOIN list_options lo1 ON a.amendment_status = lo1.option_id AND lo1.list_id = 'amendment_status' AND lo1.activity = 1\n\t\tWHERE a.amendment_id = ?"; $resultSet = sqlQuery($query, array($amendmentID)); echo "<table>"; echo "<tr class=text>"; echo "<td class=bold>" . xlt("Requested Date") . ":" . "</td>"; echo "<td>" . oeFormatShortDate($resultSet['amendment_date']) . "</td>"; echo "</tr>"; echo "<tr class=text>"; echo "<td class=bold>" . xlt("Requested By") . ":" . "</td>"; echo "<td>" . generate_display_field(array('data_type' => '1', 'list_id' => 'amendment_from'), $resultSet['amendment_by']) . "</td>"; echo "</tr>"; echo "<tr class=text>"; echo "<td class=bold>" . xlt("Request Status") . ":" . "</td>"; echo "<td>" . generate_display_field(array('data_type' => '1', 'list_id' => 'amendment_status'), $resultSet['amendment_status']) . "</td>"; echo "</tr>"; echo "<tr class=text>"; echo "<td class=bold>" . xlt("Request Description") . ":" . "</td>"; echo "<td>" . text($resultSet['amendment_desc']) . "</td>"; echo "</tr>"; echo "</table>"; echo "<hr>"; echo "<span class='bold'>" . xlt("History") . "</span><br>"; $pageBreak = $lastAmendment ? "" : "page-break-after:always"; echo "<table border='1' cellspacing=0 cellpadding=3 style='width:75%;margin-top:10px;margin-bottom:20px;" . $pageBreak . "'>"; echo "<tr class='text bold'>"; echo "<th align=left style='width:10%'>" . xlt("Date") . "</th>"; echo "<th align=left style='width:20%'>" . xlt("By") . "</th>"; echo "<th align=left >" . xlt("Comments") . "</th>"; echo "</tr>"; $query = "SELECT u.fname,u.lname,ah.* FROM amendments_history ah INNER JOIN users u ON ah.created_by = u.id WHERE ah.amendment_id = ?"; $resultSet = sqlStatement($query, array($amendmentID)); while ($row = sqlFetchArray($resultSet)) { echo "<tr class=text>"; $created_date = date('Y-m-d', strtotime($row['created_time'])); echo "<td>" . oeFormatShortDate($created_date) . "</td>"; echo "<td>" . text($row['lname']) . ", " . text($row['fname']) . "</td>"; echo "<td>" . text($row['amendment_note']) . "</td>"; echo "</tr>"; } echo "</table>"; }
function genWarehouseList($tag_name, $currvalue, $title, $class = '') { global $drug_id; $drow = sqlQuery("SELECT allow_multiple FROM drugs WHERE drug_id = ?", array($drug_id)); $allow_multiple = $drow['allow_multiple']; $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = 'warehouse' ORDER BY seq, title"); echo "<select name='" . attr($tag_name) . "' id='" . attr($tag_name) . "'"; if ($class) { echo " class='" . attr($class) . "'"; } echo " title='" . attr($title) . "'>"; $got_selected = FALSE; $count = 0; if ($allow_multiple) { echo "<option value=''>" . xlt('Unassigned') . "</option>"; ++$count; } while ($lrow = sqlFetchArray($lres)) { $whid = $lrow['option_id']; if ($whid != $currvalue && !$allow_multiple && checkWarehouseUsed($whid)) { continue; } echo "<option value='" . attr($whid) . "'"; if (strlen($currvalue) == 0 && $lrow['is_default'] || strlen($currvalue) > 0 && $whid == $currvalue) { echo " selected"; $got_selected = TRUE; } echo ">" . text($lrow['title']) . "</option>\n"; ++$count; } if (!$got_selected && strlen($currvalue) > 0) { echo "<option value='" . attr($currvalue) . "' selected>* " . text($currvalue) . " *</option>"; echo "</select>"; echo " <font color='red' title='" . xla('Please choose a valid selection from the list.') . "'>" . xlt('Fix this') . "!</font>"; } else { echo "</select>"; } return $count; }
function clinical_instructions_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_clinical_instructions", $id); if ($data) { ?> <table style='border-collapse:collapse;border-spacing:0;width: 100%;'> <tr> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Instructions'); ?> </span></td> </tr> <tr> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo nl2br(text($data['instruction'])); ?> </span></td> </tr> </table> <?php } }
echo attr($postid); ?> ' /> <table width='100%' cellpadding='1' cellspacing='2'> <tr class='head'> <th align='left'><?php echo xlt('Field'); ?> </th> <th align='left'><?php echo xlt('Current Value'); ?> </th> <th align='left'><?php echo xlt('New Value'); ?> </th> </tr> <?php $insrow = getInsuranceData($pid, $result['fields']['type']); foreach ($insurance_layout as $lorow) { $data_type = $lorow['data_type']; $field_id = $lorow['field_id']; $list_id = $lorow['list_id']; $field_title = $lorow['title']; $currvalue = ''; if (isset($insrow[$field_id])) { $currvalue = $insrow[$field_id]; }
/** * Special case of Issue Types */ function writeITLine($it_array) { global $opt_line_no, $ISSUE_TYPE_CATEGORIES, $ISSUE_TYPE_STYLES; ++$opt_line_no; $bgcolor = "#" . ($opt_line_no & 1 ? "ddddff" : "ffdddd"); echo " <tr bgcolor='{$bgcolor}'>\n"; echo ctSelector($opt_line_no, $it_array, 'category', $ISSUE_TYPE_CATEGORIES, xl('OpenEMR Application Category')); echo ctGenCBox($opt_line_no, $it_array, 'active', xl('Is this active?')); echo ctGenCell($opt_line_no, $it_array, 'ordering', 10, 10, xl('Order')); echo ctGenCell($opt_line_no, $it_array, 'type', 20, 75, xl('Issue Type')); echo ctGenCell($opt_line_no, $it_array, 'plural', 20, 75, xl('Plural')); // if not english and translating lists then show the translation if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { echo " <td align='center' class='translation'>" . xlt($it_array['plural']) . "</td>\n"; } echo ctGenCell($opt_line_no, $it_array, 'singular', 20, 75, xl('Singular')); // if not english and translating lists then show the translation if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { echo " <td align='center' class='translation'>" . xlt($it_array['singular']) . "</td>\n"; } echo ctGenCell($opt_line_no, $it_array, 'abbreviation', 10, 10, xl('Abbreviation')); // if not english and translating lists then show the translation if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { echo " <td align='center' class='translation'>" . xlt($it_array['abbreviation']) . "</td>\n"; } echo ctSelector($opt_line_no, $it_array, 'style', $ISSUE_TYPE_STYLES, xl('Standard; Simplified: only title, start date, comments and an Active checkbox;no diagnosis, occurrence, end date, referred-by or sports fields. ; Football Injury')); echo ctGenCBox($opt_line_no, $it_array, 'force_show', xl('Show this category on the patient summary screen even if no issues have been entered for this category.')); echo " </tr>\n"; }
/** * * @return multitype:string */ public function esign_form_submit() { $message = ''; $status = self::STATUS_FAILURE; $password = $this->getRequest()->getParam('password', ''); $encounterId = $this->getRequest()->getParam('encounterId', ''); // Lock if 'Lock e-signed encounters and their forms' option is set, // unless esign_lock_toggle option is enable in globals, then check the request param $lock = false; if ($GLOBALS['lock_esign_all']) { $lock = true; if ($GLOBALS['esign_lock_toggle']) { $lock = $this->getRequest()->getParam('lock', '') == 'on' ? true : false; } } $amendment = $this->getRequest()->getParam('amendment', ''); if (confirm_user_password($_SESSION['authUser'], $password)) { $signable = new Encounter_Signable($encounterId); if ($signable->sign($_SESSION['authUserID'], $lock, $amendment)) { $message = xlt("Form signed successfully"); $status = self::STATUS_SUCCESS; } else { $message = xlt("An error occured signing the form"); } } else { $message = xlt("The password you entered is invalid"); } $response = new Response($status, $message); $response->encounterId = $encounterId; $response->locked = $lock; if ($lock) { $response->editButtonHtml = "<a href=# class='css_button_small form-edit-button-locked'><span>" . xlt('Locked') . "</span></a>"; } echo json_encode($response); exit; }
echo xlt('Document Category or Discard'); ?> </th> </tr> <?php if (is_array($result['uploads'])) { foreach ($result['uploads'] as $upload) { $id = intval($upload['id']); echo " <tr class='detail'>\n"; // MIME type and view link echo " <td><a href='upload_form_show.php?id={$id}&messageid={$messageid}'>" . text($upload['mimetype']) . "</a></td>\n"; // Desired file name echo " <td><input type='text' name='form_filename[{$id}]' value='" . attr($upload['filename']) . "' size='20' /></td>"; // Desired document category with option to discard the file echo " <td><select name='form_category[{$id}]'>\n"; echo "<option value='0'>-- " . xlt('Discard') . " --</option>\n"; $i = 0; foreach ($categories as $catkey => $catname) { echo "<option value='" . attr($catkey) . "'"; if (++$i == 1) { echo " selected"; } echo ">" . text($catname) . "</option>\n"; } echo "</select></td>\n"; // echo " </tr>\n"; } } ?> </table>
function generate_receipt($patient_id, $encounter = 0) { global $sl_err, $sl_cash_acc, $css_header, $details, $INTEGRATED_AR; // Get details for what we guess is the primary facility. $frow = sqlQuery("SELECT * FROM facility " . "ORDER BY billing_location DESC, accepts_assignment DESC, id LIMIT 1"); $patdata = getPatientData($patient_id, 'fname,mname,lname,pubpid,street,city,state,postal_code,providerID'); // Get the most recent invoice data or that for the specified encounter. // // Adding a provider check so that their info can be displayed on receipts if ($INTEGRATED_AR) { if ($encounter) { $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? AND encounter = ?", array($patient_id, $encounter)); } else { $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? " . "ORDER BY id DESC LIMIT 1", array($patient_id)); } if (empty($ferow)) { die(xlt("This patient has no activity.")); } $trans_id = $ferow['id']; $encounter = $ferow['encounter']; $svcdate = substr($ferow['date'], 0, 10); if ($GLOBALS['receipts_by_provider']) { if (isset($ferow['provider_id'])) { $encprovider = $ferow['provider_id']; } else { if (isset($patdata['providerID'])) { $encprovider = $patdata['providerID']; } else { $encprovider = -1; } } } if ($encprovider) { $providerrow = sqlQuery("SELECT fname, mname, lname, title, street, streetb, " . "city, state, zip, phone, fax FROM users WHERE id = ?", array($encprovider)); } } else { SLConnect(); // $arres = SLQuery("SELECT * FROM ar WHERE " . "invnumber LIKE '{$patient_id}.%' " . "ORDER BY id DESC LIMIT 1"); if ($sl_err) { die(text($sl_err)); } if (!SLRowCount($arres)) { die(xlt("This patient has no activity.")); } $arrow = SLGetRow($arres, 0); // $trans_id = $arrow['id']; // // Determine the date of service. An 8-digit encounter number is // presumed to be a date of service imported during conversion or // associated with prescriptions only. Otherwise look it up in the // form_encounter table. // $svcdate = ""; list($trash, $encounter) = explode(".", $arrow['invnumber']); if (strlen($encounter) >= 8) { $svcdate = substr($encounter, 0, 4) . "-" . substr($encounter, 4, 2) . "-" . substr($encounter, 6, 2); } else { if ($encounter) { $tmp = sqlQuery("SELECT date FROM form_encounter WHERE " . "encounter = ?", array($encounter)); $svcdate = substr($tmp['date'], 0, 10); } } } // end not $INTEGRATED_AR // Get invoice reference number. $encrow = sqlQuery("SELECT invoice_refno FROM form_encounter WHERE " . "pid = ? AND encounter = ? LIMIT 1", array($patient_id, $encounter)); $invoice_refno = $encrow['invoice_refno']; ?> <html> <head> <?php html_header_show(); ?> <link rel='stylesheet' href='<?php echo $css_header; ?> ' type='text/css'> <title><?php echo xlt('Receipt for Payment'); ?> </title> <script type="text/javascript" src="../../library/dialog.js"></script> <script language="JavaScript"> <?php require $GLOBALS['srcdir'] . "/restoreSession.php"; ?> // Process click on Print button. function printme() { var divstyle = document.getElementById('hideonprint').style; divstyle.display = 'none'; window.print(); return false; } // Process click on Delete button. function deleteme() { dlgopen('deleter.php?billing=<?php echo attr("{$patient_id}.{$encounter}"); ?> ', '_blank', 500, 450); return false; } // Called by the deleteme.php window on a successful delete. function imdeleted() { window.close(); } </script> </head> <body class="body_top"> <center> <?php if ($GLOBALS['receipts_by_provider'] && !empty($providerrow)) { printProviderHeader($providerrow); } else { printFacilityHeader($frow); } echo xlt("Receipt Generated") . ":" . text(date(' F j, Y')); if ($invoice_refno) { echo " " . xlt("Invoice Number") . ": " . text($invoice_refno) . " " . xlt("Service Date") . ": " . text($svcdate); } ?> <br> </b></p> </center> <p> <?php echo text($patdata['fname']) . ' ' . text($patdata['mname']) . ' ' . text($patdata['lname']); ?> <br><?php echo text($patdata['street']); ?> <br><?php echo text($patdata['city']) . ', ' . text($patdata['state']) . ' ' . text($patdata['postal_code']); ?> <br> </p> <center> <table cellpadding='5'> <tr> <td><b><?php echo xlt('Date'); ?> </b></td> <td><b><?php echo xlt('Description'); ?> </b></td> <td align='right'><b><?php echo $details ? xlt('Price') : ' '; ?> </b></td> <td align='right'><b><?php echo $details ? xlt('Qty') : ' '; ?> </b></td> <td align='right'><b><?php echo xlt('Total'); ?> </b></td> </tr> <?php $charges = 0.0; if ($INTEGRATED_AR) { // Product sales $inres = sqlStatement("SELECT s.sale_id, s.sale_date, s.fee, " . "s.quantity, s.drug_id, d.name " . "FROM drug_sales AS s LEFT JOIN drugs AS d ON d.drug_id = s.drug_id " . "WHERE s.pid = ? AND s.encounter = ? " . "ORDER BY s.sale_id", array($patient_id, $encounter)); while ($inrow = sqlFetchArray($inres)) { $charges += sprintf('%01.2f', $inrow['fee']); receiptDetailLine($inrow['sale_date'], $inrow['name'], $inrow['fee'], $inrow['quantity']); } // Service and tax items $inres = sqlStatement("SELECT * FROM billing WHERE " . "pid = ? AND encounter = ? AND " . "code_type != 'COPAY' AND activity = 1 " . "ORDER BY id", array($patient_id, $encounter)); while ($inrow = sqlFetchArray($inres)) { $charges += sprintf('%01.2f', $inrow['fee']); receiptDetailLine($svcdate, $inrow['code_text'], $inrow['fee'], $inrow['units']); } // Adjustments. $inres = sqlStatement("SELECT " . "a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, " . "s.payer_id, s.reference, s.check_date, s.deposit_date " . "FROM ar_activity AS a " . "LEFT JOIN ar_session AS s ON s.session_id = a.session_id WHERE " . "a.pid = ? AND a.encounter = ? AND " . "a.adj_amount != 0 " . "ORDER BY s.check_date, a.sequence_no", array($patient_id, $encounter)); while ($inrow = sqlFetchArray($inres)) { $charges -= sprintf('%01.2f', $inrow['adj_amount']); $payer = empty($inrow['payer_type']) ? 'Pt' : 'Ins' . $inrow['payer_type']; receiptDetailLine($svcdate, $payer . ' ' . $inrow['memo'], 0 - $inrow['adj_amount'], 1); } } else { // Request all line items with money belonging to the invoice. $inres = SLQuery("SELECT * FROM invoice WHERE " . "trans_id = {$trans_id} AND sellprice != 0 ORDER BY id"); if ($sl_err) { die($sl_err); } for ($irow = 0; $irow < SLRowCount($inres); ++$irow) { $row = SLGetRow($inres, $irow); $amount = sprintf('%01.2f', $row['sellprice'] * $row['qty']); $charges += $amount; $desc = preg_replace('/^.{1,6}:/', '', $row['description']); receiptDetailLine($svcdate, $desc, $amount, $row['qty']); } } // end not $INTEGRATED_AR ?> <tr> <td colspan='5'> </td> </tr> <tr> <td><?php echo text(oeFormatShortDate($svcdispdate)); ?> </td> <td><b><?php echo xlt('Total Charges'); ?> </b></td> <td align='right'> </td> <td align='right'> </td> <td align='right'><?php echo text(oeFormatMoney($charges, true)); ?> </td> </tr> <tr> <td colspan='5'> </td> </tr> <?php if ($INTEGRATED_AR) { // Get co-pays. $inres = sqlStatement("SELECT fee, code_text FROM billing WHERE " . "pid = ? AND encounter = ? AND " . "code_type = 'COPAY' AND activity = 1 AND fee != 0 " . "ORDER BY id", array($patient_id, $encounter)); while ($inrow = sqlFetchArray($inres)) { $charges += sprintf('%01.2f', $inrow['fee']); receiptPaymentLine($svcdate, 0 - $inrow['fee'], $inrow['code_text']); } // Get other payments. $inres = sqlStatement("SELECT " . "a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, " . "s.payer_id, s.reference, s.check_date, s.deposit_date " . "FROM ar_activity AS a " . "LEFT JOIN ar_session AS s ON s.session_id = a.session_id WHERE " . "a.pid = ? AND a.encounter = ? AND " . "a.pay_amount != 0 " . "ORDER BY s.check_date, a.sequence_no", array($patient_id, $encounter)); $payer = empty($inrow['payer_type']) ? 'Pt' : 'Ins' . $inrow['payer_type']; while ($inrow = sqlFetchArray($inres)) { $charges -= sprintf('%01.2f', $inrow['pay_amount']); receiptPaymentLine($svcdate, $inrow['pay_amount'], $payer . ' ' . $inrow['reference']); } } else { $chart_id_cash = SLQueryValue("select id from chart where accno = '{$sl_cash_acc}'"); if ($sl_err) { die($sl_err); } if (!$chart_id_cash) { die("There is no COA entry for cash account '{$sl_cash_acc}'"); } // // Request all cash entries belonging to the invoice. $atres = SLQuery("SELECT * FROM acc_trans WHERE " . "trans_id = {$trans_id} AND chart_id = {$chart_id_cash} ORDER BY transdate"); if ($sl_err) { die($sl_err); } // for ($irow = 0; $irow < SLRowCount($atres); ++$irow) { $row = SLGetRow($atres, $irow); $amount = sprintf('%01.2f', $row['amount']); // negative $charges += $amount; $rowsource = $row['source']; if (strtolower($rowsource) == 'co-pay') { $rowsource = ''; } receiptPaymentLine($row['transdate'], 0 - $amount, $rowsource); } } // end not $INTEGRATED_AR ?> <tr> <td colspan='5'> </td> </tr> <tr> <td> </td> <td><b><?php echo xlt('Balance Due'); ?> </b></td> <td colspan='2'> </td> <td align='right'><?php echo text(oeFormatMoney($charges, true)); ?> </td> </tr> </table> </center> <div id='hideonprint'> <p> <a href='#' onclick='return printme();'><?php echo xlt('Print'); ?> </a> <?php if (acl_check('acct', 'disc')) { ?> <a href='#' onclick='return deleteme();'><?php echo xlt('Undo Checkout'); ?> </a> <?php } ?> <?php if ($details) { ?> <a href='pos_checkout.php?details=0&ptid=<?php echo attr($patient_id); ?> &enc=<?php echo attr($encounter); ?> '><?php echo xlt('Hide Details'); ?> </a> <?php } else { ?> <a href='pos_checkout.php?details=1&ptid=<?php echo attr($patient_id); ?> &enc=<?php echo attr($encounter); ?> '><?php echo xlt('Show Details'); ?> </a> <?php } ?> </p> </div> </body> </html> <?php if (!$INTEGRATED_AR) { SLClose(); } }
echo $urlparms; ?> " target="Main" onclick="top.restoreSession()"> <?php } ?> <span class="title"><?php echo htmlspecialchars(xl('Notes'), ENT_NOQUOTES); if ($docid) { echo " " . xlt("linked to document") . " "; $d = new Document($docid); echo $d->get_url_file(); } else { if ($orderid) { echo " " . xlt("linked to procedure order") . " {$orderid}"; } } ?> </span> <span class=more><?php echo htmlspecialchars($tmore, ENT_NOQUOTES); ?> </span> </a> <?php } ?> <br>
?> </div> <br></br> <table> <tr><td> <span class=text><?php echo xlt('Doctor:'); ?> </span><input type=text name="doctor" value="<?php echo attr($obj["doctor"]); ?> "> </td><td> <span class="text"><?php echo xlt('Date'); ?> </span> <input type='text' size='10' name='date_of_signature' id='date_of_signature' value='<?php echo attr($obj['date_of_signature']); ?> ' /> </td></tr> </table> </form> </body>
if ($perow['count']) { echo " selected"; } } else { // For new encounters the invoker may pass an issue ID. if (!empty($_REQUEST['issue']) && $_REQUEST['issue'] == $list_id) { echo " selected"; } } echo ">" . text($tcode) . ": " . text($irow['begdate']) . " " . text(substr($irow['title'], 0, 40)) . "</option>\n"; } ?> </select> <p><i><?php echo xlt('To link this encounter/consult to an existing issue, click the ' . 'desired issue above to highlight it and then click [Save]. ' . 'Hold down [Ctrl] button to select multiple issues.'); ?> </i></p> </td> </tr> </table> </form> </body> <script language="javascript"> /* required for popup calendar */ Calendar.setup({inputField:"form_date", ifFormat:"%Y-%m-%d", button:"img_form_date"});
echo $css_header; ?> " type="text/css"> </head> <body class="body_bottom"> <br/><br/><br/><span class="pwdalert <?php echo attr($case); ?> "> <table align="center" > <tr valign="top"> <td> </td> <td rowspan="3"><?php echo xlt("Welcome"); echo " " . text($username); ?> ,<br> <br> <?php echo text($msg_alert); ?> <br> </td> <td> </td> </tr> <tr> <td> </td> <td> </td>
} // end CCR/CCD reporting options if ($GLOBALS['portal_onsite_document_download']) { echo "<tr><td width='650px'>"; $widgetTitle = xl('Documents'); $widgetLabel = "documents"; $widgetButtonLabel = xl('Download'); $widgetButtonClass = "hidden"; $linkMethod = "html"; $bodyClass = "notab"; $widgetAuth = false; $fixedWidth = true; expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?> <span class="text"><?php echo xlt('Download all patient documents'); ?> </span> <br /><br /> <form name='doc_form' id='doc_form' action='get_patient_documents.php' method='post'> <input type="button" class="generateDoc_download" value="<?php echo xla('Download'); ?> " /> </form> </div> </td> </tr> <?php } echo "<tr><td width='650px'>";
for ($i = 1; $i < $k;) { print "<table border=1><tr>\n"; print "<br><br>"; Printf("<td width=70><span class=text><b>" . xlt("User ") . "</center></b><center>" . text($user_info[user][$i])) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Charges") . ' ' . "</center></b><center>" . " %1\$.2f", text($user_info[fee][$i])) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($user_info[insadj][$i])) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($user_info[inspay][$i])) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Patient Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($user_info[patadj][$i])) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Patient Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($user_info[patpay][$i])) . "</center>"; $gtotal_fee = $gtotal_fee + $user_info[fee][$i]; $gtotal_insadj = $gtotal_insadj + $user_info[insadj][$i]; $gtotal_inspay = $gtotal_inspay + $user_info[inspay][$i]; $gtotal_patadj = $gtotal_patadj + $user_info[patadj][$i]; $gtotal_patpay = $gtotal_patpay + $user_info[patpay][$i]; ++$i; print "</br></td>"; } print "<table border=1><tr>\n"; print "<br><br>"; Printf("<td width=70><span class=text><b><center>" . xlt("Grand Totals") . ' '); Printf("<td width=140><span class=text><b><center>" . xlt("Total Charges") . ' ' . "</center></b><center>" . " %1\$.2f", text($gtotal_fee)) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($gtotal_insadj)) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($gtotal_inspay)) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Patient Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($gtotal_patadj)) . "</center>"; Printf("<td width=140><span class=text><b><center>" . xlt("Patient Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($gtotal_patpay)) . "</center>"; print "</br></td>"; print "</table>"; ?> </body> </html>
</td> <td class=text><?php echo generate_display_field(array('data_type' => '1', 'list_id' => 'amendment_from'), $row['amendment_by']); ?> </td> <td class=text><?php echo generate_display_field(array('data_type' => '1', 'list_id' => 'amendment_status'), $row['amendment_status']); ?> </td> </tr> <?php } ?> </table> </div> <?php } else { ?> <span style="color:red"> <br> <?php echo xlt("No amendment requests available"); ?> </span> <?php } ?> </form> </body> </html>
<input type='text' size='40' name='form_range' maxlength='255' value='<?php echo htmlspecialchars($row['range'], ENT_QUOTES); ?> ' title='<?php echo xla('Optional default range for manual entry of results'); ?> ' style='width:100%' class='inputtext' /> </td> </tr> <tr class='resonly'> <td nowrap><b><?php echo xlt('Followup Services'); ?> :</b></td> <td> <input type='text' size='50' name='form_related_code' value='<?php echo $row['related_code']; ?> ' onclick='sel_related("form_related_code")' title='<?php echo xla('Click to select services to perform if this result is abnormal'); ?> ' style='width:100%' readonly /> </td> </tr>
//$db == 'ICD' if (!icd_import($db)) { echo htmlspecialchars(xl('ERROR: Unable to load the file into the database.'), ENT_NOQUOTES) . "<br>"; temp_dir_cleanup($db); exit; } } } // set the revision version in the database if (!update_tracker_table($db, $file_revision_date, $version, $file_checksum)) { echo htmlspecialchars(xl('ERROR: Unable to set the version number.'), ENT_NOQUOTES) . "<br>"; temp_dir_cleanup($db); exit; } // done, so clean up the temp directory if ($newInstall === "1") { ?> <div><?php echo xlt("Successfully installed the following database") . ": " . text($db); ?> </div> <?php } else { ?> <div><?php echo xlt("Successfully upgraded the following database") . ": " . text($db); ?> </div> <?php } temp_dir_cleanup($db);
/** * Generate HTML for the QOE form suitable for insertion into a <div>. * This HTML may contain single quotes but not unescaped double quotes. * * @param integer $ptid Value matching a procedure_type_id in the procedure_types table. * @param integer $orderid Procedure order ID, if there is an existing order. * @param integer $dbseq Procedure order item sequence number, if there is an existing procedure. * @param string $formseq Zero-relative occurrence number in the form. * @return string The generated HTML. */ function generate_qoe_html($ptid = 0, $orderid = 0, $dbseq = 0, $formseq = 0) { global $rootdir, $qoe_init_javascript; $s = ""; $qoe_init_javascript = ''; $prefix = 'ans' . $formseq . '_'; if (empty($ptid)) { return $s; } $s .= "<table>"; // Get all the questions for the given procedure order type. $qres = sqlStatement("SELECT " . "q.question_code, q.question_text, q.options, q.required, q.maxsize, " . "q.fldtype, q.tips " . "FROM procedure_type AS t " . "JOIN procedure_questions AS q ON q.lab_id = t.lab_id " . "AND q.procedure_code = t.procedure_code AND q.activity = 1 " . "WHERE t.procedure_type_id = ? " . "ORDER BY q.seq, q.question_text", array($ptid)); while ($qrow = sqlFetchArray($qres)) { $options = trim($qrow['options']); $qfieldid = $prefix . attr(trim($qrow['question_code'])); $fldtype = $qrow['fldtype']; $maxsize = 0 + $qrow['maxsize']; // Get answer value(s) to this question, if any. $answers = array(); if ($orderid && $dbseq > 0) { $ares = sqlStatement("SELECT answer FROM procedure_answers WHERE " . "procedure_order_id = ? AND procedure_order_seq = ? AND question_code = ? " . "ORDER BY answer_seq", array($orderid, $dbseq, $qrow['question_code'])); while ($arow = sqlFetchArray($ares)) { $answers[] = $arow['answer']; } } $s .= "<tr>"; $s .= "<td width='1%' valign='top' nowrap"; if ($qrow['required']) { $s .= " style='color:#880000'"; } // TBD: move to stylesheet $s .= ">" . attr($qrow['question_text']) . "</td>"; $s .= "<td valign='top'>"; if ($fldtype == 'T') { // Text Field. $s .= "<input type='text' name='{$qfieldid}' size='50'"; $s .= " maxlength='" . ($maxsize ? $maxsize : 255) . "'"; if (!empty($answers)) { $s .= " value='" . attr($answers[0]) . "'"; } $s .= " />"; $s .= " " . text($qrow['tips']); } else { if ($fldtype == 'N') { // Numeric text Field. // TBD: Add some JavaScript validation for this. $s .= "<input type='text' name='{$qfieldid}' maxlength='8'"; if (!empty($answers)) { $s .= " value='" . attr($answers[0]) . "'"; } $s .= " />"; $s .= " " . text($qrow['tips']); } else { if ($fldtype == 'D') { // Date Field. $s .= "<input type='text' size='10' name='{$qfieldid}' id='{$qfieldid}'"; if (!empty($answers)) { $s .= " value='" . attr($answers[0]) . "'"; } $s .= " onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />"; $s .= "<img src='{$rootdir}/pic/show_calendar.gif' align='absbottom' width='24' height='22'" . " id='img_{$qfieldid}' border='0' alt='[?]' style='cursor:pointer'" . " title='" . htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES) . "' />"; $qoe_init_javascript .= " Calendar.setup({inputField:'{$qfieldid}', ifFormat:'%Y-%m-%d', button:'img_{$qfieldid}'});"; } else { if ($fldtype == 'G') { // Gestational age in weeks and days. $currweeks = -1; $currdays = -1; if (!empty($answers)) { $currweeks = intval($answers[0] / 7); $currdays = $answers[0] % 7; } $s .= "<select name='G1_{$qfieldid}'>"; $s .= "<option value=''></option>"; for ($i = 5; $i <= 21; ++$i) { $s .= "<option value='{$i}'"; if ($i == $currweeks) { $s .= " selected"; } $s .= ">{$i}</option>"; } $s .= "</select>"; $s .= " " . xlt('weeks') . " "; $s .= "<select name='G2_{$qfieldid}'>"; $s .= "<option value=''></option>"; for ($i = 0; $i <= 6; ++$i) { $s .= "<option value='{$i}'"; if ($i == $currdays) { $s .= " selected"; } $s .= ">{$i}</option>"; } $s .= "</select>"; $s .= " " . xlt('days'); } else { if ($fldtype == 'M') { // List of checkboxes. $a = explode(';', $qrow['options']); $i = 0; foreach ($a as $aval) { list($desc, $code) = explode(':', $aval); if (empty($code)) { $code = $desc; } if ($i) { $s .= "<br />"; } $s .= "<input type='checkbox' name='{$qfieldid[$i]}' value='" . attr($code) . "'"; if (in_array($code, $answers)) { $s .= " checked"; } $s .= " />" . text($desc); ++$i; } } else { // Radio buttons or drop-list, depending on the number of choices. $a = explode(';', $qrow['options']); if (count($a) > 5) { $s .= "<select name='{$qfieldid}'"; $s .= ">"; foreach ($a as $aval) { list($desc, $code) = explode(':', $aval); if (empty($code)) { $code = $desc; } $s .= "<option value='" . attr($code) . "'"; if (in_array($code, $answers)) { $s .= " selected"; } $s .= ">" . text($desc) . "</option>"; } $s .= "</select>"; } else { $i = 0; foreach ($a as $aval) { list($desc, $code) = explode(':', $aval); if (empty($code)) { $code = $desc; } if ($i) { $s .= "<br />"; } $s .= "<input type='radio' name='{$qfieldid}' value='" . attr($code) . "'"; if (in_array($code, $answers)) { $s .= " checked"; } $s .= " />" . text($desc); ++$i; } } } } } } } $s .= '</td>'; $s .= '</tr>'; } $s .= '</table>'; return $s; }
?> /forms/dictation/save.php?mode=new" name="my_form"> <span class="title"><?php echo xlt('Speech Dictation'); ?> </span><br><br> <span class=text><?php echo xlt('Dictation: '); ?> </span><br><textarea cols=80 rows=24 wrap=virtual name="dictation" ></textarea><br> <span class=text><?php echo xlt('Additional Notes:'); ?> </span><br><textarea cols=80 rows=8 wrap=virtual name="additional_notes" ></textarea><br> <br> <a href="javascript:top.restoreSession();document.my_form.submit();" class="link_submit">[<?php echo xlt('Save'); ?> ]</a> <br> <a href="<?php echo "{$rootdir}/patient_file/encounter/{$returnurl}"; ?> " class="link" onclick="top.restoreSession()">[<?php echo xlt('Don\'t Save'); ?> ]</a> </form> <?php formFooter();
'action' => 'putmessage', 'user' => $_POST['form_send_to_portal'], 'title' => xl('Your Lab Results'), 'message' => xl('Please see the attached PDF.'), 'filename' => 'results.pdf', 'mimetype' => 'application/pdf', 'contents' => base64_encode($contents), )); if ($result['errmsg']) die(text($result['errmsg'])); } ?> <html> <head> <?php html_header_show(); ?> <link rel="stylesheet" href='<?php echo $css_header; ?>' type='text/css'> <title><?php echo xlt('Order Results'); ?></title> <style> body { margin: 9pt; font-family: sans-serif; font-size: 1em; } </style> <script type="text/javascript" src="../../library/topdialog.js"></script> <script language="JavaScript"> <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?> </script> </head> <body>
echo '<tr title="' . xl('Edit form') . '" ' . 'id="' . $formdir . '~' . $iter['form_id'] . '" class="text onerow">'; } $user = getNameFromUsername($iter['user']); $form_name = $formdir == 'newpatient' ? xl('Patient Encounter') : xl_form_title($iter['form_name']); // Create the ESign instance for this form $esign = $esignApi->createFormESign($iter['id'], $formdir, $encounter); echo "<tr>"; echo "<td style='border-bottom:1px solid'>"; // a link to edit the form echo "<div class='form_header_controls'>"; // If the form is locked, it is no longer editable if ($esign->isLocked()) { echo "<a href=# class='css_button_small form-edit-button-locked' id='form-edit-button-" . attr($formdir) . "-" . attr($iter['id']) . "'><span>" . xlt('Locked') . "</span></a>"; } else { echo "<a class='css_button_small form-edit-button' id='form-edit-button-" . attr($formdir) . "-" . attr($iter['id']) . "' target='" . "_parent" . "' href='{$rootdir}/patient_file/encounter/view_form.php?" . "formname=" . attr($formdir) . "&id=" . attr($iter['form_id']) . "' onclick='top.restoreSession()'>"; echo "<span>" . xlt('Edit') . "</span></a>"; } if ($esign->isButtonViewable()) { echo $esign->buttonHtml(); } if (acl_check('admin', 'super')) { if ($formdir != 'newpatient') { // a link to delete the form from the encounter echo "<a target='_parent'" . " href='{$rootdir}/patient_file/encounter/delete_form.php?" . "formname=" . $formdir . "&id=" . $iter['id'] . "&encounter=" . $encounter . "&pid=" . $pid . "' class='css_button_small' title='" . xl('Delete this form') . "' onclick='top.restoreSession()'><span>" . xl('Delete') . "</span></a>"; } else { ?> <a href='javascript:;' class='css_button_small' style='color:gray'><span><?php xl('Delete', 'e'); ?> </span></a><?php }
echo text($row['lname']) . ', ' . text($row['fname']) . ' ' . text($row['mname']); } } ?> </td> </tr> <?php } // end while } // end if ?> </tbody> </table> </div> <!-- end of results --> <?php } else { ?> <div class='text'> <?php echo xlt('Please input search criteria above, and click Submit to view results.'); ?> </div> <?php } ?> </form> </body> </html>
} $field_id = 'cmsportal_login'; if (empty($ptrow[$field_id])) { if ($result['post']['user'] !== '') { // Registered in portal but still need to record that in openemr. echo "</table>\n"; echo "<input type='hidden' name='form_{$field_id}' value='" . attr($result['post']['user']) . "' />\n"; } else { // Portal registration is needed. $newvalue = isset($result['fields']['email']) ? trim($result['fields']['email']) : ''; echo " <tr class='detail'>\n"; echo " <td class='bold' style='color:red;'>" . xlt('New Portal Login') . "</td>\n"; echo " <td> </td>\n"; echo " <td>"; echo "<input type='text' name='form_{$field_id}' size='10' maxlength='60' value='" . attr($newvalue) . "' />"; echo " " . xlt('Password') . ": "; echo "<input type='text' name='form_" . attr($field_id) . "_pass' size='10' maxlength='60' />"; echo "<input type='button' value='" . xla('Generate') . "' onclick='randompass()' />"; echo "</td>\n"; echo " </tr>\n"; echo "</table>\n"; } } else { // Portal login name is already in openemr. echo "</table>\n"; } ?> <p> <input type='submit' name='bn_save' value='<?php echo xla('Save and Delete Request');
</td> </tr> </tbody> </table> </div> <!-- end of results --> <?php } else { ?> <div class='text'> <?php echo xlt('Click Refresh to view all results, or please input search criteria above to view specific results.'); ?> <br> (<?php echo xlt('This report currently only works for ICD9 codes.'); ?> ) </div> <?php } ?> </form> <script language='JavaScript'> Calendar.setup({inputField:"form_from_date", ifFormat:"%Y-%m-%d", button:"img_from_date"}); Calendar.setup({inputField:"form_to_date", ifFormat:"%Y-%m-%d", button:"img_to_date"}); </script> </body> </html>