Example #1
0
 private function get_DOB($patient_id)
 {
     $dob = getPatientData($patient_id, "DOB as TS_DOB");
     $dob = $dob['TS_DOB'];
     $date = $dob . ' 00:00:00';
     // MYSQL Date Format
     return $date;
 }
Example #2
0
/**
 * This prints a header for documents.  Keeps the brand uniform...
 *  @param string $pid patient_id
 *  @param string $direction, options "web" or anything else.  Web provides apache-friendly url links.
 *  @return outputs to be displayed however requested
 */
function report_header_2($stmt,$direction='',$providerID='1') {
  $titleres = getPatientData($stmt['pid'], "fname,lname,DOB");
  if ($_SESSION['pc_facility']) {
    $sql = "select * from facility where id=?";
    $facility = sqlQuery($sql,array($_SESSION['pc_facility']));
  } else {
    $sql = "SELECT * FROM facility ORDER BY billing_location DESC LIMIT 1";
    $facility = sqlQuery($sql);
  }
  $DOB = oeFormatShortDate($titleres['DOB']);
  /******************************************************************/
  ob_start();
  // Use logo if it exists as 'practice_logo.gif' in the site dir
  // old code used the global custom dir which is no longer a valid
  ?>
  <table style="width:7in;">
    <tr>
      <td style='width:100px;text-align:top;'>
        <?php
          $practice_logo = $GLOBALS['OE_SITE_DIR']."/images/practice_logo.gif";
          if (file_exists($practice_logo)) {
            echo "<img src='$practice_logo' align='left' style='width:125px;margin:0px;'><br />\n";
          }
        ?>
      </td>
      <td style='width:40%;'>
        <em style="font-weight:bold;font-size:1.4em;"><?php echo text($facility['name']); ?></em><br />
        <?php echo text($facility['street']); ?><br />
        <?php echo text($facility['city']); ?>, <?php echo text($facility['state']); ?> <?php echo text($facility['postal_code']); ?><br />
        <?php echo xlt('Phone').': ' .text($facility['phone']); ?><br />
        <?php echo xlt('Fax').': ' .text($facility['fax']); ?><br />
        <br clear='all' />
      </td>
      <td>
        <em style="font-weight:bold;font-size:1.4em;"><?php echo text($titleres['fname']) . " " . text($titleres['lname']); ?></em><br />
        <b style="font-weight:bold;"><?php echo xlt('Chart Number'); ?>:</b> <?php echo text($stmt['pid']); ?><br />
        <b style="font-weight:bold;"><?php echo xlt('Generated on'); ?>:</b> <?php echo oeFormatShortDate(); ?><br />
        <b><?php echo xlt('Provider') . ':</b>  '; ?><?php echo text(getProviderName($providerID)); ?> <br />
      </td>
    </tr>
  </table>
  <?php
  $output = ob_get_contents();
  ob_end_clean();
  return $output;
}
 function default_action()
 {
     $form_id = $this->form_id;
     if (is_numeric($form_id)) {
         $vitals = new FormVitals($form_id);
     } else {
         $vitals = new FormVitals();
     }
     $dbconn = $GLOBALS['adodb']['db'];
     //Combined query for retrieval of vital information which is not deleted
     $sql = "SELECT fv.*, fe.date AS encdate " . "FROM form_vitals AS fv, forms AS f, form_encounter AS fe WHERE " . "fv.id != {$form_id} and fv.pid = " . $GLOBALS['pid'] . " AND " . "f.formdir = 'vitals' AND f.deleted = 0 AND f.form_id = fv.id AND " . "fe.pid = f.pid AND fe.encounter = f.encounter " . "ORDER BY encdate DESC, fv.date DESC";
     $result = $dbconn->Execute($sql);
     // get the patient's current age
     $patient_data = getPatientData($GLOBALS['pid']);
     $patient_dob = $patient_data['DOB'];
     $patient_age = getPatientAge($patient_dob);
     $this->assign("patient_age", $patient_age);
     $this->assign("patient_dob", $patient_dob);
     $i = 1;
     while ($result && !$result->EOF) {
         $results[$i]['id'] = $result->fields['id'];
         $results[$i]['encdate'] = substr($result->fields['encdate'], 0, 10);
         $results[$i]['date'] = $result->fields['date'];
         $results[$i]['activity'] = $result->fields['activity'];
         $results[$i]['bps'] = $result->fields['bps'];
         $results[$i]['bpd'] = $result->fields['bpd'];
         $results[$i]['weight'] = $result->fields['weight'];
         $results[$i]['height'] = $result->fields['height'];
         $results[$i]['temperature'] = $result->fields['temperature'];
         $results[$i]['temp_method'] = $result->fields['temp_method'];
         $results[$i]['pulse'] = $result->fields['pulse'];
         $results[$i]['respiration'] = $result->fields['respiration'];
         $results[$i]['BMI'] = $result->fields['BMI'];
         $results[$i]['BMI_status'] = $result->fields['BMI_status'];
         $results[$i]['note'] = $result->fields['note'];
         $results[$i]['waist_circ'] = $result->fields['waist_circ'];
         $results[$i]['head_circ'] = $result->fields['head_circ'];
         $results[$i++]['oxygen_saturation'] = $result->fields['oxygen_saturation'];
         $result->MoveNext();
     }
     $this->assign("vitals", $vitals);
     $this->assign("results", $results);
     $this->assign("VIEW", true);
     return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
 }
 function default_action($form_id)
 {
     if (is_numeric($form_id)) {
         $vitals = new FormVitals($form_id);
     } else {
         $vitals = new FormVitals();
     }
     $dbconn = $GLOBALS['adodb']['db'];
     //Combined query for retrieval of vital information which is not deleted
     $sql = "SELECT form_vitals.* from form_vitals,forms where form_vitals.id != {$form_id} and form_vitals.pid =" . $GLOBALS['pid'];
     $sql .= " and forms.deleted!=1 and form_vitals.id=forms.form_id";
     $sql .= " ORDER BY form_vitals.date DESC";
     $result = $dbconn->Execute($sql);
     // get the patient's current age
     $patient_data = getPatientData($GLOBALS['pid']);
     $patient_age = getPatientAge($patient_data['DOB']);
     $this->assign("patient_age", $patient_age);
     $i = 1;
     while ($result && !$result->EOF) {
         $results[$i]['id'] = $result->fields['id'];
         $results[$i]['date'] = $result->fields['date'];
         $results[$i]['activity'] = $result->fields['activity'];
         $results[$i]['bps'] = $result->fields['bps'];
         $results[$i]['bpd'] = $result->fields['bpd'];
         $results[$i]['weight'] = $result->fields['weight'];
         $results[$i]['height'] = $result->fields['height'];
         $results[$i]['temperature'] = $result->fields['temperature'];
         $results[$i]['temp_method'] = $result->fields['temp_method'];
         $results[$i]['pulse'] = $result->fields['pulse'];
         $results[$i]['respiration'] = $result->fields['respiration'];
         $results[$i]['BMI'] = $result->fields['BMI'];
         $results[$i]['BMI_status'] = $result->fields['BMI_status'];
         $results[$i]['note'] = $result->fields['note'];
         $results[$i]['waist_circ'] = $result->fields['waist_circ'];
         $results[$i]['head_circ'] = $result->fields['head_circ'];
         $results[$i++]['oxygen_saturation'] = $result->fields['oxygen_saturation'];
         $result->MoveNext();
     }
     $this->assign("vitals", $vitals);
     $this->assign("results", $results);
     $this->assign("VIEW", true);
     return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
 }
Example #5
0
        updatePatientData($ptid, $newdata['patient_data']);
    }
    // Finally, delete the request from the portal.
    $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid));
    if ($result['errmsg']) {
        die(text($result['errmsg']));
    }
    echo "<html><body><script language='JavaScript'>\n";
    echo "if (top.restoreSession) top.restoreSession(); else opener.top.restoreSession();\n";
    echo "document.location.href = 'list_requests.php';\n";
    echo "</script></body></html>\n";
    exit;
}
$db_id = 0;
if ($ptid) {
    $ptrow = getPatientData($ptid, "*");
    $db_id = $ptrow['id'];
}
if ($postid) {
    $result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid));
    if ($result['errmsg']) {
        die(text($result['errmsg']));
    }
}
?>
<html>
<head>
<?php 
html_header_show();
?>
<link rel=stylesheet href="<?php 
/**
 * Test filter of a selected rule on a selected patient
 *
 * @param  integer        $patient_id  pid of selected patient.
 * @param  string         $rule        id(string) of selected rule
 * @param  string         $dateTarget  target date (format Y-m-d H:i:s). If blank then will test with current date as target.
 * @return boolean/string              if pass filter then TRUE; if excluded then 'EXCLUDED'; if not pass filter then FALSE
 */
