diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php index 4abf370a..484e6cce 100644 --- a/controllers/jobs_controller.php +++ b/controllers/jobs_controller.php @@ -4,11 +4,12 @@ class JobsController extends AppController { var $name = 'Jobs'; var $helpers = array('Html', 'Form'); - + var $components = array('RequestHandler'); + var $paginate = array( 'contain' => false, - 'limit' => 150, + 'limit' => 100, 'order'=>array('Job.id' => 'desc') ); @@ -28,7 +29,7 @@ class JobsController extends AppController { $job = $this->Job->read(null, $id); $this->set('job', $job); $this->set('customer', $this->Job->Enquiry->Customer->findById($job['Enquiry']['customer_id'])); - + $this->set('principles', $this->Job->PurchaseOrder->Principle->find('list')); $this->pageTitle = $job['Job']['title']; } diff --git a/controllers/purchase_orders_controller.php b/controllers/purchase_orders_controller.php index f0693f11..a5117bbb 100644 --- a/controllers/purchase_orders_controller.php +++ b/controllers/purchase_orders_controller.php @@ -4,8 +4,18 @@ class PurchaseOrdersController extends AppController { var $name = 'PurchaseOrders'; var $helpers = array('Html', 'Form', 'Javascript'); + + + var $paginate = array( + + 'contain' => false, + 'limit' => 100, + 'order'=>array('PurchaseOrder.id' => 'desc') + + ); + function index() { - $this->PurchaseOrder->recursive = 0; + $this->PurchaseOrder->recursive = 1; $this->set('purchaseOrders', $this->paginate()); } diff --git a/models/purchase_order.php b/models/purchase_order.php index 0a9d1f5d..29474236 100644 --- a/models/purchase_order.php +++ b/models/purchase_order.php @@ -48,5 +48,7 @@ class PurchaseOrder extends AppModel { ) );*/ + + } ?> \ No newline at end of file diff --git a/vendors/shells/vault.php b/vendors/shells/vault.php index c10dafd6..b0b04c3c 100755 --- a/vendors/shells/vault.php +++ b/vendors/shells/vault.php @@ -5,8 +5,7 @@ class VaultShell extends Shell { * then loads the data into the 'emails' table and the attachments in the 'email_attachments' table. * Emails are discared or moved to a subfolder once processed */ - - + var $uses = array('Enquiry', 'Email', 'EmailAttachment'); function main() { @@ -40,7 +39,7 @@ class VaultShell extends Shell { $number_of_messages = $MC->Nmsgs; echo "Number of messages to Process ".$number_of_messages."\n"; - + if($number_of_messages == 0) { exit(0); } @@ -61,11 +60,11 @@ class VaultShell extends Shell { //exit(0); - + /* Loop through the messages and sort them into ones to be processed or discarded */ + - for($i=1; $i<100;$i++) { -//for($i=1; $i <= $number_of_messages; $i++) { + for($i=1; $i <= $number_of_messages; $i++) { $this_header = imap_headerinfo($mbox, $i); $message = $this->getMessage($mbox, $i, $this_header); @@ -80,7 +79,7 @@ class VaultShell extends Shell { //Process it and store the message and its attachments. //Generate a Uniqid for this email. - // $uniqid = $this->getUniqId($email_dir); + // $uniqid = $this->getUniqId($email_dir); $this->Email->create(); $this->data['Email']['enquiry_id'] = $enqID; @@ -174,9 +173,9 @@ class VaultShell extends Shell { * I may change this to simply delete the emails. This will do for now, but it's doubling up on the storage for useless files. * */ - // $discardArray[] = $i; + // $discardArray[] = $i; + - } @@ -193,36 +192,36 @@ class VaultShell extends Shell { - echo "Tidying up now. Moving messages to Stored or Discarded\n"; + echo "Tidying up now. Moving messages to Stored or Discarded\n"; - reset($discardArray); - reset($storedArray); + reset($discardArray); + reset($storedArray); - $numberToStore = count($storedArray); - $numberToDiscard= count($discardArray); + $numberToStore = count($storedArray); + $numberToDiscard= count($discardArray); + + + if($numberToStore > 0) { + echo "Got $numberToStore messages to store\n"; + $storeSet = implode(",", $storedArray); + imap_mail_move($mbox, $storeSet, 'INBOX/Stored'); + } + + if($numberToDiscard > 0) { + echo "Going to discard $numberToDiscard messages\n"; + $discardSet = implode(",",$discardArray); + + imap_mail_move($mbox, $discardSet, 'INBOX/Discarded'); + } - if($numberToStore > 0) { - echo "Got $numberToStore messages to store\n"; - $storeSet = implode(",", $storedArray); - imap_mail_move($mbox, $storeSet, 'INBOX/Stored'); - } - if($numberToDiscard > 0) { - echo "Going to discard $numberToDiscard messages\n"; - $discardSet = implode(",",$discardArray); - - imap_mail_move($mbox, $discardSet, 'INBOX/Discarded'); - } - - - //} imap_expunge($mbox); diff --git a/views/jobs/edit.ctp b/views/jobs/edit.ctp index 05d1f9f9..e6b96cfd 100644 --- a/views/jobs/edit.ctp +++ b/views/jobs/edit.ctp @@ -16,29 +16,11 @@ if($this->data['Job']['date_order_received'] != '0000-00-00') { $order_received_time = strtotime($this->data['Job']['date_order_received']); $order_received_readable = date('l j F Y', $order_received_time ); - } else { $order_received_readable = ""; } - if($this->data['Job']['date_order_placed_on_principle'] != '0000-00-00') { - $order_placed_on_principle_time = strtotime($this->data['Job']['date_order_placed_on_principle']); - $order_placed_on_principle_readable = date('l j F Y', $order_placed_on_principle_time ); - - } - else { - $order_placed_on_principle_readable = ""; - } - - if($this->data['Job']['date_scheduled_ex_works'] != '0000-00-00') { - $order_scheduled_ex_works_time = strtotime($this->data['Job']['date_scheduled_ex_works']); - $order_scheduled_readable = date('l j F Y', $order_scheduled_ex_works_time); - - } - else { - $order_scheduled_readable = ""; - } if($this->data['Job']['date_order_sent_to_customer'] != '0000-00-00') { $order_sent_to_customer_time = strtotime($this->data['Job']['date_order_sent_to_customer']); @@ -61,18 +43,6 @@ -
- - -
- - -
- - -
- -
@@ -85,7 +55,7 @@ echo $form->input('date_scheduled_ex_works', array('type'=>'hidden')); echo $form->input('date_order_sent_to_customer', array('type'=>'hidden')); echo $form->input('customer_order_number'); - echo $form->input('supplier_reference'); + echo $form->input('domestic_freight_paid_by', array('type'=>'select', 'options'=>$freight_paid_options, 'showEmpty'=>true)); echo $form->input('sale_category', array('type'=>'select', 'options'=>$sale_category_options)); echo $form->input('shipment_category', array('type'=>'select', 'options'=>$shipment_category_options)); diff --git a/views/jobs/index.ctp b/views/jobs/index.ctp index 96e824be..77f78aa9 100644 --- a/views/jobs/index.ctp +++ b/views/jobs/index.ctp @@ -16,12 +16,9 @@ sort('enquiry_id');?> sort('Customer');?> sort('customer_order_number');?> - sort('supplier_reference');?> - - + sort('date_order_received');?> - sort('date_order_placed_on_principle');?> - sort('date_scheduled_ex_works');?> + sort('date_order_sent_to_customer');?> @@ -52,7 +49,7 @@ link(__($job['Job']['title'], true), array('action' => 'view', $job['Job']['id'])); ?> - + link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?> @@ -63,20 +60,13 @@ - - - + - - - - - - + @@ -120,4 +110,4 @@ function isEmptyDate($date) { } ?> - \ No newline at end of file + \ No newline at end of file diff --git a/views/jobs/view.ctp b/views/jobs/view.ctp index 485d71bd..1e06f90f 100644 --- a/views/jobs/view.ctp +++ b/views/jobs/view.ctp @@ -24,18 +24,7 @@ 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', @@ -75,6 +64,62 @@
+ + + \ No newline at end of file diff --git a/views/purchase_orders/index.ctp b/views/purchase_orders/index.ctp index 4c5ee8e7..711fa6ba 100644 --- a/views/purchase_orders/index.ctp +++ b/views/purchase_orders/index.ctp @@ -8,11 +8,12 @@ echo $paginator->counter(array( ?>

- + + @@ -25,11 +26,14 @@ foreach ($purchaseOrders as $purchaseOrder): if ($i++ % 2 == 0) { $class = ' class="altrow"'; } + $jobLink = ""; + foreach($purchaseOrder['Job'] as $job) { + $jobLink .= $html->link($job['title']." ", array('controller'=>'jobs', 'action'=>'view', $job['id'])); + } + ?> > - + @@ -42,6 +46,9 @@ foreach ($purchaseOrders as $purchaseOrder): + @@ -54,7 +61,6 @@ foreach ($purchaseOrders as $purchaseOrder): @@ -76,3 +82,4 @@ foreach ($purchaseOrders as $purchaseOrder):
  • link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?>
  • + \ No newline at end of file diff --git a/views/purchase_orders/view.ctp b/views/purchase_orders/view.ctp index d9001305..e8e8331c 100644 --- a/views/purchase_orders/view.ctp +++ b/views/purchase_orders/view.ctp @@ -62,17 +62,14 @@
    sort('id');?>sort('issue_date');?> sort('dispatch_date');?> sort('date_arrived');?> sort('title');?>Jobs sort('principle_id');?> sort('principle_reference');?> sort('document_id');?> - - + + link($purchaseOrder['Principle']['name'], array('controller' => 'principles', 'action' => 'view', $purchaseOrder['Principle']['id'])); ?> link(__('View', true), array('action' => 'view', $purchaseOrder['PurchaseOrder']['id'])); ?> link(__('Edit', true), array('action' => 'edit', $purchaseOrder['PurchaseOrder']['id'])); ?> - link(__('Delete', true), array('action' => 'delete', $purchaseOrder['PurchaseOrder']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $purchaseOrder['PurchaseOrder']['id'])); ?>
    - + - - - @@ -107,17 +104,14 @@ } ?> > - + - - - diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index 963ec769..61c566f4 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -430,7 +430,6 @@ table tr.divider td { border-top: 2px solid black; } - td.actions { text-align: center; white-space: nowrap; @@ -1245,4 +1244,8 @@ select.editinplace { span.addLineItem { clear: right; +} + +.tinytext { + font-size: 60%; } \ No newline at end of file diff --git a/webroot/js/addjob.js b/webroot/js/addjob.js index e87fb093..21d3c402 100644 --- a/webroot/js/addjob.js +++ b/webroot/js/addjob.js @@ -16,22 +16,6 @@ $(function() { }); - $('#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({ diff --git a/webroot/js/jobindex.js b/webroot/js/jobindex.js index 9e5a1bb0..121508a8 100644 --- a/webroot/js/jobindex.js +++ b/webroot/js/jobindex.js @@ -7,21 +7,34 @@ $(function() { - // $('.editWindow').click(doGet($(this).attr('href'))); - $('.editWindow').click(alert($(this).attr('href'))); - //$('.editWindow').click(alert($(this).attr('href')) - //); - + $(".editWindow").click(function() { + //$(this).attr("name"); + + //doGet($(this).attr("name")); + $("#editDiv").dialog('open'); + + return false; + }); + + $("#editDiv").hide(); + + + + $("#editDiv").dialog({ + autoOpen: false, + width: 900, + modal: true + + }); }); function doGet(link) { - alert(link); - // - // $.get("/jobs/edit/3", function(data){ - // alert("Data Loaded: " + data); - // }); - return false; + + $.get("/jobs/edit/"+link, function(data){ + $("#editDiv").html(data); + }); + return; } \ No newline at end of file