Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
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(total_qty);
|
||||||
|
|
||||||
if (item_row.length > 0) {
|
if (item_row.length > 0) {
|
||||||
$('.create').removeAttr("disabled", false);
|
$('.create').removeAttr("disabled", false);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -90,12 +90,14 @@ class Origami::ProductCommissionsController < BaseOrigamiController
|
|||||||
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
||||||
# @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.each do |com|
|
Commission.all.active.each do |com|
|
||||||
if com.product_code.include? @menu_item.item_code && com.is_active == true
|
if com.product_code != "[]"
|
||||||
|
if com.product_code.to_s.include? @menu_item.item_code
|
||||||
@commission = Commission.find(com.id)
|
@commission = Commission.find(com.id)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
||||||
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
||||||
if !@commission.nil? && @commissioner.commission_id == @commission.commission_id
|
if !@commission.nil? && @commissioner.commission_id == @commission.commission_id
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Commission < ApplicationRecord
|
|||||||
|
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :name, :commission_type, :amount
|
validates_presence_of :name, :commission_type, :amount
|
||||||
|
scope :active, -> {where(is_active: true)}
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
||||||
|
|||||||
@@ -255,9 +255,9 @@
|
|||||||
|
|
||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding:2px;" width="5%"></td>
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||||
<td style="padding:2px;" width="15%"></td>
|
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
|
||||||
<td style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user