Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -1012,12 +1012,14 @@ $(function() {
|
||||
//calculate subtotal
|
||||
function calculate_sub_total(){
|
||||
var total_price = 0;
|
||||
var total_qty = 0;
|
||||
var taxable_amount = 0;
|
||||
var item_row = $('.summary-items tbody tr');
|
||||
|
||||
$(item_row).each(function(i){
|
||||
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||
total_qty += qty;
|
||||
total_price += qty*unit_price;
|
||||
});
|
||||
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||
@@ -1026,6 +1028,9 @@ $(function() {
|
||||
$('#sub_total').empty();
|
||||
$('#sub_total').append(fixed_total_price);
|
||||
|
||||
$('#total_qty').empty();
|
||||
$('#total_qty').append(total_qty);
|
||||
|
||||
if (item_row.length > 0) {
|
||||
$('.create').removeAttr("disabled", false);
|
||||
}else{
|
||||
|
||||
@@ -90,10 +90,12 @@ class Origami::ProductCommissionsController < BaseOrigamiController
|
||||
@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.all.each do |com|
|
||||
if com.product_code.include? @menu_item.item_code && com.is_active == true
|
||||
@commission = Commission.find(com.id)
|
||||
break
|
||||
Commission.all.active.each do |com|
|
||||
if com.product_code != "[]"
|
||||
if com.product_code.to_s.include? @menu_item.item_code
|
||||
@commission = Commission.find(com.id)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
||||
|
||||
@@ -10,7 +10,7 @@ class Commission < ApplicationRecord
|
||||
|
||||
# validations
|
||||
validates_presence_of :name, :commission_type, :amount
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
private
|
||||
def generate_custom_id
|
||||
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
||||
|
||||
@@ -255,9 +255,9 @@
|
||||
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td style="padding:2px;" width="5%"></td>
|
||||
<td style="padding:2px;" width="15%"></td>
|
||||
<td style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
|
||||
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user