diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index b14efead..50358a42 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -48,7 +48,8 @@ class EnquiriesController extends AppController { $this->set('invoices', $this->Enquiry->Invoice->find('all', array('conditions' => array('Invoice.enquiry_id' => $id)))); - + + $this->pageTitle = "Enquiry: ".$enquiry['Enquiry']['title']; @@ -78,6 +79,8 @@ class EnquiriesController extends AppController { //$this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id)))); $this->set('principle_emails', $this->Enquiry->Principle->PrincipleContact->findAllByPrincipleId($enquiry['Enquiry']['principle_id'])); + $this->set('jobs', $this->Enquiry->Job->find('all', array('conditions'=>array('Job.enquiry_id'=>$id)))); + if($enquiry['Enquiry']['billing_address_id'] != 0) { $this->set('billingaddress', $this->Enquiry->BillingAddress->findById($enquiry['Enquiry']['billing_address_id'])); diff --git a/controllers/invoices_controller.php b/controllers/invoices_controller.php index 33fd1a6d..065becc4 100644 --- a/controllers/invoices_controller.php +++ b/controllers/invoices_controller.php @@ -40,6 +40,7 @@ class InvoicesController extends AppController { $enqid = $this->data['Invoice']['enquiry_id']; + if ($this->Invoice->save($this->data)) { $this->Session->setFlash(__('The Invoice has been saved', true)); $this->redirect(array('controller'=>'enquiries', 'action'=>'view/'.$enqid)); @@ -51,6 +52,9 @@ class InvoicesController extends AppController { if(isset($this->params['named']['enquiryid'])) { $enquiryid = $this->params['named']['enquiryid']; $enquiry = $this->Invoice->Enquiry->findById($enquiryid); + + + $user = $this->Auth->user(); $this->set(compact('enquiry', 'user')); } diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php index cd9a5405..cf5d7014 100644 --- a/controllers/jobs_controller.php +++ b/controllers/jobs_controller.php @@ -13,7 +13,13 @@ class JobsController extends AppController { if (!$id) { $this->flash(__('Invalid Job', true), array('action'=>'index')); } - $this->set('job', $this->Job->read(null, $id)); + + $job = $this->Job->read(null, $id); + $this->set('job', $job); + $this->set('customer', $this->Job->Enquiry->Customer->findById($job['Enquiry']['customer_id'])); + + $this->pageTitle = $job['Job']['title']; + } function add() { @@ -23,21 +29,31 @@ class JobsController extends AppController { if (!empty($this->data)) { $this->Job->create(); - $job_offset = 6130; + $job_offset = 6137; $number_of_jobs = $this->Job->findCount(); $new_job_number = $job_offset + $number_of_jobs; $enquiry = $this->Job->Enquiry->findById($this->data['Job']['enquiry_id']); - // $this->data['Job']['title'] = + + + $monthYearShort = strtoupper(date("My")); + + $jobLetter = $enquiry['State']['enqform']; + + $this->data['Job']['title'] = $monthYearShort.$jobLetter."J".$new_job_number; + if ($this->Job->save($this->data)) { $jobid = $this->Job->id; + //$this->Job->Enquiry->set('status_id', 3); //Change status to 'Job Won'; + $enquiry['Enquiry']['status_id'] = 3; + $this->Job->Enquiry->save($enquiry); $this->Session->setFlash(__('Job Saved', true)); @@ -91,11 +107,11 @@ class JobsController extends AppController { if (empty($this->data)) { $this->data = $this->Job->read(null, $id); } - $states = $this->Job->State->find('list'); - $customers = $this->Job->Customer->find('list'); + + $enquiries = $this->Job->Enquiry->find('list'); - $contacts = $this->Job->Contact->find('list'); - $this->set(compact('states','customers','enquiries','contacts')); + + $this->set(compact('enquiries')); } function delete($id = null) { diff --git a/models/job.php b/models/job.php index cf4e349c..934f5d81 100644 --- a/models/job.php +++ b/models/job.php @@ -8,7 +8,7 @@ class Job extends AppModel { 'enquiry_id' => array('numeric'), 'date_order_received' => array('date'), - 'customer_order_number' => array('notempty'), + 'domestic_freight_paid_by' => array('notempty'), 'sale_category' => array('notempty'), 'shipment_category' => array('notempty') diff --git a/vendors/shells/firstpass.php b/vendors/shells/firstpass.php index 50b39895..e987968a 100644 --- a/vendors/shells/firstpass.php +++ b/vendors/shells/firstpass.php @@ -58,9 +58,9 @@ class FirstpassShell extends Shell { - - // for($i=1; $i <= $number_of_messages; $i++) { + + // for($i=1; $i <= $number_of_messages; $i++) { for($i=1; $i <= 500; $i++) { $this_header = imap_headerinfo($mbox, $i); $message = $this->getMessage($mbox, $i, $this_header); @@ -77,49 +77,49 @@ class FirstpassShell extends Shell { } - } + } - echo "Tidying up now.\n"; + echo "Tidying up now.\n"; - reset($discardArray); + reset($discardArray); - $numberToDiscard= count($discardArray); + $numberToDiscard= count($discardArray); - - if($numberToDiscard > 0) { - echo "Going to discard $numberToDiscard messages\n"; + + if($numberToDiscard > 0) { + echo "Going to discard $numberToDiscard messages\n"; - $discardSet = implode(",",$discardArray); + $discardSet = implode(",",$discardArray); - $delete_result = imap_delete($mbox, $discardSet); + $delete_result = imap_delete($mbox, $discardSet); - if($delete_result == false) { - echo "Error deleting messages"; - echo imap_last_error(); - } - else { - echo "Success"; - } + if($delete_result == false) { + echo "Error deleting messages"; + echo imap_last_error(); } + else { + echo "Success"; + } + } + - imap_expunge($mbox); - /* echo "Messages before delete: ".$number_of_messages."\n"; + /* echo "Messages before delete: ".$number_of_messages."\n"; $check = imap_check($mbox); echo "Messages after delete: ".$check->Nmsgs."\n"; -*/ + */ @@ -129,7 +129,7 @@ class FirstpassShell extends Shell { - function checkIfValidEnquiry($subject, &$enqList) { + function checkIfValidEnquiry($subject, &$enqList) { $subject = iconv_mime_decode($subject, 0, "ISO-8859-1"); $output = array(); @@ -169,7 +169,7 @@ class FirstpassShell extends Shell { $subject = mb_decode_mimeheader($subject); $date = $headers->date; - + $message['subject'] = $subject; return $message; diff --git a/views/elements/info_table.ctp b/views/elements/info_table.ctp new file mode 100644 index 00000000..58a8534c --- /dev/null +++ b/views/elements/info_table.ctp @@ -0,0 +1,29 @@ +
things generated by the cake scaffolding + * + * Plain old HTML tables + * + * Populated by an array in the format + * + * array("title"=>"content", + * "title1"=>"content1"); + * + * $data = array("Enquiry Number" => "CMC9742VE252665-42", + * "Assigned to User" => "Richard"); + * + */ + +?> + + + + "; + echo ""; + echo ""; + } + + ?> +
".key($line)."
+ diff --git a/views/elements/isEmptyDate.ctp b/views/elements/isEmptyDate.ctp new file mode 100644 index 00000000..e00af304 --- /dev/null +++ b/views/elements/isEmptyDate.ctp @@ -0,0 +1,9 @@ + diff --git a/views/enquiries/view.ctp b/views/enquiries/view.ctp index b021db0f..41641076 100755 --- a/views/enquiries/view.ctp +++ b/views/enquiries/view.ctp @@ -5,7 +5,7 @@ $class = ' class="altrow"';?> >
> - +   > @@ -128,6 +128,94 @@ $class = ' class="altrow"';?> + +
+
    +
  • link(__('New Job', true), array('controller'=>'jobs', 'action' => 'add/enquiryid:'.$enquiry['Enquiry']['id'])); ?>
  • +
+
+ + +
- prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> - | numbers();?> - next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?> + prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> + | numbers();?> + next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
-
    -
  • link(__('New Job', true), array('action' => 'add')); ?>
  • -
  • link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
  • -
  • link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
  • -
+
    +
  • link(__('New Job', true), array('action' => 'add')); ?>
  • +
  • link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
  • +
  • link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
  • +
+ + + \ No newline at end of file diff --git a/views/jobs/view.ctp b/views/jobs/view.ctp index 2b587b27..485d71bd 100644 --- a/views/jobs/view.ctp +++ b/views/jobs/view.ctp @@ -1,17 +1,9 @@
-

+

- > - > - -   - - > - > - -   - - > + + + > >   @@ -28,22 +20,26 @@ > > - + element('isEmptyDate', + array('date'=>$job['Job']['date_order_received'])); ?>   > > - + element('isEmptyDate', + array('date'=>$job['Job']['date_order_placed_on_principle'])); ?>   > > - + element('isEmptyDate', + array('date'=>$job['Job']['date_scheduled_ex_works'])); ?>   > > - + element('isEmptyDate', + array('date'=> $job['Job']['date_order_sent_to_customer'])); ?>   > @@ -78,3 +74,7 @@
  • link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
  • + + + + \ No newline at end of file diff --git a/views/layouts/default.ctp b/views/layouts/default.ctp index 0b85c0c9..737b0231 100755 --- a/views/layouts/default.ctp +++ b/views/layouts/default.ctp @@ -57,6 +57,11 @@ +
  • link('Jobs', '/jobs/index'); ?>
      +
    • link('Job List', '/jobs/index'); ?>
    • +
    +
  • +
  • link('Customers', '/customers/index'); ?>
    • link('Customer Index', '/customers/index'); ?>
    • diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index 1611d10f..bacd08df 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -191,7 +191,8 @@ ul.principle-emails { #nav li { float:left; display:block; - width:120px; + width:90px; + /*width: 6em; */ padding-right: 1em; position:relative; z-index:500; @@ -202,8 +203,9 @@ ul.principle-emails { /* this is the parent menu */ #nav li a { display:block; - width: 120px; - padding:8px 5px 0 5px; + width: 90px; + /*width: 6em;*/ + padding:8px 5px 0 5px; height:23px; text-decoration:none; color:#fff; diff --git a/webroot/js/addjob.js b/webroot/js/addjob.js new file mode 100644 index 00000000..e87fb093 --- /dev/null +++ b/webroot/js/addjob.js @@ -0,0 +1,51 @@ +/** + * file: addjob.js + * + * + */ + +$(function() { + + + $('#JobDateOrderReceivedDisplay').datepicker({ + showButtonPanel: true, + dateFormat: 'DD d MM yy', + altFormat: 'yy-mm-dd', + altField: '#JobDateOrderReceived' + + }); + + + $('#JobDateOrderPlacedOnPrincipleDisplay').datepicker({ + showButtonPanel: true, + dateFormat: 'DD d MM yy', + altFormat: 'yy-mm-dd', + altField: '#JobDateOrderPlacedOnPrinciple' + + }); + + + $('#JobDateScheduledExWorksDisplay').datepicker({ + showButtonPanel: true, + dateFormat: 'DD d MM yy', + altFormat: 'yy-mm-dd', + altField: '#JobDateScheduledExWorks' + + }); + + + $('#JobDateOrderSentToCustomerDisplay').datepicker({ + showButtonPanel: true, + dateFormat: 'DD d MM yy', + altFormat: 'yy-mm-dd', + altField: '#JobDateOrderSentToCustomer' + + }); + + + + + + + +}); \ No newline at end of file