This commit is contained in:
Karl Cordes 2009-02-03 12:00:01 +11:00
parent 80fcb7a93a
commit c5d30b7263
6 changed files with 60 additions and 14 deletions

View file

@ -22,9 +22,20 @@ class EnquiriesController extends AppController {
$this->Session->setFlash(__('Invalid Enquiry.', true)); $this->Session->setFlash(__('Invalid Enquiry.', true));
$this->redirect(array('action'=>'index')); $this->redirect(array('action'=>'index'));
} }
$this->set('enquiry', $this->Enquiry->read(null, $id)); $enquiry = $this->Enquiry->read(null, $id);
$this->set('enquiry', $enquiry);
$this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC'))); $this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC')));
$this->set('files', $this->Enquiry->EnquiryFile->find('all', array('conditions' => array('EnquiryFile.enquiry_id'=>$id), 'order' => 'EnquiryFile.created ASC'))); $this->set('files', $this->Enquiry->EnquiryFile->find('all', array('conditions' => array('EnquiryFile.enquiry_id'=>$id), 'order' => 'EnquiryFile.created ASC')));
$this->set('number_of_quotes', $this->Enquiry->Quote->find('count', array('conditions'=>array('Quote.enquiry_id'=>$id))));
$this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id))));
if($enquiry['Enquiry']['billing_address_id'] != 0) {
$this->set('billingaddress', $this->Enquiry->BillingAddress->findById($enquiry['Enquiry']['billing_address_id']));
}
if($enquiry['Enquiry']['shipping_address_id'] != 0) {
$this->set('shippingaddress', $this->Enquiry->ShippingAddress->findById($enquiry['Enquiry']['shipping_address_id']));
}
} }

View file

@ -59,16 +59,7 @@ class PrinciplesController extends AppController {
$this->set(compact('countries','currencies')); $this->set(compact('countries','currencies'));
} }
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for Principle', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Principle->del($id)) {
$this->Session->setFlash(__('Principle deleted', true));
$this->redirect(array('action'=>'index'));
}
}
} }
?> ?>

View file

@ -9,7 +9,7 @@
echo $form->input('state_id'); echo $form->input('state_id');
echo $form->input('postcode', array('label' => 'Post Code', 'title' => 'The Post Code for this Address. Eg. 2015 for Alexandria')); echo $form->input('postcode', array('label' => 'Post Code', 'title' => 'The Post Code for this Address. Eg. 2015 for Alexandria'));
echo $form->input('country_id'); echo $form->input('country_id');
echo $form->input('type', array('label' => 'Address Type (Billing,Shipping or Both)', 'options' => array('Billing','Shipping', 'Both Shipping and Billing'))); echo $form->input('type', array('label' => 'Address Type (Billing,Shipping or Both)', 'options' => array('Billing','Shipping', 'Both Shipping and Billing', 'Other')));
echo $form->input('customer_id', array('type' => 'hidden', 'value'=>$customer['Customer']['id'])); echo $form->input('customer_id', array('type' => 'hidden', 'value'=>$customer['Customer']['id']));
?> ?>
</fieldset> </fieldset>

View file

@ -1,4 +1,7 @@
<?php if (!empty($files)):?> <?php if (!empty($files)):?>
<span class = "note">Eg. Principle's quotes to CMC, a Customer's completed datasheet, or emails relevent to the Enquiry.<br>
Note: These files are read-only once they are uploaded. Changes you make on a local copy are not sent back to the database - the file must be re-uploaded.
</span>
<table cellpadding = "0" cellspacing = "0" class="filetable"> <table cellpadding = "0" cellspacing = "0" class="filetable">
<tr> <tr>
<th><?php __('Date Added'); ?></th> <th><?php __('Date Added'); ?></th>

View file

@ -60,6 +60,36 @@
&nbsp; &nbsp;
</dd> </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';
}
?>
&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';
}
?>
&nbsp;
</dd>
</dl> </dl>
</div> </div>
<div class="actions"> <div class="actions">
@ -69,11 +99,11 @@
</div> </div>
<div class="related"> <div class="related">
<h3><?php __('Quotes in this Enquiry');?></h3> <h3><?php __($number_of_quotes.' Quotes in this Enquiry');?></h3>
<?php echo $this->element('quote_table', $quotes); ?> <?php echo $this->element('quote_table', $quotes); ?>
</div> </div>
<div class="related"> <div class="related">
<h3><?php __('Files in this Enquiry');?><?php echo $html->image('document.png'); ?></h3> <h3><?php __($number_of_files.' Files in this Enquiry');?><?php echo $html->image('document.png'); ?></h3>
<?php echo $this->element('enquiry_file_table', $files); ?> <?php echo $this->element('enquiry_file_table', $files); ?>
</div> </div>

View file

@ -369,11 +369,18 @@ dt {
padding-left: 4px; padding-left: 4px;
vertical-align: top; vertical-align: top;
} }
dt.altrow {
background: #E6F0F0;
}
dd { dd {
margin-left: 15em; margin-left: 15em;
margin-top: -2em; margin-top: -2em;
vertical-align: top; vertical-align: top;
} }
dd.altrow {
background: #E6F0F0;
}
/* Forms */ /* Forms */
form { form {
@ -666,6 +673,10 @@ span {
font-size: 110%; font-size: 110%;
} }
span.note {
font-size: 85%;
}
div#qTip { div#qTip {
padding: 3px; padding: 3px;
border: 1px solid #666; border: 1px solid #666;