Cleaned up old code in quotes controller

This commit is contained in:
Karl Cordes 2011-08-11 13:05:02 +10:00
parent e5d02d2380
commit a66004025d
4 changed files with 0 additions and 372 deletions

View file

@ -51,43 +51,6 @@ class QuotesController extends AppController {
}
function add() {
if(isset($this->params['named']['enquiryid'])) {
$enquiryid = $this->params['named']['enquiryid'];
$this->Quote->create();
$number_of_revisions = $this->Quote->findCount('Quote.enquiry_id ='. $enquiryid);
$this->data['Quote']['revision'] = $number_of_revisions;
$this->data['Quote']['enquiry_id'] = $enquiryid;
$this->data['Quote']['date_issued'] = date('Y-m-d');
$this->data['Quote']['currency_id'] = 2;
if ($this->Quote->save($this->data)) {
$quoteid = $this->Quote->id;
//$this->data['Document']['']
$this->Session->setFlash(__('The Quote has been saved', true));
$this->redirect(array('action'=>'view/'.$quoteid));
}
else {
$this->Session->setFlash(__('The Quote was not saved. Something has gone wrong.', true));
$this->redirect(array('action'=>'index'));
}
}
else {
$this->Session->setFlash(__('Invalid Enquiry ID', true));
$this->redirect(array('controller'=>'enquiries','action'=>'index'));
}
}
function edit($id = null) {
$this->layout = 'ajax';

View file

@ -1,32 +0,0 @@
<div class="quotes form">
<?php echo $form->create('Quote');?>
<fieldset>
<legend><?php __('Add Quote');?></legend>
<?php
echo $form->input('enquiry_id');
echo $form->input('currency_id');
echo $form->input('revision');
echo $form->input('delivery_time');
echo $form->input('payment_terms');
echo $form->input('days_valid');
echo $form->input('date_issued');
echo $form->input('valid_until');
echo $form->input('delivery_point');
echo $form->input('exchange_rate');
echo $form->input('customs_duty');
echo $form->input('document_id');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('List Quotes', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Documents', true), array('controller' => 'documents', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Document', true), array('controller' => 'documents', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -1,82 +0,0 @@
<div class="quotes view">
<h2>Quote: <?=$html->link($quote['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $quote['Enquiry']['id'])); ?> Rev <?=$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 $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 $quote['Quote']['modified']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Currency'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($quote['Currency']['name'], array('controller' => 'currencies', 'action' => 'view', $quote['Currency']['id'])); ?>
&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 __('Date Issued'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['date_issued']; ?>
&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>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Delivery Point'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['delivery_point']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Exchange Rate'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['exchange_rate']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Customs Duty'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['customs_duty']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Document'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($quote['Document']['id'], array('controller' => 'documents', 'action' => 'view', $quote['Document']['id'])); ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit Quote', true), array('action' => 'edit', $quote['Quote']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete Quote', true), array('action' => 'delete', $quote['Quote']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quote['Quote']['id'])); ?> </li>
<li><?php echo $html->link(__('List Quotes', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Quote', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Documents', true), array('controller' => 'documents', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Document', true), array('controller' => 'documents', 'action' => 'add')); ?> </li>
</ul>
</div>
<?php debug($quote);?>

View file

@ -1,221 +0,0 @@
<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>