/reports/supplier.php
PHP | 201 lines | 164 code | 32 blank | 5 comment | 4 complexity | 5e55bccbea7640c2f645375cd63e7483 MD5 | raw file
- <?php
- require '../../includes/session_validator.php';
- require '../../functions/general_functions.php';
- ob_start();
- // Getting item data
- require '../../config/config.php';
- $supplier = $_POST['supplierName'];
- switch ($supplier) {
- case 'All':
- $filter = '';
- break;
- case '':
- $filter = '';
- break;
- default:
- $filter = "WHERE s.supplierID = '$supplier'";
- break;
- }
- $query_supplier = "SELECT i.`itemID`, `itemCode`, `itemDescription`,i.itemCategoryID, i.itemCost,
- `itemPrice`,`itemNote`,s.supplierID,`locationName`, category, l.locationID,
- `supplierName`, poi.itemQuantity, po.purchaseOrderID, purchaseDate, purchaseStatus,
- purchaseorderitemID
- FROM item i
- INNER JOIN itemlocation n
- ON i.`itemID` = n.`itemID`
- INNER JOIN location l
- ON n.`locationID` = l.`locationID`
- INNER JOIN itemcategory c
- ON i.`itemCategoryID` = c.`itemCategoryID`
- INNER JOIN supplier s
- ON s.`supplierID` = i.`supplierID`
- INNER JOIN purchaseorder po
- ON po.`supplierID` = s.`supplierID`
- INNER JOIN purchaseorderitem poi
- ON poi.`purchaseOrderID` = po.`purchaseOrderID`
- {$filter}
- ORDER BY `itemCode` ASC";
- $result_supplier = mysql_query($query_supplier) or die(mysql_error());
- $row_supplier = mysql_fetch_array($result_supplier);
- if (mysql_num_rows($result_supplier) < 1) {
- info('message', 'No supplier(s) match this creteria!');
- header('Location: reports.php');
- exit;
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <link rel="icon" href="../../favicon.ico" type="image/x-icon" />
- <title>inWare | USERS</title>
- <link href="../../css/layout.css" rel="stylesheet" type="text/css">
- <link href="../../css/tooltip.css" rel="stylesheet" type="text/css">
- <link href="../../css/print.css" rel="stylesheet" type="text/css">
- <script src="../../js/jquery-1.7.2.js" type="text/javascript"></script>
- <script src="../../js/tooltip.js" type="text/javascript"></script>
- <script src="../../js/core.js" type="text/javascript"></script>
- <script src="../../js/accordion.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $('.message, .error').hide().slideDown('normal').click(function() {
- $(this).slideUp('normal');
- });
- $('.tooltip').tipTip({
- delay: "300"
- });
- $('#pdf').click(function() {
- savePDF('report', '../../css/print.css', 'item_price_list');
- });
- });
- </script>
- </head>
- <body>
- <div class="container">
- <?php require '../../includes/header.php'; ?>
- <?php require '../../includes/sidebar.php'; ?>
- <div class="content">
- <?php
- // Displaying messages and errors
- include '../../includes/info.php';
- ?>
- <h1>Item Price List</h1>
- <div class="hr-line"></div>
- <div class="actions" style="top: 100px; width: auto; right: 0; margin: 0 15px 0 0" >
- <button class="print tooltip" accesskey="P" title="Print [Alt+Shift+P]" onClick="printPage('report', '../../css/print.css')">Print</button>
- <button class="pdf tooltip" accesskey="D" title="Save as PDF [Alt+Shift+D]" id="pdf" >PDF</button>
- </div>
- <form action="../pdf/pdf.php" method="post" id="html-form" style="display: none">
- <input type="hidden" name="html" id="html">
- <input type="hidden" name="pdfName" id="pdf-name">
- </form>
- <div class="report-wrapper">
- <div id="report">
- <div class="sheet-wraper">
- <?php
- // Setting report tittle
- $report_title = "ITEM PRICE LIST";
- include '../../includes/report_header.php';
- ?>
- <div>
- <table cellpadding="3" cellspacing="0" border="1" width="100%" class="two-groups">
- <tr>
- <th>ITEM CODE</th>
- <th>ITEM DESCRIPTION</th>
- <th>LOCATION</th>
- <th>CATEGORY</th>
- <th style="text-align: right">COST</th>
- <th>QUANTITY</th>
- <th>TOTAL COST</th>
- </tr>
- <?php
- $nthrow = 0;
- foreach ($itemLocation as $key => $value) {
- echo '<tr><td colspan="3" style="font-style: italic; color: #0ca696;">' . $key . '</td></tr>';
- foreach (array_unique($value) as $category) {
- echo '<tr><td colspan="3" style="font-style: italic">' . $category . '</td></tr>';
- foreach ($itemCategory[$category][$key] as $item) {
- echo '<tr class="';
- if ($nthrow % 2 != 0)
- echo 'odd';
- echo '" >';
- echo '<td>' . $item['itemCode'] . '</td>';
- echo '<td>' . $item['itemDescription'] . '</td>';
- echo '<td align="right">' . number_format($item['itemPrice'], '2', '.', ',') . '</td>';
- echo '</tr>';
- $nthrow++;
- }
- echo '<tr class=".no-border"><td colspan="3" class=".no-border" style="height: 3px;"></td></tr>';
- }
- echo '<tr class=".no-border"><td colspan="3" class=".no-border"> </td></tr>';
- }
- ?>
- </table>
- <!--<p style="float: right"><?php echo "Total Organisations " . $total; ?></p>-->
- <div style="clear: both;"></div>
- </div>
- <!-- end sheet-wrapper --></div>
- <!-- end #report --></div>
- <!-- end .report-wrapper --></div>
- <!-- end .content --></div>
- <?php include '../../includes/footer.php'; ?>
- <!-- end .container --></div>
- </body>
- <script type="text/javascript">
- $('.reports').attr("id", "current");
- var i = $('h3#current').index('.menuheader') - 1; // Find zero indexed position of class menubar containing id current
- ddaccordion.init({
- headerclass: "expandable", //Shared CSS class name of headers group that are expandable
- contentclass: "categoryitems", //Shared CSS class name of contents group
- revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
- mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
- collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
- defaultexpanded: [i], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
- onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
- animatedefault: true, //Should contents open by default be animated into view?
- persiststate: false, //persist state of opened contents within browser session?
- toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
- togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
- animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
- oninit: function(headers, expandedindices) { //custom code to run when headers have initalized
- //do nothing
- },
- onopenclose: function(header, index, state, isuseractivated) { //custom code to run whenever a header is opened or closed
- //do nothing
- }
- });
- </script>
- </html>
- <?php ob_flush(); ?>