Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $paymentQueue = array();
- foreach( $bill as $key => $single_invoice ) {
- $paymentMonth = date('Y-m-d', $single_invoice->payment_date);
- $currentMonth = date('Y-m-d', $single_invoice->start_month_year);
- if($single_invoice->payment_date){
- $paymentQueue[] = array($currentMonth, $single_invoice, 'invoice_date');
- $paymentQueue[] = array($paymentMonth, $single_invoice, 'payment_date');
- }else {
- $paymentQueue[] = array($currentMonth, $single_invoice, 'invoice_date');
- }
- }
- foreach ($paymentQueue as $key => $val) {
- $time[$key] = array($val[0], $val[1], $val[2]);
- }
- array_multisort($time, SORT_ASC, $paymentQueue);
- ?>
- <div class="table" style="margin: 15px !important;" >
- <table class="table" style="border-collapse: collapse;" width="750px;" border="1px" >
- <thead>
- <tr style="vertical-align:top;">
- <th style="text-align: center;">Date</th>
- <th style="text-align: center;">Invoice Amount</th>
- <th style="text-align: center;">Payment Process</th>
- <th style="text-align: center;">Paid Amount</th>
- <th style="text-align: center;">Balance</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $balance = 0;
- $monthlyBill = 0;
- $paidBill = 0;
- $totalBill = 0;
- ?>
- <?php foreach( $time as $statement ) : ?>
- <?php if($statement[1]->total_bill && $statement[2] == 'invoice_date') :?>
- <tr >
- <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[0]; ?></td>
- <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[1]->total_bill; ?></td>
- <td style="padding: 0px; text-align: center; line-height: 2; "></td>
- <td style="padding: 0px; text-align: center; line-height: 2; "></td>
- <td style="padding: 0px; text-align: center; line-height: 2; ">
- <?php
- $monthlyBill = $statement[1]->total_bill;
- $totalBill = $totalBill + $monthlyBill;
- echo $totalBill;
- ?>
- </td>
- </tr>
- <?php endif;?>
- <?php if($statement[2] == 'payment_date') :?>
- <tr>
- <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[0]; ?></td>
- <td class="total_bill"></td>
- <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $paid_via = (!empty($statement[1]->paid_via))? $statement[1]->paid_via :"-"; ?></td>
- <td style="padding: 0px; text-align: center; line-height: 2; "><?php echo $statement[1]->paid_bill; ?></td>
- <td style="padding: 0px; text-align: center; line-height: 2; ">
- <?php
- $paidBill = $statement[1]->paid_bill;
- $totalBill = $totalBill - $paidBill;
- echo $totalBill;
- ?>
- </td>
- </tr>
- <?php endif;?>
- <?php endforeach;?>
- </tbody>
- <tfoot>
- <table class="table table-hover" >
- <thead>
- <tr style="vertical-align:top;">
- <td><strong>Total Amount: </strong></td>
- <td><strong><?php echo $info->total ?></strong></td>
- </tr>
- <tr style="vertical-align:top;">
- <td><strong> Total Paid : </strong></td>
- <td><strong><?php echo $info->paid ?></strong></td>
- </tr>
- <tr style="vertical-align:top;">
- <td><strong><?php
- if($info->net_receivable < 0){
- echo "Advance Payment :";
- }else{
- echo "Total Due :";
- }
- ?></strong></td>
- <td><strong><?php
- if($info->net_receivable < 0){
- $net_receivable_new = $info->net_receivable;
- $net_receivable_new = str_replace('-', '(', $net_receivable_new);
- $net_receivable_new = $net_receivable_new . ')';
- echo $net_receivable_new;
- }else{
- echo $info->net_receivable;
- }
- ?></strong></td>
- </tr>
- </thead>
- <!-- <tbody>-->
- <!-- <tr>-->
- <!-- <td><strong>--><?php //echo $info->total ?><!--</strong></td>-->
- <!-- <td><strong>--><?php //echo $info->paid ?><!--</strong></td>-->
- <!-- <td><strong>--><?php //echo $info->net_receivable ?><!--</strong></td>-->
- <!-- </tr>-->
- <!-- </tbody>-->
- </table>
- </tfoot>
- </table>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement