Added Text String prices to Line Items

This commit is contained in:
Karl Cordes 2011-09-26 19:05:56 +10:00
parent 7e4f59f322
commit 66870227db
4 changed files with 78 additions and 20 deletions

View file

@ -13,7 +13,7 @@
echo $form->input('LineItem.title');
echo $form->input('LineItem.description');
echo $form->input('LineItem.product_id', array('type'=>'hidden'));
echo $form->input('LineItem.has_text_prices', array('options' => array('1' => 'Yes', '0' => 'No')));
?>
<div id="noCosting">
<?
@ -26,6 +26,14 @@
echo $form->input('net_price', array('class'=>'number_input quickpricing'));
?>
</div>
<div id="textPrices">
<?
echo $form->input('unit_price_string');
echo $form->input('gross_price_string');
?>
</div>
<?
echo $form->end();
?>

View file

@ -33,7 +33,13 @@
<?=$li['description'];?>
</td>
<td width="<?=$colWidths['unit'];?>" align="center" valign="top">
<?
if($li['has_text_prices']):
echo $li['unit_price_string'];
?>
<?
else:
?>
<?=$number->currency($li['gross_unit_price'], $currencyCode);?>
<? if($li['discount_percent']):?>
<br>less<br><?=$li['discount_percent']?>%<br>
@ -42,8 +48,16 @@
=<br>
<?=$number->currency($li['net_unit_price'], $currencyCode);?>
<?endif;?>
<?endif;?>
</td>
<td width="<?=$colWidths['total'];?>" align="center" valign="top">
<?
if($li['has_text_prices']):
echo $li['gross_price_string'];
?>
<?
else:
?>
<?=$number->currency($li['gross_price'], $currencyCode);?>
<? if($li['discount_percent']):?>
<br>less<br><?=$li['discount_percent']?>%<br>
@ -52,6 +66,7 @@
=<br>
<?=$number->currency($li['net_price'], $currencyCode);?>
<?endif;?>
<?endif;?>
</td>
</tr>
<?endforeach;?>

View file

@ -46,7 +46,13 @@
<?=$li['description'];?>
</td>
<td class="price">
<?
if($li['has_text_prices']):
echo $li['unit_price_string'];
?>
<?
else:
?>
<?=$number->currency($li['gross_unit_price'], $currencyCode);?>
<? if($li['discount_percent']):?>
<br>less<br><?=$li['discount_percent']?>%<br>
@ -55,8 +61,16 @@
=<br>
<?=$number->currency($li['net_unit_price'], $currencyCode);?>
<?endif;?>
<? endif;?>
</td>
<td class="price">
<?
if($li['has_text_prices']):
echo $li['gross_price_string'];
?>
<?
else:
?>
<?=$number->currency($li['gross_price'], $currencyCode);?>
<? if($li['discount_percent']):?>
<br>less<br><?=$li['discount_percent']?>%<br>
@ -65,6 +79,7 @@
=<br>
<?=$number->currency($li['net_price'], $currencyCode);?>
<?endif;?>
<?endif;?>
</td>
<td id="<?=$li['id'];?>">
<button class="editLineItem">Edit</button><br>

View file

@ -211,6 +211,9 @@ $(function() {
$("#productDetails").hide();
$('#LineItemDescription').ckeditor(config);
showHideTextPrices();
$( "#addLineItemModal" ).dialog('open');
});
@ -233,6 +236,7 @@ $(function() {
$("#editLineItemModal").html(data);
$("#productDetails").hide();
$('#LineItemDescription').ckeditor(config);
showHideTextPrices();
$( "#editLineItemModal" ).dialog('open');
});
@ -272,6 +276,10 @@ $(function() {
$('.page').ckeditor(config);
$("#LineItemHasTextPrices").live('change', function() {
showHideTextPrices();
});
//Remove this Page
$(".removePage").live('click',function() {
@ -444,6 +452,18 @@ $('.generateCommercialComments').live('click', function(event) {
});
function showHideTextPrices() {
if( $('#LineItemHasTextPrices').val() == 1) {
$("#noCosting").hide();
$("#noCosting").find('input').val('');
$("#textPrices").show();
}
else {
$("#noCosting").show();
$("#textPrices").hide();
}
}
function updateTextFields() {
$('#shippingDetails').ckeditor(function() {