PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/reports/supplier.php

https://gitlab.com/abhi143u11/newd
PHP | 201 lines | 164 code | 32 blank | 5 comment | 4 complexity | 5e55bccbea7640c2f645375cd63e7483 MD5 | raw file
  1. <?php
  2. require '../../includes/session_validator.php';
  3. require '../../functions/general_functions.php';
  4. ob_start();
  5. // Getting item data
  6. require '../../config/config.php';
  7. $supplier = $_POST['supplierName'];
  8. switch ($supplier) {
  9. case 'All':
  10. $filter = '';
  11. break;
  12. case '':
  13. $filter = '';
  14. break;
  15. default:
  16. $filter = "WHERE s.supplierID = '$supplier'";
  17. break;
  18. }
  19. $query_supplier = "SELECT i.`itemID`, `itemCode`, `itemDescription`,i.itemCategoryID, i.itemCost,
  20. `itemPrice`,`itemNote`,s.supplierID,`locationName`, category, l.locationID,
  21. `supplierName`, poi.itemQuantity, po.purchaseOrderID, purchaseDate, purchaseStatus,
  22. purchaseorderitemID
  23. FROM item i
  24. INNER JOIN itemlocation n
  25. ON i.`itemID` = n.`itemID`
  26. INNER JOIN location l
  27. ON n.`locationID` = l.`locationID`
  28. INNER JOIN itemcategory c
  29. ON i.`itemCategoryID` = c.`itemCategoryID`
  30. INNER JOIN supplier s
  31. ON s.`supplierID` = i.`supplierID`
  32. INNER JOIN purchaseorder po
  33. ON po.`supplierID` = s.`supplierID`
  34. INNER JOIN purchaseorderitem poi
  35. ON poi.`purchaseOrderID` = po.`purchaseOrderID`
  36. {$filter}
  37. ORDER BY `itemCode` ASC";
  38. $result_supplier = mysql_query($query_supplier) or die(mysql_error());
  39. $row_supplier = mysql_fetch_array($result_supplier);
  40. if (mysql_num_rows($result_supplier) < 1) {
  41. info('message', 'No supplier(s) match this creteria!');
  42. header('Location: reports.php');
  43. exit;
  44. }
  45. ?>
  46. <!doctype html>
  47. <html>
  48. <head>
  49. <meta charset="utf-8">
  50. <link rel="icon" href="../../favicon.ico" type="image/x-icon" />
  51. <title>inWare | USERS</title>
  52. <link href="../../css/layout.css" rel="stylesheet" type="text/css">
  53. <link href="../../css/tooltip.css" rel="stylesheet" type="text/css">
  54. <link href="../../css/print.css" rel="stylesheet" type="text/css">
  55. <script src="../../js/jquery-1.7.2.js" type="text/javascript"></script>
  56. <script src="../../js/tooltip.js" type="text/javascript"></script>
  57. <script src="../../js/core.js" type="text/javascript"></script>
  58. <script src="../../js/accordion.js" type="text/javascript"></script>
  59. <script type="text/javascript">
  60. $(document).ready(function() {
  61. $('.message, .error').hide().slideDown('normal').click(function() {
  62. $(this).slideUp('normal');
  63. });
  64. $('.tooltip').tipTip({
  65. delay: "300"
  66. });
  67. $('#pdf').click(function() {
  68. savePDF('report', '../../css/print.css', 'item_price_list');
  69. });
  70. });
  71. </script>
  72. </head>
  73. <body>
  74. <div class="container">
  75. <?php require '../../includes/header.php'; ?>
  76. <?php require '../../includes/sidebar.php'; ?>
  77. <div class="content">
  78. <?php
  79. // Displaying messages and errors
  80. include '../../includes/info.php';
  81. ?>
  82. <h1>Item Price List</h1>
  83. <div class="hr-line"></div>
  84. <div class="actions" style="top: 100px; width: auto; right: 0; margin: 0 15px 0 0" >
  85. <button class="print tooltip" accesskey="P" title="Print [Alt+Shift+P]" onClick="printPage('report', '../../css/print.css')">Print</button>
  86. <button class="pdf tooltip" accesskey="D" title="Save as PDF [Alt+Shift+D]" id="pdf" >PDF</button>
  87. </div>
  88. <form action="../pdf/pdf.php" method="post" id="html-form" style="display: none">
  89. <input type="hidden" name="html" id="html">
  90. <input type="hidden" name="pdfName" id="pdf-name">
  91. </form>
  92. <div class="report-wrapper">
  93. <div id="report">
  94. <div class="sheet-wraper">
  95. <?php
  96. // Setting report tittle
  97. $report_title = "ITEM PRICE LIST";
  98. include '../../includes/report_header.php';
  99. ?>
  100. <div>
  101. <table cellpadding="3" cellspacing="0" border="1" width="100%" class="two-groups">
  102. <tr>
  103. <th>ITEM CODE</th>
  104. <th>ITEM DESCRIPTION</th>
  105. <th>LOCATION</th>
  106. <th>CATEGORY</th>
  107. <th style="text-align: right">COST</th>
  108. <th>QUANTITY</th>
  109. <th>TOTAL COST</th>
  110. </tr>
  111. <?php
  112. $nthrow = 0;
  113. foreach ($itemLocation as $key => $value) {
  114. echo '<tr><td colspan="3" style="font-style: italic; color: #0ca696;">' . $key . '</td></tr>';
  115. foreach (array_unique($value) as $category) {
  116. echo '<tr><td colspan="3" style="font-style: italic">' . $category . '</td></tr>';
  117. foreach ($itemCategory[$category][$key] as $item) {
  118. echo '<tr class="';
  119. if ($nthrow % 2 != 0)
  120. echo 'odd';
  121. echo '" >';
  122. echo '<td>' . $item['itemCode'] . '</td>';
  123. echo '<td>' . $item['itemDescription'] . '</td>';
  124. echo '<td align="right">' . number_format($item['itemPrice'], '2', '.', ',') . '</td>';
  125. echo '</tr>';
  126. $nthrow++;
  127. }
  128. echo '<tr class=".no-border"><td colspan="3" class=".no-border" style="height: 3px;"></td></tr>';
  129. }
  130. echo '<tr class=".no-border"><td colspan="3" class=".no-border">&nbsp;</td></tr>';
  131. }
  132. ?>
  133. </table>
  134. <!--<p style="float: right"><?php echo "Total Organisations " . $total; ?></p>-->
  135. <div style="clear: both;"></div>
  136. </div>
  137. <!-- end sheet-wrapper --></div>
  138. <!-- end #report --></div>
  139. <!-- end .report-wrapper --></div>
  140. <!-- end .content --></div>
  141. <?php include '../../includes/footer.php'; ?>
  142. <!-- end .container --></div>
  143. </body>
  144. <script type="text/javascript">
  145. $('.reports').attr("id", "current");
  146. var i = $('h3#current').index('.menuheader') - 1; // Find zero indexed position of class menubar containing id current
  147. ddaccordion.init({
  148. headerclass: "expandable", //Shared CSS class name of headers group that are expandable
  149. contentclass: "categoryitems", //Shared CSS class name of contents group
  150. revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
  151. mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
  152. collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
  153. defaultexpanded: [i], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
  154. onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
  155. animatedefault: true, //Should contents open by default be animated into view?
  156. persiststate: false, //persist state of opened contents within browser session?
  157. toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
  158. togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
  159. animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
  160. oninit: function(headers, expandedindices) { //custom code to run when headers have initalized
  161. //do nothing
  162. },
  163. onopenclose: function(header, index, state, isuseractivated) { //custom code to run whenever a header is opened or closed
  164. //do nothing
  165. }
  166. });
  167. </script>
  168. </html>
  169. <?php ob_flush(); ?>