} // List Items foreach ($data['list'] as $x) { //Radix::dump($x); // $item = new Invoice($x); $item = $x; echo '<tr class="rero ' . strtolower($item['status']) . '">'; // Star echo '<td>' . star($item['star']) . '</td>'; // ID echo '<td><a href="' . Radix::link('/invoice/view?i=' . $item['id']) . '">#' . $item['id'] . '</a></td>'; // Printable Link // echo '<td><a href="' . Radix::link('/invoice/pdf?i=' . $item['id']) . '">' . img('/tango/22x22/devices/printer.png','Get PDF') . '</a></td>'; echo '<td>' . $item['status'] . '</td>'; echo '<td class="c">'; echo ImperiumView::niceDate($item['date']); // echo '<td class="r">'; $h = $t = null; if (!in_array($item['status'], $date_skip_list)) { if ($item['due_diff'] <= 0) { $t = sprintf('Invoice is Due in %d days', abs($item['due_diff'])); $h = sprintf('%d Out', abs($item['due_diff'])); } else { $t = sprintf('Invoice is Past Due in %d days', abs($item['due_diff'])); $h = sprintf('%d Due', abs($item['due_diff'])); } echo sprintf(' <span class="s" title="%s">%s</span>', $t, $h); } echo '</td>'; echo '<td>' . $item['kind'] . '</td>'; // echo '<td>' . substr($item->note,0,strrpos($item->note,' ',min(72,strlen($item->note)))) . '</td>';
// @todo Remove this shitty hack! $cols = array('star', 'id', 'date', 'status', 'kind', 'contact', 'note', 'bill_amount', 'open_amount'); echo '<table>'; // List each Invoice Item foreach ($data['list'] as $item) { echo '<tr class="rero ' . strtolower($item['status']) . ' ' . strtolower($item['kind']) . '">'; // Star echo '<td>' . star($item['star']) . '</td>'; // ID echo '<td><a href="' . Radix::link('/workorder/view?w=' . $item['id']) . '">#' . $item['id'] . '</td>'; // Printable Link if (in_array('print', $cols)) { echo '<td><a href="' . Radix::link('/workorder/pdf?w=' . $item['id']) . '">' . img('/tango/22x22/devices/printer.png', 'Get PDF') . '</a></td>'; } if (in_array('date', $cols) && isset($item['date'])) { echo '<td class="c">' . ImperiumView::niceDate($item['date']) . '</td>'; } echo '<td>' . $item['kind'] . '/' . $item['status'] . '</td>'; if (isset($item['contact_name'])) { if (in_array('contact', $cols)) { echo '<td><a href="' . Radix::link('/contact/view?c=' . $item['contact_id']) . '">' . $item['contact_name'] . '</td>'; } } if (in_array('note', $cols)) { echo '<td>'; $x = min(max(strpos($item['note'], "\n"), 32), 64); echo trim(substr($item['note'], 0, $x)); echo '</td>'; } if (in_array('open_amount', $cols)) { echo '<td class="bill" title="Open Amount">' . number_format($item['open_amount'], 2) . '</td>';
echo '<tr><td class="b" colspan="3">Tax Total:</td><td class="l">' . number_format($item_tax_total, 2) . '</td></tr>'; echo '<tr><td class="b" colspan="3">Bill Total:</td><td class="l">¤' . number_format($item_total + $item_tax_total, 2) . '</td></tr>'; echo '<tr><td class="b" colspan="3">Paid Total:</td><td class="l">¤' . number_format($this->Invoice['paid_amount'], 2) . '</td></tr>'; echo '<tr><td class="b" colspan="3">Balance:</td><td class="l" style="color: #f00;">¤' . number_format($item_total + $item_tax_total - $this->Invoice['paid_amount'], 2) . '</td></tr>'; echo '</table>'; echo '</div>'; } // Transactions if (count($this->InvoiceTransactionList) > 0) { $sum = 0; echo '<h2 style="clear:both;"><i class="fa fa-money"></i> Transactions</h2>'; echo '<table>'; echo '<tr><th>Date</th><th>Account / Note</th><th>Debit</th><th>Credit</th></tr>'; foreach ($this->InvoiceTransactionList as $le) { $sum += $le->amount; $link = Radix::link('/account/transaction?id=' . $le->account_journal_id, ImperiumView::niceDate($le->date)); echo '<tr>'; echo '<td class="c">' . $link . '</td>'; $link = Radix::link('/account/journal?id=' . $le->account_id, $le->account_name); echo '<td>' . $link; if (strlen($le->note)) { echo '/' . $le->note; } echo '</td>'; // todo: debit/credit columns if ($le->amount < 0) { echo "<td class='r'>¤" . number_format(abs($le->amount), 2) . "</td><td> </td>"; } else { echo "<td> </td><td class='r'>¤" . number_format($le->amount, 2) . "</td>"; } echo '</tr>';