<div class="quotes view">
<h2><?php  

if($quote['Quote']['revision'] == 0) {
	__('Quote: '.$quote['Enquiry']['title']);
}
else {
	__('Quote: '.$quote['Enquiry']['title'].' Revision '.$quote['Quote']['revision']);
}
?></h2>

	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $time->nice($quote['Quote']['created']); ?>
			&nbsp;
		</dd>

		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $time->nice($quote['Quote']['modified']); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $html->link($quote['Enquiry']['title'], array('controller'=> 'enquiries', 'action'=>'view', $quote['Enquiry']['id'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Revision'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $quote['Quote']['revision']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Delivery Time'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $quote['Quote']['delivery_time']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Payment Terms'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $quote['Quote']['payment_terms']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Days Valid'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $quote['Quote']['days_valid']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Valid Until'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $quote['Quote']['valid_until']; ?>
			&nbsp;
		</dd>
	</dl>
</div> 
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('Edit Details', true), array('action'=>'edit', $quote['Quote']['id'])); ?> </li>
	</ul>
</div>


<div id="viewpage">
</div>

<div id="LoadingDiv" style="display: none;">
	<?php echo $html->image('ajax-loader.gif'); ?>
</div>


<?php
		$i = 0;
		foreach ($quote['QuotePage'] as $quotePage):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}


?>

<div class="related">
<h3>Cover Page <?php echo $i; ?> </h3>

<?php echo $ajax->link('View', array('controller'=> 'quote_pages', 'action'=>'show', $quotePage['id']), 
						array('update'=>'viewpage', 'indicator' => 'LoadingDiv','loading'=>'Effect.appear(\'viewpage\')')); 


			//	echo $ajax->link('View', array('controller'=> 'quote_pages', 'action'=>'show', $quotePage['id']), 
			//array('update'=>'viewpage', 'indicator' => 'LoadingDiv')); 
?>
				

<?php // echo $html->link(__('Edit', true), array('controller'=> 'quote_pages', 'action'=>'edit', $quotePage['id'])); 
		echo $ajax->link('Edit', array('controller'=> 'quote_pages', 'action'=>'edit', $quotePage['id']), 
			array('update'=>'viewpage', 'indicator' => 'LoadingDiv','loading'=>'Effect.appear(\'viewpage\')')); 
?>
				

<?php echo $html->link(__('Delete', true), array('controller'=> 'quote_pages', 'action'=>'delete', $quotePage['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quotePage['id'])); ?>


</div>

<?php endforeach; ?>

	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('New Cover Page', true), array('controller'=> 'quote_pages', 'action'=>'add/'.$quote['Quote']['id']));?> </li>
		</ul>
	</div>



</div>


<div class="related">
	<h3><?php __('Related Quote Products');?></h3>
	<?php if (!empty($quote['QuoteProduct'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Itemnumber'); ?></th>
		<th><?php __('Option'); ?></th>
		<th><?php __('Principle Id'); ?></th>
		<th><?php __('Quantity'); ?></th>
		<th><?php __('Costprice'); ?></th>
		<th><?php __('Currency Id'); ?></th>
		<th><?php __('Ourdiscount'); ?></th>
		<th><?php __('Packing'); ?></th>
		<th><?php __('Shippingweight'); ?></th>
		<th><?php __('Shippingcost'); ?></th>
		<th><?php __('Exchangerate'); ?></th>
		<th><?php __('Duty'); ?></th>
		<th><?php __('Finance'); ?></th>
		<th><?php __('Misc'); ?></th>
		<th><?php __('Grosssellprice'); ?></th>
		<th><?php __('Grossgpdollars'); ?></th>
		<th><?php __('Grossgppercentage'); ?></th>
		<th><?php __('Netgpdollars'); ?></th>
		<th><?php __('Netgppercent'); ?></th>
		<th><?php __('Targetgp'); ?></th>
		<th><?php __('Title'); ?></th>
		<th><?php __('Description'); ?></th>
		<th><?php __('Total Landed Cost'); ?></th>
		<th><?php __('Fob Countryof Export'); ?></th>
		<th><?php __('Quote Id'); ?></th>
		<th><?php __('Product Id'); ?></th>
		<th><?php __('Discount'); ?></th>
		<th><?php __('Discountamount'); ?></th>
		<th><?php __('Grosssellpriceeach'); ?></th>
		<th><?php __('Netsellpriceeach'); ?></th>
		<th><?php __('Netsellprice'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>


<?php
		$i = 0;
		foreach ($quote['QuoteProduct'] as $quoteProduct):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>

			<td><?php echo $quoteProduct['id'];?></td>
			<td><?php echo $quoteProduct['itemnumber'];?></td>
			<td><?php echo $quoteProduct['option'];?></td>
			<td><?php echo $quoteProduct['principle_id'];?></td>
			<td><?php echo $quoteProduct['quantity'];?></td>
			<td><?php echo $quoteProduct['costprice'];?></td>
			<td><?php echo $quoteProduct['currency_id'];?></td>
			<td><?php echo $quoteProduct['ourdiscount'];?></td>
			<td><?php echo $quoteProduct['packing'];?></td>
			<td><?php echo $quoteProduct['shippingweight'];?></td>
			<td><?php echo $quoteProduct['shippingcost'];?></td>
			<td><?php echo $quoteProduct['exchangerate'];?></td>
			<td><?php echo $quoteProduct['duty'];?></td>
			<td><?php echo $quoteProduct['finance'];?></td>
			<td><?php echo $quoteProduct['misc'];?></td>
			<td><?php echo $quoteProduct['grosssellprice'];?></td>
			<td><?php echo $quoteProduct['grossgpdollars'];?></td>
			<td><?php echo $quoteProduct['grossgppercentage'];?></td>
			<td><?php echo $quoteProduct['netgpdollars'];?></td>
			<td><?php echo $quoteProduct['netgppercent'];?></td>
			<td><?php echo $quoteProduct['targetgp'];?></td>
			<td><?php echo $quoteProduct['title'];?></td>
			<td><?php echo $quoteProduct['description'];?></td>
			<td><?php echo $quoteProduct['total_landed_cost'];?></td>
			<td><?php echo $quoteProduct['fob_countryof_export'];?></td>
			<td><?php echo $quoteProduct['quote_id'];?></td>
			<td><?php echo $quoteProduct['product_id'];?></td>
			<td><?php echo $quoteProduct['discount'];?></td>
			<td><?php echo $quoteProduct['discountamount'];?></td>
			<td><?php echo $quoteProduct['grosssellpriceeach'];?></td>
			<td><?php echo $quoteProduct['netsellpriceeach'];?></td>
			<td><?php echo $quoteProduct['netsellprice'];?></td>
			
<td class="actions">
				<?php echo $html->link(__('View', true), array('controller'=> 'quote_products', 'action'=>'view', $quoteProduct['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller'=> 'quote_products', 'action'=>'edit', $quoteProduct['id'])); ?>
				<?php echo $html->link(__('Delete', true), array('controller'=> 'quote_products', 'action'=>'delete', $quoteProduct['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quoteProduct['id'])); ?>
			</td>


		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('New Quote Product', true), array('controller'=> 'quote_products', 'action'=>'add'));?> </li>
		</ul>
	</div>


</div>
