public static function ClientStatement() { $statement = TransactionVouchers::ClientStatement($_GET['sid'], $_GET['period'], $_GET['all']); $client = Client::GetClient($_GET['sid']); echo ' <div class="logo"> <h5 style="margin-bottom:-15px;margin-top:0px;font-size:14px;">Date: ' . date('d/m/Y') . '</h5> <h4>' . $client->name . ' STATEMENT</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>TYPE</td> <td>DR</td> <td>CR</td> <td>DESCRIPTION</td> <td>BALANCE</td> </tr> </thead> <tbody>'; $cr = 0.0; $dr = 0.0; foreach ($statement as $item) { echo '<tr> <td style="width:90px">' . $item['when_booked'] . '</td> <td style="width: 100px">' . $item['type'] . '</td>'; if ($item['effect'] == 'cr') { $cr += $item['amount']; echo '<td style="width: 100px"></td> <td style="width: 100px"><script>document.writeln((' . $item['amount'] . ').formatMoney(2, \'.\', \',\'));</script></td>'; } else { $dr += $item['amount']; echo '<td style="width: 100px"><script>document.writeln((' . $item['amount'] . ').formatMoney(2, \'.\', \',\'));</script></td> <td style="width: 100px"></td>'; } echo '<td style="max-width: 220px;">' . $item['descr'] . '</td> <td class="text-right" style="padding: 0 5px;"><script>document.writeln((' . $item['balance'] . ').formatMoney(2, \'.\', \',\'));</script></td> </tr>'; } echo '</tbody> </table> <div class="logo"> <p style="margin: 5px 0 0 5px">Total Debits: <b>Ksh. <script>document.writeln((' . $dr . ').formatMoney(2, \'.\', \',\'));</script></b></p> <p style="margin: 5px 0 0 5px">Total Credits: <b>Ksh. <script>document.writeln((' . $cr . ').formatMoney(2, \'.\', \',\'));</script></b></p> <p style="margin: 5px 0 0 5px">Balance: <b>Ksh. <script>document.writeln((' . ($dr - $cr) . ').formatMoney(2, \'.\', \',\'));</script></b></p> </div>'; }