2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
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)."'";
23 $drug_id = $_REQUEST['drug'];
24 $lot_id = $_REQUEST['lot'];
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!'));
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'>
38 td
{ font
-size
:10pt
; }
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
'] ?>';
53 <body
class="body_top">
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";
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) ?>'>
82 <table border
='0' width
='100%'>
85 <td valign
='top' width
='1%' nowrap
><b
><?php
echo xlt('Lot Number'); ?
>:</b
></td
>
87 <?php
echo text($row['lot_number']) ?
>
92 <td valign
='top' nowrap
><b
><?php
echo xlt('Manufacturer'); ?
>:</b
></td
>
94 <?php
echo text($row['manufacturer']) ?
>
99 <td valign
='top' nowrap
><b
><?php
echo xlt('Quantity On Hand'); ?
>:</b
></td
>
101 <?php
echo text($row['on_hand']) ?
>
106 <td valign
='top' nowrap
><b
><?php
echo xlt('Expiration Date'); ?
>:</b
></td
>
108 <?php
echo text($row['expiration']) ?
>
113 <td valign
='top' nowrap
><b
><?php
echo xlt('Date Destroyed'); ?
>:</b
></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
'); ?>'>
126 <td valign
='top' nowrap
><b
><?php
echo xlt('Method of Destruction'); ?
>:</b
></td
>
128 <input type
='text' size
='40' name
='form_method' maxlength
='250'
129 value
='<?php echo text($row['destroy_method
']) ?>' style
='width:100%' />
134 <td valign
='top' nowrap
><b
><?php
echo xlt('Witness'); ?
>:</b
></td
>
136 <input type
='text' size
='40' name
='form_witness' maxlength
='250'
137 value
='<?php echo text($row['destroy_witness
']) ?>' style
='width:100%' />
142 <td valign
='top' nowrap
><b
><?php
echo xlt('Notes'); ?
>:</b
></td
>
144 <input type
='text' size
='40' name
='form_notes' maxlength
='250'
145 value
='<?php echo text($row['destroy_notes
']) ?>' style
='width:100%' />
152 <input type
='submit' name
='form_save' value
='<?php echo xla('Submit
') ;?>' />
155 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
160 <script language
='JavaScript'>
161 Calendar
.setup({inputField
:"form_date", ifFormat
:"%Y-%m-%d", button
:"img_date"});