Commit 5ed65f20 authored by Malcolm Blaney's avatar Malcolm Blaney

Don't show price for imported orders that need quantity adjustment.

parent 6a61bf16
Pipeline #38296653 passed with stage
in 1 minute and 12 seconds
......@@ -50,10 +50,11 @@ if($.inArray(user,manager.users)===-1){alert('If an account was just created for
function showPurchase(row){var data=purchase[row];$('#manager-username-input').val(data.user);$('#manager-product-input').val(dobrado.decode(data.name));$('#manager-supplier-input').val(data.supplier);$('#manager-quantity-input').val(data.quantity);$('#manager-date-input').val(dobrado.formatDate(data.date));$('#manager-price-input').val('');$('.manager-price-info').html('');currentDate=data.date;currentProduct=null;if(data.name===''){return;}
$.each(manager.products,function(index,item){if(item.name===data.name&&item.user===data.supplier){currentProduct=item;if(item.unit==='variable'){if(data.price){$('#manager-price-input').val(data.price).attr('readonly',false);}
$('#manager-quantity-input').spinner('disable');}
else{if(data.price){var price=decimalString(data.quantity*data.price);$('#manager-price-input').val('$'+price+' @ ($'+data.price+'/'+item.unit+')');$('#manager-price-input').attr('readonly',true);var priceLevel=manager.buyerGroup[data.user];if(!priceLevel){priceLevel='retail';}
else{if(data.price&&data.price!=='0.00'){var price=decimalString(data.quantity*data.price);$('#manager-price-input').val('$'+price+' @ ($'+data.price+'/'+item.unit+')');var priceLevel=manager.buyerGroup[data.user];if(!priceLevel){priceLevel='retail';}
if(decimalString(item[priceLevel])!==data.price){$('.manager-price-info').html('Stock price now $'+
decimalString(item[priceLevel])+'/'+item.unit);}}
$('#manager-quantity-input').spinner('enable');}
else{$('.manager-price-info').html('Price calculated during adjustment');}
$('#manager-price-input').attr('readonly',true);$('#manager-quantity-input').spinner('enable');}
return false;}});if(!currentProduct){alert('This product was not found on the stock page.\n'+'Please check if it\'s name has been updated.');}}
function showProductFromMenu(event,ui){var user=$('#manager-username-input').val();var product=$('#manager-product-input').val();var supplier=$('#manager-supplier-input').val();var priceLevel='price';$('#manager-price-input').val('');$('.manager-price-info').html('');currentProduct=null;if(user!==''){priceLevel=manager.buyerGroup[user];if(!priceLevel){priceLevel='retail';}}
if(ui){product=ui.item.value;}
......
......@@ -341,11 +341,10 @@ if (!this.dobrado.manager) {
$('#manager-quantity-input').spinner('disable');
}
else {
if (data.price) {
if (data.price && data.price !== '0.00') {
var price = decimalString(data.quantity * data.price);
$('#manager-price-input').val('$' + price + ' @ ($' + data.price +
'/' + item.unit + ')');
$('#manager-price-input').attr('readonly', true);
// Check if the price the user purchased at is different from the
// current stock price, and if so let the user know the new price.
// Also data.price is given as a fixed two-decimal string, so
......@@ -361,6 +360,10 @@ if (!this.dobrado.manager) {
'/' + item.unit);
}
}
else {
$('.manager-price-info').html('Price calculated during adjustment');
}
$('#manager-price-input').attr('readonly', true);
$('#manager-quantity-input').spinner('enable');
}
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment