Fixed bug: https://sourceforge.net/p/openemr/bugs/416/
[openemr.git] / interface / reports / receipts_by_method_report.php
blob5ead091a7d3a6e304fd0e408563b30cb620fcabd
1 <?php
2 // Copyright (C) 2006-2015 Rod Roark <rod@sunsetsystems.com>
3 //
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 is a report of receipts by payer or payment method.
11 // The payer option means an insurance company name or "Patient".
13 // The payment method option is most useful for sites using
14 // pos_checkout.php (e.g. weight loss clinics) because this plugs
15 // a payment method like Cash, Check, VISA, etc. into the "source"
16 // column of the SQL-Ledger acc_trans table or ar_session table.
18 require_once("../globals.php");
19 require_once("$srcdir/patient.inc");
20 require_once("$srcdir/sql-ledger.inc");
21 require_once("$srcdir/acl.inc");
22 require_once("$srcdir/formatting.inc.php");
23 require_once "$srcdir/options.inc.php";
24 require_once "$srcdir/formdata.inc.php";
25 require_once("../../custom/code_types.inc.php");
27 // This controls whether we show pt name, policy number and DOS.
28 $showing_ppd = true;
30 $insarray = array();
32 function bucks($amount) {
33 if ($amount) echo oeFormatMoney($amount);
36 function thisLineItem($patient_id, $encounter_id, $memo, $transdate,
37 $rowmethod, $rowpayamount, $rowadjamount, $payer_type=0, $irnumber='')
39 global $form_report_by, $insarray, $grandpaytotal, $grandadjtotal;
41 if ($form_report_by != '1') { // reporting by method or check number
42 showLineItem($patient_id, $encounter_id, $memo, $transdate,
43 $rowmethod, $rowpayamount, $rowadjamount, $payer_type, $irnumber);
44 return;
47 // Reporting by payer.
49 if ($_POST['form_details']) { // details are wanted
50 // Save everything for later sorting.
51 $insarray[] = array($patient_id, $encounter_id, $memo, $transdate,
52 $rowmethod, $rowpayamount, $rowadjamount, $payer_type, $irnumber);
54 else { // details not wanted
55 if (empty($insarray[$rowmethod])) $insarray[$rowmethod] = array(0, 0);
56 $insarray[$rowmethod][0] += $rowpayamount;
57 $insarray[$rowmethod][1] += $rowadjamount;
58 $grandpaytotal += $rowpayamount;
59 $grandadjtotal += $rowadjamount;
63 function showLineItem($patient_id, $encounter_id, $memo, $transdate,
64 $rowmethod, $rowpayamount, $rowadjamount, $payer_type=0, $irnumber='')
66 global $paymethod, $paymethodleft, $methodpaytotal, $methodadjtotal,
67 $grandpaytotal, $grandadjtotal, $showing_ppd;
69 if (! $rowmethod) $rowmethod = 'Unknown';
71 $invnumber = $irnumber ? $irnumber : "$patient_id.$encounter_id";
73 if ($paymethod != $rowmethod) {
74 if ($paymethod) {
75 // Print method total.
78 <tr bgcolor="#ddddff">
79 <td class="detail" colspan="<?php echo $showing_ppd ? 7 : 4; ?>">
80 <?php echo xl('Total for ') . $paymethod ?>
81 </td>
82 <td align="right">
83 <?php bucks($methodadjtotal) ?>
84 </td>
85 <td align="right">
86 <?php bucks($methodpaytotal) ?>
87 </td>
88 </tr>
89 <?php
91 $methodpaytotal = 0;
92 $methodadjtotal = 0;
93 $paymethod = $rowmethod;
94 $paymethodleft = $paymethod;
97 if ($_POST['form_details']) {
100 <tr>
101 <td class="detail">
102 <?php echo $paymethodleft; $paymethodleft = "&nbsp;" ?>
103 </td>
104 <td>
105 <?php echo oeFormatShortDate($transdate) ?>
106 </td>
107 <td class="detail">
108 <?php echo $invnumber ?>
109 </td>
111 <?php
112 if ($showing_ppd) {
113 $pferow = sqlQuery("SELECT p.fname, p.mname, p.lname, fe.date " .
114 "FROM patient_data AS p, form_encounter AS fe WHERE " .
115 "p.pid = '$patient_id' AND fe.pid = p.pid AND " .
116 "fe.encounter = '$encounter_id' LIMIT 1");
117 $dos = substr($pferow['date'], 0, 10);
119 echo " <td class='dehead'>\n";
120 echo " " . $pferow['lname'] . ", " . $pferow['fname'] . " " . $pferow['mname'];
121 echo " </td>\n";
123 echo " <td class='dehead'>\n";
124 if ($payer_type) {
125 $ptarr = array(1 => 'primary', 2 => 'secondary', 3 => 'tertiary');
126 $insrow = getInsuranceDataByDate($patient_id, $dos,
127 $ptarr[$payer_type], "policy_number");
128 echo " " . $insrow['policy_number'];
130 echo " </td>\n";
132 echo " <td class='dehead'>\n";
133 echo " " . oeFormatShortDate($dos) . "\n";
134 echo " </td>\n";
138 <td>
139 <?php echo $memo ?>
140 </td>
141 <td align="right">
142 <?php bucks($rowadjamount) ?>
143 </td>
144 <td align="right">
145 <?php bucks($rowpayamount) ?>
146 </td>
147 </tr>
148 <?php
150 $methodpaytotal += $rowpayamount;
151 $grandpaytotal += $rowpayamount;
152 $methodadjtotal += $rowadjamount;
153 $grandadjtotal += $rowadjamount;
156 // This is called by usort() when reporting by payer with details.
157 // Sorts by payer/date/patient/encounter/memo.
158 function payerCmp($a, $b) {
159 foreach (array(4,3,0,1,2,7) as $i) {
160 if ($a[$i] < $b[$i]) return -1;
161 if ($a[$i] > $b[$i]) return 1;
163 return 0;
166 if (! acl_check('acct', 'rep')) die(xl("Unauthorized access."));
168 $INTEGRATED_AR = $GLOBALS['oer_config']['ws_accounting']['enabled'] === 2;
170 if (!$INTEGRATED_AR) SLConnect();
172 $form_from_date = fixDate($_POST['form_from_date'], date('Y-m-d'));
173 $form_to_date = fixDate($_POST['form_to_date'] , date('Y-m-d'));
174 $form_use_edate = $_POST['form_use_edate'];
175 $form_facility = $_POST['form_facility'];
176 $form_report_by = $_POST['form_report_by'];
177 $form_proc_codefull = trim($_POST['form_proc_codefull']);
178 // Parse the code type and the code from <code_type>:<code>
179 $tmp_code_array = explode(':',$form_proc_codefull);
180 $form_proc_codetype = $tmp_code_array[0];
181 $form_proc_code = $tmp_code_array[1];
184 <html>
185 <head>
187 <?php if (function_exists('html_header_show')) html_header_show(); ?>
188 <style type="text/css">
189 /* specifically include & exclude from printing */
190 @media print {
191 #report_parameters {
192 visibility: hidden;
193 display: none;
195 #report_parameters_daterange {
196 visibility: visible;
197 display: inline;
199 #report_results {
200 margin-top: 30px;
204 /* specifically exclude some from the screen */
205 @media screen {
206 #report_parameters_daterange {
207 visibility: hidden;
208 display: none;
211 </style>
213 <script type="text/javascript" src="../../library/dialog.js"></script>
214 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
216 <script language="JavaScript">
218 $(document).ready(function() {
219 var win = top.printLogSetup ? top : opener.top;
220 win.printLogSetup(document.getElementById('printbutton'));
223 // This is for callback by the find-code popup.
224 // Erases the current entry
225 function set_related(codetype, code, selector, codedesc) {
226 var f = document.forms[0];
227 var s = f.form_proc_codefull.value;
228 if (code) {
229 s = codetype + ':' + code;
230 } else {
231 s = '';
233 f.form_proc_codefull.value = s;
236 // This invokes the find-code popup.
237 function sel_procedure() {
238 dlgopen('../patient_file/encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("procedure","csv")) ?>', '_blank', 500, 400);
241 </script>
243 <title><?xl('Receipts Summary','e')?></title>
244 </head>
246 <body class="body_top">
248 <span class='title'><?php xl('Report','e'); ?> - <?php xl('Receipts Summary','e'); ?></span>
250 <form method='post' action='receipts_by_method_report.php' id='theform'>
252 <div id="report_parameters">
254 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
256 <table>
257 <tr>
258 <td width='630px'>
259 <div style='float:left'>
261 <table class='text'>
262 <tr>
263 <td class='label'>
264 <?php xl('Report by','e'); ?>
265 </td>
266 <td>
267 <?php
268 echo " <select name='form_report_by'>\n";
269 foreach (array(1 => 'Payer', 2 => 'Payment Method', 3 => 'Check Number') as $key => $value) {
270 echo " <option value='$key'";
271 if ($key == $form_report_by) echo ' selected';
272 echo ">" . xl($value) . "</option>\n";
274 echo " </select>&nbsp;\n"; ?>
275 </td>
277 <td>
278 <?php dropdown_facility(strip_escape_custom($form_facility), 'form_facility', false); ?>
279 </td>
281 <td>
282 <?php if (!$GLOBALS['simplified_demographics']) echo '&nbsp;' . xl('Procedure/Service') . ':'; ?>
283 </td>
284 <td>
285 <input type='text' name='form_proc_codefull' size='12' value='<?php echo $form_proc_codefull; ?>' onclick='sel_procedure()'
286 title='<?php xl('Click to select optional procedure code','e'); ?>'
287 <?php if ($GLOBALS['simplified_demographics']) echo "style='display:none'"; ?> />
288 <br>
289 &nbsp;<input type='checkbox' name='form_details' value='1'<?php if ($_POST['form_details']) echo " checked"; ?> /><?xl('Details','e')?>
290 </td>
291 </tr>
292 <tr>
293 <td>&nbsp;</td>
294 <td>
295 <select name='form_use_edate'>
296 <option value='0'><?php xl('Payment Date','e'); ?></option>
297 <option value='1'<?php if ($form_use_edate) echo ' selected' ?>><?php xl('Invoice Date','e'); ?></option>
298 </select>
299 </td>
300 <td>
301 <input type='text' name='form_from_date' id="form_from_date" size='10' value='<?php echo $form_from_date ?>'
302 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='yyyy-mm-dd'>
303 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
304 id='img_from_date' border='0' alt='[?]' style='cursor:pointer'
305 title='<?php xl('Click here to choose a date','e'); ?>'>
306 </td>
307 <td class='label'>
308 <?php xl('To','e'); ?>:
309 </td>
310 <td>
311 <input type='text' name='form_to_date' id="form_to_date" size='10' value='<?php echo $form_to_date ?>'
312 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='yyyy-mm-dd'>
313 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
314 id='img_to_date' border='0' alt='[?]' style='cursor:pointer'
315 title='<?php xl('Click here to choose a date','e'); ?>'>
316 </td>
317 </tr>
318 </table>
320 </div>
322 </td>
323 <td align='left' valign='middle' height="100%">
324 <table style='border-left:1px solid; width:100%; height:100%' >
325 <tr>
326 <td>
327 <div style='margin-left:15px'>
328 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
329 <span>
330 <?php xl('Submit','e'); ?>
331 </span>
332 </a>
334 <?php if ($_POST['form_refresh']) { ?>
335 <a href='#' class='css_button' id='printbutton'>
336 <span>
337 <?php xl('Print','e'); ?>
338 </span>
339 </a>
340 <?php } ?>
341 </div>
342 </td>
343 </tr>
344 </table>
345 </td>
346 </tr>
347 </table>
349 </div> <!-- end of parameters -->
351 <?php
352 if ($_POST['form_refresh']) {
354 <div id="report_results">
356 <table>
358 <thead>
359 <th>
360 <?xl('Method','e')?>
361 </th>
362 <th>
363 <?xl('Date','e')?>
364 </th>
365 <th>
366 <?xl('Invoice','e')?>
367 </th>
368 <?php if ($showing_ppd) { ?>
369 <th>
370 <?xl('Patient','e')?>
371 </th>
372 <th>
373 <?xl('Policy','e')?>
374 </th>
375 <th>
376 <?xl('DOS','e')?>
377 </th>
378 <?php } ?>
379 <th>
380 <?xl('Procedure','e')?>
381 </th>
382 <th align="right">
383 <?xl('Adjustments','e')?>
384 </th>
385 <th align="right">
386 <?xl('Payments','e')?>
387 </th>
388 </thead>
389 <?php
391 if (!$INTEGRATED_AR) {
392 $chart_id_cash = SLQueryValue("select id from chart where accno = '$sl_cash_acc'");
393 if ($sl_err) die($sl_err);
394 $chart_id_income = SLQueryValue("select id from chart where accno = '$sl_income_acc'");
395 if ($sl_err) die($sl_err);
398 if ($_POST['form_refresh']) {
399 $from_date = $form_from_date;
400 $to_date = $form_to_date;
402 $paymethod = "";
403 $paymethodleft = "";
404 $methodpaytotal = 0;
405 $grandpaytotal = 0;
406 $methodadjtotal = 0;
407 $grandadjtotal = 0;
409 if ($INTEGRATED_AR) {
411 // Get co-pays using the encounter date as the pay date. These will
412 // always be considered patient payments. Ignored if selecting by
413 // billing code.
415 if (!$form_proc_code || !$form_proc_codetype) {
416 $query = "SELECT b.fee, b.pid, b.encounter, b.code_type, " .
417 "fe.date, fe.facility_id, fe.invoice_refno " .
418 "FROM billing AS b " .
419 "JOIN form_encounter AS fe ON fe.pid = b.pid AND fe.encounter = b.encounter " .
420 "WHERE b.code_type = 'COPAY' AND b.activity = 1 AND b.fee != 0 AND " .
421 "fe.date >= '$from_date 00:00:00' AND fe.date <= '$to_date 23:59:59'";
422 // If a facility was specified.
423 if ($form_facility) $query .= " AND fe.facility_id = '$form_facility'";
424 $query .= " ORDER BY fe.date, b.pid, b.encounter, fe.id";
426 $res = sqlStatement($query);
427 while ($row = sqlFetchArray($res)) {
428 $rowmethod = $form_report_by == 1 ? 'Patient' : 'Co-Pay';
429 thisLineItem($row['pid'], $row['encounter'], $row['code_text'],
430 substr($row['date'], 0, 10), $rowmethod, 0 - $row['fee'], 0, 0, $row['invoice_refno']);
432 } // end if not form_proc_code
434 // Get all other payments and adjustments and their dates, corresponding
435 // payers and check reference data, and the encounter dates separately.
437 $query = "SELECT a.pid, a.encounter, a.post_time, a.pay_amount, " .
438 "a.adj_amount, a.memo, a.session_id, a.code, a.payer_type, fe.id, fe.date, " .
439 "fe.invoice_refno, s.deposit_date, s.payer_id, s.reference, i.name " .
440 "FROM ar_activity AS a " .
441 "JOIN form_encounter AS fe ON fe.pid = a.pid AND fe.encounter = a.encounter " .
442 "JOIN forms AS f ON f.pid = a.pid AND f.encounter = a.encounter AND f.formdir = 'newpatient' " .
443 "LEFT JOIN ar_session AS s ON s.session_id = a.session_id " .
444 "LEFT JOIN insurance_companies AS i ON i.id = s.payer_id " .
445 "WHERE ( a.pay_amount != 0 OR a.adj_amount != 0 )";
447 if ($form_use_edate) {
448 $query .= " AND fe.date >= '$from_date 00:00:00' AND fe.date <= '$to_date 23:59:59'";
449 } else {
450 $query .= " AND ( ( s.deposit_date IS NOT NULL AND " .
451 "s.deposit_date >= '$from_date' AND s.deposit_date <= '$to_date' ) OR " .
452 "( s.deposit_date IS NULL AND a.post_time >= '$from_date 00:00:00' AND " .
453 "a.post_time <= '$to_date 23:59:59' ) )";
455 // If a procedure code was specified.
456 if ($form_proc_code && $form_proc_codetype) {
457 // if a code_type is entered into the ar_activity table, then use it. If it is not entered in, then do not use it.
458 $query .= " AND ( a.code_type = '$form_proc_codetype' OR a.code_type = '' ) AND a.code LIKE '$form_proc_code%'";
460 // If a facility was specified.
461 if ($form_facility) $query .= " AND fe.facility_id = '$form_facility'";
463 if ($form_use_edate) {
464 $query .= " ORDER BY s.reference, fe.date, a.pid, a.encounter, fe.id";
465 } else {
466 $query .= " ORDER BY s.reference, s.deposit_date, a.post_time, a.pid, a.encounter, fe.id";
469 $res = sqlStatement($query);
470 while ($row = sqlFetchArray($res)) {
471 if ($form_use_edate) {
472 $thedate = substr($row['date'], 0, 10);
473 } else if (!empty($row['deposit_date'])) {
474 $thedate = $row['deposit_date'];
475 } else {
476 $thedate = substr($row['post_time'], 0, 10);
478 // Compute reporting key: insurance company name or payment method.
479 if ($form_report_by == '1') {
480 if (empty($row['payer_id'])) {
481 $rowmethod = '';
482 } else {
483 if (empty($row['name'])) $rowmethod = xl('Unnamed insurance company');
484 else $rowmethod = $row['name'];
487 else {
488 if (empty($row['session_id'])) {
489 $rowmethod = trim($row['memo']);
490 } else {
491 $rowmethod = trim($row['reference']);
493 if ($form_report_by != '3') {
494 // Extract only the first word as the payment method because any
495 // following text will be some petty detail like a check number.
496 $rowmethod = substr($rowmethod, 0, strcspn($rowmethod, ' /'));
500 thisLineItem($row['pid'], $row['encounter'], $row['code'], $thedate,
501 $rowmethod, $row['pay_amount'], $row['adj_amount'], $row['payer_type'],
502 $row['invoice_refno']);
504 } // end $INTEGRATED_AR
505 else {
506 $query = "SELECT acc_trans.amount, acc_trans.transdate, acc_trans.memo, " .
507 "replace(acc_trans.source, 'InvAdj ', '') AS source, " .
508 "acc_trans.chart_id, ar.invnumber, ar.employee_id, ar.notes " .
509 "FROM acc_trans, ar WHERE " .
510 "( acc_trans.chart_id = $chart_id_cash OR " .
511 "( acc_trans.chart_id = $chart_id_income AND " .
512 "acc_trans.source LIKE 'InvAdj %' ) ) AND " .
513 "ar.id = acc_trans.trans_id AND ";
514 if ($form_proc_code) {
515 $query .= "acc_trans.memo ILIKE '$form_proc_code%' AND ";
517 if ($form_use_edate) {
518 $query .= "ar.transdate >= '$from_date' AND " .
519 "ar.transdate <= '$to_date'";
520 } else {
521 $query .= "acc_trans.transdate >= '$from_date' AND " .
522 "acc_trans.transdate <= '$to_date'";
524 $query .= " ORDER BY source, acc_trans.transdate, ar.invnumber, acc_trans.memo";
526 // echo "<!-- $query -->\n";
528 $t_res = SLQuery($query);
529 if ($sl_err) die($sl_err);
531 for ($irow = 0; $irow < SLRowCount($t_res); ++$irow) {
532 $row = SLGetRow($t_res, $irow);
533 list($patient_id, $encounter_id) = explode(".", $row['invnumber']);
535 // If a facility was specified then skip invoices whose encounters
536 // do not indicate that facility.
537 if ($form_facility) {
538 $tmp = sqlQuery("SELECT count(*) AS count FROM form_encounter WHERE " .
539 "pid = '$patient_id' AND encounter = '$encounter_id' AND " .
540 "facility_id = '$form_facility'");
541 if (empty($tmp['count'])) continue;
544 $rowpayamount = 0 - $row['amount'];
545 $rowadjamount = 0;
546 if ($row['chart_id'] == $chart_id_income) {
547 $rowadjamount = $rowpayamount;
548 $rowpayamount = 0;
551 // Compute reporting key: insurance company name or payment method.
552 $payer_type = 0; // will be 0=pt, 1=ins1, 2=ins2 or 3=ins3
553 if ($form_report_by == '1') {
554 $rowmethod = '';
555 $rowsrc = strtolower($row['source']);
556 $insgot = strtolower($row['notes']);
557 foreach (array('ins1', 'ins2', 'ins3') as $value) {
558 if (strpos($rowsrc, $value) !== false) {
559 $i = strpos($insgot, $value);
560 if ($i !== false) {
561 $j = strpos($insgot, "\n", $i);
562 if (!$j) $j = strlen($insgot);
563 $payer_type = 0 + substr($value, 3);
564 $rowmethod = trim(substr($row['notes'], $i + 5, $j - $i - 5));
565 break;
568 } // end foreach
569 } // end reporting by payer
570 else {
571 $rowmethod = trim($row['source']);
572 if ($form_report_by != '3') {
573 // Extract only the first word as the payment method because any
574 // following text will be some petty detail like a check number.
575 $rowmethod = substr($rowmethod, 0, strcspn($rowmethod, ' /'));
577 } // end reporting by method
579 thisLineItem($patient_id, $encounter_id, $row['memo'], $row['transdate'],
580 $rowmethod, $rowpayamount, $rowadjamount, $payer_type);
581 } // end for
582 } // end not $INTEGRATED_AR
584 // Not payer summary.
585 if ($form_report_by != '1' || $_POST['form_details']) {
587 if ($form_report_by == '1') { // by payer with details
588 // Sort and dump saved info, and consolidate items with all key
589 // fields being the same.
590 usort($insarray, 'payerCmp');
591 $b = array();
592 foreach ($insarray as $a) {
593 if (empty($a[4])) $a[4] = xl('Patient');
594 if (empty($b)) {
595 $b = $a;
597 else {
598 $match = true;
599 foreach (array(4,3,0,1,2,7) as $i) if ($a[$i] != $b[$i]) $match = false;
600 if ($match) {
601 $b[5] += $a[5];
602 $b[6] += $a[6];
603 } else {
604 showLineItem($b[0], $b[1], $b[2], $b[3], $b[4], $b[5], $b[6], $b[7], $b[8]);
605 $b = $a;
609 if (!empty($b)) {
610 showLineItem($b[0], $b[1], $b[2], $b[3], $b[4], $b[5], $b[6], $b[7], $b[8]);
612 } // end by payer with details
614 // Print last method total.
616 <tr bgcolor="#ddddff">
617 <td class="detail" colspan="<?php echo $showing_ppd ? 7 : 4; ?>">
618 <?php echo xl('Total for ') . $paymethod ?>
619 </td>
620 <td align="right">
621 <?php bucks($methodadjtotal) ?>
622 </td>
623 <td align="right">
624 <?php bucks($methodpaytotal) ?>
625 </td>
626 </tr>
627 <?php
630 // Payer summary: need to sort and then print it all.
631 else {
632 ksort($insarray);
633 foreach ($insarray as $key => $value) {
634 if (empty($key)) $key = xl('Patient');
636 <tr bgcolor="#ddddff">
637 <td class="detail" colspan="<?php echo $showing_ppd ? 7 : 4; ?>">
638 <?php echo $key; ?>
639 </td>
640 <td align="right">
641 <?php bucks($value[1]); ?>
642 </td>
643 <td align="right">
644 <?php bucks($value[0]); ?>
645 </td>
646 </tr>
647 <?php
648 } // end foreach
649 } // end payer summary
651 <tr bgcolor="#ffdddd">
652 <td class="detail" colspan="<?php echo $showing_ppd ? 7 : 4; ?>">
653 <?php xl('Grand Total','e') ?>
654 </td>
655 <td align="right">
656 <?php bucks($grandadjtotal) ?>
657 </td>
658 <td align="right">
659 <?php bucks($grandpaytotal) ?>
660 </td>
661 </tr>
663 <?php
664 } // end form refresh
665 if (!$INTEGRATED_AR) SLClose();
668 </table>
669 </div>
670 <?php } else { ?>
671 <div class='text'>
672 <?php echo xl('Please input search criteria above, and click Submit to view results.', 'e' ); ?>
673 </div>
674 <?php } ?>
676 </form>
677 </body>
679 <!-- stuff for the popup calendar -->
680 <link rel='stylesheet' href='<?php echo $css_header ?>' type='text/css'>
681 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
682 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
683 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
684 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
685 <script language="Javascript">
686 Calendar.setup({inputField:"form_from_date", ifFormat:"%Y-%m-%d", button:"img_from_date"});
687 Calendar.setup({inputField:"form_to_date", ifFormat:"%Y-%m-%d", button:"img_to_date"});
688 </script>
690 </html>