cmc-sales/app/views/invoices/index.ctp
2023-03-27 16:45:38 +11:00

106 lines
3.8 KiB
PHP
Executable file

<div class="invoices index">
<h2><?php __('Invoices');?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?></p>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('issue_date');?></th>
<th>Date Due</th>
<th><?php echo $paginator->sort('paid');?></th>
<th>Date Received</th>
<th>Amount Invoiced</th>
<th>Amount Received</th>
<th>Comments</th>
<th><?php echo $paginator->sort('Invoice Number');?></th>
<th><?php echo $paginator->sort('Job Number');?></th>
<th><?php echo $paginator->sort('enquiry_id');?></th>
<th><?php echo $paginator->sort('Customer'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($invoices as $invoice):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo date('j M Y',$time->toUnix($invoice['Invoice']['issue_date'])); ?>
</td>
<td>
<?php echo date('j M Y',$time->toUnix($invoice['Invoice']['due_date'])); ?>
</td>
<td>
<?php
if($invoice['Invoice']['paid'] == 0) {
echo "UNPAID";
echo "</td>";
echo "<td>";
echo "N/A"; //@TODO fix this.
echo "</td>";
}
else {
echo "PAID";
echo "</td>";
echo "<td>";
echo date('j M Y',$time->toUnix($invoice['Invoice']['payment_received_date']));
echo "</td>";
}
?>
</td>
<td><?php echo $number->currency($invoice['Invoice']['amount_invoiced'], $invoice['Currency']['iso4217']); ?></td>
<td><?php echo $number->currency($invoice['Invoice']['amount_received'], $invoice['Currency']['iso4217']);?></td>
<td><?php echo $invoice['Invoice']['comments'];?></td>
<td>
<?php echo $invoice['Invoice']['title']; ?>
</td>
<td>
<?php echo $html->link($invoice['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $invoice['Invoice']['job_id'])); ?>
</td>
<td>
<?php echo $html->link($invoice['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $invoice['Enquiry']['id'])); ?>
</td>
<td>
<?php echo $html->link($invoice['Customer']['name'], array('controller'=>'customers', 'action'=>'view', $invoice['Customer']['id'])); ?>
</td>
<td class="actions">
<?=$html->link('View', '/documents/view/'.$invoice['Invoice']['document_id']);?>
<?=$html->link('Edit', '/invoices/edit/'.$invoice['Invoice']['id']);?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="paging">
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Invoice', true), array('action' => 'add')); ?></li>
</ul>
</div>