cmc-sales/views/quotes/view.ctp
2009-11-19 10:23:21 +11:00

182 lines
5.7 KiB
PHP
Executable file

<div class="quotes view">
<h2><?php
$enquirynumber_link = $html->link($quote['Enquiry']['title'],
array('controller'=>'enquiries', 'action'=>'view', $quote['Enquiry']['id']));
$customer_link = $html->link( $customer['Customer']['name'], array('controller'=>'customers', 'action' => 'view', $customer['Customer']['id']));
if($quote['Quote']['revision'] == 0) {
__('Quote: '.$enquirynumber_link. ' for '. $customer_link);
}
else {
__('Quote: '.$enquirynumber_link.' Revision '.$quote['Quote']['revision'].' for '. $customer_link);
}
?></h2>
</div>
<?php
$i = 0;
foreach ($quote['QuotePage'] as $quotePage):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<div class="related">
<h3>Page <?php echo $i; ?> </h3>
<div class="quotepageview">
<?php echo $quotePage['content']; ?>
</div>
<?php echo $html->link(__('Edit', true), array('controller'=>'quote_pages', 'action'=>'edit',$quotePage['id']));?>
<?php echo $html->link(__('Delete', true), array('controller'=> 'quote_pages', 'action'=>'delete', $quotePage['id']), null, sprintf(__('Are you ABSOLUTELY sure you want to delete Page # %s? This cannot be undone.', true), $i)); ?>
</div>
<div id="viewpage<?php echo $i;?>">
</div>
<?php endforeach; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Add Cover Page', true), array('controller'=> 'quote_pages', 'action'=>'add/'.$quote['Quote']['id']));?> </li>
<li> <?php echo $html->link(__('Regenerate First Page', true), array('controller'=> 'quote_pages', 'action'=>'regeneratePage', $quotePage['id']), null, sprintf(__('Are you sure you want to regenerate the first page? You will lose any changes you have made to it.', true), $i)); ?></li>
</ul>
</div>
<div class="related">
<h3><?php __('Products in this Quote');?></h3>
<?php if (!empty($quoteProducts)):?>
<table cellpadding = "0" cellspacing = "0" class="quoteproducts">
<tr>
<th><?php __('Item Number'); ?></th>
<th><?php __('Quantity'); ?></th>
<th><?php __('Title'); ?></th>
<th><?php __('Description'); ?></th>
<th>Unit Price (<?php echo $quote['Currency']['iso4217']; ?>)</th>
<th><?php __('Total Price'); ?> (<?php echo $quote['Currency']['iso4217']; ?>)</th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
$subTotal = 0;
foreach ($quoteProducts as $quoteProduct):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php
if($quoteProduct['QuoteProduct']['option'] == 1 ) {
echo 'Option <br>';
}
echo number_format($quoteProduct['QuoteProduct']['item_number'], 1, '.', '');?></td>
<td><?php echo $quoteProduct['QuoteProduct']['quantity'];?></td>
<td><?php echo $quoteProduct['QuoteProduct']['title'];?></td>
<td><?php echo $quoteProduct['QuoteProduct']['description'];?></td>
<td><?php echo $quote['Currency']['symbol'].$quoteProduct['QuoteProduct']['unit_price'];?></td>
<td><?php
$thisNetPrice = $quoteProduct['QuoteProduct']['unit_price']*$quoteProduct['QuoteProduct']['quantity'];
$subTotal += $thisNetPrice;
echo $quote['Currency']['symbol'].$thisNetPrice; ?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'quote_products', 'action'=>'view', $quoteProduct['QuoteProduct']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'quote_products', 'action'=>'edit', $quoteProduct['QuoteProduct']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('controller'=> 'quote_products', 'action'=>'delete', $quoteProduct['QuoteProduct']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quoteProduct['QuoteProduct']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<tr class="divider">
<td></td>
<td></td>
<td></td>
<td>SUB-TOTAL (Excluding GST)</td>
<td></td>
<td><?php echo $quote['Currency']['symbol'].$subTotal; ?></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>GST (10%)</td>
<td></td>
<td><?php
if($quote['Enquiry']['gst'] == 1 ) {
$gst = 0.1 * $subTotal;
echo $quote['Currency']['symbol'].$gst;
}
else {
$gst = 0;
echo "N/A";
}
?></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>TOTAL PAYABLE</td>
<td></td>
<td><?php
$total = $subTotal + $gst;
echo $quote['Currency']['symbol'].$total;
?>
</td>
<td></td>
</tr>
</tr>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Add Product to this Quote', true), array('controller'=> 'quote_products', 'action'=>'add', $quote['Quote']['id']));?> </li>
</ul>
</div>
</div>
<?php debug($quote); ?>