Removed unnessary fields from Job table

This commit is contained in:
Karl Cordes 2010-09-07 13:57:28 +10:00
parent 16e3ffb61f
commit 61791484c7
12 changed files with 150 additions and 132 deletions

View file

@ -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'];
}

View file

@ -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());
}

View file

@ -48,5 +48,7 @@ class PurchaseOrder extends AppModel {
)
);*/
}
?>

View file

@ -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);

View file

@ -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 @@
</div>
<div class="input text" id="OrderPlacedOnPrincipleDiv">
<label for="JobDateOrderPlacedOnPrincipleDisplay">Date Order Placed on Principle</label>
<input id="JobDateOrderPlacedOnPrincipleDisplay" type="text" value="<?php echo $order_placed_on_principle_readable;?>" class="datePicker">
</div>
<div class="input text">
<label for="JobDateScheduledExWorksDisplay">Date Scheduled Ex Works</label>
<input id="JobDateScheduledExWorksDisplay" type="text" value="<?php echo $order_scheduled_readable; ?>" class="datePicker">
</div>
<div class="input text">
<label for="JobDateOrderSentToCustomerDisplay">Date Order Sent to Customer</label>
<input id="JobDateOrderSentToCustomerDisplay" type="text" value="<?php echo $order_sent_readable; ?>" class="datePicker">
@ -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));

View file

@ -16,12 +16,9 @@
<th><?php echo $paginator->sort('enquiry_id');?></th>
<th><?php echo $paginator->sort('Customer');?></th>
<th><?php echo $paginator->sort('customer_order_number');?></th>
<th><?php echo $paginator->sort('supplier_reference');?></th>
<th><?php echo $paginator->sort('date_order_received');?></th>
<th><?php echo $paginator->sort('date_order_placed_on_principle');?></th>
<th><?php echo $paginator->sort('date_scheduled_ex_works');?></th>
<th><?php echo $paginator->sort('date_order_sent_to_customer');?></th>
@ -52,7 +49,7 @@
<td>
<?php echo $html->link(__($job['Job']['title'], true), array('action' => 'view', $job['Job']['id'])); ?>
</td>
<td>
<td class="tinytext">
<?php echo $html->link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
</td>
<td>
@ -63,20 +60,13 @@
<?php echo $job['Job']['customer_order_number']; ?>
</td>
<td>
<?php echo $job['Job']['supplier_reference']; ?>
</td>
<td>
<?php echo $job['Job']['date_order_received']; ?>
</td>
<td>
<?php echo isEmptyDate($job['Job']['date_order_placed_on_principle']); ?>
</td>
<td>
<?php echo isEmptyDate($job['Job']['date_scheduled_ex_works']); ?>
</td>
<td>
<?php echo isEmptyDate($job['Job']['date_order_sent_to_customer']); ?>
</td>
@ -120,4 +110,4 @@ function isEmptyDate($date) {
}
?>
<?php // debug($customers); ?>
<?php debug($jobs); ?>

View file

