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