jQuery edit in place for the Enquiry Register working nicely

This commit is contained in:
Karl Cordes 2010-02-06 18:09:57 -07:00
parent 7534bc2756
commit b77598749a
11 changed files with 745 additions and 678 deletions

View file

@ -11,7 +11,7 @@ class EnquiriesController extends AppController {
'limit' => 250,
'order'=>array('Enquiry.id' => 'desc')
);
);
var $components = array('RequestHandler', 'Email');
@ -24,7 +24,8 @@ class EnquiriesController extends AppController {
$statuses = $this->Enquiry->Status->find('all', array('recursive'=>0));
$status_list = array();
foreach ($statuses as $status) {
$status_list[] = array($status['Status']['id'], $status['Status']['name']);
$statusid = $status['Status']['id'];
$status_list[$statusid] = $status['Status']['name'];
}
$this->set('status_list', $status_list);
//debug($this->paginate());
@ -395,14 +396,29 @@ class EnquiriesController extends AppController {
$this->set(compact('enquiry', 'users','contacts','principles','statuses', 'addresses'));
}
function update_status($enquiryid) {
/* function update_status($enquiryid) {
$newid = $this->params['form']['value'];
if($newid) {
$this->Enquiry->id = $enquiryid;
$this->Enquiry->saveField('status_id', $newid);
$this->set('enquiry', $this->Enquiry->findById($enquiryid));
$this->layout='ajax';
$this->render();
$this->render('ajax');
}
}*/
function update_status() {
if($this->data) {
App::import('Core', 'Sanitize');
$new_status = Sanitize::clean($this->data['Enquiry']['status_id']);
$this->Enquiry->id = $this->data['Enquiry']['id'];
$this->Enquiry->saveField('status_id', $new_status);
$this->set('enquiry', $this->Enquiry->findById($this->data['Enquiry']['id']));
}
}
@ -433,6 +449,17 @@ class EnquiriesController extends AppController {
}
function jsonStatus($id = null) {
if($id == null) {
return null;
}
else {
}
}

View file

@ -6,7 +6,7 @@ class LineItemsController extends AppController {
function index() {
$this->LineItem->recursive = 0;
$this->set('quoteProducts', $this->paginate());
$this->set('lineItems', $this->paginate());
}
function view($id = null) {
@ -14,7 +14,7 @@ class LineItemsController extends AppController {
$this->Session->setFlash(__('Invalid LineItem.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('quoteProduct', $this->LineItem->read(null, $id));
$this->set('lineItem', $this->LineItem->read(null, $id));
}
function add($quoteid = null) {

View file

@ -1,13 +1,16 @@
<?php echo $javascript->link('jquery.jeditable.mini'); ?>
<?php echo $paginator->options(array('url'=>$this->passedArgs)); ?>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?>
<table cellpadding="0" cellspacing="0" class="mer">
<tr>
<tr>
<th><?php echo $paginator->sort('user_id');?></th>
<th><?php echo $paginator->sort('Date', 'created');?></th>
<?php /* <th> echo $paginator->sort('Date Submitted', 'submitted'); </th> */ ?>
@ -22,10 +25,10 @@
<th><?php echo $paginator->sort('status_id');?></th>
<th><?php echo $paginator->sort('comments');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($enquiries as $enquiry):
</tr>
<?php
$i = 0;
foreach ($enquiries as $enquiry):
$class = null;
//if ($i++ % 2 == 0) {
// $class = ' class="altrow"';
@ -60,8 +63,8 @@ foreach ($enquiries as $enquiry):
}
?>
<tr<?php echo $class;?> id="<?php echo $i; ?>">
?>
<tr<?php echo $class;?> id="row<?php echo $enquiry['Enquiry']['id']; ?>">
<?php $nameclass = null;
if($enquiry['Enquiry']['posted'] == 1) {
$nameclass = ' class="posted"';
@ -102,7 +105,7 @@ foreach ($enquiries as $enquiry):
*/
?>
?>
@ -143,10 +146,75 @@ foreach ($enquiries as $enquiry):
?>
</td>
<td class="status"><div id="statusupdate_<?php echo $i;?>"><?php echo $enquiry['Status']['name']; ?></div>
<td class="status"><div id="<? echo $enquiry['Enquiry']['id']; ?>"><?php echo $enquiry['Status']['name']; ?></div>
<?php
echo $ajax->editor("statusupdate_$i", array('controller'=>'Enquiries', 'action'=>'update_status', $enquiry['Enquiry']['id']), array('update' => "statusupdate_$i", 'collection' => $status_list, 'okText'=>'Change Status', 'savingText' => 'Saving..', 'formId' => 'EnquiryStatusId',
'formClassName' => 'MER-inplace-select'));
$enqid = $enquiry['Enquiry']['id'];
$statusList = $status_list;
$statusList['selected'] = $enquiry['Enquiry']['status_id'];
$jsonList = json_encode($statusList);
$jsblock = <<<ENDJS
\$('#$enqid').editable('update_status', {
id : 'data[Enquiry][id]',
name: 'data[Enquiry][status_id]',
data : '$jsonList',
type : 'select',
indicator : 'Saving...',
submit : 'Update Status',
callback : function(value, settings) {
var match = /won/i.test(value);
if(match == true) {
\$('#row$enqid').removeClass().addClass('jobwon');
return;
}
match = /lost/i.test(value);
if(match == true) {
\$('#row$enqid').removeClass().addClass('joblost');
return;
}
match = /cancelled/i.test(value);
if(match == true) {
\$('#row$enqid').removeClass().addClass('joblost');
return;
}
match = /information sent/i.test(value);
if(match == true) {
\$('#row$enqid').removeClass().addClass('informationsent');
return;
}
match = /issued/i.test(value);
if(match == true) {
\$('#row$enqid').removeClass().addClass('quoted');
return;
}
match = /request for quotation/i.test(value);
if(match == true) {
\$('#row$enqid').removeClass().addClass('requestforquote');
return;
}
}
});
ENDJS;
echo $javascript->codeBlock($jsblock);
?>
</td>
<td class="comments">
@ -168,7 +236,7 @@ foreach ($enquiries as $enquiry):
</td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
<div class="paging">

View file

@ -1,85 +1,29 @@
<div class="quoteProducts form">
<div class="lineItems form">
<?php echo $form->create('LineItem');?>
<fieldset>
<legend><?php __('Add Product to this Quote');?></legend>
<?php
echo $form->input('quote_id', array('type' => 'hidden', 'value' => $quote['Quote']['id']));
echo $form->input('quantity', array('class' => 'required validate-number', 'title'=>'Please enter the quantity. It must be a number'));
echo $form->input('option', array('label' => 'This item is optional'));
echo $form->input('principle_id', array('empty' => 'Select a Principle'));
echo $ajax->observeField('LineItemPrincipleId', array(
'url' => 'principle_products',
'frequency' => 0.2,
'update' => 'products'
));
echo $form->input('product_id', array('type' => 'select', 'id'=>'products'));
echo $ajax->observeField('products', array(
'url' => 'product_options',
'frequency' => 0.2,
'update' => 'productoptions'
));
echo $ajax->div('productoptions');
echo $ajax->divEnd('productoptions');
//echo '<div id="productoptions"></div>';
//echo $form->select('QuoteProduct.product_id', null, null, array('id'=>'products'));
//*/
/*
<legend><?php __('Add LineItem');?></legend>
<?php
echo $form->input('item_number');
echo $form->input('option');
echo $form->input('quantity');
echo $form->input('cost_price');
echo $form->input('currency_id');
echo $form->input('our_discount');
echo $form->input('packing');
echo $form->input('shipping_weight');
echo $form->input('shipping_cost');
echo $form->input('exchange_rate');
echo $form->input('duty');
echo $form->input('finance');
echo $form->input('misc');
echo $form->input('gross_sell_price');
echo $form->input('target_gp');
echo $form->input('title');
echo $form->input('description');
echo $form->input('quote_id');
echo $form->input('product_id');
echo $form->input('discount');
*/
?>
echo $form->input('costing_id');
echo $form->input('unit_price');
?>
</fieldset>
<?php echo $form->end('Submit');
echo $javascript->codeBlock("new Validation('QuoteProductAddForm', {immediate : true, useTitles : true});", array('allowCache'=>true, 'safe'=>false));
?>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('List QuoteProducts', true), array('action' => 'index'));?></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 LineItems', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Costings', true), array('controller' => 'costings', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Costing', true), array('controller' => 'costings', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -1,42 +1,31 @@
<div class="quoteProducts form">
<?php echo $form->create('QuoteProduct');?>
<div class="lineItems form">
<?php echo $form->create('LineItem');?>
<fieldset>
<legend><?php __('Edit QuoteProduct');?></legend>
<legend><?php __('Edit LineItem');?></legend>
<?php
echo $form->input('id');
echo $form->input('item_number');
echo $form->input('option');
echo $form->input('quantity');
echo $form->input('cost_price');
echo $form->input('currency_id');
echo $form->input('our_discount');
echo $form->input('packing');
echo $form->input('shipping_weight');
echo $form->input('shipping_cost');
echo $form->input('exchange_rate');
echo $form->input('duty');
echo $form->input('finance');
echo $form->input('misc');
echo $form->input('gross_sell_price');
echo $form->input('target_gp');
echo $form->input('title');
echo $form->input('description');
echo $form->input('quote_id');
echo $form->input('product_id');
echo $form->input('discount');
echo $form->input('costing_id');
echo $form->input('unit_price');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('QuoteProduct.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('QuoteProduct.id'))); ?></li>
<li><?php echo $html->link(__('List QuoteProducts', true), array('action' => 'index'));?></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(__('Delete', true), array('action' => 'delete', $form->value('LineItem.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('LineItem.id'))); ?></li>
<li><?php echo $html->link(__('List LineItems', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Costings', true), array('controller' => 'costings', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Costing', true), array('controller' => 'costings', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -1,5 +1,5 @@
<div class="quoteProducts index">
<h2><?php __('QuoteProducts');?></h2>
<div class="lineItems index">
<h2><?php __('LineItems');?></h2>
<p>
<?php
echo $paginator->counter(array(
@ -17,11 +17,12 @@ echo $paginator->counter(array(
<th><?php echo $paginator->sort('quote_id');?></th>
<th><?php echo $paginator->sort('product_id');?></th>
<th><?php echo $paginator->sort('costing_id');?></th>
<th><?php echo $paginator->sort('unit_price');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($quoteProducts as $quoteProduct):
foreach ($lineItems as $lineItem):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
@ -29,36 +30,39 @@ foreach ($quoteProducts as $quoteProduct):
?>
<tr<?php echo $class;?>>
<td>
<?php echo $quoteProduct['QuoteProduct']['id']; ?>
<?php echo $lineItem['LineItem']['id']; ?>
</td>
<td>
<?php echo $quoteProduct['QuoteProduct']['item_number']; ?>
<?php echo $lineItem['LineItem']['item_number']; ?>
</td>
<td>
<?php echo $quoteProduct['QuoteProduct']['option']; ?>
<?php echo $lineItem['LineItem']['option']; ?>
</td>
<td>
<?php echo $quoteProduct['QuoteProduct']['quantity']; ?>
<?php echo $lineItem['LineItem']['quantity']; ?>
</td>
<td>
<?php echo $quoteProduct['QuoteProduct']['title']; ?>
<?php echo $lineItem['LineItem']['title']; ?>
</td>
<td>
<?php echo $quoteProduct['QuoteProduct']['description']; ?>
<?php echo $lineItem['LineItem']['description']; ?>
</td>
<td>
<?php echo $html->link($quoteProduct['Quote']['id'], array('controller' => 'quotes', 'action' => 'view', $quoteProduct['Quote']['id'])); ?>
<?php echo $html->link($lineItem['Quote']['id'], array('controller' => 'quotes', 'action' => 'view', $lineItem['Quote']['id'])); ?>
</td>
<td>
<?php echo $html->link($quoteProduct['Product']['title'], array('controller' => 'products', 'action' => 'view', $quoteProduct['Product']['id'])); ?>
<?php echo $html->link($lineItem['Product']['title'], array('controller' => 'products', 'action' => 'view', $lineItem['Product']['id'])); ?>
</td>
<td>
<?php echo $quoteProduct['QuoteProduct']['costing_id']; ?>
<?php echo $lineItem['LineItem']['costing_id']; ?>
</td>
<td>
<?php echo $lineItem['LineItem']['unit_price']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action' => 'view', $quoteProduct['QuoteProduct']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $quoteProduct['QuoteProduct']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $quoteProduct['QuoteProduct']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quoteProduct['QuoteProduct']['id'])); ?>
<?php echo $html->link(__('View', true), array('action' => 'view', $lineItem['LineItem']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $lineItem['LineItem']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $lineItem['LineItem']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $lineItem['LineItem']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
@ -71,9 +75,7 @@ foreach ($quoteProducts as $quoteProduct):
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New QuoteProduct', true), array('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(__('New LineItem', true), array('action' => 'add')); ?></li>
<li><?php echo $html->link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>

View file

@ -20,7 +20,6 @@ foreach ($options as $opt) {
if($prodopt['default'] == 1) {
$default_option = $prodopt['id'];
$drop_options[$prodopt['id']] .= " (Default)";
}

View file

@ -1,61 +1,64 @@
<div class="quoteProducts view">
<h2><?php __('QuoteProduct');?></h2>
<div class="lineItems view">
<h2><?php __('LineItem');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['id']; ?>
<?php echo $lineItem['LineItem']['id']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Item Number'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['item_number']; ?>
<?php echo $lineItem['LineItem']['item_number']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Option'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['option']; ?>
<?php echo $lineItem['LineItem']['option']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Quantity'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['quantity']; ?>
<?php echo $lineItem['LineItem']['quantity']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['title']; ?>
<?php echo $lineItem['LineItem']['title']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Description'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['description']; ?>
<?php echo $lineItem['LineItem']['description']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Quote'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($quoteProduct['Quote']['id'], array('controller' => 'quotes', 'action' => 'view', $quoteProduct['Quote']['id'])); ?>
<?php echo $html->link($lineItem['Quote']['id'], array('controller' => 'quotes', 'action' => 'view', $lineItem['Quote']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Product'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($quoteProduct['Product']['title'], array('controller' => 'products', 'action' => 'view', $quoteProduct['Product']['id'])); ?>
<?php echo $html->link($lineItem['Product']['title'], array('controller' => 'products', 'action' => 'view', $lineItem['Product']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Costing Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['QuoteProduct']['costing_id']; ?>
<?php echo $lineItem['LineItem']['costing_id']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Unit Price'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['LineItem']['unit_price']; ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit QuoteProduct', true), array('action' => 'edit', $quoteProduct['QuoteProduct']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete QuoteProduct', true), array('action' => 'delete', $quoteProduct['QuoteProduct']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quoteProduct['QuoteProduct']['id'])); ?> </li>
<li><?php echo $html->link(__('List QuoteProducts', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New QuoteProduct', true), array('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(__('Edit LineItem', true), array('action' => 'edit', $lineItem['LineItem']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete LineItem', true), array('action' => 'delete', $lineItem['LineItem']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $lineItem['LineItem']['id'])); ?> </li>
<li><?php echo $html->link(__('List LineItems', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New LineItem', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
@ -66,97 +69,133 @@
</div>
<div class="related">
<h3><?php __('Related Costings');?></h3>
<?php if (!empty($quoteProduct['Costing'])):?>
<?php if (!empty($lineItem['Costing'])):?>
<dl> <?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['id'];?>
<?php echo $lineItem['Costing']['id'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['created'];?>
<?php echo $lineItem['Costing']['created'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Product Id');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['product_id'];?>
<?php echo $lineItem['Costing']['product_id'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Quote Product Id');?></dt>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Line Item Id');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['quote_product_id'];?>
<?php echo $lineItem['Costing']['line_item_id'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Order Product Id');?></dt>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Purchase Currency Id');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['order_product_id'];?>
<?php echo $lineItem['Costing']['purchase_currency_id'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Invoice Product Id');?></dt>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Sale Currency Id');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['invoice_product_id'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Currency Id');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['currency_id'];?>
<?php echo $lineItem['Costing']['sale_currency_id'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Quantity');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['quantity'];?>
<?php echo $lineItem['Costing']['quantity'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Unit Cost Price');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['unit_cost_price'];?>
<?php echo $lineItem['Costing']['unit_cost_price'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Exchange Rate');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['exchange_rate'];?>
<?php echo $lineItem['Costing']['exchange_rate'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Our Discount Percent');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['our_discount_percent'];?>
<?php echo $lineItem['Costing']['our_discount_percent'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Packing');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['packing'];?>
<?php echo $lineItem['Costing']['packing'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Fob Sale Currency');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['fob_sale_currency'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shipping Weight');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['shipping_weight'];?>
<?php echo $lineItem['Costing']['shipping_weight'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shipping Cost');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['shipping_cost'];?>
<?php echo $lineItem['Costing']['shipping_cost'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Duty Percent');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['duty_percent'];?>
<?php echo $lineItem['Costing']['duty_percent'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Duty Percent Amount');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['duty_percent_amount'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Customs');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['customs'];?>
<?php echo $lineItem['Costing']['customs'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Finance Percent');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['finance_percent'];?>
<?php echo $lineItem['Costing']['finance_percent'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Finance Percent Amount');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['finance_percent_amount'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Misc Costs');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['misc_costs'];?>
<?php echo $lineItem['Costing']['misc_costs'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Total Landed Cost');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['total_landed_cost'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Gross Sell Price');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['gross_sell_price'];?>
<?php echo $lineItem['Costing']['gross_sell_price'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Sale Discount Percent');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['sale_discount_percent'];?>
<?php echo $lineItem['Costing']['sale_discount_percent'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Net Sell Price');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quoteProduct['Costing']['net_sell_price'];?>
<?php echo $lineItem['Costing']['net_sell_price'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Sale Discount Amount');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['sale_discount_amount'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Gross Gp Prior To Discount');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['gross_gp_prior_to_discount'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Net Gp Percent');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['net_gp_percent'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Net Gp Amount');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['net_gp_amount'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Gross Sell Price Each');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['gross_sell_price_each'];?>
&nbsp;</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Net Sell Price Each');?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $lineItem['Costing']['net_sell_price_each'];?>
&nbsp;</dd>
</dl>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit Costing', true), array('controller' => 'costings', 'action' => 'edit', $quoteProduct['Costing']['id'])); ?></li>
<li><?php echo $html->link(__('Edit Costing', true), array('controller' => 'costings', 'action' => 'edit', $lineItem['Costing']['id'])); ?></li>
</ul>
</div>
</div>

View file

@ -106,9 +106,9 @@ foreach ($quote['QuotePage'] as $quotePage):
echo $quote['Currency']['symbol'].$thisNetPrice; ?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'quote_products', 'action'=>'view', $quoteProduct['LineItem']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'quote_products', 'action'=>'edit', $quoteProduct['LineItem']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('controller'=> 'quote_products', 'action'=>'delete', $quoteProduct['LineItem']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quoteProduct['LineItem']['id'])); ?>
<?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>

View file

@ -113,7 +113,6 @@ function buildup() {
var netGPamount = grossGP - saleDiscountAmount;
netGPamount = netGPamount.toFixed(2);
$("#CostingNetGpAmount").val(netGPamount);
//Calculate net GP %
var netGPpercent = (netGPamount / grossSellPrice) * 100;
netGPpercent = netGPpercent.toFixed(2);