acknowledgments update
[openemr.git] / interface / drugs / destroy_lot.php
blob13f8cd3b9c0929403239c9dd31ab30bfc4e0ec1a
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 $sanitize_all_escapes = true;
10 $fake_register_globals = false;
12 require_once("../globals.php");
13 require_once("$srcdir/acl.inc");
14 require_once("drugs.inc.php");
15 require_once("$srcdir/formdata.inc.php");
16 require_once("$srcdir/htmlspecialchars.inc.php");
18 function QuotedOrNull($fld) {
19 if ($fld) return "'".add_escape_custom($fld)."'";
20 return "NULL";
23 $drug_id = $_REQUEST['drug'];
24 $lot_id = $_REQUEST['lot'];
25 $info_msg = "";
27 if (!acl_check('admin', 'drugs')) die(xlt('Not authorized'));
28 if (!$drug_id) die(xlt('Drug ID missing!'));
29 if (!$lot_id ) die(xlt('Lot ID missing!'));
31 <html>
32 <head>
33 <?php html_header_show();?>
34 <title><?php echo xlt('Destroy Lot') ?></title>
35 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
37 <style>
38 td { font-size:10pt; }
39 </style>
41 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
42 <script type="text/javascript" src="../../library/textformat.js"></script>
43 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
44 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
45 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
47 <script language="JavaScript">
48 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
49 </script>
51 </head>
53 <body class="body_top">
54 <?php
55 // If we are saving, then save and close the window.
57 if ($_POST['form_save']) {
58 sqlStatement("UPDATE drug_inventory SET " .
59 "destroy_date = " . QuotedOrNull($_POST['form_date']) . ", " .
60 "destroy_method = '" . add_escape_custom($_POST['form_method']) . "', " .
61 "destroy_witness = '" . add_escape_custom($_POST['form_witness']) . "', " .
62 "destroy_notes = '" . add_escape_custom($_POST['form_notes']) . "' " .
63 "WHERE drug_id = ? AND inventory_id = ?", array($drug_id,$lot_id) );
65 // Close this window and redisplay the updated list of drugs.
67 echo "<script language='JavaScript'>\n";
68 if ($info_msg) echo " alert('".addslashes($info_msg)."');\n";
69 echo " window.close();\n";
70 echo " if (opener.refreshme) opener.refreshme();\n";
71 echo "</script></body></html>\n";
72 exit();
75 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = ? " .
76 "AND inventory_id = ?", array($drug_id,$lot_id));
79 <form method='post' name='theform' action='destroy_lot.php?drug=<?php echo attr($drug_id) ?>&lot=<?php echo attr($lot_id) ?>'>
80 <center>
82 <table border='0' width='100%'>
84 <tr>
85 <td valign='top' width='1%' nowrap><b><?php echo xlt('Lot Number'); ?>:</b></td>
86 <td>
87 <?php echo text($row['lot_number']) ?>
88 </td>
89 </tr>
91 <tr>
92 <td valign='top' nowrap><b><?php echo xlt('Manufacturer'); ?>:</b></td>
93 <td>
94 <?php echo text($row['manufacturer']) ?>
95 </td>
96 </tr>
98 <tr>
99 <td valign='top' nowrap><b><?php echo xlt('Quantity On Hand'); ?>:</b></td>
100 <td>
101 <?php echo text($row['on_hand']) ?>
102 </td>
103 </tr>
105 <tr>
106 <td valign='top' nowrap><b><?php echo xlt('Expiration Date'); ?>:</b></td>
107 <td>
108 <?php echo text($row['expiration']) ?>
109 </td>
110 </tr>
112 <tr>
113 <td valign='top' nowrap><b><?php echo xlt('Date Destroyed'); ?>:</b></td>
114 <td>
115 <input type='text' size='10' name='form_date' id='form_date'
116 value='<?php echo $row['destroy_date'] ? attr($row['destroy_date']) : date("Y-m-d"); ?>'
117 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
118 title='<?php echo xla('yyyy-mm-dd date destroyed'); ?>' />
119 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
120 id='img_date' border='0' alt='[?]' style='cursor:pointer'
121 title='<?php echo xla('Click here to choose a date'); ?>'>
122 </td>
123 </tr>
125 <tr>
126 <td valign='top' nowrap><b><?php echo xlt('Method of Destruction'); ?>:</b></td>
127 <td>
128 <input type='text' size='40' name='form_method' maxlength='250'
129 value='<?php echo text($row['destroy_method']) ?>' style='width:100%' />
130 </td>
131 </tr>
133 <tr>
134 <td valign='top' nowrap><b><?php echo xlt('Witness'); ?>:</b></td>
135 <td>
136 <input type='text' size='40' name='form_witness' maxlength='250'
137 value='<?php echo text($row['destroy_witness']) ?>' style='width:100%' />
138 </td>
139 </tr>
141 <tr>
142 <td valign='top' nowrap><b><?php echo xlt('Notes'); ?>:</b></td>
143 <td>
144 <input type='text' size='40' name='form_notes' maxlength='250'
145 value='<?php echo text($row['destroy_notes']) ?>' style='width:100%' />
146 </td>
147 </tr>
149 </table>
152 <input type='submit' name='form_save' value='<?php echo xla('Submit') ;?>' />
154 &nbsp;
155 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='window.close()' />
156 </p>
158 </center>
159 </form>
160 <script language='JavaScript'>
161 Calendar.setup({inputField:"form_date", ifFormat:"%Y-%m-%d", button:"img_date"});
162 </script>
163 </body>
164 </html>