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.
10 require_once("../globals.php");
11 require_once("$srcdir/acl.inc");
12 require_once("drugs.inc.php");
14 function QuotedOrNull($fld)
17 return "'".add_escape_custom($fld)."'";
23 $drug_id = $_REQUEST['drug'];
24 $lot_id = $_REQUEST['lot'];
27 if (!acl_check('admin', 'drugs')) {
28 die(xlt('Not authorized'));
32 die(xlt('Drug ID missing!'));
36 die(xlt('Lot ID missing!'));
41 <?php
html_header_show();?
>
42 <title
><?php
echo xlt('Destroy Lot') ?
></title
>
43 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
46 td
{ font
-size
:10pt
; }
49 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
50 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
51 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
52 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
53 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
55 <script language
="JavaScript">
56 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
61 <body
class="body_top">
63 // If we are saving, then save and close the window.
65 if ($_POST['form_save']) {
66 sqlStatement("UPDATE drug_inventory SET " .
67 "destroy_date = " . QuotedOrNull($_POST['form_date']) . ", " .
68 "destroy_method = '" . add_escape_custom($_POST['form_method']) . "', " .
69 "destroy_witness = '" . add_escape_custom($_POST['form_witness']) . "', " .
70 "destroy_notes = '" . add_escape_custom($_POST['form_notes']) . "' " .
71 "WHERE drug_id = ? AND inventory_id = ?", array($drug_id,$lot_id));
73 // Close this window and redisplay the updated list of drugs.
75 echo "<script language='JavaScript'>\n";
77 echo " alert('".addslashes($info_msg)."');\n";
80 echo " window.close();\n";
81 echo " if (opener.refreshme) opener.refreshme();\n";
82 echo "</script></body></html>\n";
86 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = ? " .
87 "AND inventory_id = ?", array($drug_id,$lot_id));
90 <form method
='post' name
='theform' action
='destroy_lot.php?drug=<?php echo attr($drug_id) ?>&lot=<?php echo attr($lot_id) ?>'>
93 <table border
='0' width
='100%'>
96 <td valign
='top' width
='1%' nowrap
><b
><?php
echo xlt('Lot Number'); ?
>:</b
></td
>
98 <?php
echo text($row['lot_number']) ?
>
103 <td valign
='top' nowrap
><b
><?php
echo xlt('Manufacturer'); ?
>:</b
></td
>
105 <?php
echo text($row['manufacturer']) ?
>
110 <td valign
='top' nowrap
><b
><?php
echo xlt('Quantity On Hand'); ?
>:</b
></td
>
112 <?php
echo text($row['on_hand']) ?
>
117 <td valign
='top' nowrap
><b
><?php
echo xlt('Expiration Date'); ?
>:</b
></td
>
119 <?php
echo text($row['expiration']) ?
>
124 <td valign
='top' nowrap
><b
><?php
echo xlt('Date Destroyed'); ?
>:</b
></td
>
126 <input type
='text' size
='10' name
='form_date' id
='form_date'
127 value
='<?php echo $row['destroy_date
'] ? attr($row['destroy_date
']) : date("Y-m-d"); ?>'
128 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
129 title
='<?php echo xla('yyyy
-mm
-dd date destroyed
'); ?>' />
130 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
131 id
='img_date' border
='0' alt
='[?]' style
='cursor:pointer'
132 title
='<?php echo xla('Click here to choose a date
'); ?>'>
137 <td valign
='top' nowrap
><b
><?php
echo xlt('Method of Destruction'); ?
>:</b
></td
>
139 <input type
='text' size
='40' name
='form_method' maxlength
='250'
140 value
='<?php echo text($row['destroy_method
']) ?>' style
='width:100%' />
145 <td valign
='top' nowrap
><b
><?php
echo xlt('Witness'); ?
>:</b
></td
>
147 <input type
='text' size
='40' name
='form_witness' maxlength
='250'
148 value
='<?php echo text($row['destroy_witness
']) ?>' style
='width:100%' />
153 <td valign
='top' nowrap
><b
><?php
echo xlt('Notes'); ?
>:</b
></td
>
155 <input type
='text' size
='40' name
='form_notes' maxlength
='250'
156 value
='<?php echo text($row['destroy_notes
']) ?>' style
='width:100%' />
163 <input type
='submit' name
='form_save' value
='<?php echo xla('Submit
') ;?>' />
166 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
171 <script language
='JavaScript'>
172 Calendar
.setup({inputField
:"form_date", ifFormat
:"%Y-%m-%d", button
:"img_date"});