Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. $paymentQueue = array();
  5. foreach( $bill as $key => $single_invoice ) {
  6. $paymentMonth = date('Y-m-d', $single_invoice->payment_date);
  7. $currentMonth = date('Y-m-d', $single_invoice->start_month_year);
  8. if($single_invoice->payment_date){
  9. $paymentQueue[] = array($currentMonth, $single_invoice, 'invoice_date');
  10. $paymentQueue[] = array($paymentMonth, $single_invoice, 'payment_date');
  11. }else {
  12. $paymentQueue[] = array($currentMonth, $single_invoice, 'invoice_date');
  13. }
  14. }
  15.  
  16. foreach ($paymentQueue as $key => $val) {
  17. $time[$key] = array($val[0], $val[1], $val[2]);
  18. }
  19.  
  20. array_multisort($time, SORT_ASC, $paymentQueue);
  21.  
  22. ?>
  23.  
  24. <div class="table" style="margin: 15px !important;" >
  25. <table class="table" style="border-collapse: collapse;" width="750px;" border="1px" >
  26. <thead>
  27. <tr style="vertical-align:top;">
  28. <th style="text-align: center;">Date</th>
  29. <th style="text-align: center;">Invoice Amount</th>
  30. <th style="text-align: center;">Payment Process</th>
  31. <th style="text-align: center;">Paid Amount</th>
  32. <th style="text-align: center;">Balance</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <?php
  37. $balance = 0;
  38. $monthlyBill = 0;
  39. $paidBill = 0;
  40. $totalBill = 0;
  41. ?>
  42.  
  43. <?php foreach( $time as $statement ) : ?>
  44. <?php if($statement[1]->total_bill && $statement[2] == 'invoice_date') :?>
  45. <tr >
  46. <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[0]; ?></td>
  47. <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[1]->total_bill; ?></td>
  48. <td style="padding: 0px; text-align: center; line-height: 2; "></td>
  49. <td style="padding: 0px; text-align: center; line-height: 2; "></td>
  50. <td style="padding: 0px; text-align: center; line-height: 2; ">
  51. <?php
  52. $monthlyBill = $statement[1]->total_bill;
  53. $totalBill = $totalBill + $monthlyBill;
  54. echo $totalBill;
  55. ?>
  56. </td>
  57. </tr>
  58. <?php endif;?>
  59.  
  60. <?php if($statement[2] == 'payment_date') :?>
  61. <tr>
  62. <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[0]; ?></td>
  63. <td class="total_bill"></td>
  64. <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $paid_via = (!empty($statement[1]->paid_via))? $statement[1]->paid_via :"-"; ?></td>
  65. <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[1]->paid_bill; ?></td>
  66. <td style="padding: 0px; text-align: center; line-height: 2; ">
  67. <?php
  68. $paidBill = $statement[1]->paid_bill;
  69. $totalBill = $totalBill - $paidBill;
  70. echo $totalBill;
  71. ?>
  72. </td>
  73. </tr>
  74.  
  75. <?php endif;?>
  76. <?php endforeach;?>
  77.  
  78. </tbody>
  79. <tfoot>
  80. <table class="table table-hover" >
  81. <thead>
  82. <tr style="vertical-align:top;">
  83. <td><strong>Total Amount: </strong></td>
  84. <td><strong><?php echo $info->total ?></strong></td>
  85. </tr> &nbsp;
  86. <tr style="vertical-align:top;">
  87.  
  88. <td><strong> Total Paid : </strong></td>
  89. <td><strong><?php echo $info->paid ?></strong></td>
  90. </tr> &nbsp;
  91. <tr style="vertical-align:top;">
  92. <td><strong><?php
  93. if($info->net_receivable < 0){
  94. echo "Advance Payment :";
  95. }else{
  96. echo "Total Due :";
  97. }
  98. ?></strong></td>
  99. <td><strong><?php
  100. if($info->net_receivable < 0){
  101. $net_receivable_new = $info->net_receivable;
  102. $net_receivable_new = str_replace('-', '(', $net_receivable_new);
  103. $net_receivable_new = $net_receivable_new . ')';
  104. echo $net_receivable_new;
  105. }else{
  106. echo $info->net_receivable;
  107. }
  108.  
  109. ?></strong></td>
  110.  
  111. </tr> &nbsp;
  112. </thead>
  113. <!-- <tbody>-->
  114. <!-- <tr>-->
  115. <!-- <td><strong>--><?php //echo $info->total ?><!--</strong></td>-->
  116. <!-- <td><strong>--><?php //echo $info->paid ?><!--</strong></td>-->
  117. <!-- <td><strong>--><?php //echo $info->net_receivable ?><!--</strong></td>-->
  118. <!-- </tr>-->
  119. <!-- </tbody>-->
  120. </table>
  121. </tfoot>
  122. </table>
  123. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement