invoice register working. now jobs

This commit is contained in:
Karl Cordes 2010-05-04 15:52:33 +10:00
parent e42e11a516
commit d1838e169c
7 changed files with 99 additions and 15 deletions

View file

@ -17,14 +17,6 @@ class AppController extends Controller {
$this->Auth->authorize = 'controller'; $this->Auth->authorize = 'controller';
/**
* Define the scheme for issue Types.
*/
$this->set('issueTypes', array(1=>"Bug Report", 2=>"Feature Request", 3=>"Other IT Help"));
$priorities = array(1 => 'Low',2=> "Medium",3=> "High", 4=> "Critical");
$this->set('issuePriorities', $priorities);
if($this->RequestHandler->isAjax()) { if($this->RequestHandler->isAjax()) {

View file

@ -45,7 +45,10 @@ class EnquiriesController extends AppController {
//$this->set('quotes', $enquiry['Quote']); //$this->set('quotes', $enquiry['Quote']);
$this->set('quotes', $this->Enquiry->Quote->find('all', array('recursive' => 0, 'conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC'))); $this->set('quotes', $this->Enquiry->Quote->find('all', array('recursive' => 0, 'conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC')));
//$this->set('files', $this->Enquiry->EnquiryFile->find('all', array('conditions' => array('EnquiryFile.enquiry_id'=>$id), 'order' => 'EnquiryFile.created ASC')));
$this->set('invoices', $this->Enquiry->Invoice->find('all', array('conditions' => array('Invoice.enquiry_id' => $id))));
//$this->set('files', $this->Enquiry->EnquiryFile->find('all', array('conditions' => array('EnquiryFile.enquiry_id'=>$id), 'order' => 'EnquiryFile.created ASC')));
/* Trying to optimise the queries for this part of the view - it's currently getting bogged down checking Email Attachments. /* Trying to optimise the queries for this part of the view - it's currently getting bogged down checking Email Attachments.
* Going to create an array describing whether a particular email ID has an attachment. Trying to avoid checking binary data in a find('all') call * Going to create an array describing whether a particular email ID has an attachment. Trying to avoid checking binary data in a find('all') call

View file

@ -3,6 +3,8 @@ class Enquiry extends AppModel {
var $name = 'Enquiry'; var $name = 'Enquiry';
//var $recursive = 2;
var $validate = array( var $validate = array(
'user_id' => array( 'user_id' => array(
'rule' => 'numeric', 'rule' => 'numeric',
@ -170,11 +172,13 @@ class Enquiry extends AppModel {
'counterQuery' => '' 'counterQuery' => ''
), ),
'Email' => array('className' => 'Email', 'Email' => array('className' => 'Email',
'foreignKey' => 'enquiry_id', 'foreignKey' => 'enquiry_id',
'dependent' => false 'dependent' => false
), ),
'Invoice' => array('className' => 'Invoice',
'foreignKey'=>'enquiry_id')
/* 'EnquiryFile' => array('className' => 'EnquiryFile', /* 'EnquiryFile' => array('className' => 'EnquiryFile',

View file

@ -4,7 +4,9 @@ class User extends AppModel {
var $name = 'User'; var $name = 'User';
var $belongsTo = array('Group'); var $belongsTo = array('Group');
var $displayField = 'username';
/* TO DO: Fix up this validation stuff /* TO DO: Fix up this validation stuff
var $validate = array( var $validate = array(
'username' => array( 'username' => array(

View file

@ -26,10 +26,10 @@ class VaultShell extends Shell {
if($testing == 1) { if($testing == 1) {
$email_dir = '/Users/karlcordes/Sites/quotenik/app/emails'; $email_dir = '/Users/karlcordes/Sites/quotenik/app/emails';
$ripmime_path = '/opt/local/bin/ripmime'; $ripmime_path = '/opt/local/bin/ripmime';
} }
$mbox = imap_open("{mail.cmctechnologies.com.au:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); $mbox = imap_open("{mail.cmctechnologies.com.au:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error());
$MC = imap_check($mbox); $MC = imap_check($mbox);
$number_of_messages = $MC->Nmsgs; $number_of_messages = $MC->Nmsgs;
@ -39,7 +39,7 @@ class VaultShell extends Shell {
if($number_of_messages == 0) { if($number_of_messages == 0) {
exit(0); exit(0);
} }
/* Loop through the messages and sort them into ones to be processed or discarded */ /* Loop through the messages and sort them into ones to be processed or discarded */
for ($i=1; $i <= $number_of_messages; $i++) { for ($i=1; $i <= $number_of_messages; $i++) {
@ -55,8 +55,6 @@ class VaultShell extends Shell {
//Generate a Uniqid for this email. //Generate a Uniqid for this email.
$uniqid = $this->getUniqId($email_dir); $uniqid = $this->getUniqId($email_dir);
$this->Email->create(); $this->Email->create();
$this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id']; $this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id'];
$this->data['Email']['to'] = $message['to']; $this->data['Email']['to'] = $message['to'];

View file

@ -128,6 +128,85 @@ $class = ' class="altrow"';?>
</div> </div>
<div class="related">
<h3><?php __($enquiry['Enquiry']['invoice_count'].' Invoices for this Enquiry');?></h3>
<table class="quotetable">
<tr>
<th>Issue Date</th>
<th>Due Date</th>
<th>Invoice Number</th>
<th>Customer</th>
<th>Paid / Unpaid</th>
<th>Payment Received Date</th>
<th>User</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>
<? echo $html->link($invoice['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $invoice['Customer']['id'])); ?>
</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>
<?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('controller'=>'invoices', 'action' => 'view', $invoice['Invoice']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=>'invoices','action' => 'edit', $invoice['Invoice']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Invoice', true), array('controller'=>'invoices', 'action' => 'add/enquiryid:'.$enquiry['Enquiry']['id'])); ?></li>
</ul>
</div>
<div id="showemail"> <div id="showemail">
</div> </div>

View file

@ -71,6 +71,12 @@
</ul> </ul>
</li> </li>
<li><?php echo $html->link('Invoices', '/invoices/index'); ?>
<ul>
<li class="last"><?php echo $html->link('Invoices Index', '/invoices/index'); ?></li>
</ul>
</li>
<li><?php echo $html->link('Products', '/products/index'); ?> <li><?php echo $html->link('Products', '/products/index'); ?>
<ul> <ul>
<li><?php echo $html->link('Product Index', '/products/index'); ?></li> <li><?php echo $html->link('Product Index', '/products/index'); ?></li>