Fixed bug: https://sourceforge.net/p/openemr/bugs/416/
[openemr.git] / interface / reports / sales_by_item.php
blob785c07835ca9cad35e2897a3de40833531eff9d2
1 <?php
2 /**
3 * This is a report of sales by item description. It's driven from
4 * SQL-Ledger so as to include all types of invoice items.
6 * Copyright (C) 2015 Terry Hill <terry@lillysystems.com>
7 * Copyright (C) 2006-2010 Rod Roark <rod@sunsetsystems.com>
9 * LICENSE: This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
20 * @package OpenEMR
21 * @author Rod Roark <rod@sunsetsystems.com>
22 * @author Terry Hill <terry@lillysystems.com>
23 * @link http://www.open-emr.org
25 $sanitize_all_escapes=true;
26 $fake_register_globals=false;
28 require_once("../globals.php");
29 require_once("$srcdir/patient.inc");
30 require_once("$srcdir/sql-ledger.inc");
31 require_once("$srcdir/acl.inc");
32 require_once("$srcdir/formatting.inc.php");
33 require_once "$srcdir/options.inc.php";
34 require_once "$srcdir/formdata.inc.php";
36 $form_provider = $_POST['form_provider'];
37 if ($_POST['form_refresh'] || $_POST['form_csvexport']) {
38 $form_details = $_POST['form_details'] ? true : false;
40 else
42 $form_details = false;
44 function bucks($amount) {
45 if ($amount) echo oeFormatMoney($amount);
48 function display_desc($desc) {
49 if (preg_match('/^\S*?:(.+)$/', $desc, $matches)) {
50 $desc = $matches[1];
52 return $desc;
55 function thisLineItem($patient_id, $encounter_id, $rowcat, $description, $transdate, $qty, $amount, $irnumber='') {
56 global $product, $category, $producttotal, $productqty, $cattotal, $catqty, $grandtotal, $grandqty;
57 global $productleft, $catleft;
59 $invnumber = $irnumber ? $irnumber : "$patient_id.$encounter_id";
60 $rowamount = sprintf('%01.2f', $amount);
62 $patdata = sqlQuery("SELECT " .
63 "p.fname, p.mname, p.lname, p.pubpid, p.DOB, " .
64 "p.street, p.city, p.state, p.postal_code, " .
65 "p.ss, p.sex, p.status, p.phone_home, " .
66 "p.phone_biz, p.phone_cell, p.hipaa_notice " .
67 "FROM patient_data AS p " .
68 "WHERE p.pid = ? LIMIT 1", array($patient_id));
70 $pat_name = $patdata['fname'] . ' ' . $patdata['mname'] . ' ' . $patdata['lname'];
72 if (empty($rowcat)) $rowcat = xl('None');
73 $rowproduct = $description;
74 if (! $rowproduct) $rowproduct = xl('Unknown');
76 if ($product != $rowproduct || $category != $rowcat) {
77 if ($product) {
78 // Print product total.
79 if ($_POST['form_csvexport']) {
80 if (! $_POST['form_details']) {
81 echo '"' . display_desc($category) . '",';
82 echo '"' . display_desc($product) . '",';
83 echo '"' . $productqty . '",';
84 echo '"'; bucks($producttotal); echo '"' . "\n";
87 else {
89 <tr bgcolor="#ddddff">
90 <td class="detail">
91 <?php echo text(display_desc($catleft)); $catleft = " "; ?>
92 </td>
93 <td class="detail" colspan="3">
94 <?php if ($_POST['form_details']) echo xlt('Total for') . ' '; echo text(display_desc($product)); ?>
95 </td>
96 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {?>
97 <td>
98 &nbsp;
99 </td>
100 <?php } ?>
101 <td align="right">
102 &nbsp;
103 </td>
104 <td align="right">
105 <?php echo text($productqty); ?>
106 </td>
107 <td align="right">
108 <?php text(bucks($producttotal)); ?>
109 </td>
110 </tr>
111 <?php
112 } // End not csv export
114 $producttotal = 0;
115 $productqty = 0;
116 $product = $rowproduct;
117 $productleft = $product;
120 if ($category != $rowcat) {
121 if ($category) {
122 // Print category total.
123 if (!$_POST['form_csvexport']) {
126 <tr bgcolor="#ffdddd">
127 <td class="detail">
128 &nbsp;
129 </td>
130 <td class="detail" colspan="3">
131 <?php echo xlt('Total for category') . ' '; echo text(display_desc($category)); ?>
132 </td>
133 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {?>
134 <td>
135 &nbsp;
136 </td>
137 <?php } ?>
138 <td align="right">
139 &nbsp;
140 </td>
141 <td align="right">
142 <?php echo text($catqty); ?>
143 </td>
144 <td align="right">
145 <?php text(bucks($cattotal)); ?>
146 </td>
147 </tr>
148 <?php
149 } // End not csv export
151 $cattotal = 0;
152 $catqty = 0;
153 $category = $rowcat;
154 $catleft = $category;
157 if ($_POST['form_details']) {
158 if ($_POST['form_csvexport']) {
159 echo '"' . display_desc($category ) . '",';
160 echo '"' . display_desc($product ) . '",';
161 echo '"' . oeFormatShortDate(display_desc($transdate)) . '",';
162 if($GLOBALS['sales_report_invoice'] == 1 || $GLOBALS['sales_report_invoice'] == 2 ) {
163 echo '"' . $pat_name . '",';
165 if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {
166 echo '"' . display_desc($invnumber) . '",';
168 if($GLOBALS['sales_report_invoice'] == 1) {
169 echo '"' . $patient_id . '",';
171 // echo '"' . display_desc($invnumber) . '",';
172 echo '"' . display_desc($qty ) . '",';
173 echo '"'; bucks($rowamount); echo '"' . "\n";
175 else {
178 <tr>
179 <td class="detail">
180 <?php echo text(display_desc($catleft)); $catleft = " "; ?>
181 </td>
182 <td class="detail">
183 <?php echo text(display_desc($productleft)); $productleft = " "; ?>
184 </td>
185 <td>
186 <?php echo text(oeFormatShortDate($transdate)); ?>
187 </td>
188 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {?>
189 <td>
190 &nbsp;
191 </td>
192 <?php } if($GLOBALS['sales_report_invoice'] == 1 || $GLOBALS['sales_report_invoice'] == 2 ) { ?>
193 <td>
194 <?php echo text($pat_name); ?>
195 </td>
196 <?php } ?>
197 <td class="detail">
198 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) { ?>
199 <a href='../patient_file/pos_checkout.php?ptid=<?php echo attr($patient_id); ?>&enc=<?php echo attr($encounter_id); ?>'>
200 <?php echo text($invnumber); ?></a>
201 <?php }
202 if($GLOBALS['sales_report_invoice'] == 1 ) {
203 echo text($patient_id);
206 </td>
207 <?php if($GLOBALS['sales_report_invoice'] == 0) {?>
208 <td>
209 &nbsp;
210 </td>
211 <?php } ?>
212 <td align="right">
213 <?php echo text($qty); ?>
214 </td>
215 <td align="right">
216 <?php text(bucks($rowamount)); ?>
217 </td>
218 </tr>
219 <?php
221 } // End not csv export
222 } // end details
223 $producttotal += $rowamount;
224 $cattotal += $rowamount;
225 $grandtotal += $rowamount;
226 $productqty += $qty;
227 $catqty += $qty;
228 $grandqty += $qty;
229 } // end function
231 if (! acl_check('acct', 'rep')) die(xl("Unauthorized access."));
233 $INTEGRATED_AR = $GLOBALS['oer_config']['ws_accounting']['enabled'] === 2;
235 if (!$INTEGRATED_AR) SLConnect();
237 $form_from_date = fixDate($_POST['form_from_date'], date('Y-m-d'));
238 $form_to_date = fixDate($_POST['form_to_date'] , date('Y-m-d'));
239 $form_facility = $_POST['form_facility'];
241 if ($_POST['form_csvexport']) {
242 header("Pragma: public");
243 header("Expires: 0");
244 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
245 header("Content-Type: application/force-download");
246 header("Content-Disposition: attachment; filename=sales_by_item.csv");
247 header("Content-Description: File Transfer");
248 // CSV headers:
249 if ($_POST['form_details']) {
250 echo '"Category",';
251 echo '"Item",';
252 echo '"Date",';
253 if($GLOBALS['sales_report_invoice'] == 1 || $GLOBALS['sales_report_invoice'] == 2 ) {
254 echo '"Name",';
256 if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {
257 echo '"Invoice",';
259 if($GLOBALS['sales_report_invoice'] == 1) {
260 echo '"ID",';
262 echo '"Qty",';
263 echo '"Amount"' . "\n";
265 else {
266 echo '"Category",';
267 echo '"Item",';
268 echo '"Qty",';
269 echo '"Total"' . "\n";
271 } // end export
272 else {
274 <html>
275 <head>
276 <?php html_header_show();?>
277 <style type="text/css">
278 /* specifically include & exclude from printing */
279 @media print {
280 #report_parameters {
281 visibility: hidden;
282 display: none;
284 #report_parameters_daterange {
285 visibility: visible;
286 display: inline;
288 #report_results {
289 margin-top: 30px;
293 /* specifically exclude some from the screen */
294 @media screen {
295 #report_parameters_daterange {
296 visibility: hidden;
297 display: none;
300 </style>
302 <title><?php echo xlt('Sales by Item') ?></title>
304 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
306 <script language="JavaScript">
307 $(document).ready(function() {
308 var win = top.printLogSetup ? top : opener.top;
309 win.printLogSetup(document.getElementById('printbutton'));
311 </script>
313 </head>
315 <body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' class="body_top">
317 <span class='title'><?php echo xlt('Report'); ?> - <?php echo xlt('Sales by Item'); ?></span>
319 <form method='post' action='sales_by_item.php' id='theform'>
321 <div id="report_parameters">
322 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
323 <input type='hidden' name='form_csvexport' id='form_csvexport' value=''/>
324 <table>
325 <tr>
326 <td width='630px'>
327 <div style='float:left'>
328 <table class='text'>
329 <tr>
330 <td class='label'>
331 <?php echo xlt('Facility'); ?>:
332 </td>
333 <td>
334 <?php dropdown_facility($form_facility, 'form_facility', true); ?>
335 </td>
336 <td class='label'>
337 <?php echo xlt('From'); ?>:
338 </td>
339 <td>
340 <input type='text' name='form_from_date' id="form_from_date" size='10' value='<?php echo attr($form_from_date) ?>'
341 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='yyyy-mm-dd'>
342 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
343 id='img_from_date' border='0' alt='[?]' style='cursor:pointer'
344 title='<?php echo xla('Click here to choose a date'); ?>'>
345 </td>
346 <td class='label'>
347 <?php echo xlt('To'); ?>:
348 </td>
349 <td>
350 <input type='text' name='form_to_date' id="form_to_date" size='10' value='<?php echo attr($form_to_date) ?>'
351 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='yyyy-mm-dd'>
352 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
353 id='img_to_date' border='0' alt='[?]' style='cursor:pointer'
354 title='<?php echo xla('Click here to choose a date'); ?>'>
355 </td>
356 </tr>
357 </table>
358 <table class='text'>
359 <tr>
360 <td class='label'>
361 <?php echo xlt('Provider'); ?>:
362 </td>
363 <td>
364 <?php
365 if (acl_check('acct', 'rep_a')) {
366 // Build a drop-down list of providers.
367 $query = "select id, lname, fname from users where " .
368 "authorized = 1 order by lname, fname";
369 $res = sqlStatement($query);
370 echo " &nbsp;<select name='form_provider'>\n";
371 echo " <option value=''>-- " . xlt('All Providers') . " --\n";
372 while ($row = sqlFetchArray($res)) {
373 $provid = $row['id'];
374 echo " <option value='". attr($provid) ."'";
375 if ($provid == $_REQUEST['form_provider']) echo " selected";
376 echo ">" . text($row['lname']) . ", " . text($row['fname']) . "\n";
378 echo " </select>\n";
379 } else {
380 echo "<input type='hidden' name='form_provider' value='" . attr($_SESSION['authUserID']) . "'>";
383 &nbsp;
384 </td>
385 <td>
386 <label><input type='checkbox' name='form_details'<?php if ($form_details) echo ' checked'; ?>>
387 <?php echo xlt('Details'); ?></label>
388 </td>
389 </tr>
390 </table>
391 </div>
393 </td>
394 <td align='left' valign='middle' height="100%">
395 <table style='border-left:1px solid; width:100%; height:100%' >
396 <tr>
397 <td>
398 <div style='margin-left:15px'>
399 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); $("#form_csvexport").attr("value",""); $("#theform").submit();'>
400 <span>
401 <?php echo xlt('Submit'); ?>
402 </span>
403 </a>
405 <?php if ($_POST['form_refresh'] || $_POST['form_csvexport']) { ?>
406 <a href='#' class='css_button' id='printbutton'>
407 <span>
408 <?php echo xlt('Print'); ?>
409 </span>
410 </a>
411 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value",""); $("#form_csvexport").attr("value","true"); $("#theform").submit();'>
412 <span>
413 <?php echo xlt('CSV Export'); ?>
414 </span>
415 </a>
416 <?php } ?>
417 </div>
418 </td>
419 </tr>
420 </table>
421 </td>
422 </tr>
423 </table>
425 </div> <!-- end of parameters -->
427 <?php
428 if ($_POST['form_refresh'] || $_POST['form_csvexport']) {
430 <div id="report_results">
431 <table >
432 <thead>
433 <th>
434 <?php echo xlt('Category'); ?>
435 </th>
436 <th>
437 <?php echo xlt('Item'); ?>
438 </th>
439 <th>
440 <?php if ($form_details) echo xlt('Date'); ?>
441 </th>
442 <?php if($GLOBALS['sales_report_invoice'] == 2) {?>
443 <th>
444 &nbsp;
445 </th>
446 <?php } ?>
447 <th>
448 <?php
449 if($GLOBALS['sales_report_invoice'] == 0) {
450 if ($form_details) echo ' ';
452 </th>
453 <th>
454 <?php
455 if ($form_details) echo xlt('Invoice'); }
456 if($GLOBALS['sales_report_invoice'] == 1 || $GLOBALS['sales_report_invoice'] == 2 ) {
457 if ($form_details) echo xlt('Name');
458 } ?>
459 </th>
460 <th>
461 <?php
462 if($GLOBALS['sales_report_invoice'] == 2) {
463 if ($form_details) echo xlt('Invoice');
465 if($GLOBALS['sales_report_invoice'] == 1) {
466 if ($form_details) echo xlt('ID');
469 </th>
470 <th align="right">
471 <?php echo xlt('Qty'); ?>
472 </th>
473 <th align="right">
474 <?php echo xlt('Amount'); ?>
475 </th>
476 </thead>
477 <?php
478 } // end not export
481 if ($_POST['form_refresh'] || $_POST['form_csvexport']) {
482 $from_date = $form_from_date . ' 00:00:00';
483 $to_date = $form_to_date . ' 23:59:59';
484 $category = "";
485 $catleft = "";
486 $cattotal = 0;
487 $catqty = 0;
488 $product = "";
489 $productleft = "";
490 $producttotal = 0;
491 $productqty = 0;
492 $grandtotal = 0;
493 $grandqty = 0;
495 if ($INTEGRATED_AR) {
496 $sqlBindArray = array();
497 $query = "SELECT b.fee, b.pid, b.encounter, b.code_type, b.code, b.units, " .
498 "b.code_text, fe.date, fe.facility_id, fe.provider_id, fe.invoice_refno, lo.title " .
499 "FROM billing AS b " .
500 "JOIN code_types AS ct ON ct.ct_key = b.code_type " .
501 "JOIN form_encounter AS fe ON fe.pid = b.pid AND fe.encounter = b.encounter " .
502 "LEFT JOIN codes AS c ON c.code_type = ct.ct_id AND c.code = b.code AND c.modifier = b.modifier " .
503 "LEFT JOIN list_options AS lo ON lo.list_id = 'superbill' AND lo.option_id = c.superbill " .
504 "WHERE b.code_type != 'COPAY' AND b.activity = 1 AND b.fee != 0 AND " .
505 "fe.date >= ? AND fe.date <= ?";
506 array_push($sqlBindArray,$from_date,$to_date);
507 // If a facility was specified.
508 if ($form_facility) {
509 $query .= " AND fe.facility_id = ?";
510 array_push($sqlBindArray,$form_facility);
512 if ($form_provider) {
513 $query .= " AND fe.provider_id = ?";
514 array_push($sqlBindArray,$form_provider);
516 $query .= " ORDER BY lo.title, b.code, fe.date, fe.id";
518 $res = sqlStatement($query,$sqlBindArray);
519 while ($row = sqlFetchArray($res)) {
520 thisLineItem($row['pid'], $row['encounter'],
521 $row['title'], $row['code'] . ' ' . $row['code_text'],
522 substr($row['date'], 0, 10), $row['units'], $row['fee'], $row['invoice_refno']);
525 $sqlBindArray = array();
526 $query = "SELECT s.sale_date, s.fee, s.quantity, s.pid, s.encounter, " .
527 "d.name, fe.date, fe.facility_id, fe.provider_id, fe.invoice_refno " .
528 "FROM drug_sales AS s " .
529 "JOIN drugs AS d ON d.drug_id = s.drug_id " .
530 "JOIN form_encounter AS fe ON " .
531 "fe.pid = s.pid AND fe.encounter = s.encounter AND " .
532 "fe.date >= ? AND fe.date <= ? " .
533 "WHERE s.fee != 0";
534 array_push($sqlBindArray,$from_date,$to_date);
535 // If a facility was specified.
536 if ($form_facility) {
537 $query .= " AND fe.facility_id = ?";
538 array_push($sqlBindArray,$form_facility);
540 if ($form_provider) {
541 $query .= " AND fe.provider_id = ?";
542 array_push($sqlBindArray,$form_provider);
544 $query .= " ORDER BY d.name, fe.date, fe.id";
546 $res = sqlStatement($query,$sqlBindArray);
547 while ($row = sqlFetchArray($res)) {
548 thisLineItem($row['pid'], $row['encounter'], xl('Products'), $row['name'],
549 substr($row['date'], 0, 10), $row['quantity'], $row['fee'], $row['invoice_refno']);
552 else {
553 $query = "SELECT ar.invnumber, ar.transdate, " .
554 "invoice.description, invoice.qty, invoice.sellprice " .
555 "FROM ar, invoice WHERE " .
556 "ar.transdate >= '$from_date' AND ar.transdate <= '$to_date' " .
557 "AND invoice.trans_id = ar.id " .
558 "ORDER BY invoice.description, ar.transdate, ar.id";
559 $t_res = SLQuery($query);
560 if ($sl_err) die($sl_err);
561 for ($irow = 0; $irow < SLRowCount($t_res); ++$irow) {
562 $row = SLGetRow($t_res, $irow);
563 list($patient_id, $encounter_id) = explode(".", $row['invnumber']);
564 // If a facility was specified then skip invoices whose encounters
565 // do not indicate that facility.
566 if ($form_facility) {
567 $tmp = sqlQuery("SELECT count(*) AS count FROM form_encounter WHERE " .
568 "pid = '$patient_id' AND encounter = '$encounter_id' AND " .
569 "facility_id = '$form_facility'");
570 if (empty($tmp['count'])) continue;
572 thisLineItem($patient_id, $encounter_id, '', $row['description'],
573 $row['transdate'], $row['qty'], $row['sellprice'] * $row['qty']);
574 } // end for
575 } // end not $INTEGRATED_AR
577 if ($_POST['form_csvexport']) {
578 if (! $_POST['form_details']) {
579 echo '"' . display_desc($product) . '",';
580 echo '"' . $productqty . '",';
581 echo '"'; bucks($producttotal); echo '"' . "\n";
584 else {
587 <tr bgcolor="#ddddff">
588 <td class="detail">
589 <?php echo text(display_desc($catleft)); $catleft = " "; ?>
590 </td>
591 <td class="detail" colspan="3">
592 <?php if ($_POST['form_details']) echo xlt('Total for') . ' '; echo text(display_desc($product)); ?>
593 </td>
594 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {?>
595 <td>
596 &nbsp;
597 </td>
598 <?php } ?>
599 <td align="right">
600 &nbsp;
601 </td>
602 <td align="right">
603 <?php echo text($productqty); ?>
604 </td>
605 <td align="right">
606 <?php text(bucks($producttotal)); ?>
607 </td>
608 </tr>
610 <tr bgcolor="#ffdddd">
611 <td class="detail">
612 &nbsp;
613 </td>
614 <td class="detail" colspan="3"><b>
615 <?php echo xlt('Total for category') . ' '; echo text(display_desc($category)); ?>
616 </b></td>
617 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {?>
618 <td>
619 &nbsp;
620 </td>
621 <?php } ?>
622 <td align="right">
623 &nbsp;
624 </td>
625 <td align="right"><b>
626 <?php echo text($catqty); ?>
627 </b></td>
628 <td align="right"><b>
629 <?php text(bucks($cattotal)); ?>
630 </b></td>
631 </tr>
633 <tr>
634 <td class="detail" colspan="4"><b>
635 <?php echo xlt('Grand Total'); ?>
636 </b></td>
637 <?php if($GLOBALS['sales_report_invoice'] == 0 || $GLOBALS['sales_report_invoice'] == 2) {?>
638 <td>
639 &nbsp;
640 </td>
641 <?php } ?>
642 <td align="right">
643 &nbsp;
644 </td>
645 <td align="right"><b>
646 <?php echo text($grandqty); ?>
647 </b></td>
648 <td align="right"><b>
649 <?php text(bucks($grandtotal)); ?>
650 </b></td>
651 </tr>
652 <?php $report_from_date = oeFormatShortDate($form_from_date) ;
653 $report_to_date = oeFormatShortDate($form_to_date) ;
655 <div align='right'><span class='title' ><?php echo xlt('Report Date'). ' '; ?><?php echo text($report_from_date);?> - <?php echo text($report_to_date);?></span></div>
656 <?php
658 } // End not csv export
660 if (!$INTEGRATED_AR) SLClose();
662 if (! $_POST['form_csvexport']) {
663 if($_POST['form_refresh']){
666 </table>
667 </div> <!-- report results -->
668 <?php } else { ?>
669 <div class='text'>
670 <?php echo xlt('Please input search criteria above, and click Submit to view results.' ); ?>
671 </div>
672 <?php } ?>
674 </form>
676 </body>
678 <!-- stuff for the popup calendar -->
679 <link rel='stylesheet' href='<?php echo $css_header ?>' type='text/css'>
680 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
681 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
682 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
683 <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>
691 <?php
692 } // End not csv export