Reminder Module features added:
[openemr.git] / interface / drugs / destroy_lot.php
blobff37eb5ac329aca4d03cbc4a1bceddb6396456d7
1 <?php
2 // Copyright (C) 2006 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 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
11 require_once("drugs.inc.php");
13 function QuotedOrNull($fld) {
14 if ($fld) return "'$fld'";
15 return "NULL";
18 $drug_id = $_REQUEST['drug'];
19 $lot_id = $_REQUEST['lot'];
20 $info_msg = "";
22 if (!acl_check('admin', 'drugs')) die(xl('Not authorized'));
23 if (!$drug_id) die(xl('Drug ID missing!'));
24 if (!$lot_id ) die(xl('Lot ID missing!'));
26 <html>
27 <head>
28 <?php html_header_show();?>
29 <title><?php xl ('Destroy Lot','e') ?></title>
30 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
32 <style>
33 td { font-size:10pt; }
34 </style>
36 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
37 <script type="text/javascript" src="../../library/textformat.js"></script>
38 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
39 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
40 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
42 <script language="JavaScript">
43 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
44 </script>
46 </head>
48 <body class="body_top">
49 <?php
50 // If we are saving, then save and close the window.
52 if ($_POST['form_save']) {
53 sqlStatement("UPDATE drug_inventory SET " .
54 "destroy_date = " . QuotedOrNull($form_date) . ", " .
55 "destroy_method = '" . $_POST['form_method'] . "', " .
56 "destroy_witness = '" . $_POST['form_witness'] . "', " .
57 "destroy_notes = '" . $_POST['form_notes'] . "' " .
58 "WHERE drug_id = '$drug_id' AND inventory_id = '$lot_id'");
60 // Close this window and redisplay the updated list of drugs.
62 echo "<script language='JavaScript'>\n";
63 if ($info_msg) echo " alert('$info_msg');\n";
64 echo " window.close();\n";
65 echo " if (opener.refreshme) opener.refreshme();\n";
66 echo "</script></body></html>\n";
67 exit();
70 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = '$drug_id' " .
71 "AND inventory_id = '$lot_id'");
74 <form method='post' name='theform' action='destroy_lot.php?drug=<?php echo $drug_id ?>&lot=<?php echo $lot_id ?>'>
75 <center>
77 <table border='0' width='100%'>
79 <tr>
80 <td valign='top' width='1%' nowrap><b><?php xl('Lot Number','e'); ?>:</b></td>
81 <td>
82 <?php echo $row['lot_number'] ?>
83 </td>
84 </tr>
86 <tr>
87 <td valign='top' nowrap><b><?php xl('Manufacturer','e'); ?>:</b></td>
88 <td>
89 <?php echo $row['manufacturer'] ?>
90 </td>
91 </tr>
93 <tr>
94 <td valign='top' nowrap><b><?php xl('Quantity On Hand','e'); ?>:</b></td>
95 <td>
96 <?php echo $row['on_hand'] ?>
97 </td>
98 </tr>
100 <tr>
101 <td valign='top' nowrap><b><?php xl('Expiration Date','e'); ?>:</b></td>
102 <td>
103 <?php echo $row['expiration'] ?>
104 </td>
105 </tr>
107 <tr>
108 <td valign='top' nowrap><b><?php xl('Date Destroyed','e'); ?>:</b></td>
109 <td>
110 <input type='text' size='10' name='form_date' id='form_date'
111 value='<?php echo $row['destroy_date'] ? $row['destroy_date'] : date("Y-m-d"); ?>'
112 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
113 title=<?php xl('yyyy-mm-dd date destroyed','e','\'','\''); ?> />
114 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
115 id='img_date' border='0' alt='[?]' style='cursor:pointer'
116 title=<?php xl('Click here to choose a date','e','\'','\''); ?>>
117 </td>
118 </tr>
120 <tr>
121 <td valign='top' nowrap><b><?php xl('Method of Destruction','e'); ?>:</b></td>
122 <td>
123 <input type='text' size='40' name='form_method' maxlength='250'
124 value='<?php echo $row['destroy_method'] ?>' style='width:100%' />
125 </td>
126 </tr>
128 <tr>
129 <td valign='top' nowrap><b><?php xl('Witness','e'); ?>:</b></td>
130 <td>
131 <input type='text' size='40' name='form_witness' maxlength='250'
132 value='<?php echo $row['destroy_witness'] ?>' style='width:100%' />
133 </td>
134 </tr>
136 <tr>
137 <td valign='top' nowrap><b><?php xl('Notes','e'); ?>:</b></td>
138 <td>
139 <input type='text' size='40' name='form_notes' maxlength='250'
140 value='<?php echo $row['destroy_notes'] ?>' style='width:100%' />
141 </td>
142 </tr>
144 </table>
147 <input type='submit' name='form_save' value='<?php xl('Submit','e') ;?>' />
149 &nbsp;
150 <input type='button' value='<?php xl('Cancel','e'); ?>' onclick='window.close()' />
151 </p>
153 </center>
154 </form>
155 <script language='JavaScript'>
156 Calendar.setup({inputField:"form_date", ifFormat:"%Y-%m-%d", button:"img_date"});
157 </script>
158 </body>
159 </html>