Fix to using most recent development translation set on development demo.
[openemr.git] / interface / reports / destroyed_drugs_report.php
blobceb6c5116d00a93b0fc2e5cc5e7321f7c50a7afb
1 <?php
2 // Copyright (C) 2006, 2010 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 report lists destroyed drug lots within a specified date
10 // range.
12 require_once("../globals.php");
13 require_once("$srcdir/patient.inc");
14 require_once("../drugs/drugs.inc.php");
15 require_once("$srcdir/formatting.inc.php");
17 $form_from_date = fixDate($_POST['form_from_date'], date('Y-01-01'));
18 $form_to_date = fixDate($_POST['form_to_date'] , date('Y-m-d'));
20 <html>
21 <head>
22 <?php html_header_show();?>
23 <title><?php xl('Destroyed Drugs','e'); ?></title>
24 <link rel='stylesheet' href='<?php echo $css_header ?>' type='text/css'>
26 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
27 <script type="text/javascript" src="../../library/textformat.js"></script>
28 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
29 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
30 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
31 <script type="text/javascript" src="../../library/dialog.js"></script>
32 <script language="JavaScript">
33 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
34 </script>
35 </head>
37 <body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
39 <center>
41 <h2><?php xl('Destroyed Drugs','e'); ?></h2>
43 <form name='theform' method='post' action='destroyed_drugs_report.php'>
45 <table border='0' cellpadding='3'>
47 <tr>
48 <td>
49 <?php xl('From','e'); ?>:
50 <input type='text' name='form_from_date' id='form_from_date'
51 size='10' value='<?php echo $form_from_date ?>'
52 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title=<?php xl('yyyy-mm-dd','e','\'','\''); ?>>
53 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
54 id='img_from_date' border='0' alt='[?]' style='cursor:pointer'
55 title=<?php xl('Click here to choose a date','e','\'','\''); ?>>
57 &nbsp;<?php xl('To','e'); ?>:
58 <input type='text' name='form_to_date' id='form_to_date'
59 size='10' value='<?php echo $form_to_date ?>'
60 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title=<?php xl('yyyy-mm-dd','e','\'','\''); ?>>
61 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
62 id='img_to_date' border='0' alt='[?]' style='cursor:pointer'
63 title=<?php xl('Click here to choose a date','e','\'','\''); ?>>
65 &nbsp;
66 <input type='submit' name='form_refresh' value=<?php xl('Refresh','e'); ?>>
67 &nbsp;
68 <input type='button' value='<?php xl('Print','e'); ?>' onclick='window.print()' />
69 </td>
70 </tr>
72 <tr>
73 <td height="1">
74 </td>
75 </tr>
77 </table>
79 <table border='0' cellpadding='1' cellspacing='2' width='98%'>
80 <tr bgcolor="#dddddd">
81 <td class='dehead'>
82 <?php xl('Drug Name','e'); ?>
83 </td>
84 <td class='dehead'>
85 <?php xl('NDC','e'); ?>
86 </td>
87 <td class='dehead'>
88 <?php xl('Lot','e'); ?>
89 </td>
90 <td class='dehead'>
91 <?php xl('Qty','e'); ?>
92 </td>
93 <td class='dehead'>
94 <?php xl('Date Destroyed','e'); ?>
95 </td>
96 <td class='dehead'>
97 <?php xl('Method','e'); ?>
98 </td>
99 <td class='dehead'>
100 <?php xl('Witness','e'); ?>
101 </td>
102 <td class='dehead'>
103 <?php xl('Notes','e'); ?>
104 </td>
105 </tr>
106 <?php
108 if ($_POST['form_refresh']) {
109 $where = "i.destroy_date >= '$form_from_date' AND " .
110 "i.destroy_date <= '$form_to_date'";
112 $query = "SELECT i.inventory_id, i.lot_number, i.on_hand, i.drug_id, " .
113 "i.destroy_date, i.destroy_method, i.destroy_witness, i.destroy_notes, " .
114 "d.name, d.ndc_number " .
115 "FROM drug_inventory AS i " .
116 "LEFT OUTER JOIN drugs AS d ON d.drug_id = i.drug_id " .
117 "WHERE $where " .
118 "ORDER BY d.name, i.drug_id, i.destroy_date, i.lot_number";
120 // echo "<!-- $query -->\n"; // debugging
121 $res = sqlStatement($query);
123 $last_drug_id = 0;
124 while ($row = sqlFetchArray($res)) {
125 $drug_name = $row['name'];
126 $ndc_number = $row['ndc_number'];
127 if ($row['drug_id'] == $last_drug_id) {
128 $drug_name = '&nbsp;';
129 $ndc_number = '&nbsp;';
132 <tr>
133 <td class='detail'>
134 <?php echo $drug_name ?>
135 </td>
136 <td class='detail'>
137 <?php echo $ndc_number ?>
138 </td>
139 <td class='detail'>
140 <a href='../drugs/destroy_lot.php?drug=<?php echo $row['drug_id'] ?>&lot=<?php echo $row['inventory_id'] ?>'
141 style='color:#0000ff' target='_blank'>
142 <?php echo $row['lot_number'] ?>
143 </a>
144 </td>
145 <td class='detail'>
146 <?php echo $row['on_hand'] ?>
147 </td>
148 <td class='detail'>
149 <?php echo oeFormatShortDate($row['destroy_date']) ?>
150 </td>
151 <td class='detail'>
152 <?php echo $row['destroy_method'] ?>
153 </td>
154 <td class='detail'>
155 <?php echo $row['destroy_witness'] ?>
156 </td>
157 <td class='detail'>
158 <?php echo $row['destroy_notes'] ?>
159 </td>
160 </tr>
161 <?php
162 $last_drug_id = $row['drug_id'];
163 } // end while
164 } // end if
167 </table>
168 </form>
169 </center>
170 <script language='JavaScript'>
171 Calendar.setup({inputField:"form_from_date", ifFormat:"%Y-%m-%d", button:"img_from_date"});
172 Calendar.setup({inputField:"form_to_date", ifFormat:"%Y-%m-%d", button:"img_to_date"});
173 </script>
174 </body>
175 </html>