Finish invoice changes - Closes #54
This commit is contained in:
parent
5dc842df9c
commit
b8b894a5f9
|
|
@ -2,7 +2,7 @@
|
|||
class InvoicesController extends AppController {
|
||||
|
||||
var $name = 'Invoices';
|
||||
var $helpers = array('Html', 'Form', 'Time', 'Text','Javascript');
|
||||
var $helpers = array('Html', 'Form', 'Time', 'Text','Javascript', 'Number');
|
||||
|
||||
|
||||
var $paginate = array(
|
||||
|
|
@ -17,13 +17,6 @@ class InvoicesController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
function calculate() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function printView() {
|
||||
$this->layout = 'minimal';
|
||||
$this->Invoice->recursive = 0;
|
||||
|
|
|
|||
9
app/vendors/shells/invoice.php
vendored
9
app/vendors/shells/invoice.php
vendored
|
|
@ -31,6 +31,13 @@ class InvoiceShell extends Shell {
|
|||
$totals = $this->calculateTotals($document, $enquiry['Enquiry']['gst']);
|
||||
$invoice['Invoice']['amount_invoiced'] = $totals['total'];
|
||||
print_r($totals);
|
||||
|
||||
$parts = explode(" ", $invoice['Invoice']['title'], 2);
|
||||
if(count($parts) > 1) {
|
||||
$invoice['Invoice']['title'] = $parts[0];
|
||||
$invoice['Invoice']['comments'] = $parts[1];
|
||||
}
|
||||
|
||||
echo "Saving invoice ".$invoice["Invoice"]["id"]."\n";
|
||||
$this->LineItem->Document->Invoice->save($invoice);
|
||||
}
|
||||
|
|
@ -64,7 +71,7 @@ class InvoiceShell extends Shell {
|
|||
|
||||
|
||||
function main() {
|
||||
$q = "SELECT id, document_id FROM invoices i";
|
||||
$q = "SELECT id, document_id FROM invoices i ORDER BY id DESC";
|
||||
$results = $this->Invoice->query($q);
|
||||
foreach($results as $row) {
|
||||
if($row["i"]["document_id"]) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
echo $form->input('title', array('class'=>'disabled', 'readonly'=>'readonly'));
|
||||
echo $form->input('paid');
|
||||
echo $form->input('payment_received_date');
|
||||
echo $form->input('amount_invoiced', array('class'=>'disabled', 'readonly'=>'readonly'));
|
||||
echo $form->input('amount_received');
|
||||
echo $form->input('comments');
|
||||
echo $form->input('enquiry_id', array('type'=>'hidden'));
|
||||
echo $form->input('job_id');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<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>
|
||||
|
|
@ -66,8 +67,9 @@
|
|||
?>
|
||||
|
||||
</td>
|
||||
<td><?php echo $invoice['Invoice']['amount_invoiced']; ?></td>
|
||||
<td>TODO</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>
|
||||
|
|
@ -101,4 +103,3 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<?php debug($invoices); ?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue