public static function PurchaseOrders() { $collection = PurchaseOrder::GetAllOrders($_GET['period'], $_GET['all']); echo ' <div class="logo"> <h5 style="margin-bottom:-15px;margin-top:0px;font-size:14px;">Date: ' . date('d/m/Y') . '</h5> <h4>ALL PURCHASE ORDERS</h4>'; if ($_GET['period'] != '' && $_GET['period']) { echo '<h5 style="margin-top:-10px">Period: ' . $_GET['period'] . '</h5>'; } echo '</div> <table class="table table-bordered table-striped" style="text-align:center;margin-left:0;margin-right:0;width:760px;font-size:12px;"> <thead class="title"> <tr> <td>DATE</td> <td>ORDER ID</td> <td>COMPANY</td> <td>PURPOSE</td> <td>STATUS</td> <td>TOTAL</td> </tr> </thead> <tbody>'; $total = 0.0; $invoiced = 0.0; $itms = 0; foreach ($collection as $item) { echo '<tr> <td>' . $item->date . '</td> <td>' . $item->id . '</td> <td>' . $item->party->name . '</td>'; $sql = 'SELECT * FROM purchase_orders WHERE id = ' . $item->id; $res = DatabaseHandler::GetRow($sql); $vc = PurchaseOrderVoucher::initialize($res); echo '<td>' . $vc->description . '</td>'; if ($item->status == 1) { echo '<td style="color:#232836">CREATED</td>'; } else { echo '<td style="color:#27c97b">ORDERED</td>'; $invoiced += $item->total; } echo '<td class="text-right" style="padding: 0 5px;"><script>document.writeln((' . $item->total . ').formatMoney(2, \'.\', \',\'));</script></td> </tr>'; $total += $item->total; ++$itms; } echo '</tbody> </table> <div class="logo"> <p style="margin: 5px 0 0 5px">Total Quotes: <b>' . $itms . '</b></p> <p style="margin: 5px 0 0 5px">Total Quoted: <b>Ksh. <script>document.writeln((' . $total . ').formatMoney(2, \'.\', \',\'));</script></b></p> <p style="margin: 5px 0 0 5px">Total Invoiced: <b>Ksh. <script>document.writeln((' . $invoiced . ').formatMoney(2, \'.\', \',\'));</script></b></p> </div>'; }