3 * This report lists destroyed drug lots within a specified date range.
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2006-2016 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/patient.inc");
16 require_once("../drugs/drugs.inc.php");
18 $form_from_date = fixDate($_POST['form_from_date'], date('Y-01-01'));
19 $form_to_date = fixDate($_POST['form_to_date'], date('Y-m-d'));
23 <?php
html_header_show();?
>
24 <title
><?php
xl('Destroyed Drugs', 'e'); ?
></title
>
25 <link rel
='stylesheet' href
='<?php echo $css_header ?>' type
='text/css'>
26 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker/build/jquery.datetimepicker.min.css">
29 table
.mymaintable
, table
.mymaintable td
, table
.mymaintable th
{
30 border
: 1px solid
#aaaaaa;
31 border
-collapse
: collapse
;
33 table
.mymaintable td
, table
.mymaintable th
{
34 padding
: 1pt
4pt
1pt
4pt
;
38 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
39 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
40 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-1-9-1/jquery.min.js"></script
>
41 <script type
="text/javascript" src
="../../library/js/report_helper.js?v=<?php echo $v_js_includes; ?>"></script
>
42 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker/build/jquery.datetimepicker.full.min.js"></script
>
44 <script language
="JavaScript">
46 $
(document
).ready(function() {
47 oeFixedHeaderSetup(document
.getElementById('mymaintable'));
48 var win
= top
.printLogSetup ? top
: opener
.top
;
49 win
.printLogSetup(document
.getElementById('printbutton'));
51 $
('.datepicker').datetimepicker({
52 <?php
$datetimepicker_timepicker = false; ?
>
53 <?php
$datetimepicker_showseconds = false; ?
>
54 <?php
$datetimepicker_formatInput = false; ?
>
55 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
56 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
63 <body leftmargin
='0' topmargin
='0' marginwidth
='0' marginheight
='0'>
67 <h2
><?php
xl('Destroyed Drugs', 'e'); ?
></h2
>
69 <form name
='theform' method
='post' action
='destroyed_drugs_report.php'>
71 <table border
='0' cellpadding
='3'>
75 <?php
xl('From', 'e'); ?
>:
76 <input type
='text' class='datepicker' name
='form_from_date' id
='form_from_date'
77 size
='10' value
='<?php echo $form_from_date ?>'
78 title
=<?php
xl('yyyy-mm-dd', 'e', '\'', '\''); ?
>>
80  
;<?php
xl('To', 'e'); ?
>:
81 <input type
='text' class='datepicker' name
='form_to_date' id
='form_to_date'
82 size
='10' value
='<?php echo $form_to_date ?>'
83 title
=<?php
xl('yyyy-mm-dd', 'e', '\'', '\''); ?
>>
86 <input type
='submit' name
='form_refresh' value
=<?php
xl('Refresh', 'e'); ?
>>
88 <input type
='button' value
='<?php echo xla('Print'); ?>' id
='printbutton' />
99 <table width
='98%' id
='mymaintable' class='mymaintable'>
101 <tr bgcolor
="#dddddd">
103 <?php
xl('Drug Name', 'e'); ?
>
106 <?php
xl('NDC', 'e'); ?
>
109 <?php
xl('Lot', 'e'); ?
>
112 <?php
xl('Qty', 'e'); ?
>
115 <?php
xl('Date Destroyed', 'e'); ?
>
118 <?php
xl('Method', 'e'); ?
>
121 <?php
xl('Witness', 'e'); ?
>
124 <?php
xl('Notes', 'e'); ?
>
130 if ($_POST['form_refresh']) {
131 $where = "i.destroy_date >= '$form_from_date' AND " .
132 "i.destroy_date <= '$form_to_date'";
134 $query = "SELECT i.inventory_id, i.lot_number, i.on_hand, i.drug_id, " .
135 "i.destroy_date, i.destroy_method, i.destroy_witness, i.destroy_notes, " .
136 "d.name, d.ndc_number " .
137 "FROM drug_inventory AS i " .
138 "LEFT OUTER JOIN drugs AS d ON d.drug_id = i.drug_id " .
140 "ORDER BY d.name, i.drug_id, i.destroy_date, i.lot_number";
142 // echo "<!-- $query -->\n"; // debugging
143 $res = sqlStatement($query);
146 while ($row = sqlFetchArray($res)) {
147 $drug_name = $row['name'];
148 $ndc_number = $row['ndc_number'];
149 if ($row['drug_id'] == $last_drug_id) {
150 $drug_name = ' ';
151 $ndc_number = ' ';
156 <?php
echo $drug_name ?
>
159 <?php
echo $ndc_number ?
>
162 <a href
='../drugs/destroy_lot.php?drug=<?php echo $row['drug_id
'] ?>&lot=<?php echo $row['inventory_id
'] ?>'
163 style
='color:#0000ff' target
='_blank'>
164 <?php
echo $row['lot_number'] ?
>
168 <?php
echo $row['on_hand'] ?
>
171 <?php
echo text(oeFormatShortDate($row['destroy_date'])); ?
>
174 <?php
echo $row['destroy_method'] ?
>
177 <?php
echo $row['destroy_witness'] ?
>
180 <?php
echo $row['destroy_notes'] ?
>
184 $last_drug_id = $row['drug_id'];