Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php
  2.  
  3. $planilha = [
  4. [
  5. [
  6. 'PCT_DESCRICAO' => 'teste',
  7. 'NAT_DESCRICAO' => 'teste2',
  8. 'ORCD_VLR' => 99
  9. ],
  10. ['ORCD_VLR' => 100],
  11. ['ORCD_VLR' => 101],
  12. ['ORCD_VLR' => 102],
  13. ['ORCD_VLR' => 103],
  14. ['ORCD_VLR' => 104],
  15. ['ORCD_VLR' => 105],
  16. ['ORCD_VLR' => 106],
  17. ['ORCD_VLR' => 107],
  18. ['ORCD_VLR' => 108],
  19. ['ORCD_VLR' => 109],
  20. ['ORCD_VLR' => 110],
  21. ['ORCD_VLR' => 111],
  22.  
  23. ],
  24. [
  25. [
  26. 'PCT_DESCRICAO' => 'teste3',
  27. 'NAT_DESCRICAO' => 'teste4',
  28. 'ORCD_VLR' => 89
  29. ],
  30. ['ORCD_VLR' => 90],
  31. ['ORCD_VLR' => 91],
  32. ['ORCD_VLR' => 92],
  33. ['ORCD_VLR' => 93],
  34. ['ORCD_VLR' => 94],
  35. ['ORCD_VLR' => 95],
  36. ['ORCD_VLR' => 96],
  37. ['ORCD_VLR' => 97],
  38. ['ORCD_VLR' => 98],
  39. ['ORCD_VLR' => 99],
  40. ['ORCD_VLR' => 100],
  41. ['ORCD_VLR' => 101],
  42.  
  43. ],
  44. ];
  45.  
  46. function currencye($param)
  47. {
  48. return $param;
  49. }
  50.  
  51. ?>
  52. <table>
  53. <?php foreach ($planilha as $info) {
  54. $count = 0;
  55. $total = 0;
  56. $remove = 0;
  57. if ($count == 0 OR ($count % 13 === 0)) {
  58. $count++; ?>
  59. <tr>
  60. <?php for ($i = 0; $i < 13; $i++) { ?>
  61. <?php $remove = $info[0]['ORCD_VLR']; ?>
  62. <?php if ($i === 0) { ?>
  63. <td><?= $info[$i]['PCT_DESCRICAO'] ?></td>
  64. <td><?= $info[$i]['NAT_DESCRICAO'] ?></td>
  65. <?php } else { ?>
  66. <td>
  67. <?= "<input type='text' value='" . currencye($info[$i - 1]['ORCD_VLR']) . "' class='valor' />" ?>
  68. </td>
  69. <?php } ?>
  70. <?php $total += $info[$i]['ORCD_VLR']; ?>
  71. <?php } ?>
  72. <td class="valor retornatotal blue">
  73. <?= "<input type='text' value='" . currencye((($total - $remove) / 12)) . "' class='valor blue' />" ?>
  74. </td>
  75. <td class="valor retornamedia">
  76. <?= "<input type='text' value='" . currencye(($total - $remove)) . "' class='valor laranja' />" ?>
  77. </td>
  78. </tr>
  79. <?php }
  80. } ?>
  81.  
  82. <tr>
  83. <td></td>
  84. <td></td>
  85.  
  86. <?php
  87.  
  88. for ($i = 0; $i < 13; $i++) {
  89.  
  90. $totalPorColuna = '0';
  91.  
  92. foreach ($planilha as $item) {
  93.  
  94. $totalPorColuna = bcadd($totalPorColuna, $item[$i]['ORCD_VLR']);
  95.  
  96. }
  97.  
  98. echo '<td><input type="text" value="' . $totalPorColuna . '"></td>';
  99.  
  100. }
  101.  
  102.  
  103. ?>
  104.  
  105. </tr>
  106.  
  107. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement