264 lines
7.9 KiB
PHP
Executable file
264 lines
7.9 KiB
PHP
Executable file
<?php echo $javascript->link('addLineItem'); ?>
|
|
|
|
<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="quoteproducts">
|
|
<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['LineItem']['option'] == 1 ) {
|
|
echo 'Option <br>';
|
|
}
|
|
echo number_format($quoteProduct['LineItem']['item_number'], 1, '.', '');?></td>
|
|
|
|
<td><?php echo $quoteProduct['LineItem']['quantity'];?></td>
|
|
<td><?php echo $quoteProduct['LineItem']['title'];?></td>
|
|
<td class="leftAlign"><?php echo $quoteProduct['LineItem']['description'];?></td>
|
|
|
|
<td><?php echo $quote['Currency']['symbol'].$quoteProduct['LineItem']['unit_price'];
|
|
?></td>
|
|
<td><?php
|
|
|
|
$thisNetPrice = $quoteProduct['LineItem']['unit_price']*$quoteProduct['LineItem']['quantity'];
|
|
|
|
$subTotal += $thisNetPrice;
|
|
|
|
echo $quote['Currency']['symbol'].$thisNetPrice; ?></td>
|
|
|
|
<td class="actions">
|
|
<?php echo $html->link(__('View', true), array('controller'=> 'line_items', 'action'=>'view', $quoteProduct['LineItem']['id'])); ?>
|
|
<?php echo $html->link(__('Edit', true), array('controller'=> 'line_items', 'action'=>'edit', $quoteProduct['LineItem']['id'])); ?>
|
|
<?php echo $html->link(__('Delete', true), array('controller'=> 'line_items', 'action'=>'delete', $quoteProduct['LineItem']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quoteProduct['LineItem']['id'])); ?>
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
|
|
<tr class="divider">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="rightAlign">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 class="rightAlign">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 class="rightAlign">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>
|
|
<button id="addLineItem">Add a Product to this Quote</button>
|
|
<li><?php echo $html->link(__('Generate PDF from this Quote', true), array('controller'=>'quotes', 'action'=>'pdf', $quote['Quote']['id'])); ?></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="commercialComments">
|
|
<h3><?php __('Commercial Details');?></h3>
|
|
|
|
|
|
<?php echo $form->create('Quote');?>
|
|
<fieldset>
|
|
<?php
|
|
echo $form->input('id', array('type' => 'hidden', 'value' => $quote['Quote']['id']));
|
|
|
|
echo $form->input('enquiry_id', array('type' => 'hidden'));
|
|
echo $form->input('delivery_time');
|
|
echo $this->element('payment_terms_box');
|
|
echo $form->input('date_issued');
|
|
echo $form->input('days_valid', array('default'=>'30'));
|
|
echo $form->input('currency_id', array('label' => 'Sale Currency', 'options' => $currencies));
|
|
echo $form->input('delivery_point', array('default' => 'EX-CMC TECHNOLOGIES, ALEXANDRIA NSW'));
|
|
echo $form->input('exchange_rate', array('default' => 'FIXED'));
|
|
echo $form->input('customs_duty', array('default' => 'NIL'));
|
|
|
|
echo $form->end('Update Commercial Terms');
|
|
?>
|
|
</fieldset>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="addLineItem-form" title="Add a Product to this quote">
|
|
<?php echo $form->create('LineItem');?>
|
|
|
|
<?php
|
|
|
|
echo $form->input('principle_id', array('options'=>$principles, 'empty' =>'Select the Principle for this Product'));
|
|
?>
|
|
|
|
<div id="productBox" class="input select"></div>
|
|
|
|
|
|
<div id="addLineItem-form2">
|
|
<?
|
|
echo $form->input('item_number');
|
|
echo $form->input('option');
|
|
|
|
|
|
|
|
|
|
echo $form->input('quantity');
|
|
echo $form->input('title');
|
|
echo $form->input('description');
|
|
|
|
|
|
echo $form->input('quote_id');
|
|
echo $form->input('product_id');
|
|
echo $form->input('costing_id');
|
|
echo $form->input('unit_price');
|
|
?>
|
|
</div>
|
|
|
|
<?php echo $form->end('Submit');?>
|
|
</div>
|
|
|
|
|
|
|
|
<?php debug ($quoteProducts); ?>
|
|
|
|
<?php foreach ($quoteProducts as $quoteProduct) {
|
|
|
|
if($quoteProduct['Costing']) {
|
|
echo "YAY. We have a costing for: ".$quoteProduct['LineItem']['title'];
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
}
|