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 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'";
18 $drug_id = $_REQUEST['drug'];
19 $lot_id = $_REQUEST['lot'];
22 if (!acl_check('admin', 'drugs')) die("Not authorized!");
23 if (!$drug_id) die("Drug ID missing!");
24 if (!$lot_id ) die("Lot ID missing!");
28 <title
><?php
xl ('Destroy Lot','e') ?
></title
>
29 <link rel
=stylesheet href
='<?php echo $css_header ?>' type
='text/css'>
32 td
{ font
-size
:10pt
; }
35 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
36 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
37 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
38 <script type
="text/javascript" src
="../../library/dynarch_calendar_en.js"></script
>
39 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
41 <script language
="JavaScript">
42 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
47 <body
<?php
echo $top_bg_line;?
>>
49 // If we are saving, then save and close the window.
51 if ($_POST['form_save']) {
52 sqlStatement("UPDATE drug_inventory SET " .
53 "destroy_date = " . QuotedOrNull($form_date) . ", " .
54 "destroy_method = '" . $_POST['form_method'] . "', " .
55 "destroy_witness = '" . $_POST['form_witness'] . "', " .
56 "destroy_notes = '" . $_POST['form_notes'] . "' " .
57 "WHERE drug_id = '$drug_id' AND inventory_id = '$lot_id'");
59 // Close this window and redisplay the updated list of drugs.
61 echo "<script language='JavaScript'>\n";
62 if ($info_msg) echo " alert('$info_msg');\n";
63 echo " window.close();\n";
64 echo " if (opener.refreshme) opener.refreshme();\n";
65 echo "</script></body></html>\n";
69 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = '$drug_id' " .
70 "AND inventory_id = '$lot_id'");
73 <form method
='post' name
='theform' action
='destroy_lot.php?drug=<?php echo $drug_id ?>&lot=<?php echo $lot_id ?>'>
76 <table border
='0' width
='100%'>
79 <td valign
='top' width
='1%' nowrap
><b
><?php
xl('Lot Number','e'); ?
>:</b
></td
>
81 <?php
echo $row['lot_number'] ?
>
86 <td valign
='top' nowrap
><b
><?php
xl('Manufacturer','e'); ?
>:</b
></td
>
88 <?php
echo $row['manufacturer'] ?
>
93 <td valign
='top' nowrap
><b
><?php
xl('Quantity On Hand','e'); ?
>:</b
></td
>
95 <?php
echo $row['on_hand'] ?
>
100 <td valign
='top' nowrap
><b
><?php
xl('Expiration Date','e'); ?
>:</b
></td
>
102 <?php
echo $row['expiration'] ?
>
107 <td valign
='top' nowrap
><b
><?php
xl('Date Destroyed','e'); ?
>:</b
></td
>
109 <input type
='text' size
='10' name
='form_date' id
='form_date'
110 value
='<?php echo $row['destroy_date
'] ? $row['destroy_date
'] : date("Y-m-d"); ?>'
111 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
112 title
='yyyy-mm-dd date destroyed' />
113 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
114 id
='img_date' border
='0' alt
='[?]' style
='cursor:pointer'
115 title
='Click here to choose a date'>
120 <td valign
='top' nowrap
><b
><?php
xl('Method of Destruction','e'); ?
>:</b
></td
>
122 <input type
='text' size
='40' name
='form_method' maxlength
='250'
123 value
='<?php echo $row['destroy_method
'] ?>' style
='width:100%' />
128 <td valign
='top' nowrap
><b
><?php
xl('Witness','e'); ?
>:</b
></td
>
130 <input type
='text' size
='40' name
='form_witness' maxlength
='250'
131 value
='<?php echo $row['destroy_witness
'] ?>' style
='width:100%' />
136 <td valign
='top' nowrap
><b
><?php
xl('Notes','e'); ?
>:</b
></td
>
138 <input type
='text' size
='40' name
='form_notes' maxlength
='250'
139 value
='<?php echo $row['destroy_notes
'] ?>' style
='width:100%' />
146 <input type
='submit' name
='form_save' value
='<?php xl('Submit
','e
') ;?>' />
149 <input type
='button' value
='<?php xl('Cancel
','e
'); ?>' onclick
='window.close()' />
154 <script language
='JavaScript'>
155 Calendar
.setup({inputField
:"form_date", ifFormat
:"%Y-%m-%d", button
:"img_date"});