diff --git a/app/models/menu_category.rb b/app/models/menu_category.rb index 21d95770..218bacb8 100755 --- a/app/models/menu_category.rb +++ b/app/models/menu_category.rb @@ -9,7 +9,7 @@ class MenuCategory < ApplicationRecord validates_presence_of :code, :name, :menu, :order_by validates_uniqueness_of :code - default_scope { order('name asc') } + default_scope { order('order_by asc') } scope :active, -> {where("is_available = 1")} def self.destroyCategory(menu_category) diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb index e184cd51..03e90011 100755 --- a/app/models/menu_item.rb +++ b/app/models/menu_item.rb @@ -16,7 +16,7 @@ class MenuItem < ApplicationRecord validates_presence_of :item_code, :name, :type, :min_qty,:account_id validates_uniqueness_of :item_code - default_scope { order('name asc') } + default_scope { order('item_code asc') } scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') } scope :set_menu_item, -> { where(type: 'SetMenuItem') } diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 4d0b23f2..4e4d586b 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -205,7 +205,7 @@ class ReceiptBillA5Pdf < Prawn::Document price = item.unit_price product_name = item.product_name - if show_price.to_i>0 + if !show_price.nil? && show_price.value.to_i>0 item_row(item,precision,delimiter,product_name,price,qty ,total_price) else if item.price != 0 diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 458e1780..fa923720 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -187,7 +187,7 @@ class ReceiptBillPdf < Prawn::Document total_qty = 0.0 sale_items.each do |item| # check for item not to show - show_price = Lookup.find_by_lookup_type("show_price").value + show_price = Lookup.find_by_lookup_type("show_price") sub_total += item.price #(item.qty*item.unit_price) - comment for room charges if item.status != 'Discount' && item.qty > 0 @@ -198,7 +198,7 @@ class ReceiptBillPdf < Prawn::Document price = item.unit_price product_name = item.product_name - if show_price.to_i>0 + if !show_price.nil? && show_price.value.to_i>0 item_row(item,precision,delimiter,product_name,price,qty ,total_price) else if item.price != 0 diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb index d9485b3a..64015e82 100644 --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -104,10 +104,12 @@ $(document).ready(function(){ $('#qty-update').on('click', function(){ var qty_weight = $("input[name='qty_weight']").val(); - if(parseInt(qty_weight) > parseInt(original_value)){ + if(parseInt(qty_weight) >= parseInt(original_value)){ swal("Alert!", "Not allowed over quantity", "warning"); return; } + + var remarks = $("textarea[name='remarks']").val(); var order_items_id = $(this).attr('data-id'); diff --git a/app/views/origami/dashboard/_menu.json.jbuilder b/app/views/origami/dashboard/_menu.json.jbuilder index 5fe53223..ff9721a3 100644 --- a/app/views/origami/dashboard/_menu.json.jbuilder +++ b/app/views/origami/dashboard/_menu.json.jbuilder @@ -5,7 +5,14 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M") json.valid_time_to menu.valid_time_to.strftime("%H:%M") if (menu.menu_categories) - json.categories menu.menu_categories do |category| + order_by = Lookup.find_by_lookup_type("order_by") + if !order_by.nil? && order_by.value == "name" + categories = MenuCategory.where("menu_id ='#{menu.id}'").order("name asc") + else + categories = menu.menu_categories + end + byebug + json.categories categories do |category| menu_category = MenuCategory.find_by_menu_category_id(category.id) if !menu_category.nil? @@ -25,10 +32,14 @@ if (menu.menu_categories) json.parent_id category.menu_category_id json.is_available category.is_available - + if !order_by.nil? && order_by.value == "name" + menu_items = MenuItem.find_by_menu_category_id(category.id).order("name asc") + else + menu_items = category.menu_items + end if category.menu_items - json.items category.menu_items do |item| + json.items menu_items do |item| if item.is_available json.partial! 'origami/addorders/menu_item', item: item end diff --git a/app/views/reports/commission/index.xls.erb b/app/views/reports/commission/index.xls.erb index 4ea1f2f0..6ec88072 100755 --- a/app/views/reports/commission/index.xls.erb +++ b/app/views/reports/commission/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -50,3 +57,5 @@
+ + \ No newline at end of file diff --git a/app/views/reports/credit_payment/index.xls.erb b/app/views/reports/credit_payment/index.xls.erb index ebf360a9..3eeb6f5c 100755 --- a/app/views/reports/credit_payment/index.xls.erb +++ b/app/views/reports/credit_payment/index.xls.erb @@ -1,4 +1,10 @@ - + + + + + + +
<% unless @sale_data.blank? %> @@ -38,3 +44,5 @@ <% end %>
+ + \ No newline at end of file diff --git a/app/views/reports/dailysale/index.xls.erb b/app/views/reports/dailysale/index.xls.erb index e0a5842e..0f2767c5 100755 --- a/app/views/reports/dailysale/index.xls.erb +++ b/app/views/reports/dailysale/index.xls.erb @@ -1,4 +1,10 @@ - + + + + + + +
@@ -147,4 +153,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/order_reservation/index.xls.erb b/app/views/reports/order_reservation/index.xls.erb index c674cc9b..5a3bc4ea 100755 --- a/app/views/reports/order_reservation/index.xls.erb +++ b/app/views/reports/order_reservation/index.xls.erb @@ -1,4 +1,10 @@ - + + + + + + +
@@ -129,4 +135,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/payment_method/index.xls.erb b/app/views/reports/payment_method/index.xls.erb index 73c8683b..73a53005 100755 --- a/app/views/reports/payment_method/index.xls.erb +++ b/app/views/reports/payment_method/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -108,4 +115,6 @@
-
\ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/product_sale/index.xls.erb b/app/views/reports/product_sale/index.xls.erb index 0ff60964..98885861 100644 --- a/app/views/reports/product_sale/index.xls.erb +++ b/app/views/reports/product_sale/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -81,4 +88,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/receipt_no/index.xls.erb b/app/views/reports/receipt_no/index.xls.erb index 0b6a4dd0..ff74ef5a 100755 --- a/app/views/reports/receipt_no/index.xls.erb +++ b/app/views/reports/receipt_no/index.xls.erb @@ -1,4 +1,10 @@ - + + + + + + +
@@ -103,4 +109,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/saleitem/index.xls.erb b/app/views/reports/saleitem/index.xls.erb index 82b11aef..78d0aaec 100755 --- a/app/views/reports/saleitem/index.xls.erb +++ b/app/views/reports/saleitem/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -223,4 +230,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/shiftsale/index.xls.erb b/app/views/reports/shiftsale/index.xls.erb index aa1d0231..46fe502d 100755 --- a/app/views/reports/shiftsale/index.xls.erb +++ b/app/views/reports/shiftsale/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -105,4 +112,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/reports/stock_check/index.xls.erb b/app/views/reports/stock_check/index.xls.erb index 4ea1f2f0..6ec88072 100755 --- a/app/views/reports/stock_check/index.xls.erb +++ b/app/views/reports/stock_check/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -50,3 +57,5 @@
+ + \ No newline at end of file diff --git a/app/views/reports/void_sale/index.xls.erb b/app/views/reports/void_sale/index.xls.erb index e07b60b0..587ca509 100755 --- a/app/views/reports/void_sale/index.xls.erb +++ b/app/views/reports/void_sale/index.xls.erb @@ -1,4 +1,10 @@ - + + + + + + +
@@ -63,4 +69,6 @@ <% end %>
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/reports/waste_and_spoilage/index.xls.erb b/app/views/reports/waste_and_spoilage/index.xls.erb index 48f26650..7e71fbdc 100755 --- a/app/views/reports/waste_and_spoilage/index.xls.erb +++ b/app/views/reports/waste_and_spoilage/index.xls.erb @@ -1,3 +1,10 @@ + + + + + + +
@@ -80,4 +87,6 @@
- \ No newline at end of file + + + \ No newline at end of file