set default margins to 5
[openemr.git] / interface / reports / inventory_list.php
blobdba70a907e70f173adc42f71acc67be0637eb7a8
1 <?php
2 // Copyright (C) 2008 Rod Roark <rod@sunsetsystems.com>
3 //
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("$srcdir/options.inc.php");
12 require_once("$include_root/drugs/drugs.inc.php");
14 // Check authorization.
15 $thisauth = acl_check('admin', 'drugs');
16 if (!$thisauth) die(xl('Not authorized'));
18 // get drugs
19 $res = sqlStatement("SELECT d.*, SUM(di.on_hand) AS on_hand " .
20 "FROM drugs AS d " .
21 "LEFT OUTER JOIN drug_inventory AS di ON di.drug_id = d.drug_id " .
22 "AND di.on_hand != 0 AND di.destroy_date IS NULL " .
23 "WHERE d.active = 1 " .
24 "GROUP BY d.name, d.drug_id ORDER BY d.name, d.drug_id");
26 <html>
28 <head>
29 <?php html_header_show(); ?>
31 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
32 <title><?php xl('Inventory List','e'); ?></title>
34 <style>
35 tr.head { font-size:10pt; background-color:#cccccc; text-align:center; }
36 tr.detail { font-size:10pt; }
37 a, a:visited, a:hover { color:#0000cc; }
38 </style>
40 <script type="text/javascript" src="../../library/dialog.js"></script>
42 <script language="JavaScript">
43 </script>
45 </head>
47 <body>
48 <center>
50 <form method='post' action='inventory_list.php' name='theform'>
51 <table border='0' cellpadding='5' cellspacing='0' width='98%'>
52 <tr>
53 <td class='title'>
54 <?php xl('Inventory List','e'); ?>
55 </td>
56 <td class='text' align='right'>
57 <input type="button" value="Print" onclick="window.print()">
58 </td>
59 </tr>
60 </table>
61 </form>
63 <table width='98%' cellpadding='2' cellspacing='2'>
64 <thead style='display:table-header-group'>
65 <tr class='head'>
66 <th><?php xl('NDC','e'); ?></th>
67 <th><?php xl('Name','e'); ?></th>
68 <th><?php xl('Form','e'); ?></th>
69 <th align='right'><?php xl('QOH','e'); ?></th>
70 </tr>
71 </thead>
72 <tbody>
73 <?php
74 $encount = 0;
75 while ($row = sqlFetchArray($res)) {
76 ++$encount;
77 $bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
78 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
79 echo " <td>" . htmlentities($row['ndc_number']) . "</td>\n";
80 echo " <td>" . htmlentities($row['name']) . "</td>\n";
81 echo " <td>" .
82 generate_display_field(array('data_type'=>'1','list_id'=>'drug_form'), $row['form']) .
83 "</td>\n";
84 echo " <td align='right'>" . $row['on_hand'] . "</td>\n";
85 echo " </tr>\n";
88 </tbody>
89 </table>
91 </center>
92 </body>
93 </html>