ongoing internationalization of date widget
[openemr.git] / interface / reports / destroyed_drugs_report.php
bloba056790f5437c2488ee713ff94ad33c19a69f8c7
1 <?php
2 /**
3 * This report lists destroyed drug lots within a specified date range.
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2006-2016 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/patient.inc");
16 require_once("../drugs/drugs.inc.php");
18 $form_from_date = fixDate($_POST['form_from_date'], date('Y-01-01'));
19 $form_to_date = fixDate($_POST['form_to_date'], date('Y-m-d'));
21 <html>
22 <head>
23 <?php html_header_show();?>
24 <title><?php xl('Destroyed Drugs', 'e'); ?></title>
25 <link rel='stylesheet' href='<?php echo $css_header ?>' type='text/css'>
26 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
28 <style>
29 table.mymaintable, table.mymaintable td, table.mymaintable th {
30 border: 1px solid #aaaaaa;
31 border-collapse: collapse;
33 table.mymaintable td, table.mymaintable th {
34 padding: 1pt 4pt 1pt 4pt;
36 </style>
38 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
39 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
40 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script>
41 <script type="text/javascript" src="../../library/js/report_helper.js?v=<?php echo $v_js_includes; ?>"></script>
42 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
44 <script language="JavaScript">
46 $(document).ready(function() {
47 oeFixedHeaderSetup(document.getElementById('mymaintable'));
48 var win = top.printLogSetup ? top : opener.top;
49 win.printLogSetup(document.getElementById('printbutton'));
51 $('.datepicker').datetimepicker({
52 <?php $datetimepicker_timepicker = false; ?>
53 <?php $datetimepicker_showseconds = false; ?>
54 <?php $datetimepicker_formatInput = false; ?>
55 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
56 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
57 });
58 });
60 </script>
61 </head>
63 <body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
65 <center>
67 <h2><?php xl('Destroyed Drugs', 'e'); ?></h2>
69 <form name='theform' method='post' action='destroyed_drugs_report.php'>
71 <table border='0' cellpadding='3'>
73 <tr>
74 <td>
75 <?php xl('From', 'e'); ?>:
76 <input type='text' class='datepicker' name='form_from_date' id='form_from_date'
77 size='10' value='<?php echo $form_from_date ?>'
78 title=<?php xl('yyyy-mm-dd', 'e', '\'', '\''); ?>>
80 &nbsp;<?php xl('To', 'e'); ?>:
81 <input type='text' class='datepicker' name='form_to_date' id='form_to_date'
82 size='10' value='<?php echo $form_to_date ?>'
83 title=<?php xl('yyyy-mm-dd', 'e', '\'', '\''); ?>>
85 &nbsp;
86 <input type='submit' name='form_refresh' value=<?php xl('Refresh', 'e'); ?>>
87 &nbsp;
88 <input type='button' value='<?php echo xla('Print'); ?>' id='printbutton' />
89 </td>
90 </tr>
92 <tr>
93 <td height="1">
94 </td>
95 </tr>
97 </table>
99 <table width='98%' id='mymaintable' class='mymaintable'>
100 <thead>
101 <tr bgcolor="#dddddd">
102 <td class='dehead'>
103 <?php xl('Drug Name', 'e'); ?>
104 </td>
105 <td class='dehead'>
106 <?php xl('NDC', 'e'); ?>
107 </td>
108 <td class='dehead'>
109 <?php xl('Lot', 'e'); ?>
110 </td>
111 <td class='dehead'>
112 <?php xl('Qty', 'e'); ?>
113 </td>
114 <td class='dehead'>
115 <?php xl('Date Destroyed', 'e'); ?>
116 </td>
117 <td class='dehead'>
118 <?php xl('Method', 'e'); ?>
119 </td>
120 <td class='dehead'>
121 <?php xl('Witness', 'e'); ?>
122 </td>
123 <td class='dehead'>
124 <?php xl('Notes', 'e'); ?>
125 </td>
126 </tr>
127 </thead>
128 <tbody>
129 <?php
130 if ($_POST['form_refresh']) {
131 $where = "i.destroy_date >= '$form_from_date' AND " .
132 "i.destroy_date <= '$form_to_date'";
134 $query = "SELECT i.inventory_id, i.lot_number, i.on_hand, i.drug_id, " .
135 "i.destroy_date, i.destroy_method, i.destroy_witness, i.destroy_notes, " .
136 "d.name, d.ndc_number " .
137 "FROM drug_inventory AS i " .
138 "LEFT OUTER JOIN drugs AS d ON d.drug_id = i.drug_id " .
139 "WHERE $where " .
140 "ORDER BY d.name, i.drug_id, i.destroy_date, i.lot_number";
142 // echo "<!-- $query -->\n"; // debugging
143 $res = sqlStatement($query);
145 $last_drug_id = 0;
146 while ($row = sqlFetchArray($res)) {
147 $drug_name = $row['name'];
148 $ndc_number = $row['ndc_number'];
149 if ($row['drug_id'] == $last_drug_id) {
150 $drug_name = '&nbsp;';
151 $ndc_number = '&nbsp;';
154 <tr>
155 <td class='detail'>
156 <?php echo $drug_name ?>
157 </td>
158 <td class='detail'>
159 <?php echo $ndc_number ?>
160 </td>
161 <td class='detail'>
162 <a href='../drugs/destroy_lot.php?drug=<?php echo $row['drug_id'] ?>&lot=<?php echo $row['inventory_id'] ?>'
163 style='color:#0000ff' target='_blank'>
164 <?php echo $row['lot_number'] ?>
165 </a>
166 </td>
167 <td class='detail'>
168 <?php echo $row['on_hand'] ?>
169 </td>
170 <td class='detail'>
171 <?php echo oeFormatShortDate($row['destroy_date']) ?>
172 </td>
173 <td class='detail'>
174 <?php echo $row['destroy_method'] ?>
175 </td>
176 <td class='detail'>
177 <?php echo $row['destroy_witness'] ?>
178 </td>
179 <td class='detail'>
180 <?php echo $row['destroy_notes'] ?>
181 </td>
182 </tr>
183 <?php
184 $last_drug_id = $row['drug_id'];
185 } // end while
186 } // end if
189 </tbody>
190 </table>
191 </form>
192 </center>
193 </body>
194 </html>