function test_filter($patient_id, $rule, $dateTarget)
{
    // Set date to current if not set
    $dateTarget = $dateTarget ? $dateTarget : date('Y-m-d H:i:s');
    // Collect patient information
    $patientData = getPatientData($patient_id, "sex, DATE_FORMAT(DOB,'%Y %m %d') as DOB_TS");
    //
    // ----------------- INCLUSIONS -----------------
    //
    // -------- Age Filter (inclusion) ------------
    // Calculate patient age in years and months
    $patientAgeYears = convertDobtoAgeYearDecimal($patientData['DOB_TS'], $dateTarget);
    $patientAgeMonths = convertDobtoAgeMonthDecimal($patientData['DOB_TS'], $dateTarget);
    // Min age (year) Filter (assume that there in not more than one of each)
    $filter = resolve_filter_sql($rule, 'filt_age_min');
    if (!empty($filter)) {
        $row = $filter[0];
        if ($row['method_detail'] == "year") {
            if ($row['value'] && $row['value'] > $patientAgeYears) {
                return false;
            }
        }
        if ($row['method_detail'] == "month") {
            if ($row['value'] && $row['value'] > $patientAgeMonths) {
                return false;
            }
        }
    }
    // Max age (year) Filter (assume that there in not more than one of each)
    $filter = resolve_filter_sql($rule, 'filt_age_max');
    if (!empty($filter)) {
        $row = $filter[0];
        if ($row['method_detail'] == "year") {
            if ($row['value'] && $row['value'] < $patientAgeYears) {
                return false;
            }
        }
        if ($row['method_detail'] == "month") {
            if ($row['value'] && $row['value'] < $patientAgeMonths) {
                return false;
            }
        }
    }
    // -------- Gender Filter (inclusion) ---------
    // Gender Filter (assume that there in not more than one of each)
    $filter = resolve_filter_sql($rule, 'filt_sex');
    if (!empty($filter)) {
        $row = $filter[0];
        if ($row['value'] && $row['value'] != $patientData['sex']) {
            return false;
        }
    }
    // -------- Database Filter (inclusion) ------
    // Database Filter
    $filter = resolve_filter_sql($rule, 'filt_database');
    if (!empty($filter) && !database_check($patient_id, $filter, '', $dateTarget)) {
        return false;
    }
    // -------- Lists Filter (inclusion) ----
    // Set up lists filter, which is fully customizable and currently includes diagnoses, meds,
    //   surgeries and allergies.
    $filter = resolve_filter_sql($rule, 'filt_lists');
    if (!empty($filter) && !lists_check($patient_id, $filter, $dateTarget)) {
        return false;
    }
    // -------- Procedure (labs,imaging,test,procedures,etc) Filter (inlcusion) ----
    // Procedure Target (includes) (may need to include an interval in the future)
    $filter = resolve_filter_sql($rule, 'filt_proc');
    if (!empty($filter) && !procedure_check($patient_id, $filter, '', $dateTarget)) {
        return false;
    }
    //
    // ----------------- EXCLUSIONS -----------------
    //
    // -------- Lists Filter (EXCLUSION) ----
    // Set up lists EXCLUSION filter, which is fully customizable and currently includes diagnoses, meds,
    //   surgeries and allergies.
    $filter = resolve_filter_sql($rule, 'filt_lists', 0);
    if (!empty($filter) && lists_check($patient_id, $filter, $dateTarget)) {
        return "EXCLUDED";
    }
    // Passed all filters, so return true.
    return true;
}
Example #7
0
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>&nbsp;
</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>&nbsp;
</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') : '&nbsp;';
    ?>
</b></td>
  <td align='right'><b><?php 
    echo $details ? xlt('Qty') : '&nbsp;';
    ?>
</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'>&nbsp;</td>
 </tr>
 <tr>
  <td><?php 
    echo text(oeFormatShortDate($svcdispdate));
    ?>
</td>
  <td><b><?php 
    echo xlt('Total Charges');
    ?>
</b></td>
  <td align='right'>&nbsp;</td>
  <td align='right'>&nbsp;</td>
  <td align='right'><?php 
    echo text(oeFormatMoney($charges, true));
    ?>
</td>
 </tr>
 <tr>
  <td colspan='5'>&nbsp;</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'>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td><b><?php 
    echo xlt('Balance Due');
    ?>
</b></td>
  <td colspan='2'>&nbsp;</td>
  <td align='right'><?php 
    echo text(oeFormatMoney($charges, true));
    ?>
</td>
 </tr>
</table>
</center>
<div id='hideonprint'>
<p>
&nbsp;
<a href='#' onclick='return printme();'><?php 
    echo xlt('Print');
    ?>
