update addorder
This commit is contained in:
@@ -1012,12 +1012,14 @@ $(function() {
|
|||||||
//calculate subtotal
|
//calculate subtotal
|
||||||
function calculate_sub_total(){
|
function calculate_sub_total(){
|
||||||
var total_price = 0;
|
var total_price = 0;
|
||||||
|
var total_qty = 0;
|
||||||
var taxable_amount = 0;
|
var taxable_amount = 0;
|
||||||
var item_row = $('.summary-items tbody tr');
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
$(item_row).each(function(i){
|
$(item_row).each(function(i){
|
||||||
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||||
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||||
|
total_qty += qty;
|
||||||
total_price += qty*unit_price;
|
total_price += qty*unit_price;
|
||||||
});
|
});
|
||||||
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||||
@@ -1026,6 +1028,9 @@ $(function() {
|
|||||||
$('#sub_total').empty();
|
$('#sub_total').empty();
|
||||||
$('#sub_total').append(fixed_total_price);
|
$('#sub_total').append(fixed_total_price);
|
||||||
|
|
||||||
|
$('#total_qty').empty();
|
||||||
|
$('#total_qty').append(fixed_total_price);
|
||||||
|
|
||||||
if (item_row.length > 0) {
|
if (item_row.length > 0) {
|
||||||
$('.create').removeAttr("disabled", false);
|
$('.create').removeAttr("disabled", false);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ class Origami::ProductCommissionsController < BaseOrigamiController
|
|||||||
# @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.item_code, true).take
|
# @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.item_code, true).take
|
||||||
|
|
||||||
Commission.all.active.each do |com|
|
Commission.all.active.each do |com|
|
||||||
puts com.product_code != "[]"
|
|
||||||
if com.product_code != "[]"
|
if com.product_code != "[]"
|
||||||
if com.product_code.to_s.include? @menu_item.item_code
|
if com.product_code.to_s.include? @menu_item.item_code
|
||||||
@commission = Commission.find(com.id)
|
@commission = Commission.find(com.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user