Rolling out job number generation
This commit is contained in:
parent
feff586f65
commit
a865aabf41
|
|
@ -49,6 +49,7 @@ 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']));
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
2
vendors/shells/firstpass.php
vendored
2
vendors/shells/firstpass.php
vendored
|
|
@ -119,7 +119,7 @@ class FirstpassShell extends Shell {
|
|||
$check = imap_check($mbox);
|
||||
|
||||
echo "Messages after delete: ".$check->Nmsgs."\n";
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
29
views/elements/info_table.ctp
Normal file
29
views/elements/info_table.ctp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?
|
||||
/**
|
||||
* To replace all the weird <dd> <dt> 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");
|
||||
*
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<table>
|
||||
<?php foreach($data as $line) {
|
||||
echo "<tr>";
|
||||
echo "<td>".key($line)."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
9
views/elements/isEmptyDate.ctp
Normal file
9
views/elements/isEmptyDate.ctp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
if($date == "0000-00-00") {
|
||||
echo "-";
|
||||
}
|
||||
else {
|
||||
echo date("j M Y", strtotime($date));
|
||||
}
|
||||
?>
|
||||
|
|
@ -5,7 +5,7 @@ $class = ' class="altrow"';?>
|
|||
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry Number'); ?></dt>
|
||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||
<?php echo $enquiry['Enquiry']['title']; ?>
|
||||
<?php echo $enquiry['Enquiry']['title']; ?>
|
||||
|
||||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Assigned to User'); ?></dt>
|
||||
|
|
@ -128,6 +128,94 @@ $class = ' class="altrow"';?>
|
|||
</div>
|
||||
|
||||
|
||||
<div class="related">
|
||||
<h3>Jobs for this Enquiry</h3>
|
||||
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
|
||||
<th>Job Number</th>
|
||||
<th>Customer Order Number</th>
|
||||
|
||||
<th>Date Order Received</th>
|
||||
<th>Date Order Placed on Principle</th>
|
||||
<th>Date Sheduled Ex-Works</th>
|
||||
<th>Date Sent to Customer</th>
|
||||
|
||||
<th>Domestic Freight Paid By</th>
|
||||
<th>Sale Category</th>
|
||||
<th>Shipment Category</th>
|
||||
<th>Comments</th>
|
||||
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($jobs as $job):
|
||||
$class = null;
|
||||
if ($i++ % 2 == 0) {
|
||||
$class = ' class="altrow"';
|
||||
}
|
||||
?>
|
||||
<tr<?php echo $class;?>>
|
||||
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['title']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['customer_order_number']; ?>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=>$job['Job']['date_order_received'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date' => $job['Job']['date_order_placed_on_principle']));
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=>$job['Job']['date_scheduled_ex_works'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=>$job['Job']['date_order_sent_to_customer'])); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['domestic_freight_paid_by']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['sale_category']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['shipment_category']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['comments']; ?>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<?php echo $html->link(__('View', true), array('action' => 'view', $job['Job']['id'])); ?>
|
||||
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $job['Job']['id'])); ?>
|
||||
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $job['Job']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $job['Job']['id'])); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li> <?php echo $html->link(__('New Job', true), array('controller'=>'jobs', 'action' => 'add/enquiryid:'.$enquiry['Enquiry']['id'])); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="related">
|
||||
<h3><?php __($enquiry['Enquiry']['invoice_count'].' Invoices for this Enquiry');?></h3>
|
||||
<table class="quotetable">
|
||||
|
|
@ -217,6 +305,3 @@ $class = ' class="altrow"';?>
|
|||
<?php echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php //debug($emails); ?>
|
||||
|
|
@ -9,13 +9,16 @@
|
|||
echo $form->input('enquiry_id', array('type'=>'hidden', 'value'=>$enquiry['Enquiry']['id']));
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="input text">
|
||||
<label for="JobDateOrderReceivedDisplay">Date Order Received by CMC</label>
|
||||
<input id="JobDateOrderReceivedDisplay" type="text" value="" class="datePicker">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="input text" id="OrderPlacedOnPrincipleDiv">
|
||||
<label for="JobDateOrderPlacedOnPrincipleDisplay">Date Order Placed on Principle</label>
|
||||
<input id="JobDateOrderPlacedOnPrincipleDisplay" type="text" value="" class="datePicker">
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
<legend><?php __('Edit Job');?></legend>
|
||||
<?php
|
||||
echo $form->input('id');
|
||||
echo $form->input('title');
|
||||
echo $form->input('enquiry_id');
|
||||
echo $form->input('title', array('readonly'=>'readonly'));
|
||||
echo $form->input('enquiry_id', array('type'=>'hidden'));
|
||||
echo $form->input('comments');
|
||||
echo $form->input('date_order_received');
|
||||
echo $form->input('date_order_placed_on_principle');
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<div class="jobs index">
|
||||
<h2><?php __('Jobs');?></h2>
|
||||
<p>
|
||||
<?php
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?></p>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th><?php echo $paginator->sort('id');?></th>
|
||||
<h2><?php __('Jobs');?></h2>
|
||||
<p>
|
||||
<?php
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?></p>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
|
||||
<th><?php echo $paginator->sort('created');?></th>
|
||||
<th><?php echo $paginator->sort('title');?></th>
|
||||
<th><?php echo $paginator->sort('Job Number');?></th>
|
||||
<th><?php echo $paginator->sort('enquiry_id');?></th>
|
||||
<th><?php echo $paginator->sort('comments');?></th>
|
||||
<th><?php echo $paginator->sort('date_order_received');?></th>
|
||||
|
|
@ -22,19 +22,17 @@ echo $paginator->counter(array(
|
|||
<th><?php echo $paginator->sort('sale_category');?></th>
|
||||
<th><?php echo $paginator->sort('shipment_category');?></th>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($jobs as $job):
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($jobs as $job):
|
||||
$class = null;
|
||||
if ($i++ % 2 == 0) {
|
||||
$class = ' class="altrow"';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<tr<?php echo $class;?>>
|
||||
<td>
|
||||
<?php echo $job['Job']['id']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['created']; ?>
|
||||
</td>
|
||||
|
|
@ -51,13 +49,15 @@ foreach ($jobs as $job):
|
|||
<?php echo $job['Job']['date_order_received']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['date_order_placed_on_principle']; ?>
|
||||
<?php echo isEmptyDate($job['Job']['date_order_placed_on_principle']);
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['date_scheduled_ex_works']; ?>
|
||||
<?php echo isEmptyDate($job['Job']['date_scheduled_ex_works']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['date_order_sent_to_customer']; ?>
|
||||
<?php echo isEmptyDate($job['Job']['date_order_sent_to_customer']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['customer_order_number']; ?>
|
||||
|
|
@ -77,8 +77,8 @@ foreach ($jobs as $job):
|
|||
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $job['Job']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $job['Job']['id'])); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="paging">
|
||||
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||
|
|
@ -92,3 +92,16 @@ foreach ($jobs as $job):
|
|||
<li><?php echo $html->link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
function isEmptyDate($date) {
|
||||
if($date == "0000-00-00") {
|
||||
return "-";
|
||||
}
|
||||
else {
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,17 +1,9 @@
|
|||
<div class="jobs view">
|
||||
<h2><?php __('Job');?></h2>
|
||||
<h2><?php __('Job: '.$job['Job']['title']." for ".$customer['Customer']['name']);?></h2>
|
||||
<dl><?php $i = 0; $class = ' class="altrow"';?>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
|
||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||
<?php echo $job['Job']['id']; ?>
|
||||
|
||||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
|
||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||
<?php echo $job['Job']['created']; ?>
|
||||
|
||||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt>
|
||||
|
||||
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Job Number'); ?></dt>
|
||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||
<?php echo $job['Job']['title']; ?>
|
||||
|
||||
|
|
@ -28,22 +20,26 @@
|
|||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date Order Received'); ?></dt>
|
||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||
<?php echo $job['Job']['date_order_received']; ?>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=>$job['Job']['date_order_received'])); ?>
|
||||
|
||||
</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 $job['Job']['date_order_placed_on_principle']; ?>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=>$job['Job']['date_order_placed_on_principle'])); ?>
|
||||
|
||||
</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 $job['Job']['date_scheduled_ex_works']; ?>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=>$job['Job']['date_scheduled_ex_works'])); ?>
|
||||
|
||||
</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 $job['Job']['date_order_sent_to_customer']; ?>
|
||||
<?php echo $this->element('isEmptyDate',
|
||||
array('date'=> $job['Job']['date_order_sent_to_customer'])); ?>
|
||||
|
||||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Customer Order Number'); ?></dt>
|
||||
|
|
@ -78,3 +74,7 @@
|
|||
<li><?php echo $html->link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php debug($job);?>
|
||||
|
|
@ -57,6 +57,11 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li><?php echo $html->link('Jobs', '/jobs/index'); ?><ul>
|
||||
<li class="last"><?php echo $html->link('Job List', '/jobs/index'); ?></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><?php echo $html->link('Customers', '/customers/index'); ?>
|
||||
<ul>
|
||||
<li><?php echo $html->link('Customer Index', '/customers/index'); ?></li>
|
||||
|
|
|
|||
|
|
@ -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,7 +203,8 @@ ul.principle-emails {
|
|||
/* this is the parent menu */
|
||||
#nav li a {
|
||||
display:block;
|
||||
width: 120px;
|
||||
width: 90px;
|
||||
/*width: 6em;*/
|
||||
padding:8px 5px 0 5px;
|
||||
height:23px;
|
||||
text-decoration:none;
|
||||
|
|
|
|||
51
webroot/js/addjob.js
Normal file
51
webroot/js/addjob.js
Normal file
|
|
@ -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'
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue