Merge pull request #1154 for user interface improvements of left nav and main title
[openemr.git] / interface / drugs / destroy_lot.php
blobbbac8d415676737eccf87cd19b4929e9c4b5c4c7
1 <?php
2 /**
3 * destroy lot
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 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
15 require_once("../globals.php");
16 require_once("$srcdir/acl.inc");
17 require_once("drugs.inc.php");
19 function QuotedOrNull($fld)
21 if ($fld) {
22 return "'".add_escape_custom($fld)."'";
25 return "NULL";
28 $drug_id = $_REQUEST['drug'];
29 $lot_id = $_REQUEST['lot'];
30 $info_msg = "";
32 if (!acl_check('admin', 'drugs')) {
33 die(xlt('Not authorized'));
36 if (!$drug_id) {
37 die(xlt('Drug ID missing!'));
40 if (!$lot_id) {
41 die(xlt('Lot ID missing!'));
44 <html>
45 <head>
46 <?php html_header_show();?>
47 <title><?php echo xlt('Destroy Lot') ?></title>
48 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
49 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
51 <style>
52 td { font-size:10pt; }
53 </style>
55 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
56 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
57 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
60 <script language="JavaScript">
61 $(document).ready(function(){
62 $('.datepicker').datetimepicker({
63 <?php $datetimepicker_timepicker = false; ?>
64 <?php $datetimepicker_showseconds = false; ?>
65 <?php $datetimepicker_formatInput = false; ?>
66 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
67 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
68 });
69 });
70 </script>
72 </head>
74 <body class="body_top">
75 <?php
76 // If we are saving, then save and close the window.
78 if ($_POST['form_save']) {
79 sqlStatement("UPDATE drug_inventory SET " .
80 "destroy_date = " . QuotedOrNull($_POST['form_date']) . ", " .
81 "destroy_method = '" . add_escape_custom($_POST['form_method']) . "', " .
82 "destroy_witness = '" . add_escape_custom($_POST['form_witness']) . "', " .
83 "destroy_notes = '" . add_escape_custom($_POST['form_notes']) . "' " .
84 "WHERE drug_id = ? AND inventory_id = ?", array($drug_id,$lot_id));
86 // Close this window and redisplay the updated list of drugs.
88 echo "<script language='JavaScript'>\n";
89 if ($info_msg) {
90 echo " alert('".addslashes($info_msg)."');\n";
93 echo " window.close();\n";
94 echo " if (opener.refreshme) opener.refreshme();\n";
95 echo "</script></body></html>\n";
96 exit();
99 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = ? " .
100 "AND inventory_id = ?", array($drug_id,$lot_id));
103 <form method='post' name='theform' action='destroy_lot.php?drug=<?php echo attr($drug_id) ?>&lot=<?php echo attr($lot_id) ?>'>
104 <center>
106 <table border='0' width='100%'>
108 <tr>
109 <td valign='top' width='1%' nowrap><b><?php echo xlt('Lot Number'); ?>:</b></td>
110 <td>
111 <?php echo text($row['lot_number']) ?>
112 </td>
113 </tr>
115 <tr>
116 <td valign='top' nowrap><b><?php echo xlt('Manufacturer'); ?>:</b></td>
117 <td>
118 <?php echo text($row['manufacturer']) ?>
119 </td>
120 </tr>
122 <tr>
123 <td valign='top' nowrap><b><?php echo xlt('Quantity On Hand'); ?>:</b></td>
124 <td>
125 <?php echo text($row['on_hand']) ?>
126 </td>
127 </tr>
129 <tr>
130 <td valign='top' nowrap><b><?php echo xlt('Expiration Date'); ?>:</b></td>
131 <td>
132 <?php echo text($row['expiration']) ?>
133 </td>
134 </tr>
136 <tr>
137 <td valign='top' nowrap><b><?php echo xlt('Date Destroyed'); ?>:</b></td>
138 <td>
139 <input type='text' size='10' class='datepicker' name='form_date' id='form_date'
140 value='<?php echo $row['destroy_date'] ? attr($row['destroy_date']) : date("Y-m-d"); ?>'
141 title='<?php echo xla('yyyy-mm-dd date destroyed'); ?>' />
142 </td>
143 </tr>
145 <tr>
146 <td valign='top' nowrap><b><?php echo xlt('Method of Destruction'); ?>:</b></td>
147 <td>
148 <input type='text' size='40' name='form_method' maxlength='250'
149 value='<?php echo text($row['destroy_method']) ?>' style='width:100%' />
150 </td>
151 </tr>
153 <tr>
154 <td valign='top' nowrap><b><?php echo xlt('Witness'); ?>:</b></td>
155 <td>
156 <input type='text' size='40' name='form_witness' maxlength='250'
157 value='<?php echo text($row['destroy_witness']) ?>' style='width:100%' />
158 </td>
159 </tr>
161 <tr>
162 <td valign='top' nowrap><b><?php echo xlt('Notes'); ?>:</b></td>
163 <td>
164 <input type='text' size='40' name='form_notes' maxlength='250'
165 value='<?php echo text($row['destroy_notes']) ?>' style='width:100%' />
166 </td>
167 </tr>
169 </table>
172 <input type='submit' name='form_save' value='<?php echo xla('Submit') ;?>' />
174 &nbsp;
175 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='window.close()' />
176 </p>
178 </center>
179 </form>
180 </body>
181 </html>