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 // This report lists destroyed drug lots within a specified date
12 require_once("../globals.php");
13 require_once("$srcdir/patient.inc");
14 require_once("../drugs/drugs.inc.php");
16 $form_from_date = fixDate($_POST['form_from_date'], date('Y-01-01'));
17 $form_to_date = fixDate($_POST['form_to_date'] , date('Y-m-d'));
21 <?
html_header_show();?
>
22 <title
><?
xl('Destroyed Drugs','e'); ?
></title
>
23 <link rel
='stylesheet' href
='<?php echo $css_header ?>' type
='text/css'>
25 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
26 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
27 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
28 <script type
="text/javascript" src
="../../library/dynarch_calendar_en.js"></script
>
29 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
30 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
31 <script language
="JavaScript">
32 var mypcc
= '<? echo $GLOBALS['phone_country_code
'] ?>';
36 <body leftmargin
='0' topmargin
='0' marginwidth
='0' marginheight
='0'>
40 <h2
><?
xl('Destroyed Drugs','e'); ?
></h2
>
42 <form name
='theform' method
='post' action
='destroyed_drugs_report.php'>
44 <table border
='0' cellpadding
='3'>
48 <?
xl('From','e'); ?
>:
49 <input type
='text' name
='form_from_date' id
='form_from_date'
50 size
='10' value
='<? echo $form_from_date ?>'
51 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='yyyy-mm-dd'>
52 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
53 id
='img_from_date' border
='0' alt
='[?]' style
='cursor:pointer'
54 title
='Click here to choose a date'>
56  
;<?
xl('To','e'); ?
>:
57 <input type
='text' name
='form_to_date' id
='form_to_date'
58 size
='10' value
='<? echo $form_to_date ?>'
59 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='yyyy-mm-dd'>
60 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
61 id
='img_to_date' border
='0' alt
='[?]' style
='cursor:pointer'
62 title
='Click here to choose a date'>
65 <input type
='submit' name
='form_refresh' value
=<?
xl('Refresh','e'); ?
>>
67 <input type
='button' value
='<?php xl('Print','e
'); ?>' onclick
='window.print()' />
78 <table border
='0' cellpadding
='1' cellspacing
='2' width
='98%'>
79 <tr bgcolor
="#dddddd">
81 <?
xl('Drug Name','e'); ?
>
93 <?
xl('Date Destroyed','e'); ?
>
96 <?
xl('Method','e'); ?
>
99 <?
xl('Witness','e'); ?
>
102 <?
xl('Notes','e'); ?
>
106 if ($_POST['form_refresh']) {
107 $where = "i.destroy_date >= '$form_from_date' AND " .
108 "i.destroy_date <= '$form_to_date'";
110 $query = "SELECT i.inventory_id, i.lot_number, i.on_hand, i.drug_id, " .
111 "i.destroy_date, i.destroy_method, i.destroy_witness, i.destroy_notes, " .
112 "d.name, d.ndc_number " .
113 "FROM drug_inventory AS i " .
114 "LEFT OUTER JOIN drugs AS d ON d.drug_id = i.drug_id " .
116 "ORDER BY d.name, i.drug_id, i.destroy_date, i.lot_number";
118 // echo "<!-- $query -->\n"; // debugging
119 $res = sqlStatement($query);
122 while ($row = sqlFetchArray($res)) {
123 $drug_name = $row['name'];
124 $ndc_number = $row['ndc_number'];
125 if ($row['drug_id'] == $last_drug_id) {
126 $drug_name = ' ';
127 $ndc_number = ' ';
132 <?php
echo $drug_name ?
>
135 <?php
echo $ndc_number ?
>
138 <a href
='../drugs/destroy_lot.php?drug=<?php echo $row['drug_id
'] ?>&lot=<?php echo $row['inventory_id
'] ?>'
139 style
='color:#0000ff' target
='_blank'>
140 <?php
echo $row['lot_number'] ?
>
144 <?php
echo $row['on_hand'] ?
>
147 <?php
echo $row['destroy_date'] ?
>
150 <?php
echo $row['destroy_method'] ?
>
153 <?php
echo $row['destroy_witness'] ?
>
156 <?php
echo $row['destroy_notes'] ?
>
160 $last_drug_id = $row['drug_id'];
168 <script language
='JavaScript'>
169 Calendar
.setup({inputField
:"form_from_date", ifFormat
:"%Y-%m-%d", button
:"img_from_date"});
170 Calendar
.setup({inputField
:"form_to_date", ifFormat
:"%Y-%m-%d", button
:"img_to_date"});