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");
16 function QuotedOrNull($fld) {
17 if ($fld) return "'".add_escape_custom($fld)."'";
21 $drug_id = $_REQUEST['drug'];
22 $lot_id = $_REQUEST['lot'];
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!'));
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'>
36 td
{ font
-size
:10pt
; }
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
'] ?>';
51 <body
class="body_top">
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";
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) ?>'>
80 <table border
='0' width
='100%'>
83 <td valign
='top' width
='1%' nowrap
><b
><?php
echo xlt('Lot Number'); ?
>:</b
></td
>
85 <?php
echo text($row['lot_number']) ?
>
90 <td valign
='top' nowrap
><b
><?php
echo xlt('Manufacturer'); ?
>:</b
></td
>
92 <?php
echo text($row['manufacturer']) ?
>
97 <td valign
='top' nowrap
><b
><?php
echo xlt('Quantity On Hand'); ?
>:</b
></td
>
99 <?php
echo text($row['on_hand']) ?
>
104 <td valign
='top' nowrap
><b
><?php
echo xlt('Expiration Date'); ?
>:</b
></td
>
106 <?php
echo text($row['expiration']) ?
>
111 <td valign
='top' nowrap
><b
><?php
echo xlt('Date Destroyed'); ?
>:</b
></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
'); ?>'>
124 <td valign
='top' nowrap
><b
><?php
echo xlt('Method of Destruction'); ?
>:</b
></td
>
126 <input type
='text' size
='40' name
='form_method' maxlength
='250'
127 value
='<?php echo text($row['destroy_method
']) ?>' style
='width:100%' />
132 <td valign
='top' nowrap
><b
><?php
echo xlt('Witness'); ?
>:</b
></td
>
134 <input type
='text' size
='40' name
='form_witness' maxlength
='250'
135 value
='<?php echo text($row['destroy_witness
']) ?>' style
='width:100%' />
140 <td valign
='top' nowrap
><b
><?php
echo xlt('Notes'); ?
>:</b
></td
>
142 <input type
='text' size
='40' name
='form_notes' maxlength
='250'
143 value
='<?php echo text($row['destroy_notes
']) ?>' style
='width:100%' />
150 <input type
='submit' name
='form_save' value
='<?php echo xla('Submit
') ;?>' />
153 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
158 <script language
='JavaScript'>
159 Calendar
.setup({inputField
:"form_date", ifFormat
:"%Y-%m-%d", button
:"img_date"});