From aaad5c1a5e64efe5744b08cac8faadb5f1b06104 Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Tue, 5 Dec 2006 22:21:25 +0000 Subject: [PATCH] new report: patient list --- interface/reports/patient_list.php | 192 ++++++++++++++++++++++++++++++++++ templates/report/general_default.html | 2 + 2 files changed, 194 insertions(+) create mode 100644 interface/reports/patient_list.php diff --git a/interface/reports/patient_list.php b/interface/reports/patient_list.php new file mode 100644 index 000000000..5370d7c8c --- /dev/null +++ b/interface/reports/patient_list.php @@ -0,0 +1,192 @@ + + // + // 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. + + // This report lists patients that were seen within a given date + // range. + + include_once("../globals.php"); + include_once("$srcdir/patient.inc"); + + $from_date = fixDate($_POST['form_from_date'], date('Y-01-01')); + $to_date = fixDate($_POST['form_to_date'], date('Y-12-31')); +?> + + +<? xl('Patient List','e'); ?> + + + + + + + + + + + + + +
+ +

+ +
+ + + + + + + + + + + +
+ : + + +  : + + +   + > +
+
+ + + + + + + + + + + + + += '$from_date 00:00:00' AND " . + "e.date <= '$to_date 23:59:59' " . + "LEFT OUTER JOIN insurance_data AS i1 ON " . + "i1.pid = p.pid AND i1.type = 'primary' " . + "LEFT OUTER JOIN insurance_companies AS c1 ON " . + "c1.id = i1.provider " . + "LEFT OUTER JOIN insurance_data AS i2 ON " . + "i2.pid = p.pid AND i2.type = 'secondary' " . + "LEFT OUTER JOIN insurance_companies AS c2 ON " . + "c2.id = i2.provider " . + "GROUP BY p.lname, p.fname, p.mname, p.pid " . + "ORDER BY p.lname, p.fname, p.mname, p.pid"; + + // echo "\n"; // debugging + $res = sqlStatement($query); + + while ($row = sqlFetchArray($res)) { + $age = ''; + if ($row['DOB']) { + $dob = $row['DOB']; + $tdy = $row['edate']; + $ageInMonths = (substr($tdy,0,4)*12) + substr($tdy,5,2) - + (substr($dob,0,4)*12) - substr($dob,5,2); + $dayDiff = substr($tdy,8,2) - substr($dob,8,2); + if ($dayDiff < 0) --$ageInMonths; + $age = intval($ageInMonths/12); + } +?> + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+   +
+ + + +
+
+
+ + diff --git a/templates/report/general_default.html b/templates/report/general_default.html index 0e0ecfaf8..bf2560fae 100644 --- a/templates/report/general_default.html +++ b/templates/report/general_default.html @@ -48,6 +48,8 @@ function dopopup(aurl) {
Unique Seen Patients Report
+Patient List +
{php} } {/php} {php} if (! $GLOBALS['weight_loss_clinic']) { {/php} -- 2.11.4.GIT