2 // Copyright (C) 2006-2010 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");
12 require_once("$srcdir/options.inc.php");
13 require_once("$srcdir/formatting.inc.php");
15 // Check authorization.
16 $thisauth = acl_check('admin', 'drugs');
17 if (!$thisauth) die(xl('Not authorized'));
20 $res = sqlStatement("SELECT d.*, " .
21 "di.inventory_id, di.lot_number, di.expiration, di.manufacturer, di.on_hand " .
23 "LEFT OUTER JOIN drug_inventory AS di ON di.drug_id = d.drug_id " .
24 "AND di.destroy_date IS NULL " .
25 "ORDER BY d.name, d.drug_id, di.expiration, di.lot_number");
30 <?php
html_header_show();?
>
32 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
33 <title
><?php
xl('Drug Inventory','e'); ?
></title
>
36 tr
.head
{ font
-size
:10pt
; background
-color
:#cccccc; text-align:center; }
37 tr
.detail
{ font
-size
:10pt
; }
38 a
, a
:visited
, a
:hover
{ color
:#0000cc; }
41 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
43 <script language
="JavaScript">
45 // callback from add_edit_drug.php or add_edit_drug_inventory.php:
46 function refreshme() {
50 // Process click on drug title.
51 function dodclick(id
) {
52 dlgopen('add_edit_drug.php?drug=' + id
, '_blank', 725, 475);
55 // Process click on drug QOO or lot.
56 function doiclick(id
, lot
) {
57 dlgopen('add_edit_lot.php?drug=' + id +
'&lot=' + lot
, '_blank', 600, 475);
64 <body
class="body_top">
65 <form method
='post' action
='drug_inventory.php'>
67 <table width
='100%' cellpadding
='1' cellspacing
='2'>
69 <td title
=<?php
xl('Click to edit','e','\'','\''); ?
>><?php
xl('Name','e'); ?
></td
>
70 <td
><?php
xl('Act','e'); ?
></td
>
71 <td
><?php
xl('NDC','e'); ?
></td
>
72 <td
><?php
xl('Form','e'); ?
></td
>
73 <td
><?php
xl('Size','e'); ?
></td
>
74 <td
><?php
xl('Unit','e'); ?
></td
>
75 <td title
=<?php
xl('Click to receive (add) new lot','e','\'','\''); ?
>><?php
xl('New','e'); ?
></td
>
76 <td title
=<?php
xl('Click to edit','e','\'','\''); ?
>><?php
xl('Lot','e'); ?
></td
>
77 <td
><?php
xl('QOH','e'); ?
></td
>
78 <td
><?php
xl('Expires','e'); ?
></td
>
83 while ($row = sqlFetchArray($res)) {
84 if ($lastid != $row['drug_id']) {
86 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
87 $lastid = $row['drug_id'];
88 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
89 echo " <td onclick='dodclick($lastid)'>" .
90 "<a href='' onclick='return false'>" .
91 htmlentities($row['name']) . "</a></td>\n";
92 echo " <td>" . ($row['active'] ?
xl('Yes') : xl('No')) . "</td>\n";
93 echo " <td>" . htmlentities($row['ndc_number']) . "</td>\n";
95 generate_display_field(array('data_type'=>'1','list_id'=>'drug_form'), $row['form']) .
97 echo " <td>" . $row['size'] . "</td>\n";
99 generate_display_field(array('data_type'=>'1','list_id'=>'drug_units'), $row['unit']) .
101 echo " <td onclick='doiclick($lastid,0)' title='" . xl('Add new lot and transaction') . "'>" .
102 "<a href='' onclick='return false'>" . xl('New') . "</a></td>\n";
104 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
105 echo " <td colspan='7'> </td>\n";
107 if (!empty($row['inventory_id'])) {
108 $lot_number = htmlentities($row['lot_number']);
109 echo " <td onclick='doiclick($lastid," . $row['inventory_id'] . ")'>" .
110 "<a href='' onclick='return false'>$lot_number</a></td>\n";
111 echo " <td>" . $row['on_hand'] . "</td>\n";
112 echo " <td>" . oeFormatShortDate($row['expiration']) . "</td>\n";
114 echo " <td colspan='3'> </td>\n";
122 <input type
='button' value
='<?php xl('Add Drug
','e
'); ?>' onclick
='dodclick(0)' style
='background-color:transparent' />