2 include_once(dirname(__file__
)."/../globals.php");
5 include_once("$srcdir/forms.inc");
6 include_once("$srcdir/billing.inc");
7 include_once("$srcdir/pnotes.inc");
8 include_once("$srcdir/patient.inc");
9 include_once("$srcdir/report.inc");
10 include_once("$srcdir/classes/Document.class.php");
11 include_once("$srcdir/classes/Note.class.php");
17 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
22 <body
<?
echo $top_bg_line;?
> topmargin
=0 rightmargin
=0 leftmargin
=2 bottommargin
=0 marginwidth
=2 marginheight
=0>
27 if(empty($_POST['start']) ||
empty($_POST['end'])){
29 <form method
="post" action
="custom_report_range.php">
31 <tr
><td
>Start Date
:</td
><td
><input type
="text" name
="start" value
="" size
="10"/></td
><td
>YYYYMMDD
</td
></tr
>
32 <tr
><td
>End Date
:</td
><td
><input type
="text" name
="end" value
="" size
="10"/></td
><td
>YYYYMMDD
</td
></tr
>
33 <tr
><td
><input type
="submit" value
="Submit"/></td
><td
></td
></tr
>
38 $sql = "select * from facility where billing_location = 1";
39 $db = $GLOBALS['adodb']['db'];
40 $results = $db->Execute($sql);
43 $facility = $results->fields
;
46 <h2
><?
=$facility['name']?
></h2
>
47 <?
=$facility['street']?
><br
>
48 <?
=$facility['city']?
>, <?
=$facility['state']?
> <?
=$facility['postal_code']?
><br
>
55 $res = sqlStatement("select * from forms where form_name='New Patient Encounter' and date between DATE('$start') and DATE('$end') order by date DESC");
56 while($result = sqlFetchArray($res)) {
57 if ($result{"form_name"} == "New Patient Encounter") {
58 $newpatient[] = $result{"form_id"}.":".$result{"encounter"};
59 $pids[] = $result{"pid"};
63 function postToGet($newpatient, $pids) {
65 $serialnewpatient = serialize($newpatient);
66 $serialpids = serialize($pids);
67 $getstring = "newpatient=".urlencode($serialnewpatient)."&pids=".urlencode($serialpids);
74 if(empty($newpatient)){
75 $newpatient = array();
77 foreach($newpatient as $patient){
79 $inclookupres = sqlStatement("select distinct formdir from forms where pid='".$pids[$iCounter]."'");
80 while($result = sqlFetchArray($inclookupres)) {
81 include_once("{$GLOBALS['incdir']}/forms/" . $result{"formdir"} . "/report.php");
85 print "<font class=bold>Patient Data:</font><br>";
86 printRecDataOne($patient_data_array, getRecPatientData ($pids[$iCounter]), $N);
88 print "<font class=bold>Primary Insurance Data:</font><br>";
89 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"primary"), $N);
90 print "<font class=bold>Secondary Insurance Data:</font><br>";
91 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"secondary"), $N);
93 print "<font class=bold>Tertiary Insurance Data:</font><br>";
94 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"tertiary"), $N);
96 print "<font class=bold>Billing Information:</font><br>";
97 if (count($patient) > 0) {
100 echo "<tr><td class=bold>Date</td><td width=\"200\" class=bold>Provider</td><td width=\"400\" class=bold>Code</td><td class=bold>Fee</td></tr>\n";
103 //foreach ($patient as $be) {
105 $ta = split(":",$patient);
106 $billing = getPatientBillingEncounter($pids[$iCounter],$ta[1]);
108 $billings[] = $billing;
109 foreach ($billing as $b) {
111 echo "<td class=text>" . $b['date'] . "</td>";
112 echo "<td class=text>" . $b['provider_name'] . "</td>";
113 echo "<td class=text>";
114 echo $b['code_type'] . ":\t" . $b['code'] . " ". $b['modifier'] . " " . $b['code_text'] . " ";
116 echo "<td class=text>";
121 if ($b['code_type'] == "COPAY") {
122 $copays +
= $b['fee'];
127 echo "<tr><td> </td></tr>";
128 echo "<tr><td class=bold>Sub-Total</td><td class=text>" . sprintf("%0.2f",$total +
abs($copays)) . "</td></tr>";
129 echo "<tr><td class=bold>Paid</td><td class=text>" . sprintf("%0.2f",abs($copays)) . "</td></tr>";
130 echo "<tr><td class=bold>Total</td><td class=text>" . sprintf("%0.2f",$total) . "</td></tr>";
133 //print_r($billings);
137 print "<br/><br/>Physician Signature: _______________________________________________<br/><br/><br/>";
138 print "<hr width=\"100%\" />";