7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2006-2021 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("drugs.inc.php");
18 use OpenEMR\Common\Acl\AclMain
;
19 use OpenEMR\Common\Csrf\CsrfUtils
;
20 use OpenEMR\Core\Header
;
22 $drug_id = $_REQUEST['drug'];
23 $lot_id = $_REQUEST['lot'];
26 if (!AclMain
::aclCheckCore('admin', 'drugs')) {
27 die(xlt('Not authorized'));
31 die(xlt('Drug ID missing!'));
35 die(xlt('Lot ID missing!'));
40 <title
><?php
echo xlt('Destroy Lot') ?
></title
>
42 <?php Header
::setupHeader(['datetime-picker', 'opener']); ?
>
52 $
('.datepicker').datetimepicker({
53 <?php
$datetimepicker_timepicker = false; ?
>
54 <?php
$datetimepicker_showseconds = false; ?
>
55 <?php
$datetimepicker_formatInput = false; ?
>
56 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
57 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
61 function validate(f
) {
62 if (!confirm(<?php
echo xlj('Really destroy this lot?'); ?
>)) {
73 <body
class="body_top">
75 // If we are saving, then save and close the window.
77 if ($_POST['form_save']) {
78 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
79 CsrfUtils
::csrfNotVerified();
83 "UPDATE drug_inventory SET " .
84 "destroy_date = ?, " .
85 "destroy_method = ?, " .
86 "destroy_witness = ?, " .
87 "destroy_notes = ? " .
88 "WHERE drug_id = ? AND inventory_id = ?",
90 (empty($_POST['form_date']) ?
"NULL" : $_POST['form_date']),
91 $_POST['form_method'],
92 $_POST['form_witness'],
99 // Close this window and redisplay the updated list of drugs.
103 echo " alert('" . addslashes($info_msg) . "');\n";
106 echo " window.close();\n";
107 echo " if (opener.refreshme) opener.refreshme();\n";
108 echo "</script></body></html>\n";
112 $row = sqlQuery("SELECT * FROM drug_inventory WHERE drug_id = ? " .
113 "AND inventory_id = ?", array($drug_id,$lot_id));
116 <form method
='post' name
='theform' onsubmit
='return validate(this);'
117 action
='destroy_lot.php?drug=<?php echo attr_url($drug_id) ?>&lot=<?php echo attr_url($lot_id) ?>'>
119 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
123 <table
class='table-borderless w-100'>
126 <td
class="text-nowrap align-top font-weight-bold" width
='1%'><?php
echo xlt('Lot Number'); ?
>:</td
>
128 <?php
echo text($row['lot_number']) ?
>
133 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Manufacturer'); ?
>:</td
>
135 <?php
echo text($row['manufacturer']) ?
>
140 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Quantity On Hand'); ?
>:</td
>
142 <?php
echo text($row['on_hand']) ?
>
147 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Expiration Date'); ?
>:</td
>
149 <?php
echo text($row['expiration']) ?
>
154 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Date Destroyed'); ?
>:</td
>
156 <input type
='text' size
='10' class='datepicker' name
='form_date' id
='form_date' value
='<?php echo $row['destroy_date
'] ? attr($row['destroy_date
']) : date("Y-m-d"); ?>' title
='<?php echo xla('yyyy
-mm
-dd date destroyed
'); ?>' />
161 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Method of Destruction'); ?
>:</td
>
163 <input type
='text' class='w-100' size
='40' name
='form_method' maxlength
='250'
164 value
='<?php echo attr($row['destroy_method
']) ?>' />
169 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Witness'); ?
>:</td
>
171 <input type
='text' class='w-100' size
='40' name
='form_witness' maxlength
='250'
172 value
='<?php echo attr($row['destroy_witness
']) ?>' />
177 <td
class="text-nowrap align-top font-weight-bold"><?php
echo xlt('Notes'); ?
>:</td
>
179 <input type
='text' class='w-100' size
='40' name
='form_notes' maxlength
='250'
180 value
='<?php echo attr($row['destroy_notes
']) ?>' />
186 <div
class="btn-group">
187 <input type
='submit' class="btn btn-primary" name
='form_save' value
='<?php echo xla('Submit
') ;?>' />
188 <input type
='button' class="btn btn-secondary" value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />