Restored Invoice Editing to allow for them to be marked payment received

This commit is contained in:
Karl Cordes 2011-09-05 11:43:21 +10:00
parent c967490bd9
commit ef42c5e668
4 changed files with 74 additions and 49 deletions

View file

@ -375,6 +375,26 @@ class DocumentsController extends AppController {
}
/**
* Convert an Order Acknowledgement to an Invoice.
*
* @TODO Finish this.
*
* @param <int> $id
*/
function convert_to_invoice($id = null) {
if (!$id) {
echo 'Invalid Document ID';
}
else {
}
}
function pdf($id = null) {
//Configure::write('debug',0);
if(!$id) {

View file

@ -38,15 +38,24 @@ class InvoicesController extends AppController {
}
$emails = $this->Invoice->Email->find('all', array('conditions'=>array('Email.id'=>$emailIDs)));
$this->set('emails', $emails);
}
function payment_received($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Invoice.', true));
$this->redirect(array('action'=>'index'));
}
$invoice = $this->Invoice->read(null, $id);
$invoice['Invoice']['paid'] = 1;
$invoice['Invoice']['payment_received_date'] = date('Y-m-d');
$this->Invoice->save($invoice);
}
/*function edit($id = null) {
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid Invoice', true));
$this->redirect(array('action'=>'index'));
@ -65,10 +74,9 @@ class InvoicesController extends AppController {
}
$users = $this->Invoice->User->find('list');
$jobs = $this->Invoice->Job->find('list', array('conditions'=>array('Job.enquiry_id'=>$invoice['Invoice']['enquiry_id'])));
$this->set(compact('users', 'jobs'));
}*/
}
/*function delete($id = null) {
if (!$id) {

View file

@ -11,7 +11,6 @@
echo $form->input('payment_received_date');
echo $form->input('enquiry_id', array('type'=>'hidden'));
echo $form->input('job_id');
echo $form->input('user_id');
?>
</fieldset>
<?php echo $form->end('Submit');?>

View file

@ -75,9 +75,7 @@
<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'])); ?>
<?=$html->link('Edit', '/invoices/edit/'.$invoice['Invoice']['id']);?>
</td>
</tr>
<?php endforeach; ?>