@ -24,18 +24,7 @@
array('date'=>$job['Job']['date_order_received'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date Order Placed On Principle'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->element('isEmptyDate',
array('date'=>$job['Job']['date_order_placed_on_principle'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date Scheduled Ex Works'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->element('isEmptyDate',
array('date'=>$job['Job']['date_scheduled_ex_works'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date Order Sent To Customer'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->element('isEmptyDate',
@ -75,6 +64,62 @@
</ul>
</div>
<div class="related">
<h3><?php __('Purchase Orders for this Job');?></h3>
<?php if (!empty($job['PurchaseOrder'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th>Issue Date</th>
<th>Dispatch Date</th>
<th>Date Arrived</th>
<th>PO Number</th>
<th>Principle</th>
<th>Principle Reference</th>
<th>Document</th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($job['PurchaseOrder'] as $purchaseOrder):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $purchaseOrder['issue_date']; ?>
</td>
<td>
<?php echo $purchaseOrder['dispatch_date']; ?>
</td>
<td>
<?php echo $purchaseOrder['date_arrived']; ?>
</td>
<td>
<?php echo $purchaseOrder['title']; ?>
</td>
<td>
<?php echo $html->link($principles[$purchaseOrder['principle_id']], array('controller' => 'principles', 'action' => 'view', $purchaseOrder['principle_id'])); ?>
</td>
<td>
<?php echo $purchaseOrder['principle_reference']; ?>
</td>
<td>
<?php //echo $html->link($purchaseOrder['Document']['id'], array('controller' => 'documents', 'action' => 'view', $purchaseOrder['Document']['id'])); ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=>'purchase_orders', 'action' => 'view', $purchaseOrder['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=>'purchase_orders','action' => 'edit', $purchaseOrder['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif;?>
<?php debug($job);?>

View file

@ -8,11 +8,12 @@ echo $paginator->counter(array(
?></p>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('id');?></th>
<th><?php echo $paginator->sort('issue_date');?></th>
<th><?php echo $paginator->sort('dispatch_date');?></th>
<th><?php echo $paginator->sort('date_arrived');?></th>
<th><?php echo $paginator->sort('title');?></th>
<th>Jobs</th>
<th><?php echo $paginator->sort('principle_id');?></th>
<th><?php echo $paginator->sort('principle_reference');?></th>
<th><?php echo $paginator->sort('document_id');?></th>
@ -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']));
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $purchaseOrder['PurchaseOrder']['id']; ?>
</td>
<td>
<?php echo $purchaseOrder['PurchaseOrder']['issue_date']; ?>
</td>
@ -42,6 +46,9 @@ foreach ($purchaseOrders as $purchaseOrder):
<td>
<?php echo $purchaseOrder['PurchaseOrder']['title']; ?>
</td>
<td class="tinytext">
<?php echo $jobLink; ?>
</td>
<td>
<?php echo $html->link($purchaseOrder['Principle']['name'], array('controller' => 'principles', 'action' => 'view', $purchaseOrder['Principle']['id'])); ?>
</td>
@ -54,7 +61,6 @@ foreach ($purchaseOrders as $purchaseOrder):
<td class="actions">
<?php echo $html->link(__('View', true), array('action' => 'view', $purchaseOrder['PurchaseOrder']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $purchaseOrder['PurchaseOrder']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $purchaseOrder['PurchaseOrder']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $purchaseOrder['PurchaseOrder']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
@ -76,3 +82,4 @@ foreach ($purchaseOrders as $purchaseOrder):
<li><?php echo $html->link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?> </li>
</ul>
</div>
<?php debug($purchaseOrders);?>

View file

@ -62,17 +62,14 @@
<?php if (!empty($purchaseOrder['Job'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('Title'); ?></th>
<th><?php __('Enquiry Id'); ?></th>
<th><?php __('Comments'); ?></th>
<th><?php __('Date Order Received'); ?></th>
<th><?php __('Date Order Placed On Principle'); ?></th>
<th><?php __('Date Scheduled Ex Works'); ?></th>
<th><?php __('Date Order Sent To Customer'); ?></th>
<th><?php __('Customer Order Number'); ?></th>
<th><?php __('Supplier Reference'); ?></th>
<th><?php __('Domestic Freight Paid By'); ?></th>
<th><?php __('Sale Category'); ?></th>
<th><?php __('Shipment Category'); ?></th>
@ -107,17 +104,14 @@
}
?>
<tr<?php echo $class;?>>
<td><?php echo $job['id'];?></td>
<td><?php echo $job['created'];?></td>
<td><?php echo $job['title'];?></td>
<td><?php echo $job['enquiry_id'];?></td>
<td><?php echo $job['comments'];?></td>
<td><?php echo $job['date_order_received'];?></td>
<td><?php echo $job['date_order_placed_on_principle'];?></td>
<td><?php echo $job['date_scheduled_ex_works'];?></td>
<td><?php echo $job['date_order_sent_to_customer'];?></td>
<td><?php echo $job['customer_order_number'];?></td>
<td><?php echo $job['supplier_reference'];?></td>
<td><?php echo $job['domestic_freight_paid_by'];?></td>
<td><?php echo $job['sale_category'];?></td>
<td><?php echo $job['shipment_category'];?></td>

View file

@ -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%;
}

View file

@ -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({

View file

@ -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;
}