cmc-sales/views/invoices/index.ctp
2010-07-16 14:35:13 +10:00

99 lines
3.7 KiB
PHP

<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><?php echo $paginator->sort('due_date');?></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><?php echo $paginator->sort('paid');?></th>
<th><?php echo $paginator->sort('payment_received_date');?></th>
<th><?php echo $paginator->sort('user_id');?></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 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 $invoice['Customer']['name']; ?>
</td>
<td>
<?php
if($invoice['Invoice']['paid'] == 0) {
echo "UNPAID";
echo "</td>";
echo "<td>";
echo "N/A";
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 $html->link($invoice['User']['username'], array('controller' => 'users', 'action' => 'view', $invoice['User']['id'])); ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action' => 'view', $invoice['Invoice']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => '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>
<?php debug($invoices); ?>