</a>
<?php 
    if (acl_check('acct', 'disc')) {
        ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href='#' onclick='return deleteme();'><?php 
        echo xlt('Undo Checkout');
        ?>
</a>
<?php 
    }
    ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?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();
    }
}
Example #8
0
$frow = sqlQuery("SELECT * FROM facility WHERE primary_business_entity = 1");
// If primary is not set try to old method of guessing...for backward compatibility
if (empty($frow)) {
    $frow = sqlQuery("SELECT * FROM facility " . "ORDER BY billing_location DESC, accepts_assignment DESC, id LIMIT 1");
}
// Still missing...
if (empty($frow)) {
    $alertmsg = xl("No Primary Business Entity selected in facility list");
}
// Loop on array of PIDS
$saved_pages = $pages;
//Save calculated page count of a single fee sheet
foreach ($pid_list as $pid) {
    if ($form_fill) {
        // Get the patient's name and chart number.
        $patdata = getPatientData($pid);
    }
    // This tracks our position in the $SBCODES array.
    $cindex = 0;
    while (--$pages >= 0) {
        $html .= genFacilityTitle(xl('Superbill/Fee Sheet'), -1);
        $html .= "\n<table class='bordertbl' cellspacing='0' cellpadding='0' width='100%'>\n<tr>\n<td valign='top'>\n<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n<tr>\n<td class='toprow' style='width:10%'></td>\n<td class='toprow' style='width:10%'></td>\n<td class='toprow' style='width:25%'></td>\n<td class='toprow' style='width:55%'></td>\n</tr>";
        $cindex = genColumn($cindex);
        // Column 1
        if ($pages == 0) {
            // if this is the last page
            $html .= "<tr>\n<td colspan='3' valign='top' class='fshead' style='height:" . $lheight * 2 . "pt'>";
            $html .= xl('Patient', 'r');
            $html .= ":<br />";
            if ($form_fill) {
                $html .= $patdata['fname'] . ' ' . $patdata['mname'] . ' ' . $patdata['lname'] . "<br />\n";
         $us19_fee = $us19_fee + $iter['fee'];
         $us19_inspay = $us19_inspay + $iter['ins_code'];
         $us19_insadj = $us19_insadj + $iter['ins_adjust_dollar'];
         $us19_patadj = $us19_patadj + $iter['pat_adjust_dollar'];
         $us19_patpay = $us19_patpay + $iter['pat_code'];
         break;
 }
 if ($the_first_time == 1) {
     $user = $iter['user'];
     $first_user = $iter['user'];
     $the_first_time = 0;
 }
 if ($totals_only != 1) {
     if ($old_pid != $iter['pid'] and $iter['code_type'] != 'payment_info') {
         // $name has patient information
         $name = getPatientData($iter["pid"]);
         // formats the displayed text
         //
         if ($first_time) {
             print "<table border=0><tr>\n";
             // small table
             $first_time = 0;
         }
         // Displays name
         print "<tr><td colspan=50><hr><span class=bold>" . "     " . text($name["fname"]) . " " . text($name["lname"]) . "</span><br><br></td></tr><tr>\n";
         //==================================
         if ($iter['code_type'] === 'COPAY' || $iter['code_type'] === 'Patient Payment' || $iter['code_type'] === 'Insurance Payment') {
             print "<td width=40><span class=text><center><b>" . xlt("Units") . "</b></center>";
             print "</span></td><td width=100><span class=text><center><b>" . xlt("Fee") . "</b></center>";
             print "</span></td><td width=100><span class=text><center><b>" . xlt("Code") . "</b></center>";
             print "</span></td><td width=100><span class=text><b>";
Example #10
0
 $mmo_empty_mod = false;
 $mmo_num_charges = 0;
 // If there are ANY unauthorized items in this encounter and this is
 // the normal case of viewing only authorized billing, then skip the
 // entire encounter.
 //
 $skipping = FALSE;
 if ($my_authorized == '1') {
     $res = sqlQuery("select count(*) as count from billing where " . "encounter = ? and " . "pid=? and " . "activity = 1 and authorized = 0", array($iter['enc_encounter'], $iter['enc_pid']));
     if ($res['count'] > 0) {
         $skipping = TRUE;
         $last_encounter_id = $this_encounter_id;
         continue;
     }
 }
 $name = getPatientData($iter['enc_pid'], "fname, mname, lname, pubpid, billing_note, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
 # Check if patient has primary insurance and a subscriber exists for it.
 # If not we will highlight their name in red.
 # TBD: more checking here.
 #
 $res = sqlQuery("select count(*) as count from insurance_data where " . "pid = ? and " . "type='primary' and " . "subscriber_lname is not null and " . "subscriber_lname != '' limit 1", array($iter['enc_pid']));
 $namecolor = $res['count'] > 0 ? "black" : "#ff7777";
 $bgcolor = "#" . ($encount & 1 ? "ddddff" : "ffdddd");
 echo "<tr bgcolor='{$bgcolor}'><td colspan='9' height='5'></td></tr>\n";
 $lcount = 1;
 $rcount = 0;
 $oldcode = "";
 $ptname = $name['fname'] . " " . $name['lname'];
 $raw_encounter_date = date("Y-m-d", strtotime($iter['enc_date']));
 $billing_note = $name['billing_note'];
 //  Add Encounter Date to display with "To Encounter" button 2/17/09  JCH
Example #11
0
require_once $GLOBALS['srcdir'] . '/acl.inc';
require_once $GLOBALS['fileroot'] . '/custom/code_types.inc.php';
require_once $GLOBALS['srcdir'] . '/options.inc.php';
// Check authorization.
if (acl_check('patients', 'med')) {
    $tmp = getPatientData($pid, "squad");
    if ($tmp['squad'] && !acl_check('squads', $tmp['squad'])) {
        die(htmlspecialchars(xl('Not authorized'), ENT_NOQUOTES));
    }
} else {
    die(htmlspecialchars(xl('Not authorized'), ENT_NOQUOTES));
}
// Collect parameter(s)
$category = empty($_REQUEST['category']) ? '' : $_REQUEST['category'];
// Get patient's preferred language for the patient education URL.
$tmp = getPatientData($pid, 'language');
$language = $tmp['language'];
?>
<html>

<head>
<?php 
html_header_show();
?>

<link rel="stylesheet" href='<?php 
echo $css_header;
?>
' type='text/css'>

<title><?php 
Example #12
0
            foreach ($result4 as $iter) {
                $authorize[$iter["pid"]]["forms"] .= "<span class=text>" . htmlspecialchars($iter["form_name"] . " " . date("n/j/Y", strtotime($iter["date"])), ENT_NOQUOTES) . "</span><br>\n";
            }
        }
    }
    ?>

<table border='0' cellpadding='0' cellspacing='2' width='100%'>
<tr>
<td valign='top'>

<?php 
    if ($authorize) {
        $count = 0;
        while (list($ppid, $patient) = each($authorize)) {
            $name = getPatientData($ppid);
            // If I want to see mine only and this patient is not mine, skip it.
            if ($see_auth == 2 && $_SESSION['authUserID'] != $name['id']) {
                continue;
            }
            if ($count >= $N) {
                print "<tr><td colspan='5' align='center'><a" . ($GLOBALS['concurrent_layout'] ? "" : " target='Main'") . " href='authorizations_full.php?active=1' class='alert'>" . htmlspecialchars(xl('Some authorizations were not displayed. Click here to view all'), ENT_NOQUOTES) . "</a></td></tr>\n";
                break;
            }
            echo "<tr><td valign='top'>";
            if ($GLOBALS['concurrent_layout']) {
                // Clicking the patient name will load both frames for that patient,
                // as demographics.php takes care of loading the bottom frame.
                echo "<a href='{$rootdir}/patient_file/summary/demographics.php?set_pid=" . htmlspecialchars($ppid, ENT_QUOTES) . "' target='RTop'>";
            } else {
                echo "<a href='{$rootdir}/patient_file/patient_file.php?set_pid=" . htmlspecialchars($ppid, ENT_QUOTES) . "' target='_top'>";
Example #13
0
 function note_action_process($patient_id)
 {
     // this function is a dual function that will set up a note associated with a document or send a document via email.
     if ($_POST['process'] != "true") {
         return;
     }
     $n = new Note();
     $n->set_owner($_SESSION['authUserID']);
     parent::populate_object($n);
     if ($_POST['identifier'] == "no") {
         // associate a note with a document
         $n->persist();
     } elseif ($_POST['identifier'] == "yes") {
         // send the document via email
         $d = new Document($_POST['foreign_id']);
         $url = $d->get_url();
         $storagemethod = $d->get_storagemethod();
         $couch_docid = $d->get_couch_docid();
         $couch_revid = $d->get_couch_revid();
         if ($couch_docid && $couch_revid) {
             $couch = new CouchDB();
             $data = array($GLOBALS['couchdb_dbase'], $couch_docid);
             $resp = $couch->retrieve_doc($data);
             $content = $resp->data;
             if ($content == '' && $GLOBALS['couchdb_log'] == 1) {
                 $log_content = date('Y-m-d H:i:s') . " ==> Retrieving document\r\n";
                 $log_content = date('Y-m-d H:i:s') . " ==> URL: " . $url . "\r\n";
                 $log_content .= date('Y-m-d H:i:s') . " ==> CouchDB Document Id: " . $couch_docid . "\r\n";
                 $log_content .= date('Y-m-d H:i:s') . " ==> CouchDB Revision Id: " . $couch_revid . "\r\n";
                 $log_content .= date('Y-m-d H:i:s') . " ==> Failed to fetch document content from CouchDB.\r\n";
                 //$log_content .= date('Y-m-d H:i:s')." ==> Will try to download file from HardDisk if exists.\r\n\r\n";
                 $this->document_upload_download_log($d->get_foreign_id(), $log_content);
                 die(xlt("File retrieval from CouchDB failed"));
             }
             // place it in a temporary file and will remove the file below after emailed
             $temp_couchdb_url = $GLOBALS['OE_SITE_DIR'] . '/documents/temp/couch_' . date("YmdHis") . $d->get_url_file();
             $fh = fopen($temp_couchdb_url, "w");
             fwrite($fh, base64_decode($content));
             fclose($fh);
             $temp_url = $temp_couchdb_url;
             // doing this ensure hard drive file never deleted in case something weird happens
         } else {
             $url = preg_replace("|^(.*)://|", "", $url);
             // Collect filename and path
             $from_all = explode("/", $url);
             $from_filename = array_pop($from_all);
             $from_pathname_array = array();
             for ($i = 0; $i < $d->get_path_depth(); $i++) {
                 $from_pathname_array[] = array_pop($from_all);
             }
             $from_pathname_array = array_reverse($from_pathname_array);
             $from_pathname = implode("/", $from_pathname_array);
             $temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/' . $from_pathname . '/' . $from_filename;
         }
         if (!file_exists($temp_url)) {
             echo xl('The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it.', '', '', ' ') . $temp_url;
         }
         $url = $temp_url;
         $body_notes = attr($_POST['note']);
         $pdetails = getPatientData($patient_id);
         $pname = $pdetails['fname'] . " " . $pdetails['lname'];
         $this->document_send($_POST['provide_email'], $body_notes, $url, $pname);
         if ($couch_docid && $couch_revid) {
             // remove the temporary couchdb file
             unlink($temp_couchdb_url);
         }
     }
     $this->_state = false;
     $_POST['process'] = "";
     return $this->view_action($patient_id, $n->get_foreign_id());
 }
Example #14
0
?>
<link rel=stylesheet href="<?php 
echo $css_header;
?>
" type="text/css">
</head>

<body bgcolor="#ffffff" topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
<p>
<?php 
if (sizeof($_GET) > 0) {
    $ar = $_GET;
} else {
    $ar = $_POST;
}
$titleres = getPatientData($pid, "fname,lname,providerID");
// $sql = "select * from facility where billing_location = 1";
$sql = "select f.* from facility f " . "LEFT JOIN form_encounter fe on fe.facility_id = f.id " . "where fe.encounter = " . $encounter;
$db = $GLOBALS['adodb']['db'];
$results = $db->Execute($sql);
$facility = array();
if (!$results->EOF) {
    $facility = $results->fields;
}
$practice_logo = "../../../custom/practice_logo.gif";
if (file_exists($practice_logo)) {
    echo "<img src='{$practice_logo}' align='left'>\n";
}
?>
<h2><?php 
echo $facility['name'];
Example #15
0
/**
 *    postcalendar_userapi_buildSubmitForm()
 *    create event submit form
 */
function postcalendar_userapi_buildSubmitForm($args, $admin = false)
{
    $_SESSION['category'] = "";
    if (!PC_ACCESS_ADD) {
        return _POSTCALENDARNOAUTH;
    }
    extract($args);
    unset($args);
    //since we seem to clobber category
    $cat = $category;
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    // set up Smarty
    $tpl = new pcSmarty();
    $tpl->caching = false;
    $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate');
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Setup the correct config file path for the templates
    //=================================================================
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $modir = pnVarPrepForOS($modinfo['directory']);
    $modname = $modinfo['displayname'];
    $all_categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    //print_r($all_categories);
    unset($modinfo);
    $tpl->config_dir = "modules/{$modir}/pntemplates/{$template_name}/config/";
    //=================================================================
    //  PARSE MAIN
    //=================================================================
    $tpl->assign('webroot', $GLOBALS['web_root']);
    $tpl->assign_by_ref('TPL_NAME', $template_name);
    $tpl->assign('FUNCTION', pnVarCleanFromInput('func'));
    $tpl->assign_by_ref('ModuleName', $modname);
    $tpl->assign_by_ref('ModuleDirectory', $modir);
    $tpl->assign_by_ref('category', $all_categories);
    $tpl->assign('NewEventHeader', _PC_NEW_EVENT_HEADER);
    $tpl->assign('EventTitle', _PC_EVENT_TITLE);
    $tpl->assign('Required', _PC_REQUIRED);
    $tpl->assign('DateTimeTitle', _PC_DATE_TIME);
    $tpl->assign('AlldayEventTitle', _PC_ALLDAY_EVENT);
    $tpl->assign('TimedEventTitle', _PC_TIMED_EVENT);
    $tpl->assign('TimedDurationTitle', _PC_TIMED_DURATION);
    $tpl->assign('TimedDurationHoursTitle', _PC_TIMED_DURATION_HOURS);
    $tpl->assign('TimedDurationMinutesTitle', _PC_TIMED_DURATION_MINUTES);
    $tpl->assign('EventDescTitle', _PC_EVENT_DESC);
    //the double book variable comes from the eventdata array that is
    //passed here and extracted, injection is not an issue here
    if (is_numeric($double_book)) {
        $tpl->assign('double_book', $double_book);
    }
    //pennfirm begin patient info handling
    $ProviderID = pnVarCleanFromInput("provider_id");
    if (is_numeric($ProviderID)) {
        $tpl->assign('ProviderID', $ProviderID);
        $tpl->assign('provider_id', $ProviderID);
    } elseif (is_numeric($event_userid) && $event_userid != 0) {
        $tpl->assign('ProviderID', $event_userid);
        $tpl->assign('provider_id', $event_userid);
    } else {
        if ($_SESSION['userauthorized'] == 1) {
            $tpl->assign('ProviderID', $_SESSION['authUserID']);
        } else {
            $tpl->assign('ProviderID', "");
        }
    }
    $provinfo = getProviderInfo();
    $tpl->assign('providers', $provinfo);
    $PatientID = pnVarCleanFromInput("patient_id");
    // limit the number of results returned by getPatientPID
    // this helps to prevent the server from stalling on a request with
    // no PID and thousands of PIDs in the database -- JRM
    // the function getPatientPID($pid, $given, $orderby, $limit, $start) <-- defined in library/patient.inc
    $plistlimit = 500;
    if (is_numeric($PatientID)) {
        $tpl->assign('PatientList', getPatientPID(array('pid' => $PatientID, 'limit' => $plistlimit)));
    } elseif (is_numeric($event_pid)) {
        $tpl->assign('PatientList', getPatientPID(array('pid' => $event_pid, 'limit' => $plistlimit)));
    } else {
        $tpl->assign('PatientList', getPatientPID(array('limit' => $plistlimit)));
    }
    $tpl->assign('event_pid', $event_pid);
    $tpl->assign('event_aid', $event_aid);
    $tpl->assign('event_category', pnVarCleanFromInput("event_category"));
    if (empty($event_patient_name)) {
        $patient_data = getPatientData($event_pid, $given = "lname, fname");
        $event_patient_name = $patient_data['lname'] . ", " . $patient_data['fname'];
    }
    $tpl->assign('patient_value', $event_patient_name);
    //=================================================================
    //  PARSE INPUT_EVENT_TITLE
    //=================================================================
    $tpl->assign('InputEventTitle', 'event_subject');
    $tpl->assign('ValueEventTitle', pnVarPrepForDisplay($event_subject));
    //=================================================================
    //  PARSE SELECT_DATE_TIME
    //=================================================================
    // It seems that with Mozilla at least, <select> fields that are disabled
    // do not get passed as form data.  Therefore we ignore $double_book so
    // that the fields will not be disabled.  -- Rod 2005-03-22
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata = $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata .= $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, '');
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata = $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata .= $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, '');
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_startyear));
    $formdata .= $output->FormSelectMultiple('event_startyear', $sel_data, 0, 1, "", "", false, '');
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTime', $formdata);
    $tpl->assign('InputAllday', 'event_allday');
    $tpl->assign('ValueAllday', '1');
    $tpl->assign('SelectedAllday', $event_allday == 1 ? 'checked' : '');
    $tpl->assign('InputTimed', 'event_allday');
    $tpl->assign('ValueTimed', '0');
    $tpl->assign('SelectedTimed', $event_allday == 0 ? 'checked' : '');
    $tpl->assign('STYLE', $GLOBALS['style']);
    //=================================================================
    //  PARSE SELECT_END_DATE_TIME
    //=================================================================
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    //if there is no end date we want the box to read todays date instead of jan 01 1994 :)
    if ($event_endmonth == 0 && $event_endday == 0 && $event_endyear == 0) {
        $event_endmonth = $month;
        $event_endday = $day;
        $event_endyear = $year;
    }
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata = $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata = $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata .= $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear));
    $formdata .= $output->FormSelectMultiple('event_endyear', $sel_data, 0, 1, "", "", false, '');
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectEndDate', $formdata);
    //=================================================================
    //  PARSE SELECT_TIMED_EVENT
    //=================================================================
    $stimes = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildTimeSelect', array('hselected' => $event_starttimeh, 'mselected' => $event_starttimem));
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $timed_hours = $output->FormSelectMultiple('event_starttimeh', $stimes['h'], 0, 1, "", "", false, '');
    $timed_minutes = $output->FormSelectMultiple('event_starttimem', $stimes['m'], 0, 1, "", "", false, '');
    if (!_SETTING_TIME_24HOUR) {
        $ampm = array();
        $ampm[0]['id'] = pnVarPrepForStore(_AM_VAL);
        $ampm[0]['name'] = pnVarPrepForDisplay(_PC_AM);
        $ampm[1]['id'] = pnVarPrepForStore(_PM_VAL);
        $ampm[1]['name'] = pnVarPrepForDisplay(_PC_PM);
        if ($event_startampm == "AM" || $event_startampm == _AM_VAL) {
            $ampm[0]['selected'] = 1;
        } else {
            $ampm[1]['selected'] = 1;
        }
        $timed_ampm = $output->FormSelectMultiple('event_startampm', $ampm, 0, 1, "", "", false, '');
    } else {
        $timed_ampm = '';
    }
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectTimedHours', $timed_hours);
    $tpl->assign('SelectTimedMinutes', $timed_minutes);
    $tpl->assign('SelectTimedAMPM', $timed_ampm);
    $tpl->assign('event_startday', $event_startday);
    $tpl->assign('event_startmonth', $event_startmonth);
    $tpl->assign('event_startyear', $event_startyear);
    $tpl->assign('event_starttimeh', $event_starttimeh);
    $tpl->assign('event_starttimem', $event_starttimem);
    $tpl->assign('event_startampm', $event_startampm);
    $tpl->assign('event_dur_hours', $event_dur_hours);
    $tpl->assign('event_dur_minutes', $event_dur_minutes);
    //=================================================================
    //  PARSE SELECT_DURATION
    //=================================================================
    $event_dur_hours = (int) $event_dur_hours;
    for ($i = 0; $i <= 24; $i += 1) {
        $TimedDurationHours[$i] = array('value' => $i, 'selected' => $event_dur_hours == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
    }
    $tpl->assign('TimedDurationHours', $TimedDurationHours);
    $tpl->assign('InputTimedDurationHours', 'event_dur_hours');
    $found_time = false;
    for ($i = 0; $i < 60; $i += _SETTING_TIME_INCREMENT) {
        $TimedDurationMinutes[$i] = array('value' => $i, 'selected' => $event_dur_minutes == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
        if ($TimedDurationMinutes[$i]['selected'] == 'selected') {
            $found_time = true;
        }
    }
    if (!$found_time) {
        $TimedDurationMinutes[$i] = array('value' => $event_dur_minutes, 'selected' => 'selected', 'name' => sprintf('%02d', $event_dur_minutes));
    }
    $tpl->assign('TimedDurationMinutes', $TimedDurationMinutes);
    $tpl->assign('hidden_event_dur_minutes', $event_dur_minutes);
    $tpl->assign('InputTimedDurationMinutes', 'event_dur_minutes');
    //=================================================================
    //  PARSE INPUT_EVENT_DESC
    //=================================================================
    $tpl->assign('InputEventDesc', 'event_desc');
    if (empty($pc_html_or_text)) {
        $display_type = substr($event_desc, 0, 6);
        if ($display_type == ':text:') {
            $pc_html_or_text = 'text';
            $event_desc = substr($event_desc, 6);
        } elseif ($display_type == ':html:') {
            $pc_html_or_text = 'html';
            $event_desc = substr($event_desc, 6);
        } else {
            $pc_html_or_text = 'text';
        }
        unset($display_type);
    }
    $tpl->assign('ValueEventDesc', pnVarPrepForDisplay($event_desc));
    $eventHTMLorText = "<select name=\"pc_html_or_text\">";
    if ($pc_html_or_text == 'text') {
        $eventHTMLorText .= "<option value=\"text\" selected=\"selected\">" . _PC_SUBMIT_TEXT . "</option>";
    } else {
        $eventHTMLorText .= "<option value=\"text\">" . _PC_SUBMIT_TEXT . "</option>";
    }
    if ($pc_html_or_text == 'html') {
        $eventHTMLorText .= "<option value=\"html\" selected=\"selected\">" . _PC_SUBMIT_HTML . "</option>";
    } else {
        $eventHTMLorText .= "<option value=\"html\">" . _PC_SUBMIT_HTML . "</option>";
    }
    $eventHTMLorText .= "</select>";
    $tpl->assign('EventHTMLorText', $eventHTMLorText);
    //=================================================================
    //  PARSE select_event_topic_block
    //=================================================================
    $tpl->assign('displayTopics', _SETTING_DISPLAY_TOPICS);
    if ((bool) _SETTING_DISPLAY_TOPICS) {
        $a_topics =& postcalendar_userapi_getTopics();
        $topics = array();
        foreach ($a_topics as $topic) {
            array_push($topics, array('value' => $topic['id'], 'selected' => $topic['id'] == $event_topic ? 'selected' : '', 'name' => $topic['text']));
        }
        unset($a_topics);
        // only show this if we have topics to show
        if (count($topics) > 0) {
            $tpl->assign('topics', $topics);
            $tpl->assign('EventTopicTitle', _PC_EVENT_TOPIC);
            $tpl->assign('InputEventTopic', 'event_topic');
        }
    }
    //=================================================================
    //  PARSE select_event_type_block
    //=================================================================
    $categories = array();
    foreach ($all_categories as $category) {
        array_push($categories, array('value' => $category['id'], 'selected' => $category['id'] == $event_category ? 'selected' : '', 'name' => $category['name'], 'color' => $category['color'], 'desc' => $category['desc']));
    }
    // only show this if we have categories to show
    // you should ALWAYS have at least one valid category
    if (count($categories) > 0) {
        $tpl->assign('categories', $categories);
        $tpl->assign('EventCategoriesTitle', _PC_EVENT_CATEGORY);
        $tpl->assign('InputEventCategory', 'event_category');
        $tpl->assign('hidden_event_category', $event_category);
    }
    //=================================================================
    //  PARSE event_sharing_block
    //=================================================================
    $data = array();
    if (_SETTING_ALLOW_USER_CAL) {
        array_push($data, array(SHARING_PRIVATE, _PC_SHARE_PRIVATE));
        array_push($data, array(SHARING_PUBLIC, _PC_SHARE_PUBLIC));
        array_push($data, array(SHARING_BUSY, _PC_SHARE_SHOWBUSY));
    }
    if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN) || _SETTING_ALLOW_GLOBAL || !_SETTING_ALLOW_USER_CAL) {
        array_push($data, array(SHARING_GLOBAL, _PC_SHARE_GLOBAL));
    }
    $sharing = array();
    foreach ($data as $cell) {
        array_push($sharing, array('value' => $cell[0], 'selected' => (int) $event_sharing == $cell[0] ? 'selected' : '', 'name' => $cell[1]));
    }
    //pennfirm get list of providers from openemr code in calendar.inc
    $tpl->assign("user", getCalendarProviderInfo());
    $tpl->assign('sharing', $sharing);
    $tpl->assign('EventSharingTitle', _PC_SHARING);
    $tpl->assign('InputEventSharing', 'event_sharing');
    //=================================================================
    //  location information
    //=================================================================
    $tpl->assign('EventLocationTitle', _PC_EVENT_LOCATION);
    $tpl->assign('InputLocation', 'event_location');
    $tpl->assign('ValueLocation', pnVarPrepForDisplay($event_location));
    $tpl->assign('EventStreetTitle', _PC_EVENT_STREET);
    $tpl->assign('InputStreet1', 'event_street1');
    $tpl->assign('ValueStreet1', pnVarPrepForDisplay($event_street1));
    $tpl->assign('InputStreet2', 'event_street2');
    $tpl->assign('ValueStreet2', pnVarPrepForDisplay($event_street2));
    $tpl->assign('EventCityTitle', _PC_EVENT_CITY);
    $tpl->assign('InputCity', 'event_city');
    $tpl->assign('ValueCity', pnVarPrepForDisplay($event_city));
    $tpl->assign('EventStateTitle', _PC_EVENT_STATE);
    $tpl->assign('InputState', 'event_state');
    $tpl->assign('ValueState', pnVarPrepForDisplay($event_state));
    $tpl->assign('EventPostalTitle', _PC_EVENT_POSTAL);
    $tpl->assign('InputPostal', 'event_postal');
    $tpl->assign('ValuePostal', pnVarPrepForDisplay($event_postal));
    //=================================================================
    //  contact information
    //=================================================================
    $tpl->assign('EventContactTitle', _PC_EVENT_CONTACT);
    $tpl->assign('InputContact', 'event_contname');
    $tpl->assign('ValueContact', pnVarPrepForDisplay($event_contname));
    $tpl->assign('EventPhoneTitle', _PC_EVENT_PHONE);
    $tpl->assign('InputPhone', 'event_conttel');
    $tpl->assign('ValuePhone', pnVarPrepForDisplay($event_conttel));
    $tpl->assign('EventEmailTitle', _PC_EVENT_EMAIL);
    $tpl->assign('InputEmail', 'event_contemail');
    $tpl->assign('ValueEmail', pnVarPrepForDisplay($event_contemail));
    $tpl->assign('EventWebsiteTitle', _PC_EVENT_WEBSITE);
    $tpl->assign('InputWebsite', 'event_website');
    $tpl->assign('ValueWebsite', pnVarPrepForDisplay($event_website));
    $tpl->assign('EventFeeTitle', _PC_EVENT_FEE);
    $tpl->assign('InputFee', 'event_fee');
    $tpl->assign('ValueFee', pnVarPrepForDisplay($event_fee));
    //=================================================================
    //  Repeating Information
    //=================================================================
    $tpl->assign('RepeatingHeader', _PC_REPEATING_HEADER);
    $tpl->assign('NoRepeatTitle', _PC_NO_REPEAT);
    $tpl->assign('RepeatTitle', _PC_REPEAT);
    $tpl->assign('RepeatOnTitle', _PC_REPEAT_ON);
    $tpl->assign('OfTheMonthTitle', _PC_OF_THE_MONTH);
    $tpl->assign('EndDateTitle', _PC_END_DATE);
    $tpl->assign('NoEndDateTitle', _PC_NO_END);
    $tpl->assign('InputNoRepeat', 'event_repeat');
    $tpl->assign('ValueNoRepeat', '0');
    $tpl->assign('SelectedNoRepeat', (int) $event_repeat == 0 ? 'checked' : '');
    $tpl->assign('InputRepeat', 'event_repeat');
    $tpl->assign('ValueRepeat', '1');
    $tpl->assign('SelectedRepeat', (int) $event_repeat == 1 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY, _PC_EVERY_OTHER, _PC_EVERY_THIRD, _PC_EVERY_FOURTH);
    $keys = array(REPEAT_EVERY, REPEAT_EVERY_OTHER, REPEAT_EVERY_THIRD, REPEAT_EVERY_FOURTH);
    $repeat_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreq', 'event_repeat_freq');
    if (empty($event_repeat_freq) || $event_repeat_freq < 1) {
        $event_repeat_freq = 1;
    }
    $tpl->assign('InputRepeatFreqVal', $event_repeat_freq);
    $tpl->assign('repeat_freq', $repeat_freq);
    unset($in);
    $in = array(_PC_EVERY_DAY, _PC_EVERY_WORKDAY, _PC_EVERY_WEEK, _PC_EVERY_MONTH, _PC_EVERY_YEAR);
    $keys = array(REPEAT_EVERY_DAY, REPEAT_EVERY_WORK_DAY, REPEAT_EVERY_WEEK, REPEAT_EVERY_MONTH, REPEAT_EVERY_YEAR);
    $repeat_freq_type = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq_type, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq_type ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreqType', 'event_repeat_freq_type');
    $tpl->assign('repeat_freq_type', $repeat_freq_type);
    $tpl->assign('InputRepeatOn', 'event_repeat');
    $tpl->assign('ValueRepeatOn', '2');
    $tpl->assign('SelectedRepeatOn', (int) $event_repeat == 2 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY_1ST, _PC_EVERY_2ND, _PC_EVERY_3RD, _PC_EVERY_4TH, _PC_EVERY_LAST);
    $keys = array(REPEAT_ON_1ST, REPEAT_ON_2ND, REPEAT_ON_3RD, REPEAT_ON_4TH, REPEAT_ON_LAST);
    $repeat_on_num = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_num, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_num ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnNum', 'event_repeat_on_num');
    $tpl->assign('repeat_on_num', $repeat_on_num);
    unset($in);
    $in = array(_PC_EVERY_SUN, _PC_EVERY_MON, _PC_EVERY_TUE, _PC_EVERY_WED, _PC_EVERY_THU, _PC_EVERY_FRI, _PC_EVERY_SAT);
    $keys = array(REPEAT_ON_SUN, REPEAT_ON_MON, REPEAT_ON_TUE, REPEAT_ON_WED, REPEAT_ON_THU, REPEAT_ON_FRI, REPEAT_ON_SAT);
    $repeat_on_day = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_day, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_day ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnDay', 'event_repeat_on_day');
    $tpl->assign('repeat_on_day', $repeat_on_day);
    unset($in);
    $in = array(_PC_OF_EVERY_MONTH, _PC_OF_EVERY_2MONTH, _PC_OF_EVERY_3MONTH, _PC_OF_EVERY_4MONTH, _PC_OF_EVERY_6MONTH, _PC_OF_EVERY_YEAR);
    $keys = array(REPEAT_ON_MONTH, REPEAT_ON_2MONTH, REPEAT_ON_3MONTH, REPEAT_ON_4MONTH, REPEAT_ON_6MONTH, REPEAT_ON_YEAR);
    $repeat_on_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnFreq', 'event_repeat_on_freq');
    if (empty($event_repeat_on_freq) || $event_repeat_on_freq < 1) {
        $event_repeat_on_freq = 1;
    }
    $tpl->assign('InputRepeatOnFreqVal', $event_repeat_on_freq);
    $tpl->assign('repeat_on_freq', $repeat_on_freq);
    $tpl->assign('MonthsTitle', _PC_MONTHS);
    //=================================================================
    //  PARSE INPUT_END_DATE
    //=================================================================
    $tpl->assign('InputEndOn', 'event_endtype');
    $tpl->assign('ValueEndOn', '1');
    $tpl->assign('SelectedEndOn', (int) $event_endtype == 1 ? 'checked' : '');
    //=================================================================
    //  PARSE INPUT_NO_END
    //=================================================================
    $tpl->assign('InputNoEnd', 'event_endtype');
    $tpl->assign('ValueNoEnd', '0');
    $tpl->assign('SelectedNoEnd', (int) $event_endtype == 0 ? 'checked' : '');
    $qstring = preg_replace("/provider_id=[0-9]*[&]{0,1}/", "", $_SERVER['QUERY_STRING']);
    $tpl->assign('qstring', $qstring);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $authkey = $output->FormHidden('authid', pnSecGenAuthKey());
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $form_hidden = "<input type=\"hidden\" name=\"is_update\" value=\"{$is_update}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"pc_event_id\" value=\"{$pc_event_id}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"category\" value=\"{$cat}\" />";
    if (isset($data_loaded)) {
        $form_hidden .= "<input type=\"hidden\" name=\"data_loaded\" value=\"{$data_loaded}\" />";
        $tpl->assign('FormHidden', $form_hidden);
    }
    $form_submit = '<input type=hidden name="form_action" value="commit"/>
                   ' . $authkey . '<input type="submit" name="submit" value="go">';
    $tpl->assign('FormSubmit', $form_submit);
    // do not cache this page
    if ($admin) {
        $output->Text($tpl->fetch($template_name . '/admin/submit.html'));
    } elseif (pnVarCleanFromInput("no_nav") == 1) {
        $output->Text($tpl->fetch($template_name . '/user/submit_no_nav.html'));
    } else {
        $output->Text($tpl->fetch($template_name . '/user/submit.html'));
    }
    $output->Text(postcalendar_footer());
    return $output->GetOutput();
}
Example #16
0
<?php 
if ($result_sent_count == $M) {
    echo "   <a class='link' href='pnotes_full.php" . "?{$urlparms}" . "&s=1" . "&form_active=" . htmlspecialchars($form_active, ENT_QUOTES) . "&form_inactive=" . htmlspecialchars($form_inactive, ENT_QUOTES) . "&form_doc_only=" . htmlspecialchars($form_doc_only, ENT_QUOTES) . "&offset_sent=" . ($offset_sent + $M) . "&" . attr($activity_string_html) . "' onclick='top.restoreSession()'>[" . htmlspecialchars(xl('Next'), ENT_NOQUOTES) . "]</a>\n";
}
?>
  </td>
 </tr>
</table>

  </div>
</div>
<script language='JavaScript'>

<?php 
if ($_GET['set_pid']) {
    $ndata = getPatientData($patient_id, "fname, lname, pubpid");
    ?>
 parent.left_nav.setPatient(<?php 
    echo "'" . addslashes($ndata['fname'] . " " . $ndata['lname']) . "'," . addslashes($patient_id) . ",'" . addslashes($ndata['pubpid']) . "',window.name";
    ?>
);
<?php 
}
// If this note references a new patient document, pop up a display
// of that document.
//
if ($noteid) {
    $prow = getPnoteById($noteid, 'body');
    if (preg_match('/New scanned document (\\d+): [^\\n]+\\/([^\\n]+)/', $prow['body'], $matches)) {
        $docid = $matches[1];
        $docname = $matches[2];
Example #17
0
// Check authorization.
$thisauth = acl_check('patients', 'med');
if (!$thisauth) {
    die(xl('Not authorized'));
}
// Check authorization for pending review.
$reviewauth = acl_check('patients', 'sign');
if ($form_review and !$reviewauth and !$thisauth) {
    die(xl('Not authorized'));
}
// Set pid for pending review.
if ($_GET['set_pid'] && $form_review) {
    require_once "{$srcdir}/pid.inc";
    require_once "{$srcdir}/patient.inc";
    setpid($_GET['set_pid']);
    $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
    ?>
  <script language='JavaScript'>
    parent.left_nav.setPatient(<?php 
    echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',{$pid},'" . addslashes($result['pubpid']) . "','', ' " . xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']) . "'";
    ?>
);
    parent.left_nav.setRadio(window.name, 'orp');
  </script>
  <?php 
}
if (!$form_batch && !$pid && !$form_review) {
    die(xl('There is no current patient'));
}
function oresRawData($name, $index)
{
Example #18
0
}
?>

</div> <!-- end of report_custom DIV -->

<?php 
if ($PDF_OUTPUT) {
    $content = getContent();
    // $pdf->setDefaultFont('Arial');
    $pdf->writeHTML($content, false);
    if ($PDF_OUTPUT == 1) {
        $pdf->Output('report.pdf', $GLOBALS['pdf_output']);
        // D = Download, I = Inline
    } else {
        // This is the case of writing the PDF as a message to the CMS portal.
        $ptdata = getPatientData($pid, 'cmsportal_login');
        $contents = $pdf->Output('', true);
        echo "<html><head>\n";
        echo "<link rel='stylesheet' href='{$css_header}' type='text/css'>\n";
        echo "</head><body class='body_top'>\n";
        $result = cms_portal_call(array('action' => 'putmessage', 'user' => $ptdata['cmsportal_login'], 'title' => xl('Your Clinical Report'), 'message' => xl('Please see the attached PDF.'), 'filename' => 'report.pdf', 'mimetype' => 'application/pdf', 'contents' => base64_encode($contents)));
        if ($result['errmsg']) {
            die(text($result['errmsg']));
        }
        echo "<p>" . xlt('Report has been sent to the patient.') . "</p>\n";
        echo "</body></html>\n";
    }
} else {
    ?>
</body>
</html>
 */
header("Content-Type:text/xml");
$ignoreAuth = true;
require_once 'classes.php';
$p_id = $_REQUEST['patientID'];
$token = $_REQUEST['token'];
$xml_array = array();
if ($userId = validateToken($token)) {
    $user_data = getUserData($userId);
    $user = $user_data['user'];
    $emr = $user_data['emr'];
    $username = $user_data['username'];
    $password = $user_data['password'];
    $acl_allow = acl_check('patientportal', 'portal', $username);
    if ($acl_allow) {
        $patient = getPatientData($p_id);
        $xml_array['status'] = 0;
        $xml_array['reason'] = "Success patient processing record";
        if ($patient) {
            $xml_array['Patient']['demographics'] = $patient;
            $ethencity_query = "SELECT option_id, title FROM list_options WHERE list_id  = 'ethnicity' AND `option_id` = ?";
            $patientData = $patient["ethnicity"];
            $ethencity_result = sqlQuery($ethencity_query, array($patientData));
            if ($ethencity_result) {
                $xml_array['Patient']['demographics']['ethnicityvalue'] = $ethencity_result['title'];
            } else {
                $xml_array['Patient']['demographics']['ethnicityvalue'] = '';
            }
            $p_insurance = getInsuranceData($p_id);
            $s_insurance = getInsuranceData($p_id, 'secondary');
            $o_insurance = getInsuranceData($p_id, 'tertiary');
Example #20
0
            //if ($amount = 0 + $payment)
        }
        //foreach
    }
    //if ($_POST['form_upay'])
}
//if ($_POST['form_save'])
if ($_POST['form_save'] || $_REQUEST['receipt']) {
    if ($_REQUEST['receipt']) {
        $form_pid = $_GET['patient'];
        $timestamp = decorateString('....-..-.. ..:..:..', $_GET['time']);
    }
    // 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");
    // Get the patient's name and chart number.
    $patdata = getPatientData($form_pid, 'fname,mname,lname,pubpid');
    // Re-fetch payment info.
    $payrow = sqlQuery("SELECT " . "SUM(amount1) AS amount1, " . "SUM(amount2) AS amount2, " . "MAX(method) AS method, " . "MAX(source) AS source, " . "MAX(dtime) AS dtime, " . "MAX(user) AS user, " . "MAX(encounter) as encounter " . "FROM payments WHERE " . "pid = ? AND dtime = ?", array($form_pid, $timestamp));
    // Create key for deleting, just in case.
    $ref_id = $_REQUEST['radio_type_of_payment'] == 'copay' ? $session_id : $payment_id;
    $payment_key = $form_pid . '.' . preg_replace('/[^0-9]/', '', $timestamp) . '.' . $ref_id;
    // get facility from encounter
    $tmprow = sqlQuery("\n    SELECT facility_id\n    FROM form_encounter\n    WHERE encounter = ?", array($payrow['encounter']));
    $frow = sqlQuery("SELECT * FROM facility " . " WHERE id = ?", array($tmprow['facility_id']));
    // Now proceed with printing the receipt.
    ?>

<title><?php 
    echo xlt('Receipt for Payment');
    ?>
</title>
Example #21
0
}
$issue = $_REQUEST['issue'];
$thispid = 0 + (empty($_REQUEST['thispid']) ? $pid : $_REQUEST['thispid']);
$info_msg = "";
// A nonempty thisenc means we are to link the issue to the encounter.
$thisenc = 0 + (empty($_REQUEST['thisenc']) ? 0 : $_REQUEST['thisenc']);
// A nonempty thistype is an issue type to be forced for a new issue.
$thistype = empty($_REQUEST['thistype']) ? '' : $_REQUEST['thistype'];
$thisauth = acl_check('patients', 'med');
if ($issue && $thisauth != 'write') {
    die("Edit is not authorized!");
}
if ($thisauth != 'write' && $thisauth != 'addonly') {
    die("Add is not authorized!");
}
$tmp = getPatientData($thispid, "squad");
if ($tmp['squad'] && !acl_check('squads', $tmp['squad'])) {
    die("Not authorized for this squad!");
}
function QuotedOrNull($fld)
{
    if ($fld) {
        return "'{$fld}'";
    }
    return "NULL";
}
function rbvalue($rbname)
{
    $tmp = $_POST[$rbname];
    if (!$tmp) {
        $tmp = '0';
<?php

// Copyright (C) 2005 Rod Roark <*****@*****.**>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
include_once "../globals.php";
include_once "{$srcdir}/patient.inc";
include_once "{$srcdir}/acl.inc";
include_once "{$srcdir}/lists.inc";
$patdata = getPatientData($pid, "fname,lname,squad");
$thisauth = (acl_check('encounters', 'notes', '', 'write') || acl_check('encounters', 'notes_a', '', 'write')) && acl_check('patients', 'med', '', 'write');
if ($patdata['squad'] && !acl_check('squads', $patdata['squad'])) {
    $thisauth = 0;
}
if (!$thisauth) {
    echo "<html>\n<body>\n";
    echo "<p>" . xl('You are not authorized for this.') . "</p>\n";
    echo "</body>\n</html>\n";
    exit;
}
$alertmsg = "";
// anything here pops up in an alert box
$endjs = "";
// holds javascript to write at the end
// If the Save button was clicked...
if ($_POST['form_save']) {
    $form_pid = $_POST['form_pid'];
    $form_pelist = $_POST['form_pelist'];
Example #23
0
});

</script>

</head>

<body class="body_top">

<div id="wrapper" class="lefttop" style="width: 700px;">
<h2 class="heading"><?php 
echo xlt("Patient Portal");
?>
</h2>

<?php 
$result = getPatientData($pid);
echo xlt('Welcome');
?>
 <b><?php 
echo text($result['fname'] . " " . $result['lname']);
?>
</b>

<div style='margin-top:10px'> <!-- start main content div -->
 <table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tr>
   <td align="left" valign="top">
    <!-- start left column div -->
    <div style='float:left; margin-right:20px'>
     <table cellspacing=0 cellpadding=0>
      <?php 
Example #24
0
$patient_name = $result['fname'] . " " . $result['lname'];
?>
   </label>
   <input type="hidden" name="client_name" value="<?php 
echo attr($patient_name);
?>
">
		</td>
		<td align="left"  class="forms"><?php 
echo xlt('DOB');
?>
:</td>
		<td class="forms">
		<label class="forms-data"> <?php 
if (is_numeric($pid)) {
    $result = getPatientData($pid, "*");
    echo htmlspecialchars($result['DOB']);
}
$dob = $result['DOB'];
?>
   </label>
     <input type="hidden" name="DOB" value="<?php 
echo attr($dob);
?>
">
		</td>
		</tr>
<tr>
	
		
  <td align="left" class="forms"><?php 
Example #25
0
//STOP FAKE REGISTER GLOBALS
$fake_register_globals = false;
//
include_once "../../globals.php";
include_once "{$srcdir}/lists.inc";
include_once "{$srcdir}/acl.inc";
include_once "{$srcdir}/options.inc.php";
include_once "{$srcdir}/formdata.inc.php";
?>

<div id="patient_stats_summary">

<?php 
$thisauth = acl_check('patients', 'med');
if ($thisauth) {
    $tmp = getPatientData($pid, "squad");
    if ($tmp['squad'] && !acl_check('squads', $tmp['squad'])) {
        $thisauth = 0;
    }
}
if (!$thisauth) {
    echo "<p>(" . htmlspecialchars(xl('Issues not authorized'), ENT_NOQUOTES) . ")</p>\n";
    echo "</body>\n</html>\n";
    exit;
}
?>

<script type='text/javascript'>
    function load_location( location ) {
        top.restoreSession();
		if ( !top.frames["RTop"] ) {
Example #26
0
    <?php 
$has_note = 0;
$thisauth = acl_check('patients', 'notes');
if ($thisauth) {
    $tmp = getPatientData($pid, "squad");
    if ($tmp['squad'] && !acl_check('squads', $tmp['squad'])) {
        $thisauth = 0;
    }
}
if (!$thisauth) {
    echo "<p>(" . htmlspecialchars(xl('Notes not authorized'), ENT_NOQUOTES) . ")</p>\n";
} else {
    ?>
    <table width='100%' border='0' cellspacing='1' cellpadding='1' style='border-collapse:collapse;' >
    <?php 
    $pres = getPatientData($pid, "lname, fname");
    $patientname = $pres['lname'] . ", " . $pres['fname'];
    //retrieve all active notes
    $result = getPnotesByDate("", 1, "id,date,body,user,title,assigned_to,message_status", $pid, "{$N}", 0, '', $docid);
    if ($result != null) {
        $notes_count = 0;
        //number of notes so far displayed
        echo "<tr class='text' style='border-bottom:2px solid #000;' >\n";
        echo "<td valign='top' class='text' ><b>" . htmlspecialchars(xl('From'), ENT_NOQUOTES) . "</b></td>\n";
        echo "<td valign='top' class='text' ><b>" . htmlspecialchars(xl('Date'), ENT_NOQUOTES) . "</b></td>\n";
        echo "<td valign='top' class='text' ><b>" . htmlspecialchars(xl('Subject'), ENT_NOQUOTES) . "</b></td>\n";
        echo "<td valign='top' class='text' ><b>" . htmlspecialchars(xl('Content'), ENT_NOQUOTES) . "</b></td>\n";
        echo "<td valign='top' class='text' ><b>" . htmlspecialchars(xl('Status'), ENT_NOQUOTES) . "</b></td>\n";
        echo "</tr>\n";
        foreach ($result as $iter) {
            $has_note = 1;
Example #27
0
?>

<div class='encounter-summary-container'>
<div class='encounter-summary-column'>
<div>
<span class="title"><?php 
echo oeFormatShortDate($encounter_date) . " " . xl("Encounter");
?>
 </span>
<?php 
$auth_notes_a = acl_check('encounters', 'notes_a');
$auth_notes = acl_check('encounters', 'notes');
$auth_relaxed = acl_check('encounters', 'relaxed');
if (is_numeric($pid)) {
    // Check for no access to the patient's squad.
    $result = getPatientData($pid, "fname,lname,squad");
    echo htmlspecialchars(xl('for', '', ' ', ' ') . $result['fname'] . " " . $result['lname']);
    if ($result['squad'] && !acl_check('squads', $result['squad'])) {
        $auth_notes_a = $auth_notes = $auth_relaxed = 0;
    }
    // Check for no access to the encounter's sensitivity level.
    $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " . "pid = '{$pid}' AND encounter = '{$encounter}' LIMIT 1");
    if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
        $auth_notes_a = $auth_notes = $auth_relaxed = 0;
    }
}
?>
</div>
<div style='margin-top:8px;'>
<?php 
// ESign for entire encounter
Example #28
0
//  page1.css
//  page2.css
//
include_once "../../../../interface/globals.php";
include_once $GLOBALS['fileroot'] . "/library/patient.inc";
$chartpath = $GLOBALS['fileroot'] . "/interface/forms/vitals/growthchart/";
$name = "";
$pid = $_GET['pid'];
if ($pid == "") {
    // no pid? no graph for you.
    echo "<p>" . xl('Missing PID.', '', '', ' ') . xl('Please close this window.') . "</p>";
    exit;
}
$patient_data = "";
if (isset($pid) && is_numeric($pid)) {
    $patient_data = getPatientData($pid, "fname, lname, sex, DATE_FORMAT(DOB,'%Y%m%d') as DOB");
    $nowAge = getPatientAge($patient_data['DOB']);
    $dob = $patient_data['DOB'];
    $name = $patient_data['fname'] . " " . $patient_data['lname'];
}
// The first data point in the DATA set is significant. It tells date
// of the currently viewed vitals by the user. We will use this
// date to define which chart is displayed on the screen
$charttype = "2-20";
// default the chart-type to ages 2-20
$datapoints = explode('~', $_GET['data']);
if (isset($datapoints) && $datapoints != "") {
    list($date, $height, $weight, $head_circ) = explode('-', $datapoints[0]);
    if ($date != "") {
        $charttype_date = $date;
    }
Example #29
0
<html>
<head>
<?php 
html_header_show();
?>

<link rel="stylesheet" href="<?php 
echo $css_header;
?>
" type="text/css">

</head>
<body class="body_title">

<?php 
$result = getPatientData($pid, "fname,lname,pid,pubpid,phone_home,pharmacy_id,DOB,DATE_FORMAT(DOB,'%Y%m%d') as DOB_YMD");
$provider_results = sqlQuery("select * from users where username=?", array($_SESSION["authUser"]));
$age = getPatientAge($result["DOB_YMD"]);
$info = 'ID: ' . $result['pubpid'];
if ($result['DOB']) {
    $info .= ', ' . xl('DOB') . ': ' . $result['DOB'] . ', ' . xl('Age') . ': ' . $age;
}
if ($result['phone_home']) {
    $info .= ', ' . xl('Home') . ': ' . $result['phone_home'];
}
if ($result['pharmacy_id']) {
    $pharmacy = new Pharmacy($result['pharmacy_id']);
    if ($pharmacy->get_phone()) {
        $info .= ', ' . xl('Pharm') . ': ' . $pharmacy->get_phone();
    }
}
Example #30
0
<?php

//SANITIZE ALL ESCAPES
$sanitize_all_escapes = true;
//
//STOP FAKE REGISTER GLOBALS
$fake_register_globals = false;
//
include_once "../../globals.php";
include_once "{$srcdir}/patient.inc";
include_once "{$srcdir}/acl.inc";
include_once "{$srcdir}/options.inc.php";
$prow = getPatientData($pid, "squad, title, fname, mname, lname");
// Check authorization.
$thisauth = acl_check('patients', 'notes');
if (!$thisauth) {
    die(htmlspecialchars(xl('Not authorized'), ENT_NOQUOTES));
}
if ($prow['squad'] && !acl_check('squads', $prow['squad'])) {
    die(htmlspecialchars(xl('Not authorized for this squad.'), ENT_NOQUOTES));
}
$noteid = $_REQUEST['noteid'];
$ptname = $prow['title'] . ' ' . $prow['fname'] . ' ' . $prow['mname'] . ' ' . $prow['lname'];
$title = '';
$assigned_to = '';
$body = '';
$activity = 0;
if ($noteid) {
    $nrow = getPnoteById($noteid, 'title,assigned_to,activity,body');
    $title = $nrow['title'];
    $assigned_to = $nrow['assigned_to'];