Guest User

Untitled

a guest
Dec 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. function downloadExcel(status)
  2. {
  3. $.ajax({
  4. url: "http://localhost/WareHouse/reporte.php?status="+status,
  5. type: "GET",
  6. success:function(status)
  7. {
  8. console.log("Entre a download excel");
  9. var tmpElemento = document.createElement('a');
  10. var data_type = 'data:application/vnd.ms-excel';
  11. var tabla_div = document.getElementById('actives');
  12. tmpElemento.href = data_type + ', ' + tabla_div;
  13. //Asignamos el nombre a nuestro EXCEL
  14. tmpElemento.download = 'InventoryToReorder.xls';
  15. tmpElemento.click();
  16. }
  17. });
  18. }
  19.  
  20. <!DOCTYPE html>
  21. <html>
  22. <head>
  23. <meta charset="utf-8">
  24. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  25. <?php echo'<title>Inventory To Reorder</title>';?>
  26. </head>
  27.  
  28. <body onload="window.print()">
  29. <?php echo '<img src="http://localhost/WareHouse/assets/img/Esterline.png" style="position: absolute; top: 0; left: 0; height:6%; width:23%; margin-top:40px; margin-left:40px;"/>';?>
  30. <?php echo '<center style="margin-top:120px; font-size:14pt;"><strong>Inventory To Reorder</strong></center>';?>
  31. <?php echo '<label><center>____________________________________________________________________________</center></label><br>';?>
  32. <?php
  33.  
  34. require_once('apis/connection.php');
  35. if(isset($_GET['status']))
  36. {
  37. $status = $_GET["status"];
  38. //Trae todos los item que esten por debajo de su minimo en stock.
  39. $connection = new MySqlServerConnection();
  40. $query = "SELECT i.description_item,i.quantity,u.name_unit,i.reorder_Level,i.target_Stock,l.name_location,i.commentt,io.quantity_s,i.status
  41. FROM inventory_list AS i
  42. INNER JOIN unit_mesurement AS u ON id_unit = fkUnit
  43. INNER JOIN location AS l on id_location = fkLocation
  44. INNER JOIN inventory_output as io on id_output = fkInventory
  45. WHERE i.quantity <= i.reorder_Level OR i.status = 1";
  46. $result = $connection->executeQuery($query,array($status));
  47. if ($result > 0) {
  48. //echo $query;
  49. ?>
  50. <center>
  51. <table class="table table-striped xd" border="1px;" id="actives">
  52. <thead>
  53. <tr>
  54. <th style="width: 3%;">Description</th>
  55. <th style="width: 3%;">Quantity</th>
  56. <th style="width: 3%;">Usage</th>
  57. <th style="width: 3%;">Name Unit</th>
  58. <th style="width: 3%;">Reorder Level</th>
  59. <th style="width: 3%;">Target Stock</th>
  60. <th style="width: 3%;">Area</th>
  61. <th style="width: 3%;">Comment</th>
  62. </tr>
  63. </thead>
  64. <?php
  65. $arraycount=count($result);
  66. $i=0;
  67. $total=0;
  68. while ($i < $arraycount)
  69. {
  70. ?>
  71. <tr>
  72. <td><center><?php echo $result[$i]['description_item']; ?></td>
  73. <td><p style="color:red;" ><?php echo $result[$i]['quantity']; ?></p></td>
  74. <td>
  75. <?php
  76. $qs = $result[$i]['quantity_s'];
  77. switch (true) {
  78. case ($qs >= 1000 && $qs <= 2000) :
  79. echo " 1000 a 2000 SEMANAL";
  80. break;
  81.  
  82. case ($qs >= 100 && $qs <= 200) :
  83. echo " 100 a 200 SEMANAL Y/O QUINCENAL";
  84. break;
  85. }
  86. ?>
  87. </td>
  88. <td><?php echo $result[$i]['name_unit']; ?></td>
  89. <td><?php echo $result[$i]['reorder_Level']; ?></td>
  90. <td><?php echo $result[$i]['target_Stock']; ?></td>
  91. <td><?php echo $result[$i]['name_location']; ?></td>
  92. <td><?php echo $result[$i]['commentt']; ?></center></td>
  93. </tr>
  94. <?php $i++;
  95. }
  96. ?>
  97. </table><br><br>
  98. </center>
  99. <?php
  100. }
  101. //}
  102. }
  103. ?>
  104. </body>
Add Comment
Please, Sign In to add comment