125 lines
4.1 KiB
PHP
125 lines
4.1 KiB
PHP
|
|
<?php $enqCount = count($enquiryResults);
|
|
$custCount = count($customerResults);
|
|
$contactCount = count($contactResults);
|
|
|
|
?>
|
|
|
|
|
|
<?php if($enqCount > 0):
|
|
?>
|
|
|
|
<h2><?php echo $enqCount;?> Matching Enquiries</h2>
|
|
<table class="mer">
|
|
<tr>
|
|
<th>Date</th>
|
|
<th>Principle</th>
|
|
<th>Enquiry Number</th>
|
|
<th>Customer</th>
|
|
<th>Contact</th>
|
|
<th class="actions">Actions</th>
|
|
</tr>
|
|
<?php foreach ($enquiryResults as $enquiryRes):?>
|
|
|
|
|
|
<?php
|
|
|
|
/* Set Row colour to Yellow if the Job has been won and turned into an order */
|
|
if($enquiryRes['Status']['id'] == 3) {
|
|
$class = ' class="jobwon"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 4) {
|
|
$class = ' class="joblost"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 8) {
|
|
$class = ' class="joblost"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 9) {
|
|
$class = ' class="joblost"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 10) {
|
|
$class = ' class="joblost"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 6) {
|
|
$class = ' class="information"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 11) {
|
|
$class = ' class="informationsent"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 5) {
|
|
$class = ' class="quoted"';
|
|
}
|
|
else if($enquiryRes['Status']['id'] == 1) {
|
|
$class = ' class="requestforquote"';
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<tr <?php echo $class; ?>>
|
|
<td><?php echo date('j M Y',$time->toUnix($enquiryRes['Enquiry']['created'])); ?></td>
|
|
<td> <?php
|
|
if($enquiryRes['Principle']['short_name']) {
|
|
echo $html->link($enquiryRes['Principle']['short_name'], array('controller'=> 'principles', 'action'=>'view', $enquiryRes['Principle']['id']));
|
|
}
|
|
else {
|
|
echo $html->link($enquiryRes['Principle']['name'], array('controller'=> 'principles', 'action'=>'view', $enquiryRes['Principle']['id']));
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?php echo $html->link($enquiryRes['Enquiry']['title'], array('controller'=>'enquiries', 'action'=>'view', $enquiryRes['Enquiry']['id'])); ?></td>
|
|
<td> <?php echo $html->link($enquiryRes['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiryRes['Customer']['id'])); ?></td>
|
|
<td> <?php echo $html->link($enquiryRes['Contact']['first_name'].' '.$enquiryRes['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiryRes['Contact']['id'])); ?></td>
|
|
<td><?php echo $html->link('View', array('controller'=>'enquiries', 'action'=>'view', $enquiryRes['Enquiry']['id'])); ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
|
|
</table>
|
|
|
|
<?php endif;?>
|
|
|
|
|
|
|
|
<?php if($custCount > 0):
|
|
?>
|
|
<h2><?php echo $custCount; ?> Matching Customers</h2>
|
|
<table>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th class="actions"></th>
|
|
</tr>
|
|
<?php foreach($customerResults as $custRes): ?>
|
|
<tr>
|
|
<td><?php echo $custRes['Customer']['name'];?></td>
|
|
<td><?php echo $html->link(__('View', true), array('action'=>'view', $custRes['Customer']['id'])); ?></td>
|
|
</tr>
|
|
<?php endforeach;?>
|
|
</table>
|
|
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php if($contactCount > 0): ?>
|
|
<h2><?php echo $contactCount; ?> Matching Contacts</h2>
|
|
<table>
|
|
<tr>
|
|
<th>First Name</th>
|
|
<th>Last Name</th>
|
|
<th>Customer</th>
|
|
<th class="actions"></th>
|
|
</tr>
|
|
<?php foreach($contactResults as $contact): ?>
|
|
<tr>
|
|
<td><?php echo $contact['Contact']['first_name'];?></td>
|
|
<td><?php echo $contact['Contact']['last_name'];?></td>
|
|
<td><?php echo $html->link($contact['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $contact['Customer']['id'])); ?></td>
|
|
<td><?php echo $html->link(__('View', true), array('action'=>'view', $contact['Contact']['id'])); ?></td>
|
|
</tr>
|
|
<?php endforeach;?>
|
|
</table>
|
|
<?php endif;?>
|