<caption><h2>Purchase Table</h2></caption> <thead> <tr> <th width="20px">#</th> <th>Name</th> <th>Product</th> <th>Price</th> <th>Quantity</th> <th>Total</th> <th>Balance</th> <th>Date Ordered</th> <th>Action</th> </tr> </thead> <tbody> <?php if (count($Purcahses)) { foreach ($Purcahses as $k => $v) { $k++; $total = $Purchase->format_decimal($v->quantity * $v->price); $color = array('danger', 'success', 'warning'); $paynow = $v->status != 1 ? "<a class='btn btn-primary' href='" . BASE_URL . "/custpayment/{$v->id}'>Pay Now</a>" : "<span class='btn disabled'>Paid</span>"; echo "\n\t\t\t\t\t<tr class='{$color[$v->status]}'>\n\t\t\t\t\t\t<td>{$k}</td>\n\t\t\t\t\t\t<td>{$v->first_name} {$v->first_name}</td>\n\t\t\t\t\t\t<td>{$v->product}</td>\n\t\t\t\t\t\t<td>{$v->price}</td>\n\t\t\t\t\t\t<td>{$v->quantity}</td>\n\t\t\t\t\t\t<td>{$total}</td>\n\t\t\t\t\t\t<td>{$v->balance}</td>\n\t\t\t\t\t\t<td>{$v->date}</td>\n\t\t\t\t\t\t<td>{$paynow}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t"; } } else { echo "<tr><td colspan='9' class='center'>No record yet<td></tr>"; } ?> </tbody> </table> </div>
<th >Date</th> <th>Price</th> <th>Quantity</th> <th>Total</th> <th>Balance</th> <th>Action</th> </tr> </thead> <?php if (count($getPurchases)) { echo "<tbody>"; $total_balance = 0; foreach ($getPurchases as $key => $val) { $key++; $total = $Purchase->format_decimal($val->quantity * $val->price); $paid_amount = $Purchase->format_decimal($val->paid_amount); $balance = $Purchase->format_decimal($total - $paid_amount); $total_balance += $balance; $color = array('danger', 'success', 'warning'); $paynow = $val->status != 1 ? "<a class='btn btn-primary' href='" . BASE_URL . "/custpayment/{$val->id}'>Pay Now</a>" : "<span class='btn disabled'>Paid</span>"; echo "<tr class='{$color[$val->status]}'>\n\t\t\t\t\t\t\t\t\t\t<td >{$key}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{$val->product}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{$val->date}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{$val->price}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{$val->quantity}</td>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<td>{$total}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{$balance}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{$paynow}</td>\n\t\t\t\t\t\t\t\t\t</tr>"; } echo "</tbody>\n\t\t\t\t\t\t\t\t<tfoot style='padding:0px'>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td colspan='6' align='right'>Total Balance</td>\n\t\t\t\t\t\t\t\t\t\t\t<td colspan='2'>{$total_balance}</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</tfoot>"; } else { echo "<tbody><tr><td colspan='8' align='center'>No transaction's yet</td></tr></tbody>"; } ?> </table> </div> </div>