Skip to content

Commit

Permalink
changed layout of output from printPatientForms()
Browse files Browse the repository at this point in the history
  • Loading branch information
cfapress committed Feb 9, 2009
1 parent 3488408 commit d68a4ae
Showing 1 changed file with 51 additions and 21 deletions.
72 changes: 51 additions & 21 deletions library/report.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
require_once("{$GLOBALS['srcdir']}/sql.inc");
require_once("{$GLOBALS['srcdir']}/acl.inc");

$patient_data_array = array(title => "Title: ",
fname => "First Name: ",
Expand Down Expand Up @@ -223,7 +224,9 @@ function printPatientTransactions($pid) {
function printPatientBilling($pid) {
$res = sqlStatement("select * from billing where pid='$pid' order by date");
while($result = sqlFetchArray($res)) {
print "<span class=bold>" . date("Y-m-d",strtotime($result{"date"})) . ":</span><span class=text>(".$result{"code_type"}.") " . $result{"code"} . "</span><br>\n";
echo "<span class=bold>" . date("Y-m-d",strtotime($result{"date"})) . " : </span>";
echo "<span class=text>(".$result{"code_type"}.") " . $result{"code"} . " - ". $result['code_text']."</span>";
echo "<br>\n";
}
}

Expand All @@ -239,27 +242,54 @@ function getPatientBillingEncounter($pid,$encounter) {


function printPatientForms($pid, $cols) {
//this function takes a $pid
$inclookupres = sqlStatement("select distinct formdir from forms where pid='$pid' AND deleted=0");
while($result = sqlFetchArray($inclookupres)) {
include_once("{$GLOBALS['incdir']}/forms/" . $result{"formdir"} . "/report.php");
}
//this function takes a $pid
$inclookupres = sqlStatement("select distinct formdir from forms where pid='$pid' AND deleted=0");
while($result = sqlFetchArray($inclookupres)) {
include_once("{$GLOBALS['incdir']}/forms/" . $result{"formdir"} . "/report.php");
}

$isfirst=1;
$res = sqlStatement("select * from forms where pid='$pid' AND deleted=0 order by date");
while($result = sqlFetchArray($res)) {
if ($result{"form_name"} == "New Patient Encounter") {
if ($isfirst==0) {
print "</blockquote>\n\n";
}
$isfirst=0;
print "<span class=bold>".$result{"form_name"}." </span><span class=text>(".date("Y-m-d",strtotime($result{"date"})).")</span><br><blockquote>\n";
} else {
print "<span class=bold>".$result{"form_name"}." </span><span class=text>(".date("Y-m-d",strtotime($result{"date"})).")</span><br>\n";
}
call_user_func($result{"formdir"} . "_report", $pid, $result{"encounter"}, $cols, $result{"form_id"});

}
$res = sqlStatement("select * from forms where pid='$pid' AND deleted=0 order by date");
while($result = sqlFetchArray($res)) {
if ($result{"form_name"} == "New Patient Encounter") {
echo "<div class='text encounter'>\n";
echo "<h1>" . $result["form_name"] . "</h1>";

// display the provider info
$tmp = sqlQuery("SELECT u.title, u.fname, u.mname, u.lname " .
"FROM forms AS f, users AS u WHERE " .
"f.pid = '$pid' AND f.encounter = ".$result['encounter']." AND " .
"f.formdir = 'newpatient' AND u.username = f.user " .
" AND f.deleted=0 ". //--JRM--
"ORDER BY f.id LIMIT 1");
echo " ".xl('Provider').": ".$tmp['title']." ".
$tmp['fname']." ".$tmp['mname']." ".$tmp['lname'];
echo "<br/>";
}
else {
echo "<div class='text encounter_form'>";
echo "<h1>" . $result["form_name"] . "</h1>";
}
echo "(" . date("Y-m-d",strtotime($result["date"])) . ") ";

if (acl_check('acct', 'rep') || acl_check('acct', 'eob') || acl_check('acct', 'bill')) {
if ($result{"form_name"} == "New Patient Encounter") {
// display billing info
echo "<br/>";
$bres = sqlStatement("SELECT date, code, code_text FROM billing WHERE " .
"pid = '$pid' AND encounter = '".$result['encounter']."' AND activity = 1 AND " .
"( code_type = 'CPT4' OR code_type = 'OPCS' OR code_type = 'OSICS10' ) " .
"ORDER BY date");
while ($brow=sqlFetchArray($bres)) {
echo "<span class='bold'>&nbsp;".xl('Procedure').": </span><span class='text'>" .
$brow['code'] . " " . $brow['code_text'] . "</span><br>\n";
}
}
}

call_user_func($result{"formdir"} . "_report", $pid, $result{"encounter"}, $cols, $result{"form_id"});

echo "</div>";
}
}


Expand Down

0 comments on commit d68a4ae

Please sign in to comment.