Improved view Enquiry. New Quotes now default to AUD and issue date is the day created

This commit is contained in:
Karl Cordes 2011-08-09 14:41:46 +10:00
parent 6d8c6915ae
commit fb94915cde
3 changed files with 208 additions and 142 deletions

View file

@ -71,15 +71,14 @@ class DocumentsController extends AppController {
$this->data['Quote']['enquiry_id'] = $enquiryid;
$number_of_revisions = $this->Document->Quote->findCount('Quote.enquiry_id ='. $enquiryid);
$this->data['Quote']['revision'] = $number_of_revisions;
$this->data['Quote']['date_issued'] = date('Y-m-d');
$this->data['Quote']['currency_id'] = 2; //All new Quotes default to AUD.
$this->data['Document']['user_id']= $enquiry['Enquiry']['user_id'];
$this->data['Document']['enquiry_id'] = $enquiryid;
$this->data['Document']['type'] = 'quote';
if ($this->Document->saveAll($this->data)) {
$newid = $this->Document->id;

View file

@ -1,94 +1,122 @@
<div class="enquiries-view">
<h2><?php __("Enquiry: " . $enquiry['Enquiry']['title']);?></h2>
<dl><?php $i = 0;
$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']; ?>
&nbsp;
</dd>
<dl class="enquirySummary">
<dt>Enquiry:</dt>
<dd><?=$enquiry['Enquiry']['title']?></dd>
<dt>Customer:</dt>
<dd><?=$html->link($enquiry['Customer']['name'], array('controller'=>'customers','action'=>'view', $enquiry['Customer']['id']));?>
</dd>
<dt>Contact:</dt>
<dd><?=$html->link($enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'], array('controller'=> 'users', 'action'=>'view', $enquiry['Contact']['id'])); ?>
<?=$html->link($enquiry['Contact']['email'], 'mailto:'.$enquiry['Contact']['email']);?>
</dd>
<?
/* Copy+pasta. Should be a helper of an element or something. Aug_2011_Hackfest_for_victory_and_liberation_from_this_project! */
if ($enquiry['Status']['id'] == 3) {
$class = ' class="jobwon"';
} else if ($enquiry['Status']['id'] == 4) {
$class = ' class="joblost"';
} else if ($enquiry['Status']['id'] == 8) {
$class = ' class="joblost"';
} else if ($enquiry['Status']['id'] == 9) {
$class = ' class="joblost"';
} else if ($enquiry['Status']['id'] == 10) {
$class = ' class="joblost"';
} else if ($enquiry['Status']['id'] == 6) {
$class = ' class="information"';
} else if ($enquiry['Status']['id'] == 11) {
$class = ' class="informationsent"';
} else if ($enquiry['Status']['id'] == 5) {
$class = ' class="quoted"';
} else if ($enquiry['Status']['id'] == 1) {
$class = ' class="requestforquote"';
}
?>
<dt>Status:</dt>
<dd <?=$class?>> <?php echo $html->link($enquiry['Status']['name'], array('controller'=> 'statuses', 'action'=>'view', $enquiry['Status']['id'])); ?></dd>
</dl>
<h3>Details</h3>
<dl><?php $i = 0;
$class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Assigned to User'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['User']['username'], array('controller'=> 'users', 'action'=>'view', $enquiry['User']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Customer'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiry['Customer']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Contact'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?>
<?php echo $html->link($enquiry['User']['username'], array('controller'=> 'users', 'action'=>'view', $enquiry['User']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('State'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['State']['name'], array('controller'=> 'states', 'action'=>'view', $enquiry['State']['id'])); ?>
<?php echo $html->link($enquiry['State']['name'], array('controller'=> 'states', 'action'=>'view', $enquiry['State']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Country'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $enquiry['Country']['id'])); ?>
<?php echo $html->link($enquiry['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $enquiry['Country']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('GST Applicable'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php
if($enquiry['Enquiry']['gst'] == 0) {
echo "No - GST Not Applicable";
}
else {
echo "Yes - GST Applicable";
}
?>
<?php
if($enquiry['Enquiry']['gst'] == 0) {
echo "No - GST Not Applicable";
}
else {
echo "Yes - GST Applicable";
}
?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Principle'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['Principle']['name'], array('controller'=> 'principles', 'action'=>'view', $enquiry['Principle']['id'])); ?>
<?php echo $html->link($enquiry['Principle']['name'], array('controller'=> 'principles', 'action'=>'view', $enquiry['Principle']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Status'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($enquiry['Status']['name'], array('controller'=> 'statuses', 'action'=>'view', $enquiry['Status']['id'])); ?>
<?php echo $html->link($enquiry['Status']['name'], array('controller'=> 'statuses', 'action'=>'view', $enquiry['Status']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Comments'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<span class="enquiry-view-comments">
<?php echo $enquiry['Enquiry']['comments']; ?>
<?php echo $enquiry['Enquiry']['comments']; ?>
</span>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Billing Address'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php
if($enquiry['BillingAddress']['customer_id'] != NULL) {
echo $enquiry['BillingAddress']['address'].'<br>';
echo $enquiry['BillingAddress']['city'].' '.$billingaddress['State']['name'].' '.$enquiry['BillingAddress']['postcode'].'<br>';
echo '<b>'.$billingaddress['Country']['name'].'</b>';
}
else {
echo 'No Billing Address Assigned for this Enquiry';
}
?>
<?php
if($enquiry['BillingAddress']['customer_id'] != NULL) {
echo $enquiry['BillingAddress']['address'].'<br>';
echo $enquiry['BillingAddress']['city'].' '.$billingaddress['State']['name'].' '.$enquiry['BillingAddress']['postcode'].'<br>';
echo '<b>'.$billingaddress['Country']['name'].'</b>';
}
else {
echo 'No Billing Address Assigned for this Enquiry';
}
?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shipping Address'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php
if($enquiry['ShippingAddress']['customer_id'] != NULL) {
echo $enquiry['ShippingAddress']['address'].'<br>';
echo $enquiry['ShippingAddress']['city'].' '.$shippingaddress['State']['name'].' '.$enquiry['ShippingAddress']['postcode'].'<br>';
echo '<b>'.$shippingaddress['Country']['name'].'</b>';
}
else {
echo 'No Shipping Address Assigned for this Enquiry';
}
?>
<?php
if($enquiry['ShippingAddress']['customer_id'] != NULL) {
echo $enquiry['ShippingAddress']['address'].'<br>';
echo $enquiry['ShippingAddress']['city'].' '.$shippingaddress['State']['name'].' '.$enquiry['ShippingAddress']['postcode'].'<br>';
echo '<b>'.$shippingaddress['Country']['name'].'</b>';
}
else {
echo 'No Shipping Address Assigned for this Enquiry';
}
?>
&nbsp;
</dd>
@ -107,41 +135,35 @@ $class = ' class="altrow"';?>
$boxdata['enquirynumber'] = $enquiry['Enquiry']['title'];
//$boxdata['principle_emails'] = $principle_emails;
?>
<?php echo $this->element('principle_contacts_email_box', array('enquirynumber' => $enquiry['Enquiry']['title'],
'principle_emails' => $principle_emails )); ?>
<?php echo $this->element('principle_contacts_email_box', array('enquirynumber' => $enquiry['Enquiry']['title'],
'principle_emails' => $principle_emails )); ?>
</div>
<? /*
<div class="related">
<h3><?php __($number_of_files.' Files in this Enquiry');?><?php echo $html->image('document.png'); ?></h3>
<?php echo $this->element('enquiry_file_table', $files); ?>
</div>
*/?>
<div class="related">
<h3><?php if($enquiry['Enquiry']['quote_count'] > 1) {
echo $enquiry['Enquiry']['quote_count'].' Quotes for this Enquiry';
echo $enquiry['Enquiry']['quote_count'].' Quotes for this Enquiry';
}
else {
echo $enquiry['Enquiry']['quote_count'].' Quote for this Enquiry';
}?>
</h3>
<?php echo $this->element('quote_table', $quotes); ?>
<button>New Quote</button>
<?php echo $this->element('quote_table', $quotes); ?>
</div>
<div class="related">
<h3>Jobs for this Enquiry</h3>
<table cellpadding="0" cellspacing="0">
<table cellpadding="0" cellspacing="0">
<tr>
<th>Job Number</th>
<th>Customer Order Number</th>
<th>Customer Order Number</th>
<th>Date Order Received</th>
<th>Date Sheduled Ex-Works</th>
@ -154,61 +176,61 @@ $class = ' class="altrow"';?>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($jobs as $job):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<?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']; ?>
<?php echo $job['Job']['title']; ?>
</td>
<td>
<?php echo $job['Job']['customer_order_number']; ?>
<?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_scheduled_ex_works'])); ?>
</td>
<td>
<?php echo $this->element('isEmptyDate',
array('date'=>$job['Job']['date_order_sent_to_customer'])); ?>
<?php echo $this->element('isEmptyDate',
array('date'=>$job['Job']['date_order_received'])); ?>
</td>
<td>
<?php echo $job['Job']['domestic_freight_paid_by']; ?>
<?php echo $this->element('isEmptyDate',
array('date'=>$job['Job']['date_scheduled_ex_works'])); ?>
</td>
<td>
<?php echo $job['Job']['sale_category']; ?>
<?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']['shipment_category']; ?>
<?php echo $job['Job']['sale_category']; ?>
</td>
<td>
<?php echo $job['Job']['comments']; ?>
<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('controller'=>'jobs', 'action' => 'view', $job['Job']['id'])); ?>
<?php echo $html->link(__('View', true), array('controller'=>'jobs', 'action' => 'view', $job['Job']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>
<div class="actions">
<?=$javascript->link('add_job');?>
<?=$javascript->link('add_job');?>
<ul>
<li><button class="addJob" id="<?=$enquiry['Enquiry']['id'];?>">New Job</button></li>
</ul>
@ -228,9 +250,9 @@ $class = ' class="altrow"';?>
<div class="related">
<h3><?php __($enquiry['Enquiry']['invoice_count'].' Invoices for this Enquiry');?></h3>
<table class="quotetable">
<tr>
<tr>
<th>Issue Date</th>
<th>Due Date</th>
<th>Invoice Number</th>
@ -241,61 +263,61 @@ $class = ' class="altrow"';?>
<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"';
}
?>
<?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'])); ?>
<?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'])); ?>
<?php echo date('j M Y',$time->toUnix($invoice['Invoice']['due_date'])); ?>
</td>
<td>
<?php echo $invoice['Invoice']['title']; ?>
<?php echo $invoice['Invoice']['title']; ?>
</td>
<td>
<?php echo $html->link($invoice['Job']['title'], array('controller'=>'jobs', 'action'=>'view',$invoice['Invoice']['job_id'])); ?>
<?php echo $html->link($invoice['Job']['title'], array('controller'=>'jobs', 'action'=>'view',$invoice['Invoice']['job_id'])); ?>
</td>
<td>
<? echo $html->link($invoice['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $invoice['Customer']['id'])); ?>
<? 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>";
}
<?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'])); ?>
<?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'])); ?>
<?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; ?>
<?php endforeach; ?>
</table>
</div>
@ -313,10 +335,10 @@ $class = ' class="altrow"';?>
<div class="related">
<h3>
Emails for this Enquiry<?php echo $html->image('internet-mail.png'); ?>
Emails for this Enquiry<?php echo $html->image('internet-mail.png'); ?>
</h3>
<?php echo $this->element('email_table_ajax', array('emails' => $emails)); ?>
<?php //echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
<?php echo $this->element('email_table_ajax', array('emails' => $emails)); ?>
<?php //echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
</div>

View file

@ -89,7 +89,7 @@ a.headerlinks {
h3 {
color: #2C5FD5;
font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif;
font-size: 130%;
font-size: 150%;
/* padding-top: 1.5em; */
}
@ -638,6 +638,9 @@ div.paging span.current {
div.paging span a {
}
/* Scaffold View */
dl {
line-height: 2em;
@ -658,6 +661,46 @@ dt.altrow {
background: #E6F0F0;
}
/** Enquiry Details Summary */
dl.enquirySummary {
font-size: 150%;
color: #045FB4;
}
dl.enquirySummary dt {
width: 5em;
}
dl.enquirySummary dd {
margin-left: 8em;
}
/* Colors for Enquiry Statuses */
.joblost {
background: #FFC0CB;
}
.jobwon {
background: #55E055;
}
.information {
background: #FFFFFF;
}
.informationsent {
background: #ADD8E6;
}
.requestforquote {
background: #FFFFFF;
}
#emailHeaders {
font-size: 80%;
}
@ -1564,4 +1607,6 @@ table.lineItems tr td.price {
#userType {
display: none;
}
}