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(xl('Not authorized'));
23 if (!$drug_id) die(xl('Drug ID missing!'));
24 if (!$lot_id ) die(xl('Lot ID missing!'));
28 <?php
html_header_show();?
>
29 <title
><?php
xl ('Destroy Lot','e') ?
></title
>
30 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
33 td
{ font
-size
:10pt
; }
36 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
37 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
38 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
39 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
40 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
42 <script language
="JavaScript">
43 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
48 <body
class="body_top">
50 // If we are saving, then save and close the window.
52 if ($_POST['form_save']) {
53 sqlStatement("UPDATE drug_inventory SET " .
54 "destroy_date = " . QuotedOrNull($form_date) . ", " .
55 "destroy_method = '" . $_POST['form_method'] . "', " .
56 "destroy_witness = '" . $_POST['form_witness'] . "', " .
57 "destroy_notes = '" . $_POST['form_notes'] . "' " .
58 "WHERE drug_id = '$drug_id' AND inventory_id = '$lot_id'");
60 // Close this window and redisplay the updated list of drugs.
62 echo "<script language='JavaScript'>\n";
63 if ($info_msg) echo " alert('$info_msg');\n";
64 echo " window.close();\n";
65 echo " if (opener.refreshme) opener.refreshme();\n";
66 echo "</script></body></html>\n";
70 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = '$drug_id' " .
71 "AND inventory_id = '$lot_id'");
74 <form method
='post' name
='theform' action
='destroy_lot.php?drug=<?php echo $drug_id ?>&lot=<?php echo $lot_id ?>'>
77 <table border
='0' width
='100%'>
80 <td valign
='top' width
='1%' nowrap
><b
><?php
xl('Lot Number','e'); ?
>:</b
></td
>
82 <?php
echo $row['lot_number'] ?
>
87 <td valign
='top' nowrap
><b
><?php
xl('Manufacturer','e'); ?
>:</b
></td
>
89 <?php
echo $row['manufacturer'] ?
>
94 <td valign
='top' nowrap
><b
><?php
xl('Quantity On Hand','e'); ?
>:</b
></td
>
96 <?php
echo $row['on_hand'] ?
>
101 <td valign
='top' nowrap
><b
><?php
xl('Expiration Date','e'); ?
>:</b
></td
>
103 <?php
echo $row['expiration'] ?
>
108 <td valign
='top' nowrap
><b
><?php
xl('Date Destroyed','e'); ?
>:</b
></td
>
110 <input type
='text' size
='10' name
='form_date' id
='form_date'
111 value
='<?php echo $row['destroy_date
'] ? $row['destroy_date
'] : date("Y-m-d"); ?>'
112 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
113 title
=<?php
xl('yyyy-mm-dd date destroyed','e','\'','\''); ?
> />
114 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
115 id
='img_date' border
='0' alt
='[?]' style
='cursor:pointer'
116 title
=<?php
xl('Click here to choose a date','e','\'','\''); ?
>>
121 <td valign
='top' nowrap
><b
><?php
xl('Method of Destruction','e'); ?
>:</b
></td
>
123 <input type
='text' size
='40' name
='form_method' maxlength
='250'
124 value
='<?php echo $row['destroy_method
'] ?>' style
='width:100%' />
129 <td valign
='top' nowrap
><b
><?php
xl('Witness','e'); ?
>:</b
></td
>
131 <input type
='text' size
='40' name
='form_witness' maxlength
='250'
132 value
='<?php echo $row['destroy_witness
'] ?>' style
='width:100%' />
137 <td valign
='top' nowrap
><b
><?php
xl('Notes','e'); ?
>:</b
></td
>
139 <input type
='text' size
='40' name
='form_notes' maxlength
='250'
140 value
='<?php echo $row['destroy_notes
'] ?>' style
='width:100%' />
147 <input type
='submit' name
='form_save' value
='<?php xl('Submit
','e
') ;?>' />
150 <input type
='button' value
='<?php xl('Cancel
','e
'); ?>' onclick
='window.close()' />
155 <script language
='JavaScript'>
156 Calendar
.setup({inputField
:"form_date", ifFormat
:"%Y-%m-%d", button
:"img_date"});