2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This report lists front office receipts for a given date range.
11 include_once("../globals.php");
12 include_once("$srcdir/patient.inc");
14 $from_date = fixDate($_POST['form_from_date'], date('Y-m-d'));
15 $to_date = fixDate($_POST['form_to_date'], date('Y-m-d'));
17 function bucks($amt) {
18 return ($amt != 0.00) ?
sprintf('%.2f', $amt) : '';
23 <title
>Front Office Receipts
</title
>
24 <link rel
='stylesheet' href
='<?php echo $css_header ?>' type
='text/css'>
25 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
26 <script type
="text/javascript" src
="../../library/calendar.js"></script
>
27 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
28 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
29 <script language
="JavaScript">
31 var mypcc
= '<? echo $GLOBALS['phone_country_code
'] ?>';
33 // The OnClick handler for receipt display.
34 function show_receipt(payid
) {
35 dlgopen('../patient_file/front_payment.php?receipt=1&payid=' + payid
, '_blank', 550, 400);
42 <body leftmargin
='0' topmargin
='0' marginwidth
='0' marginheight
='0'>
44 <!-- Required
for the popup date selectors
-->
45 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
49 <h2
>Front Office Receipts
</h2
>
51 <form name
='theform' method
='post' action
='front_receipts_report.php'>
53 <table border
='0' cellpadding
='3'>
58 <input type
='text' name
='form_from_date' size
='10' value
='<? echo $from_date ?>'
59 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='yyyy-mm-dd'>
60 <a href
="javascript:show_calendar('theform.form_from_date')"
61 title
="Click here to choose a date"
62 ><img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0'></a
>
64 <input type
='text' name
='form_to_date' size
='10' value
='<? echo $to_date ?>'
65 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='yyyy-mm-dd'>
66 <a href
="javascript:show_calendar('theform.form_to_date')"
67 title
="Click here to choose a date"
68 ><img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0'></a
>
70 <input type
='submit' name
='form_refresh' value
='Refresh'>
81 <table border
='0' cellpadding
='1' cellspacing
='2' width
='98%'>
83 <tr bgcolor
="#dddddd">
99 <td
class='dehead' align
='right'>
102 <td
class='dehead' align
='right'>
105 <td
class='dehead' align
='right'>
110 if (true ||
$_POST['form_refresh']) {
115 "r.id, r.dtime, r.method, r.source, r.amount1, r.amount2, " .
116 "p.fname, p.mname, p.lname, p.pubpid " .
117 "FROM payments AS r " .
118 "LEFT OUTER JOIN patient_data AS p ON " .
121 "r.dtime >= '$from_date 00:00:00' AND " .
122 "r.dtime <= '$to_date 23:59:59' " .
125 // echo "<!-- $query -->\n"; // debugging
126 $res = sqlStatement($query);
128 while ($row = sqlFetchArray($res)) {
132 <a href
='' onclick
='return show_receipt(<?php echo $row['id
'] ?>)'>
133 <?php
echo substr($row['dtime'], 0, 16) ?
>
137 <?php
echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'] ?
>
140 <?php
echo $row['pubpid'] ?
>
143 <?php
echo $row['method'] ?
>
146 <?php
echo $row['source'] ?
>
148 <td
class='detail' align
='right'>
149 <?php
echo bucks($row['amount1']) ?
>
151 <td
class='detail' align
='right'>
152 <?php
echo bucks($row['amount2']) ?
>
154 <td
class='detail' align
='right'>
155 <?php
echo bucks($row['amount1'] +
$row['amount2']) ?
>
159 $total1 +
= $row['amount1'];
160 $total2 +
= $row['amount2'];
165 <td
class='dehead' colspan
='8'>
171 <td
class='dehead' colspan
='5'>
174 <td
class='detail' align
='right'>
175 <?php
echo bucks($total1) ?
>
177 <td
class='detail' align
='right'>
178 <?php
echo bucks($total2) ?
>
180 <td
class='detail' align
='right'>
181 <?php
echo bucks($total1 +
$total2) ?
>