From 7d5d23e5a66fe9507b7b8bde0ec412c6c475e6b5 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 10:07:31 +0630 Subject: [PATCH 01/29] Update --- app/assets/javascripts/origami.js | 16 +-- app/assets/javascripts/payment.js | 40 +++++++ .../origami/payments_controller.rb | 6 +- app/views/origami/jcb/index.html.erb | 106 +++++------------- app/views/origami/master/index.html.erb | 104 +++++------------ app/views/origami/mpu/index.html.erb | 102 +++-------------- app/views/origami/payments/show.html.erb | 5 +- .../origami/redeem_payments/index.html.erb | 39 ------- app/views/origami/visa/index.html.erb | 104 +++++------------ 9 files changed, 156 insertions(+), 366 deletions(-) create mode 100644 app/assets/javascripts/payment.js diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index fbf641df..7fbd7d8f 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -198,11 +198,11 @@ $(document).ready(function(){ var url = "origami/"+customer_id+"/get_customer/" } - $('.customer_detail').removeClass('hide'); - + $('.customer_detail').removeClass('hide'); + //Start Ajax - $.ajax({ - type: "GET", + $.ajax({ + type: "GET", url: url, data: {}, dataType: "json", @@ -212,15 +212,15 @@ $(document).ready(function(){ if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){ var balance = data["response_data"]["data"][i]["balance"]; if (data["response_data"]["status"]==true) { - $('.rebate_amount').removeClass('hide'); + $('.rebate_amount').removeClass('hide'); console.log(balance); - row = + row = '' + data["response_data"]["data"][i]["accountable_type"] +'' - +'' + balance + ''; + +'' + balance + ''; $(".rebate_amount").append(row); } - + } }); } diff --git a/app/assets/javascripts/payment.js b/app/assets/javascripts/payment.js new file mode 100644 index 00000000..b7aadf05 --- /dev/null +++ b/app/assets/javascripts/payment.js @@ -0,0 +1,40 @@ +// number key pad +$(document).on('click', '.cashier_number', function(event){ + event.stopPropagation(); + event.preventDefault(); + if(event.handled !== true) { + var original_value; + original_value = $('#amount').text(); + + var input_value = $(this).attr("data-value"); + + var input_type = $(this).attr("data-type"); + switch (input_type) { + case 'num': + if (original_value == "0.0"){ + $('#amount').text(input_value); + }else{ + $('#amount').append(input_value); + } + break; + + case 'add': + var input_value = $(this).attr("data-value"); + amount = parseInt(input_value) + parseInt(original_value); + $('#amount').html(amount); + + break; + case 'clr': + $('#amount').html("0.0"); + break; + case 'del' : + var cash=$('#amount').text(); + $('#amount').text(cash.substr(0,cash.length-1)); + break; + + } + event.handled = true; + } else { + return false; + } +}); diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 4ac519b0..a9437736 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -37,7 +37,7 @@ class Origami::PaymentsController < BaseOrigamiController 'Accept' => 'application/json' } ) - + @balance = 0.00 @accountable_type = '' if response["data"]==true @@ -45,10 +45,10 @@ class Origami::PaymentsController < BaseOrigamiController if res["accountable_type"] == "RebateAccount" @balance = res["balance"] @accountable_type = res["accountable_type"] - end + end end end - + #end customer amount @sale_data.sale_payments.each do |spay| diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index a0760b38..723b387d 100644 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -1,19 +1,25 @@ +
+
+
+

JCB

+
+
- - + +

- -
0.0
+ +
0.0

@@ -21,7 +27,7 @@
-
+
@@ -67,78 +73,26 @@
+ +
+ +
-
-
- diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb index a0760b38..d8a4faa0 100644 --- a/app/views/origami/master/index.html.erb +++ b/app/views/origami/master/index.html.erb @@ -1,19 +1,25 @@ +
+
+
+

Master

+
+
- +

- -
0.0
+ +
0.0

@@ -21,7 +27,7 @@
-
+
@@ -67,78 +73,26 @@
+ +
+ +
-
-
- diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index 3d9d1024..6ef6d279 100644 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -1,19 +1,25 @@ +
+
+
+

MPU

+
+
- +

- -
0.0
+ +
0.0

@@ -21,7 +27,7 @@
-
+
@@ -67,91 +73,11 @@
+ +
+ +
-
- -
- - - -

MPU

- - -Amount : - - - - From b7f1a0a029424b7b4bc42cf9ef8d64fe14fd0884 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 10:15:35 +0630 Subject: [PATCH 02/29] print format updating --- app/assets/javascripts/origami.js | 22 +++++++--- app/models/order.rb | 59 ++++++++++++++++++--------- app/models/sale.rb | 2 +- app/pdf/order_item_pdf.rb | 58 ++++++++++++++------------ app/pdf/order_summary_pdf.rb | 35 ++++++++-------- app/views/origami/home/index.html.erb | 38 +++++++---------- 6 files changed, 123 insertions(+), 91 deletions(-) diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 0079142f..2a618214 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -18,9 +18,13 @@ //= require jquery-ui //= require bootstrap-datepicker -$(document).ready(function(){ +$(document).ready(function(){ + // For selected order return + var order_status = ""; + order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim(); + console.log(order_status) ; // Enable/Disable Button - control_button("disabled"); + control_button(order_status); $(".orders").on('click', function(){ $("#order-sub-total").text(''); @@ -66,12 +70,15 @@ $(document).ready(function(){ for (i = 0; i < result.length; i++) { var data = JSON.stringify(result[i]); var parse_data = JSON.parse(data); + var show_date = ""; // Receipt Header receipt_no = result[i].receipt_no; cashier = result[i].cashier_name; - receipt_date = new Date(result[i].receipt_date); - show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes() + if(result[i].receipt_date != null){ + receipt_date = new Date(result[i].receipt_date); + show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes() + } $("#receipt_no").text(receipt_no); $("#cashier").text(cashier == null ? "" : cashier); @@ -274,18 +281,21 @@ $(document).ready(function(){ }); /* Button Control by Status */ -function control_button(order_status){ - if(order_status=="billed"){ +function control_button(order_status){ + if(order_status=="billed"){ + $("#customer").prop('disabled', false); $("#request_bills").prop('disabled', true); $("#discount").prop('disabled', false); $("#pay-bill").prop('disabled', false); } else if(order_status=="new") { + $("#customer").prop('disabled', false); $("#request_bills").prop('disabled', false); $("#discount").prop('disabled', true); $("#pay-bill").prop('disabled', true); } else { + $("#customer").prop('disabled', true); $("#request_bills").prop('disabled', true); $("#discount").prop('disabled', true); $("#pay-bill").prop('disabled', true); diff --git a/app/models/order.rb b/app/models/order.rb index 9a1afe5d..feb49cfa 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -228,10 +228,13 @@ class Order < ApplicationRecord bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") - .joins("left join orders on orders.order_id = booking_orders.order_id") + .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") - .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true) - .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id") + .where("(orders.status = 'new' or orders.status = 'billed')") + .group("bookings.booking_id") + # For PG + # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true + # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id end #Origami: Cashier : to view booking order Table @@ -243,7 +246,9 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("sales.sale_status='completed'") - .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id") + .group("sales.sale_id") + # For PG + #bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id end #Origami: Cashier : to view order type Room @@ -255,10 +260,12 @@ class Order < ApplicationRecord .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join orders on orders.order_id = booking_orders.order_id") - .joins("left join sale_orders on sale_orders.order_id = orders.order_id") - .joins("left join sales on sales.sale_id = sale_orders.sale_id") - .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true) - .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id") + .joins("left join sales on sales.sale_id = bookings.sale_id") + .where("(orders.status = 'new' or orders.status = 'billed')") + .group("bookings.booking_id") + # For PG + # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true + # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id end #Origami: Cashier : to view order type Room @@ -271,24 +278,36 @@ class Order < ApplicationRecord left join order_items on order_items.order_id = orders.order_id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true) .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no") - end #Origami: Cashier : to view orders def self.get_orders from = Time.now.beginning_of_day.utc to = Time.now.end_of_day.utc - orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status, - orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id - ,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") - .joins("left join booking_orders on booking_orders.order_id = orders.order_id - left join bookings on bookings.booking_id = booking_orders.order_id - left join dining_facilities on dining_facilities.id = bookings.dining_facility_id - left join order_items on order_items.order_id = orders.order_id - left join sale_orders on sale_orders.order_id = orders.order_id - left join sales on sales.sale_id = sale_orders.sale_id") - .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) - .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id") + orders=Booking.select("sales.receipt_no, sales.sale_status as sale_status, orders.status as order_status, + orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id, + bookings.booking_id,orders.customer_id as customer_id, + sales.sale_id as sale_id,dining_facilities.name as table_name") + .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") + .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") + .joins("left join orders on orders.order_id = booking_orders.order_id") + .joins("left join sales on sales.sale_id = bookings.sale_id") + .where("(orders.status = 'new' or orders.status = 'billed')") + + # orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status, + # orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id + # ,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") + # .joins("left join booking_orders on booking_orders.order_id = orders.order_id + # left join bookings on bookings.booking_id = booking_orders.order_id + # left join dining_facilities on dining_facilities.id = bookings.dining_facility_id + # left join order_items on order_items.order_id = orders.order_id + # left join sale_orders on sale_orders.order_id = orders.order_id + # left join sales on sales.sale_id = sale_orders.sale_id") + # .where("(orders.status = 'new' or orders.status = 'billed')") + # .group("orders.order_id") + # For PG + # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) + # .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id") end diff --git a/app/models/sale.rb b/app/models/sale.rb index b9ce13d2..c1e1d262 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -251,7 +251,7 @@ class Sale < ApplicationRecord if self.receipt_no.nil? prefix = DateTime.now().utc #self.receipt_no = prefix.to_s + "/" + self.shit_id.to_s + "/" + SeedGenerator.new_receipt_no().to_s - self.receipt_no = prefix.strftime("%Y%m%d") + "/" + SeedGenerator.new_receipt_no().to_s + self.receipt_no = prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s self.receipt_date = prefix Rails.logger.debug "Receipt No #{self.receipt_no} | Date #{ self.receipt_date.to_s}" diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index f322de64..24293350 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -1,15 +1,16 @@ class OrderItemPdf < Prawn::Document - attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width + attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(order_item, print_settings) - self.page_width = 300 - self.page_height = 400 + self.page_width = 254 + self.page_height = 1450 self.margin = 10 - self.price_width = 50 - self.qty_width = 50 - self.item_width = self.page_width - (self.price_width + self.qty_width) + self.price_width = 40 # No Need for item + self.qty_width = 34 + self.total_width = 40 # No Need for item + self.item_width = self.page_width - (self.qty_width + (self.margin*4)) self.item_height = 15 - self.item_description_width = self.page_width - (self.price_width + self.qty_width) - self.receipt_width=130 + self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) + self.label_width=80 super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) # super(:margin => [10, 5, 30, 5], :page_size => [200,400]) @@ -17,10 +18,10 @@ class OrderItemPdf < Prawn::Document # font "public/fonts/#{font_name}".to_s + ".ttf".to_s # font "public/fonts/Zawgyi-One.ttf" # font "public/fonts/padauk.ttf" - self.header_font_size = 12 - self.item_font_size = 10 + self.header_font_size = 14 + self.item_font_size = 12 - text "#{order_item.dining}", :size => self.header_font_size,:align => :center + text "#{order_item.dining}", :size => self.header_font_size,:align => :center, :left_margin => -20 stroke_horizontal_rule move_down 5 @@ -35,36 +36,43 @@ class OrderItemPdf < Prawn::Document def order_info(order_by, order_at) y_position = cursor - bounding_box([0,y_position], :width => self.item_width - 50, :height => self.item_height) do - text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left end - bounding_box([self.item_width - 50,y_position], :width => self.item_width + 50, :height => self.item_height) do - text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left + move_down 5 + + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left end stroke_horizontal_rule - move_down 20 + move_down 10 end # Write Order items to PDF def order_items(order_item) y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "Item", :size => self.item_font_size,:align => :left - end + # No Need for Order Item + # bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + # text "Item", :size => self.item_font_size,:align => :left + # end - bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do - text "Qty", :size => self.item_font_size,:align => :right - end + # bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do + # text "Qty", :size => self.item_font_size,:align => :right + # end - stroke_horizontal_rule - move_down 5 + # stroke_horizontal_rule + # move_down 5 #Add Order Item add_order_items(order_item) + + dash(1, :space => 1, :phase => 1) + stroke_horizontal_line 0, self.page_width + move_down 5 end # Add order items under order info @@ -78,7 +86,7 @@ class OrderItemPdf < Prawn::Document end bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do - text "#{order_item.qty}", :size => self.item_font_size,:align => :right + text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left end move_down 5 diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 63d75a78..9e3b1334 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -1,15 +1,16 @@ class OrderSummaryPdf < Prawn::Document - attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width + attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(order, print_settings) - self.page_width = 300 - self.page_height = 400 + self.page_width = 254 + self.page_height = 1450 self.margin = 10 - self.price_width = 60 - self.qty_width = 60 - self.item_width = self.page_width - (self.price_width + self.qty_width) + self.price_width = 40 # No Need for item + self.qty_width = 34 + self.total_width = 40 # No Need for item + self.item_width = self.page_width - (self.qty_width + (self.margin*4)) self.item_height = 15 - self.item_description_width = self.page_width - (self.price_width + self.qty_width) - self.receipt_width=130 + self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) + self.label_width=100 super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) @@ -19,7 +20,7 @@ class OrderSummaryPdf < Prawn::Document self.header_font_size = 12 self.item_font_size = 10 - text "#{order[0].dining}", :size => self.header_font_size,:align => :center + text "#{order[0].dining}", :size => self.header_font_size,:align => :center, :left_margin => -20 stroke_horizontal_rule move_down 5 @@ -35,17 +36,19 @@ class OrderSummaryPdf < Prawn::Document def order_info(order_by, order_at) y_position = cursor - bounding_box([0,y_position], :width => self.item_width - 20, :height => self.item_height) do - text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left end - bounding_box([self.item_width - 20,y_position], :width => self.item_width + 20, :height => self.item_height) do - text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left + move_down 5 + + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left end stroke_horizontal_rule - move_down 20 + move_down 10 end # Write Order items to PDF @@ -57,7 +60,7 @@ class OrderSummaryPdf < Prawn::Document end bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do - text "Qty", :size => self.item_font_size,:align => :right + text "Qty", :size => self.item_font_size,:align => :left end stroke_horizontal_rule @@ -79,7 +82,7 @@ class OrderSummaryPdf < Prawn::Document end bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do - text "#{odi.qty}", :size => self.item_font_size,:align => :right + text "#{odi.qty}", :size => self.item_font_size,:align => :left end end diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 24410ef8..2288dec5 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -64,14 +64,12 @@

Receipt No : - <%= cpo.receipt_no %> + <%= cpo.sale_status %>

Order Status : - - <%= cpo.order_status %> - + <%= cpo.order_status %>

@@ -84,10 +82,11 @@
-
+
<% @booking_orders.each do |bko| # No Show completed + puts bko.sale_status if bko.sale_status == 'completed' next end @@ -132,9 +131,7 @@

Order Status : - - <%= bko.order_status %> - + <%= bko.order_status %>

@@ -196,9 +193,7 @@

Order Status : - - <%= rmo.order_status %> - + <%= rmo.order_status %>

@@ -214,6 +209,7 @@
<% @orders.each do |odr| + puts odr # No Show completed if odr.sale_status == 'completed' next @@ -258,9 +254,7 @@

Order Status : - - <%= odr.order_status %> - + <%= odr.order_status %>

@@ -310,14 +304,14 @@ Price - + <% # For Sale Items sub_total = 0 if @selected_item_type == "Sale" @selected_item.sale_items.each do |sale_item| sub_total += (sale_item.qty*sale_item.unit_price) - %> + %> <%= sale_item.product_name %> <%= sale_item.qty %> @@ -329,8 +323,7 @@ %> <% - # For Order Items - sub_total = 0 + # For Order Items if @selected_item_type == "Order" @selected_item.order_items.each do |order_item| sub_total += (order_item.qty*order_item.unit_price) @@ -385,13 +378,12 @@ - - - + + - + - +
From 998b23aae543bbc811b43cb9acc97af3cd556823 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 10:27:15 +0630 Subject: [PATCH 03/29] update key --- app/views/origami/jcb/index.html.erb | 42 +++++++++++++++++++ app/views/origami/master/index.html.erb | 39 +++++++++++++++++ app/views/origami/mpu/index.html.erb | 39 +++++++++++++++++ .../origami/redeem_payments/index.html.erb | 38 +++++++++++++++++ app/views/origami/visa/index.html.erb | 39 +++++++++++++++++ 5 files changed, 197 insertions(+) diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index 723b387d..ea6ea5cc 100644 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -80,6 +80,48 @@
From 9d1aff2fa2e0ab43adf0f1b7a0a470792a0f4a73 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 10:49:00 +0630 Subject: [PATCH 07/29] other payment updated --- app/views/origami/jcb/index.html.erb | 2 +- app/views/origami/master/index.html.erb | 2 +- app/views/origami/mpu/index.html.erb | 2 +- app/views/origami/visa/index.html.erb | 2 +- config/routes.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index 924eeb0e..a1a5a2cd 100644 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -123,7 +123,7 @@ $(document).on('click', '.cashier_number', function(event){ $('#jcb_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb index a2e31257..da481022 100644 --- a/app/views/origami/master/index.html.erb +++ b/app/views/origami/master/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){ } }); $('#master_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index d6ebd1a4..10caf0b3 100644 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){ } }); $('#mpu_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb index 37f48772..72cd94aa 100644 --- a/app/views/origami/visa/index.html.erb +++ b/app/views/origami/visa/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){ } }); $('#visa_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/config/routes.rb b/config/routes.rb index a0da05ae..ee9b44a0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,7 +91,7 @@ Rails.application.routes.draw do post 'payment/mpu' => "mpu#create" post 'payment/jcb' => "jcb#create" post 'payment/master' => "master#create" - post 'payment/visa' => "master#visa" + post 'payment/visa' => "visa#create" post 'payment/paypar' => 'paypar_payments#create' get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" From 7e35850c69632d9940cf2db201503bc1d0380d2a Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 10:53:37 +0630 Subject: [PATCH 08/29] comment nokogiri gem --- Gemfile | 2 +- Gemfile.lock | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 1ac2660c..93fe2014 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ gem 'bcrypt', '~> 3.1.7' gem 'sidekiq' # XML parser -# gem 'nokogiri', '~> 1.6' +#gem 'nokogiri', '~> 1.6' # Pagination gem 'kaminari', '~> 0.16.3' diff --git a/Gemfile.lock b/Gemfile.lock index a4441893..e96c8ee0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -250,6 +250,7 @@ DEPENDENCIES kaminari (~> 0.16.3) listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) + nokogiri (~> 1.6) pg prawn prawn-table From 7b2d2731c1c9edf76c54afc63d5f327e85f9b364 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 11:05:15 +0630 Subject: [PATCH 09/29] auth --- app/controllers/home_controller.rb | 6 +++++- db/seeds.rb | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c3dba58b..e84aef30 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -10,9 +10,13 @@ class HomeController < ApplicationController @login_form.emp_id = params[:login_form][:emp_id] @login_form.password = params[:login_form][:password] @employee = Employee.login(@login_form.emp_id, @login_form.password) - if @employee + puts @employee.role + if @employee.role == "administrator" session[:session_token] = @employee.token_session redirect_to dashboard_path + elsif @employee.role == "cashier" + session[:session_token] = @employee.token_session + redirect_to origami_root_path else render :index end diff --git a/db/seeds.rb b/db/seeds.rb index a7fdc416..e834c9f6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -136,8 +136,8 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o #Create Adminstrator employee -admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) -admin_employee = Employee.create({name: "Waiter", role: "Waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) +admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) +admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"}) order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"}) request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"}) From 7d7ac9fe06fd6064ba791ad9c021d5d779962f59 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 11:21:37 +0630 Subject: [PATCH 10/29] oqs print formatted --- app/pdf/order_item_pdf.rb | 2 +- app/pdf/order_summary_pdf.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 24293350..01c60ef0 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -41,7 +41,7 @@ class OrderItemPdf < Prawn::Document end move_down 5 - + y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left end diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 9e3b1334..3ff6663e 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -41,7 +41,7 @@ class OrderSummaryPdf < Prawn::Document end move_down 5 - + y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left end From 5cff9c891baea88a410430e1383a6d72e0218239 Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 12:02:52 +0630 Subject: [PATCH 11/29] Other Payment shown by type --- .../origami/payments_controller.rb | 5 ++++- app/views/origami/payments/show.html.erb | 20 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index a9437736..97d08547 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -19,6 +19,7 @@ class Origami::PaymentsController < BaseOrigamiController if Sale.exists?(sale_id) @cash = 0.0 @other = 0.0 + @ppamount = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) #get customer amount @@ -55,8 +56,10 @@ class Origami::PaymentsController < BaseOrigamiController if spay.payment_method == "cash" @cash = spay.payment_amount end - if spay.payment_method == "mpu" || spay.payment_method == "paypar" + if spay.payment_method == "mpu" @other += spay.payment_amount + elsif spay.payment_method == "paypar" + @ppamount += spay.payment_amount end end end diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 490ec341..b9c2fdbf 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -102,8 +102,24 @@

-
Others Payment
-
<%= @other %>
+
+ <% if @other != 0.0 %> +
+
MPU
+
<%= @other %>
+
+ <% elsif @ppamount != 0.0 %> +
+
Paypar
+
<%= @ppamount %>
+
+ <% else %> +
+
Others Payment
+
<%= @ppamount %>
+
+ <% end %> +

From f7451a46754cf1bd1ab83eda1101fc30321c4d9c Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 13:33:09 +0630 Subject: [PATCH 12/29] update --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 36be43b7..6c3703d2 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ gem 'to_xls-rails' #Reporting gem #gem 'compendium' - +#gem "cancan" # Use jquery as the JavaScript library gem 'jquery-rails' gem 'jquery-ui-rails' From cd588d9b4fe1d9e9f6c1569fd55b39c5e247f5c1 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 14:37:23 +0630 Subject: [PATCH 13/29] print setting ui updated --- app/views/print_settings/_form.html.erb | 1 + app/views/print_settings/edit.html.erb | 15 +++- app/views/print_settings/index.html.erb | 94 ++++++++++++---------- app/views/print_settings/new.html.erb | 16 +++- app/views/print_settings/show.html.erb | 8 +- app/views/settings/employees/edit.html.erb | 14 ++-- app/views/settings/employees/new.html.erb | 14 ++-- 7 files changed, 96 insertions(+), 66 deletions(-) diff --git a/app/views/print_settings/_form.html.erb b/app/views/print_settings/_form.html.erb index e6ed306b..c5166103 100644 --- a/app/views/print_settings/_form.html.erb +++ b/app/views/print_settings/_form.html.erb @@ -18,5 +18,6 @@
<%= f.button :submit %> + <%= link_to 'Back', print_settings_path, :class => "btn btn-default" %>
<% end %> diff --git a/app/views/print_settings/edit.html.erb b/app/views/print_settings/edit.html.erb index fdae5f78..362dce39 100644 --- a/app/views/print_settings/edit.html.erb +++ b/app/views/print_settings/edit.html.erb @@ -1,6 +1,13 @@ -

Editing Print Setting

+
+ + <%= render 'form', print_setting: @print_setting %> +
+
-<%= render 'form', print_setting: @print_setting %> -<%= link_to 'Show', @print_setting %> | -<%= link_to 'Back', print_settings_path %> diff --git a/app/views/print_settings/index.html.erb b/app/views/print_settings/index.html.erb index 32d3dead..0db16892 100644 --- a/app/views/print_settings/index.html.erb +++ b/app/views/print_settings/index.html.erb @@ -1,49 +1,55 @@

<%= notice %>

+ -

Print Settings

- - - - - - - - - - - - - - - - - - - - - - <% @print_settings.each do |print_setting| %> +
+
+
NameUnique codeTemplateDb nameDb typeDb usernameDb passwordPrinter nameApi settingsPage widthPage heightPrint copies
+ - - - - - - - - - - - - - - - + + + + + + + + + + - <% end %> - -
<%= print_setting.name %><%= print_setting.unique_code %><%= print_setting.template %><%= print_setting.db_name %><%= print_setting.db_type %><%= print_setting.db_username %><%= print_setting.db_password %><%= print_setting.printer_name %><%= print_setting.api_settings %><%= print_setting.page_width %><%= print_setting.page_height %><%= print_setting.print_copies %><%= link_to 'Show', print_setting %><%= link_to 'Edit', edit_print_setting_path(print_setting) %><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %>NameUnique codeTemplatePrinter nameApi settingsPage widthPage heightPrint copies
+ -
- -<%= link_to 'New Print Setting', new_print_setting_path %> + + <% @print_settings.each do |print_setting| %> + + <%= print_setting.name %> + <%= print_setting.unique_code %> + <%= print_setting.template %> + + <%= print_setting.printer_name %> + <%= print_setting.api_settings %> + <%= print_setting.page_width %> + <%= print_setting.page_height %> + <%= print_setting.print_copies %> + <%= link_to 'Show', print_setting %> + <%= link_to 'Edit', edit_print_setting_path(print_setting) %> + <%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %> + + <% end %> + + +
diff --git a/app/views/print_settings/new.html.erb b/app/views/print_settings/new.html.erb index 810ad9c9..2521a16b 100644 --- a/app/views/print_settings/new.html.erb +++ b/app/views/print_settings/new.html.erb @@ -1,5 +1,15 @@ -

New Print Setting

+
+ + <%= render 'form', print_setting: @print_setting %> +
+
+ + -<%= render 'form', print_setting: @print_setting %> -<%= link_to 'Back', print_settings_path %> diff --git a/app/views/print_settings/show.html.erb b/app/views/print_settings/show.html.erb index 12d15696..b15e4650 100644 --- a/app/views/print_settings/show.html.erb +++ b/app/views/print_settings/show.html.erb @@ -1,5 +1,11 @@

<%= notice %>

- +

Name: <%= @print_setting.name %> diff --git a/app/views/settings/employees/edit.html.erb b/app/views/settings/employees/edit.html.erb index 6948734c..a6c0a4aa 100644 --- a/app/views/settings/employees/edit.html.erb +++ b/app/views/settings/employees/edit.html.erb @@ -1,11 +1,11 @@

- + <%= render 'form', employee: @employee %>
diff --git a/app/views/settings/employees/new.html.erb b/app/views/settings/employees/new.html.erb index 7c6498f5..430df9f2 100644 --- a/app/views/settings/employees/new.html.erb +++ b/app/views/settings/employees/new.html.erb @@ -1,11 +1,11 @@
- + <%= render 'form', employee: @employee %>
From af623cb474c5bf0e85db2624ea54a8ccdf468632 Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 15:01:36 +0630 Subject: [PATCH 14/29] Instances Name Show --- app/views/settings/set_menu_items/show.html.erb | 2 ++ app/views/settings/simple_menu_items/show.html.erb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/views/settings/set_menu_items/show.html.erb b/app/views/settings/set_menu_items/show.html.erb index ba23771f..a5762fc3 100644 --- a/app/views/settings/set_menu_items/show.html.erb +++ b/app/views/settings/set_menu_items/show.html.erb @@ -116,6 +116,7 @@ item_instance_code + item_instance_name item_attributes price is_on_promotion @@ -131,6 +132,7 @@ <%= settings_menu_item.item_instance_code %> + <%= settings_menu_item.item_instance_name %> <%= settings_menu_item.item_attributes %> <%= settings_menu_item.price %> <%= settings_menu_item.is_on_promotion %> diff --git a/app/views/settings/simple_menu_items/show.html.erb b/app/views/settings/simple_menu_items/show.html.erb index 11620acd..9bfae1b0 100644 --- a/app/views/settings/simple_menu_items/show.html.erb +++ b/app/views/settings/simple_menu_items/show.html.erb @@ -122,6 +122,7 @@ item_instance_code + Instances Name item_attributes price is_on_promotion @@ -138,6 +139,7 @@ <%= settings_menu_item.item_instance_code %> + <%= settings_menu_item.item_instance_name %> <%= settings_menu_item.item_attributes %> <%= settings_menu_item.price %> <%= settings_menu_item.is_on_promotion %> From c1e8f3ffb2eccaa7b98ad0d5bba690b05a3f2beb Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 15:30:28 +0630 Subject: [PATCH 15/29] updated printer for each stations --- app/controllers/oqs/print_controller.rb | 10 ++++++++-- app/models/printer/order_queue_printer.rb | 12 ++++++------ app/pdf/order_item_pdf.rb | 2 +- app/pdf/order_summary_pdf.rb | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 1731f69c..ecbc94e7 100644 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -6,10 +6,13 @@ class Oqs::PrintController < ApplicationController assigned_item=AssignedOrderItem.find(assigned_item_id) assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + # printer for each stations + printer_name = assigned_item.order_queue_station.printer_name + # print when complete click print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_item(print_settings,assigned_item.order_id, assigned_item.item_code ) + order_queue_printer.print_order_item(printer_name,assigned_item.order_id, assigned_item.item_code ) # update print status for completed same order items assigned_items.each do |ai| @@ -25,10 +28,13 @@ class Oqs::PrintController < ApplicationController assigned_item=AssignedOrderItem.find(assigned_item_id) assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + # printer for each stations + printer_name = assigned_item.order_queue_station.printer_name + # print when complete click print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_summary(print_settings,assigned_item.order_id) + order_queue_printer.print_order_summary(printer_name,assigned_item.order_id) # update print status for completed same order items assigned_items.each do |ai| diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 9c928593..9b3f5205 100644 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -1,25 +1,25 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker - def print_order_item(printer_settings,order_id, item_code) + def print_order_item(printer_name,order_id, item_code) #Use CUPS service #Generate PDF #Print order_item= print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code) - pdf = OrderItemPdf.new(order_item[0],printer_settings) + pdf = OrderItemPdf.new(order_item[0]) pdf.render_file "tmp/receipt.pdf" - self.print("tmp/receipt.pdf") + self.print("tmp/receipt.pdf", printer_name) end - def print_order_summary(printer_settings,order_id) + def print_order_summary(printer_name,order_id) #Use CUPS service #Generate PDF #Print order=print_query('order_summary',order_id) filename = "tmp/order_summary_#{order_id}" + ".pdf" - pdf = OrderSummaryPdf.new(order,printer_settings) + pdf = OrderSummaryPdf.new(order) pdf.render_file filename - self.print(filename) + self.print(filename, printer_name) end # Query for OQS with status diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 01c60ef0..96008dfd 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -1,6 +1,6 @@ class OrderItemPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width - def initialize(order_item, print_settings) + def initialize(order_item) self.page_width = 254 self.page_height = 1450 self.margin = 10 diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 3ff6663e..47c1f6a5 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -1,6 +1,6 @@ class OrderSummaryPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width - def initialize(order, print_settings) + def initialize(order) self.page_width = 254 self.page_height = 1450 self.margin = 10 From 7d6414cce6e7961f861c3dcf7cf41e0aab3e064b Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 15:59:08 +0630 Subject: [PATCH 16/29] auto reload page for oqs 5sec and origami 10sec --- app/assets/javascripts/OQS.js | 12 ++++++++++-- app/assets/javascripts/origami.js | 11 ++++++++--- app/assets/stylesheets/OQS.scss | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 2cddf699..cb0b997a 100644 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -17,6 +17,11 @@ //= require cable $(document).ready(function(){ + // auto refresh every 5 seconds + setTimeout(function(){ + window.location.reload(1); + }, 5000); + $('.queue_station').on('click',function(){ var orderZone=$(this).children().children().children('.order-zone').text(); var orderItem=$(this).children().children().children('.order-item').text(); @@ -39,7 +44,8 @@ $(document).ready(function(){ }); // complete for queue item - $('.order-complete').on('click',function(){ + $('.order-complete').on('click',function(e){ + //e.preventDefault(); var _self = $(this); // To know in ajax return var assigned_item_id=$(this).attr('id').substr(15); var params = { 'id':assigned_item_id }; @@ -72,8 +78,10 @@ $(document).ready(function(){ $("#completed_count").text(parseInt($("#completed_count").text()) + data.length); alert("updated!"); + // Page reload + location.reload(); } - }); + }); }); $('#print_order_item').on('click',function(){ diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index b5bcb827..9e967e54 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -18,11 +18,16 @@ //= require jquery-ui //= require bootstrap-datepicker -$(document).ready(function(){ +$(document).ready(function(){ + // auto refresh every 10 seconds + setTimeout(function(){ + window.location.reload(1); + }, 10000); + // For selected order return var order_status = ""; - order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim(); - console.log(order_status) ; + order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim(); + // Enable/Disable Button control_button(order_status); diff --git a/app/assets/stylesheets/OQS.scss b/app/assets/stylesheets/OQS.scss index 07c98b85..b516836a 100644 --- a/app/assets/stylesheets/OQS.scss +++ b/app/assets/stylesheets/OQS.scss @@ -16,5 +16,6 @@ } .selected-item { + color: #fff !important; background-color: blue; } From f00bd9df37adc632f8fa2bb642f609c40b83d601 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 16:06:11 +0630 Subject: [PATCH 17/29] update --- app/controllers/api/invoices_controller.rb | 4 ++-- app/controllers/api/memberships_controller.rb | 4 ++-- app/controllers/api/payments_controller.rb | 22 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/controllers/api/invoices_controller.rb b/app/controllers/api/invoices_controller.rb index 7d6e2cb7..aedfc9f7 100644 --- a/app/controllers/api/invoices_controller.rb +++ b/app/controllers/api/invoices_controller.rb @@ -1,6 +1,6 @@ class Api::InvoicesController < ActionController::API - before :authenticate_token - before :set_sale_params, only:[:show, :update, :destroy] + # before :authenticate_token + # before :set_sale_params, only:[:show, :update, :destroy] #List open invoices for today. def index diff --git a/app/controllers/api/memberships_controller.rb b/app/controllers/api/memberships_controller.rb index 210a4ca0..ea5b5279 100644 --- a/app/controllers/api/memberships_controller.rb +++ b/app/controllers/api/memberships_controller.rb @@ -1,7 +1,7 @@ class Api::MembershipsController < ActionController::API - before :authenticate_token + #before :authenticate_token + - #Add Membership to invoice def create diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index 2c2d219b..39219c6b 100644 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -29,56 +29,56 @@ class Api::PaymentsController < ActionController::API #:received_amount, :card_payment_reference, :vochure_no, :giftcard_no, #:customer_id, :external_payment_status - switch (payment_method) - case "cash" + case payment_method + when "cash" sale_payment.payment_method = "cash" sale_payment.received_amount = params[:amount] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "creditnote" + when "creditnote" sale_payment.payment_method = "creditnote" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "visa" + when "visa" sale_payment.payment_method = "visa" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "master" + when "master" sale_payment.payment_method = "master" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "jcb" + when "jcb" sale_payment.payment_method = "jcb" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "mpu" + when "mpu" sale_payment.payment_method = "mpu" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "unionpay" + when "unionpay" sale_payment.payment_method = "unionpay" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "vochure" + when "vochure" sale_payment.payment_method = "vochure" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] sale_payment.payment_reference = params[:vochure_no] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "giftcard" + when "giftcard" sale_payment.payment_method = "giftcard" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] sale_payment.payment_reference = params[:giftcard_no] @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) - case "paypar" + when "paypar" sale_payment.payment_method = "paypar" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] From 41e9aec389bb403247a541e335c5ff7e7ab307cc Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 16:51:25 +0630 Subject: [PATCH 18/29] add cashier in sale and origami ui updated --- app/assets/javascripts/origami.js | 4 -- app/controllers/origami/home_controller.rb | 3 +- .../origami/request_bills_controller.rb | 2 +- app/models/order.rb | 2 +- app/models/sale.rb | 7 +- app/views/origami/home/index.html.erb | 72 +++++++++---------- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 9e967e54..83646c92 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -47,10 +47,6 @@ $(document).ready(function(){ // Enable/Disable Button control_button(order_status); - //for customer button - $("#customer").removeAttr('disabled'); - - var customer_id=$(this).find(".customer-id").text(); show_customer_details(customer_id); diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 22c0c119..3f453565 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -11,8 +11,7 @@ class Origami::HomeController < BaseOrigamiController @selected_item = Order.find(params[:booking_id]) @selected_item_type="Order" end - end - puts params[:booking_id] + end @completed_orders = Order.get_completed_order() @booking_orders = Order.get_booking_order_table() diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 58ba0b11..b6bfdfaa 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -9,7 +9,7 @@ class Origami::RequestBillsController < BaseOrigamiController check_booking = Booking.find_by_booking_id(booking_id) if check_booking.sale_id.nil? # Create Sale if it doesn't exist - @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name) + @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee) @sale_data = Sale.find_by_sale_id(@sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_id) else diff --git a/app/models/order.rb b/app/models/order.rb index 397bd2f3..aa6cb26f 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -239,7 +239,7 @@ class Order < ApplicationRecord #Origami: Cashier : to view booking order Table def self.get_completed_order - completed_orders = Booking.select("sales.receipt_no,orders.status as order_status,orders.order_id, + completed_orders = Booking.select("sales.receipt_no, sales.sale_status, orders.status as order_status,orders.order_id, bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") diff --git a/app/models/sale.rb b/app/models/sale.rb index 5adb8a33..426ece2d 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -56,7 +56,12 @@ class Sale < ApplicationRecord #Default Tax - Values self.tax_type = "exclusive" - self.requested_by = requested_by + # set cashier by current login + self.cashier_id = requested_by.id + self.cashier_name = requested_by.name + + + self.requested_by = requested_by.name self.requested_at = DateTime.now.utc Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}" diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 43ee0ada..09d9b7ef 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -31,28 +31,28 @@ customer_id = "" # For CSS- Class for Order? Sale? - sale_status="" - if cpo.order_status == 'new' - unique_id=cpo.booking_id + # sale_status="" + # if cpo.order_status == 'new' + # unique_id=cpo.booking_id - customer_id=cpo.order_customer_id - # check selected item and assign - if @selected_item != nil - if cpo.order_id == @selected_item.order_id - sale_status = sale_status + " selected-item" - end - end - else - unique_id=cpo.sale_id - customer_id=cpo.sale_customer_id - sale_status="paid" - # check selected item and assign - if @selected_item != nil - if unique_id == @selected_item.sale_id - sale_status = sale_status + " selected-item" - end + # customer_id=cpo.order_customer_id + # # check selected item and assign + # if @selected_item_type == "Sale" + # if cpo.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end + # else + unique_id=cpo.sale_id + customer_id=cpo.sale_customer_id + sale_status="paid" + # check selected item and assign + if @selected_item != nil + if unique_id == @selected_item.sale_id + sale_status = sale_status + " selected-item" end end + # end %>
@@ -64,12 +64,12 @@

Receipt No : - <%= cpo.sale_status %> + <%= cpo.receipt_no %>

Order Status : - <%= cpo.order_status %> + <%= cpo.sale_status %>

@@ -100,11 +100,11 @@ unique_id=bko.booking_id customer_id=bko.order_customer_id # check selected item and assign - if !@selected_item.nil? - if bko.order_id == @selected_item.order_id - sale_status = sale_status + " selected-item" - end - end + # if @selected_item != nil + # if bko.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end else unique_id=bko.sale_id customer_id=bko.sale_customer_id @@ -162,11 +162,11 @@ unique_id=rmo.booking_id customer_id=rmo.order_customer_id # check selected item and assign - if @selected_item != nil - if rmo.order_id == @selected_item.order_id - sale_status = sale_status + " selected-item" - end - end + # if @selected_item != nil + # if rmo.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end else unique_id=rmo.sale_id customer_id=rmo.sale_customer_id @@ -223,11 +223,11 @@ if odr.order_status == 'new' unique_id=odr.booking_id customer_id = odr.order_customer_id - if @selected_item != nil - if odr.order_id == @selected_item.order_id - sale_status = sale_status + " selected-item" - end - end + # if @selected_item != nil + # if odr.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end else unique_id=odr.sale_id customer_id = odr.sale_customer_id From 3b99016f80fdffcb60f2b8356533e5c7a5b7b3d3 Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 17:13:43 +0630 Subject: [PATCH 19/29] Limit paid amount for JCB, Visa and Master Card --- app/controllers/origami/jcb_controller.rb | 15 +++ app/controllers/origami/master_controller.rb | 14 +++ app/controllers/origami/mpu_controller.rb | 15 +++ .../origami/payments_controller.rb | 9 ++ app/controllers/origami/visa_controller.rb | 14 +++ app/views/origami/jcb/index.html.erb | 43 ++++++--- app/views/origami/master/index.html.erb | 23 ++++- app/views/origami/mpu/index.html.erb | 43 ++++++--- app/views/origami/payments/show.html.erb | 91 +++++++++++++++---- .../origami/redeem_payments/index.html.erb | 22 ++++- app/views/origami/visa/index.html.erb | 23 ++++- 11 files changed, 264 insertions(+), 48 deletions(-) diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index b13790c3..5bed3470 100644 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -2,6 +2,21 @@ class Origami::JcbController < BaseOrigamiController def index @sale_id = params[:sale_id] + + # limit jcb_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @jcbcount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "jcb" + @jcbcount = @jcbcount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_jcb = total - @jcbcount - others + end def create diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index 714d4b6a..67107167 100644 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -2,6 +2,20 @@ class Origami::MasterController < BaseOrigamiController def index @sale_id = params[:sale_id] + + # limit master_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @mastercount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "master" + @mastercount = @mastercount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_master = total - @mastercount - others end def create diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 263e55f7..3707d1f4 100644 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -2,6 +2,21 @@ class Origami::MpuController < BaseOrigamiController def index @sale_id = params[:sale_id] + + # limit mpu_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @mpucount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "mpu" + @mpucount = @mpucount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_mpu = total - @mpucount - others + end def create diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 97d08547..7eb93d92 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -20,6 +20,9 @@ class Origami::PaymentsController < BaseOrigamiController @cash = 0.0 @other = 0.0 @ppamount = 0.0 + @visacount= 0.0 + @jcbcount= 0.0 + @mastercount = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) #get customer amount @@ -60,6 +63,12 @@ class Origami::PaymentsController < BaseOrigamiController @other += spay.payment_amount elsif spay.payment_method == "paypar" @ppamount += spay.payment_amount + elsif spay.payment_method == "visa" + @visacount += spay.payment_amount + elsif spay.payment_method == "jcb" + @jcbcount += spay.payment_amount + elsif spay.payment_method == "master" + @mastercount += spay.payment_amount end end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index 05f475a9..3cb8cabb 100644 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -2,6 +2,20 @@ class Origami::VisaController < BaseOrigamiController def index @sale_id = params[:sale_id] + + # limit visa_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @visacount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "visa" + @visacount = @visacount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_visa = total - @visacount - others end def create diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index a1a5a2cd..6d08b25a 100644 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -9,6 +9,22 @@
+
+
+ + +
+
+
+ <% if @jcbcount != 0 %> +
+
+ + +
+
+
+ <% end %>
@@ -75,7 +91,7 @@
- +
@@ -125,16 +141,19 @@ $(document).on('click', '.cashier_number', function(event){ $('#jcb_pay').on('click',function(){ var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; - - $.ajax({type: "POST", - url: "<%= origami_payment_jcb_path %>", - data: "amount="+ amount + "&sale_id="+ sale_id, - success:function(result){ - if(result){ - alert("Payment success") - window.location.href = '/origami/sale/'+ sale_id + "/payment"; - } - } - }); + if(parseFloat(amount) <= "<%= @can_jcb %>"){ + $.ajax({type: "POST", + url: "<%= origami_payment_jcb_path %>", + data: "amount="+ amount + "&sale_id="+ sale_id, + success:function(result){ + if(result){ + alert("Payment success") + window.location.href = '/origami/sale/'+ sale_id + "/payment"; + } + } + }); + }else{ + alert("Paid Amount is over!"); + } }) diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb index da481022..5767ad0f 100644 --- a/app/views/origami/master/index.html.erb +++ b/app/views/origami/master/index.html.erb @@ -9,6 +9,22 @@
+
+
+ + +
+
+
+ <% if @mastercount != 0 %> +
+
+ + +
+
+
+ <% end %>
@@ -75,7 +91,7 @@
- +
@@ -122,7 +138,7 @@ $(document).on('click', '.cashier_number', function(event){ $('#master_pay').on('click',function(){ var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; - + if(parseFloat(amount) <= "<%= @can_master %>"){ $.ajax({type: "POST", url: "<%= origami_payment_master_path %>", data: "amount="+ amount + "&sale_id="+ sale_id, @@ -133,5 +149,8 @@ $(document).on('click', '.cashier_number', function(event){ } } }); + }else{ + alert("Paid Amount is over!"); + } }) diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index 10caf0b3..f58ca552 100644 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -9,6 +9,22 @@
+
+
+ + +
+
+
+ <% if @mpucount != 0 %> +
+
+ + +
+
+
+ <% end %>
@@ -75,7 +91,7 @@
- +
@@ -122,16 +138,19 @@ $(document).on('click', '.cashier_number', function(event){ $('#mpu_pay').on('click',function(){ var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; - - $.ajax({type: "POST", - url: "<%= origami_payment_mpu_path %>", - data: "amount="+ amount + "&sale_id="+ sale_id, - success:function(result){ - if(result){ - alert("Payment success") - window.location.href = '/origami/sale/'+ sale_id + "/payment"; - } - } - }); + if(parseFloat(amount) <= "<%= @can_mpu %>"){ + $.ajax({type: "POST", + url: "<%= origami_payment_mpu_path %>", + data: "amount="+ amount + "&sale_id="+ sale_id, + success:function(result){ + if(result){ + alert("Payment success") + window.location.href = '/origami/sale/'+ sale_id + "/payment"; + } + } + }); + }else{ + alert("Paid Amount is over!") + } }) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index b9c2fdbf..eb5d3c67 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -102,23 +102,76 @@

-
- <% if @other != 0.0 %> -
-
MPU
-
<%= @other %>
+
Other Payment
+
+
+ + <% if @other != 0.0 %> +
+
MPU
+
<%= @other %>
+
+ <% else %> + + <% end %> + + <% if @ppamount != 0.0 %> +
+
Paypar
+
<%= @ppamount %>
+
+ <% else %> + + <% end %> + + <% if @visacount != 0.0 %> +
+
Visa
+
<%= @visacount %>
+
+ <% else %> + + <% end %> + + <% if @jcbcount != 0.0 %> +
+
JCB
+
<%= @jcbcount %>
+
+ <% else %> + + <% end %> + + <% if @mastercount != 0.0 %> +
+
Master
+
<%= @mastercount %>
+
+ <% else %> + + <% end %> + <% if @other == 0.0 && @ppamount == 0.0 %> +
+
+
<%= @ppamount %>
+
+ <% end %>
- <% elsif @ppamount != 0.0 %> -
-
Paypar
-
<%= @ppamount %>
-
- <% else %> -
-
Others Payment
-
<%= @ppamount %>
-
- <% end %>

@@ -275,8 +328,12 @@ function update_balance(){ var cash = $('#cash').text(); var credit = $('#credit').text(); var card = $('#others').text(); + var paypar = $('#ppamount').text(); + var visa = $('#visacount').text(); + var jcb = $('#jcbcount').text(); + var master = $('#mastercount').text(); var amount_due = $('#amount_due').text(); - var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) var result = amount_due - total; $('#balance').text(result.toFixed(2)); } diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb index 4d0ab223..0991e562 100644 --- a/app/views/origami/redeem_payments/index.html.erb +++ b/app/views/origami/redeem_payments/index.html.erb @@ -5,7 +5,23 @@
- + + +
+
+
+ <% if @payparcount > 0 %> +
+
+ + +
+
+
+ <% end %> +
+
+

@@ -19,10 +35,10 @@
- <% if @payparcount > 0 %> +
diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb index 72cd94aa..e01ca696 100644 --- a/app/views/origami/visa/index.html.erb +++ b/app/views/origami/visa/index.html.erb @@ -9,6 +9,22 @@
+
+
+ + +
+
+
+ <% if @visacount != 0 %> +
+
+ + +
+
+
+ <% end %>
@@ -75,7 +91,7 @@
- +
@@ -122,7 +138,7 @@ $(document).on('click', '.cashier_number', function(event){ $('#visa_pay').on('click',function(){ var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; - + if(parseFloat(amount) <= "<%= @can_visa %>"){ $.ajax({type: "POST", url: "<%= origami_payment_visa_path %>", data: "amount="+ amount + "&sale_id="+ sale_id, @@ -133,5 +149,8 @@ $(document).on('click', '.cashier_number', function(event){ } } }); + }else{ + alert("Paid Amount is over!"); + } }) From d970cfc8bdcdc7f8da584dbb675a6a64e16e882c Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 17:58:38 +0630 Subject: [PATCH 20/29] Other Payments UI change --- app/views/origami/payments/show.html.erb | 152 ++++++++++++----------- 1 file changed, 80 insertions(+), 72 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index eb5d3c67..230e8a5a 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -101,79 +101,87 @@
0.0

-
-
Other Payment
-
-
- - <% if @other != 0.0 %> -
-
MPU
-
<%= @other %>
-
- <% else %> - - <% end %> - - <% if @ppamount != 0.0 %> -
-
Paypar
-
<%= @ppamount %>
-
- <% else %> - - <% end %> - - <% if @visacount != 0.0 %> -
-
Visa
-
<%= @visacount %>
-
- <% else %> - - <% end %> - - <% if @jcbcount != 0.0 %> -
-
JCB
-
<%= @jcbcount %>
-
- <% else %> - - <% end %> - - <% if @mastercount != 0.0 %> -
-
Master
-
<%= @mastercount %>
-
- <% else %> - - <% end %> - <% if @other == 0.0 && @ppamount == 0.0 %> -
-
-
<%= @ppamount %>
-
- <% end %> -
+ <% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%> +
+
Other Payments
+
<%= @other %>
-
+ <% else %> +
+
Other Payments
+
+ <% end %> + + + <% if @other != 0.0 %> +
+
+
MPU
+
<%= @other %>
+
+ <% else %> + + <% end %> + + <% if @ppamount != 0.0 %> +
+
+
Paypar
+
<%= @ppamount %>
+
+ <% else %> + + <% end %> + + <% if @visacount != 0.0 %> +
+
+
Visa
+
<%= @visacount %>
+
+ <% else %> + + <% end %> + + <% if @jcbcount != 0.0 %> +
+
+
JCB
+
<%= @jcbcount %>
+
+ <% else %> + + <% end %> + + <% if @mastercount != 0.0 %> +
+
+
Master
+
<%= @mastercount %>
+
+ <% else %> + + <% end %>
Balance
From dd9863025f33b9d45464c11dfd9e17c42dc9611c Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 18:15:01 +0630 Subject: [PATCH 21/29] prepare for payment bill --- app/assets/javascripts/origami.js | 4 +-- .../origami/payments_controller.rb | 31 ++++++++++--------- .../origami/request_bills_controller.rb | 6 ++-- app/views/transactions/sales/show.html.erb | 13 ++++---- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 1b06e381..ca54f6f6 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -19,10 +19,10 @@ //= require bootstrap-datepicker $(document).ready(function(){ - // auto refresh every 10 seconds + // auto refresh every 60 seconds setTimeout(function(){ window.location.reload(1); - }, 10000); + }, 60000); // For selected order return var order_status = ""; diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 97d08547..7ba72486 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -11,6 +11,21 @@ class Origami::PaymentsController < BaseOrigamiController saleObj = Sale.find(sale_id) sale_payment = SalePayment.new sale_payment.process_payment(saleObj, @user, cash, "cash") + + unique_code = "ReceiptBillPdf" + customer= Customer.where('customer_id=' + saleObj.customer_id) + + # get member information + response = get_member_information(customer, "get_all_member_account") + + # get printer info + print_settings=PrintSetting.find_by_unique_code(unique_code) + + # Calculate Food and Beverage Total + food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items) + + printer = Printer::ReceiptPrinter.new(print_settings) + printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total) end end @@ -25,19 +40,8 @@ class Origami::PaymentsController < BaseOrigamiController #get customer amount @customer = Customer.find(@sale_data.customer_id) - membership = MembershipSetting.find_by_membership_type("paypar_url") - - memberaction = MembershipAction.find_by_membership_type("get_all_member_account") - merchant_uid = memberaction.merchant_account_id.to_s - auth_token = memberaction.auth_token.to_s - url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - - response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - } - ) + # get member information + response = get_member_information(@customer, "get_all_member_account") @balance = 0.00 @accountable_type = '' @@ -64,5 +68,4 @@ class Origami::PaymentsController < BaseOrigamiController end end end - end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index b6bfdfaa..5239d121 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -1,6 +1,5 @@ class Origami::RequestBillsController < BaseOrigamiController - - + # Print Request Bill and add to sale tables def print @sale = Sale.new sale_order=SaleOrder.new @@ -20,10 +19,11 @@ class Origami::RequestBillsController < BaseOrigamiController unique_code = "ReceiptBillPdf" customer= Customer.where('customer_id=' + @sale_data.customer_id) + # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) # find order id by sale id - sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id) + # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id) # Calculate Food and Beverage Total food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items) diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb index a96c63db..3ff7557e 100644 --- a/app/views/transactions/sales/show.html.erb +++ b/app/views/transactions/sales/show.html.erb @@ -167,16 +167,17 @@
From 109d1b643523811d5655ea1baa8de45f9af1f86f Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 18:56:11 +0630 Subject: [PATCH 22/29] update --- app/forms/shop_form.rb | 8 ++++---- app/pdf/receipt_bill_pdf.rb | 14 ++++++-------- app/reports/menu_report.rb | 10 +++++----- app/views/kaminari/_paginator.html.erb | 12 ++++++------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/app/forms/shop_form.rb b/app/forms/shop_form.rb index 19af84a5..179e73fd 100644 --- a/app/forms/shop_form.rb +++ b/app/forms/shop_form.rb @@ -1,7 +1,7 @@ #Form object to use during the installation process - will handle creation of shop model into db after verification from the cloud #provising service through license verification -class ShopForm < ActiveModel - :attr_accessor :logo, :name, :address, :township, :city, :state, :country, :license, :base_currency, :password, :password_confirmation - -end +# class ShopForm < ActiveModel +# # attr_accessor :logo, :name, :address, :township, :city, :state, :country, :license, :base_currency, :password, :password_confirmation +# +# end diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index dbaea572..c03e7791 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -8,9 +8,9 @@ class ReceiptBillPdf < Prawn::Document self.qty_width = 20 self.total_width = 40 self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width)+(self.margin*4)) - self.item_height = 15 + self.item_height = 15 self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) - self.label_width=80 + self.label_width=80 # @item_width = self.page_width.to_i / 2 # @qty_width = @item_width.to_i / 3 @@ -31,7 +31,7 @@ class ReceiptBillPdf < Prawn::Document cashier_info(sale_data, customer_name) line_items(sale_items, food_total, beverage_total) - all_total(sale_data) + all_total(sale_data) footer end @@ -96,7 +96,7 @@ class ReceiptBillPdf < Prawn::Document stroke_horizontal_rule add_line_item_row(sale_items, food_total, beverage_total) - + end def add_line_item_row(sale_items, food_total, beverage_total) @@ -110,17 +110,15 @@ class ReceiptBillPdf < Prawn::Document total_price = item.qty*item.unit_price price = item.unit_price product_name = item.product_name - + y_position = cursor pad_top(15) { - # @item_width.to_i + @half_qty.to_i text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :overflow => :shrink_to_fix, :size => self.item_font_size, :overflow => :shrink_to_fix text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix text_box "#{qty.to_i}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix text_box "#{total_price}", :at =>[(item_name_width+2),y_position], :width =>self.total_width+2, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - } move_down 3 end @@ -151,7 +149,7 @@ class ReceiptBillPdf < Prawn::Document end def all_total(sale_data) - item_name_width = self.item_width + item_name_width = self.item_width move_down 5 y_position = cursor diff --git a/app/reports/menu_report.rb b/app/reports/menu_report.rb index ca430f0a..2a17e851 100644 --- a/app/reports/menu_report.rb +++ b/app/reports/menu_report.rb @@ -1,5 +1,5 @@ -class MenuReport < Compendium::Report - query :list, collect: :active_record do |params| - Menu.all - end -end +# class MenuReport < Compendium::Report +# query :list, collect: :active_record do |params| +# Menu.all +# end +# end diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb index 4fb445fd..c52381e2 100644 --- a/app/views/kaminari/_paginator.html.erb +++ b/app/views/kaminari/_paginator.html.erb @@ -10,14 +10,14 @@ -<% end -%> +<% end %> From 0eb8ac70873e498a779717a273de1d44cbcdfff5 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 19:54:11 +0630 Subject: [PATCH 23/29] fixing pagination --- Gemfile | 3 ++- Gemfile.lock | 3 +-- app/controllers/transactions/orders_controller.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 7774eba1..4de32f60 100644 --- a/Gemfile +++ b/Gemfile @@ -61,7 +61,8 @@ gem 'sidekiq' #gem 'nokogiri', '~> 1.6' # Pagination -gem 'kaminari', '~> 0.16.3' +gem 'kaminari' +# gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master' # Datatable gem 'filterrific' diff --git a/Gemfile.lock b/Gemfile.lock index e96c8ee0..3a3721d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -247,10 +247,9 @@ DEPENDENCIES jbuilder (~> 2.5) jquery-rails jquery-ui-rails - kaminari (~> 0.16.3) + kaminari listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) - nokogiri (~> 1.6) pg prawn prawn-table diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 35cefe6f..2d3a819e 100644 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -13,7 +13,7 @@ class Transactions::OrdersController < ApplicationController end end - @orders = Kaminari.paginate_array(orders).page(params[:page]).per(50) + @orders = Kaminari.paginate_array(orders).page(params[:page]).per(2) respond_to do |format| format.html # index.html.erb format.json { render json: @orders } From 5cfcc9ab6a5a9cdd1f466640351af7be04fba387 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 14 Jun 2017 20:01:34 +0630 Subject: [PATCH 24/29] fixed pagination --- Gemfile | 3 +-- Gemfile.lock | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 4de32f60..99489d5b 100644 --- a/Gemfile +++ b/Gemfile @@ -61,8 +61,7 @@ gem 'sidekiq' #gem 'nokogiri', '~> 1.6' # Pagination -gem 'kaminari' -# gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master' +gem 'kaminari', '~> 1.0.1' # Datatable gem 'filterrific' diff --git a/Gemfile.lock b/Gemfile.lock index 3a3721d9..e6f683f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,9 +89,18 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - kaminari (0.16.3) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) + kaminari (1.0.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.0.1) + kaminari-activerecord (= 1.0.1) + kaminari-core (= 1.0.1) + kaminari-actionview (1.0.1) + actionview + kaminari-core (= 1.0.1) + kaminari-activerecord (1.0.1) + activerecord + kaminari-core (= 1.0.1) + kaminari-core (1.0.1) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -247,7 +256,7 @@ DEPENDENCIES jbuilder (~> 2.5) jquery-rails jquery-ui-rails - kaminari + kaminari (~> 1.0.1) listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) pg From 541907d204cdfef78d8fee26edbe00d4f708872c Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 20:08:44 +0630 Subject: [PATCH 25/29] Merchant Id --- app/models/sale_payment.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index e0fe2e7c..fc085259 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -256,10 +256,11 @@ class SalePayment < ApplicationRecord receipt_no = sObj.receipt_no membership = MembershipSetting.find_by_membership_type("paypar_url") memberaction = MembershipAction.find_by_membership_type("rebate") + merchant_uid = memberaction.merchant_account_id.to_s campaign_type_id = memberaction.additional_parameter["campaign_type_id"] auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_amount: total_amount,campaign_type_id: campaign_type_id, + response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id, receipt_no: receipt_no,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', From 401bba7aed923cdece47576e6da7c67c385df00f Mon Sep 17 00:00:00 2001 From: Nweni Date: Thu, 15 Jun 2017 01:19:50 +0630 Subject: [PATCH 26/29] add set up menu --- db/seeds.rb | 42 +-- lib/tasks/menu_import.rake | 579 ++++++++++++++++++++++++++++++++++++- 2 files changed, 599 insertions(+), 22 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index e834c9f6..37484bef 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -92,33 +92,33 @@ room = Room.create({name:"Table 2", zone: zone2, status:"available", seater: 4 , tax_profiles = TaxProfile.create({id:1, name: "Commerical Tax", rate:5.0, order_by:1, created_by:"SYSTEM DEFAULT"}) #Account for Menu Item Type (eg: Food, Beverage) -food = Account.create({title: "Food", account_type: "0"}) -beverage = Account.create({title: "Beverage", account_type: "1"}) +# food = Account.create({title: "Food", account_type: "0"}) +# beverage = Account.create({title: "Beverage", account_type: "1"}) #Default menu -menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"}) +# menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"}) menu_options = MenuItemOption.create([{name: "Less Spicy", value: "less_spicy"},{name: "Spicy", value: "spicy"},{name: "Super Spicy", value: "super_spicy"}]) menu_options = MenuItemOption.create([{name: "Less Oil", value: "less_oil"},{name: "No MSG", value: "no_msg"},{name: "Less Sweet", value: "less_sweet"}]) -#Default Menu Category -menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"}) -menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"}) -menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"}) -menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"}) - -#Default Menu items -menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) -menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Single Pot",item_instance_code:"II0011", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}]) -menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0041", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) - -menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Twin Pot", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food}) -menu_category1_menu_item2 = SetMenuItem.create({item_code:"I005", name: "VIP Room Individual Pot",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 2", min_selectable_item: 1, max_selectable_item:1 , account: food}) -menu_category1_menu_item3 = SetMenuItem.create({item_code:"I006", name: "Default Menu Item Name 3",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 3", min_selectable_item: 1, max_selectable_item:1 , account: food}) - -menu_category2_menu_item0 = SimpleMenuItem.create({item_code:"I007", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food}) -menu_category2_menu_item1 = SimpleMenuItem.create({item_code:"I008", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food}) -menu_category2_menu_item2 = SimpleMenuItem.create({item_code:"I009", name: "Default Menu Item Name 2", alt_name: "Alternate Menu Item Name 2",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 3 , account: food}) +# #Default Menu Category +# menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"}) +# menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"}) +# menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"}) +# menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"}) +# +# #Default Menu items +# menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) +# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Single Pot",item_instance_code:"II0011", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}]) +# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0041", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) +# +# menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Twin Pot", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food}) +# menu_category1_menu_item2 = SetMenuItem.create({item_code:"I005", name: "VIP Room Individual Pot",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 2", min_selectable_item: 1, max_selectable_item:1 , account: food}) +# menu_category1_menu_item3 = SetMenuItem.create({item_code:"I006", name: "Default Menu Item Name 3",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 3", min_selectable_item: 1, max_selectable_item:1 , account: food}) +# +# menu_category2_menu_item0 = SimpleMenuItem.create({item_code:"I007", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food}) +# menu_category2_menu_item1 = SimpleMenuItem.create({item_code:"I008", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food}) +# menu_category2_menu_item2 = SimpleMenuItem.create({item_code:"I009", name: "Default Menu Item Name 2", alt_name: "Alternate Menu Item Name 2",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 3 , account: food}) menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size", name: "Small", value: "small"}) menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size",name: "Medium", value: "medium"}) diff --git a/lib/tasks/menu_import.rake b/lib/tasks/menu_import.rake index 48c134a7..c1a90c53 100644 --- a/lib/tasks/menu_import.rake +++ b/lib/tasks/menu_import.rake @@ -1,3 +1,580 @@ -namespace :menu_import do +namespace :menu do + desc "Clear Data" + task :bitp => :environment do +# Main Menu +menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"}) +food = Account.create({title: "Food", account_type: "0"}) +beverage = Account.create({title: "Beverage", account_type: "1"}) +# soup base +menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"}) + # single pot + menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Single Pot",item_instance_code:"II0011", menu_item: menu_category1_menu_item0, price:10.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0041", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0051", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0071", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0081", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0061", menu_item: menu_category1_menu_item0, price:17800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0091", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + # twin pot + menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"01002", name: "Twin Pot", alt_name: "Twin Pot",menu_category: menu_category1 , min_selectable_item: 2, max_selectable_item:2, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Twin Pot",item_instance_code:"II0021", menu_item: menu_category1_menu_item1, price:10.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0042", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0052", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0072", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0082", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0062", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0092", menu_item: menu_category1_menu_item1, price:11800.00, is_on_promotion:false}]) + # vip room Individual pot + menu_category1_menu_item2 = SimpleMenuItem.create({item_code:"01003", name: "VIP Room Individual Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"VIP Room Individual Pot",item_instance_code:"II0031", menu_item: menu_category1_menu_item2, price:10.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0043", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0053", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0073", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0083", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0063", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0093", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) +# Assorted Platter +menu_category2 = MenuCategory.create({menu: menu, code:"C002", name: "Assorted Platter", alt_name: "Assorted Platter", order_by: 2, created_by: "SYSTEM DEFAULT"}) + # Pork Platter + menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"01002", name: "Pork Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Pork Platter",item_instance_code:"II0101", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false}]) + # Beef Platter + menu_category1_menu_item4 = SimpleMenuItem.create({item_code:"01002", name: "Beef Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beef Platter",item_instance_code:"II0111", menu_item: menu_category1_menu_item4, price:24000.00, is_on_promotion:false}]) + # Assorted Seafood Platter + menu_category1_menu_item5 = SimpleMenuItem.create({item_code:"01002", name: "Assorted Seafood Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Assorted Seafood Platter",item_instance_code:"II0121", menu_item: menu_category1_menu_item5, price:66000.00, is_on_promotion:false}]) +# Beef & Mutton +menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 3,created_by: "SYSTEM DEFAULT"}) + # Australia Angus Boneless Short Rib + menu_category1_menu_item6 = SimpleMenuItem.create({item_code:"01002", name: "Australia Angus Boneless Short Rib", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0132", menu_item: menu_category1_menu_item5, price:12500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0131", menu_item: menu_category1_menu_item5, price:25000.00, is_on_promotion:false}]) + # Spain Beef + menu_category1_menu_item7 = SimpleMenuItem.create({item_code:"01002", name: "Spain Beef", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0142", menu_item: menu_category1_menu_item7, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0141", menu_item: menu_category1_menu_item7, price:16000.00, is_on_promotion:false}]) + # Sliced Beef (Thin) + menu_category1_menu_item8 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Beef (Thin)", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0152", menu_item: menu_category1_menu_item7, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0151", menu_item: menu_category1_menu_item7, price:12000.00, is_on_promotion:false}]) + # Tender Sliced Beef + menu_category1_menu_item9 = SimpleMenuItem.create({item_code:"01002", name: "Tender Sliced Beef", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0162", menu_item: menu_category1_menu_item7, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0161", menu_item: menu_category1_menu_item7, price:12000.00, is_on_promotion:false}]) + # Beef Tripe + menu_category1_menu_item10 = SimpleMenuItem.create({item_code:"01002", name: "Beef Tripe", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0172", menu_item: menu_category1_menu_item7, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0171", menu_item: menu_category1_menu_item7, price:7000.00, is_on_promotion:false}]) + # Braised Cow's Stomach + menu_category1_menu_item11 = SimpleMenuItem.create({item_code:"01002", name: "Braised Cow's Stomach", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0182", menu_item: menu_category1_menu_item11, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0181", menu_item: menu_category1_menu_item11, price:14000.00, is_on_promotion:false}]) +# Pork +menu_category4 = MenuCategory.create({menu: menu, code:"C004", name: "Pork", alt_name: "Pork", order_by: 4,created_by: "SYSTEM DEFAULT"}) + # Sliced Lamb + menu_category1_menu_item12 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Lamb", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0192", menu_item: menu_category1_menu_item12, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0191", menu_item: menu_category1_menu_item12, price:12000.00, is_on_promotion:false}]) + # Sliced Tenderloin Pork + menu_category1_menu_item13 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Tenderloin Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item13, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item13, price:8000.00, is_on_promotion:false}]) + # Sliced Pork Belly + menu_category1_menu_item14 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Pork Belly", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0212", menu_item: menu_category1_menu_item14, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0211", menu_item: menu_category1_menu_item14, price:8000.00, is_on_promotion:false}]) + # Sliced Pork Collar + menu_category1_menu_item15 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Pork Collar", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0222", menu_item: menu_category1_menu_item15, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0221", menu_item: menu_category1_menu_item15, price:8000.00, is_on_promotion:false}]) + # Pork Jawl + menu_category1_menu_item16 = SimpleMenuItem.create({item_code:"01002", name: "Pork Jawl", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0232", menu_item: menu_category1_menu_item16, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0231", menu_item: menu_category1_menu_item16, price:8000.00, is_on_promotion:false}]) + # Tender Sliced Tenderloin Pork + menu_category1_menu_item17 = SimpleMenuItem.create({item_code:"01002", name: "Tender Sliced Tenderloin Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0242", menu_item: menu_category1_menu_item17, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0241", menu_item: menu_category1_menu_item17, price:8000.00, is_on_promotion:false}]) + # Spicy Sliced Pork + menu_category1_menu_item18 = SimpleMenuItem.create({item_code:"01002", name: "Spicy Sliced Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0252", menu_item: menu_category1_menu_item18, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0251", menu_item: menu_category1_menu_item18, price:8000.00, is_on_promotion:false}]) + # Pig's Tongue + menu_category1_menu_item19 = SimpleMenuItem.create({item_code:"01002", name: "Pig's Tongue", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0262", menu_item: menu_category1_menu_item19, price:60000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0261", menu_item: menu_category1_menu_item19, price:12000.00, is_on_promotion:false}]) + # Luncheon Meat + menu_category1_menu_item20 = SimpleMenuItem.create({item_code:"01002", name: "Luncheon Meat", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0272", menu_item: menu_category1_menu_item20, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0271", menu_item: menu_category1_menu_item20, price:5000.00, is_on_promotion:false}]) + # Pig's Liver + menu_category1_menu_item21 = SimpleMenuItem.create({item_code:"01002", name: "Pig's Liver", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0282", menu_item: menu_category1_menu_item21, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0281", menu_item: menu_category1_menu_item21, price:5000.00, is_on_promotion:false}]) + # Pig's Intestine + menu_category1_menu_item22 = SimpleMenuItem.create({item_code:"01002", name: "Pig's Intestine", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0292", menu_item: menu_category1_menu_item22, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0291", menu_item: menu_category1_menu_item22, price:6000.00, is_on_promotion:false}]) +# Chicken +menu_category5 = MenuCategory.create({menu: menu, code:"C005", name: "Chicken", alt_name: "Chicken", order_by: 5, created_by: "SYSTEM DEFAULT"}) + # Sliced Chicken Breast + menu_category1_menu_item23 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Chicken Breast", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0302", menu_item: menu_category1_menu_item23, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0301", menu_item: menu_category1_menu_item23, price:7000.00, is_on_promotion:false}]) + # Sliced Chicken Thigh + menu_category1_menu_item24 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Chicken Thigh", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0312", menu_item: menu_category1_menu_item24, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0311", menu_item: menu_category1_menu_item24, price:7000.00, is_on_promotion:false}]) + # Crunchy Gourmet Chicken Sausage + menu_category1_menu_item25 = SimpleMenuItem.create({item_code:"01002", name: "Crunchy Gourmet Chicken Sausage", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0322", menu_item: menu_category1_menu_item25, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0321", menu_item: menu_category1_menu_item25, price:8000.00, is_on_promotion:false}]) + # Cheesy Chicken Sausage + menu_category1_menu_item26 = SimpleMenuItem.create({item_code:"01002", name: "Cheesy Chicken Sausage", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0332", menu_item: menu_category1_menu_item26, price:4800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0331", menu_item: menu_category1_menu_item26, price:9600.00, is_on_promotion:false}]) + # Chicken Feet Skin + menu_category1_menu_item27 = SimpleMenuItem.create({item_code:"01002", name: "Chicken Feet Skin", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0342", menu_item: menu_category1_menu_item27, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0341", menu_item: menu_category1_menu_item27, price:5000.00, is_on_promotion:false}]) + # Chinese Wine Kampong Chicken + menu_category1_menu_item28 = SimpleMenuItem.create({item_code:"01002", name: "Chinese Wine Kampong Chicken", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0352", menu_item: menu_category1_menu_item28, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0351", menu_item: menu_category1_menu_item28, price:16000.00, is_on_promotion:false}]) +# Handmade Balls +menu_category6 = MenuCategory.create({menu: menu, code:"C006", name: "Handmade Balls", alt_name: "Soup_base", order_by: 6,created_by: "SYSTEM DEFAULT"}) + # Soft Bone Pork Meatball + menu_category1_menu_item29 = SimpleMenuItem.create({item_code:"01002", name: "Soft Bone Pork Meatball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0362", menu_item: menu_category1_menu_item29, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0361", menu_item: menu_category1_menu_item29, price:6000.00, is_on_promotion:false}]) + # Fish Ball + menu_category1_menu_item30 = SimpleMenuItem.create({item_code:"01002", name: "Fish Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0372", menu_item: menu_category1_menu_item30, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0371", menu_item: menu_category1_menu_item30, price:6000.00, is_on_promotion:false}]) + # Beef Ball + menu_category1_menu_item31 = SimpleMenuItem.create({item_code:"01002", name: "Beef Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0382", menu_item: menu_category1_menu_item31, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0381", menu_item: menu_category1_menu_item31, price:7000.00, is_on_promotion:false}]) + # Mushroom Ball + menu_category1_menu_item32 = SimpleMenuItem.create({item_code:"01002", name: "Mushroom Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0392", menu_item: menu_category1_menu_item32, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0391", menu_item: menu_category1_menu_item32, price:7000.00, is_on_promotion:false}]) + # Cuttlefish Ball + menu_category1_menu_item33 = SimpleMenuItem.create({item_code:"01002", name: "Cuttlefish Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0402", menu_item: menu_category1_menu_item33, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0401", menu_item: menu_category1_menu_item33, price:7000.00, is_on_promotion:false}]) + # Cheesy Pork Ball + menu_category1_menu_item34 = SimpleMenuItem.create({item_code:"01002", name: "Cheesy Pork Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0412", menu_item: menu_category1_menu_item34, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0411", menu_item: menu_category1_menu_item34, price:7000.00, is_on_promotion:false}]) + # Assorted Ball Platter + menu_category1_menu_item35 = SimpleMenuItem.create({item_code:"01002", name: "Assorted Ball Platter", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0421", menu_item: menu_category1_menu_item35, price:7800.00, is_on_promotion:false}]) +# Specialty Homemade Paste +menu_category7 = MenuCategory.create({menu: menu, code:"C007", name: "Specialty Homemade Paste", alt_name: "Beef_and_mutton", order_by: 7,created_by: "SYSTEM DEFAULT"}) + # Fish Paste + menu_category1_menu_item36 = SimpleMenuItem.create({item_code:"01002", name: "Fish Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0431", menu_item: menu_category1_menu_item36, price:4800.00, is_on_promotion:false}]) + # Century Egg Fish Paste + menu_category1_menu_item37 = SimpleMenuItem.create({item_code:"01002", name: "Century Egg Fish Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0441", menu_item: menu_category1_menu_item37, price:5800.00, is_on_promotion:false}]) + # Pork Paste + menu_category1_menu_item38 = SimpleMenuItem.create({item_code:"01002", name: " Pork Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0451", menu_item: menu_category1_menu_item38, price:5800.00, is_on_promotion:false}]) + # Dried Scallop Fish Paste + menu_category1_menu_item39 = SimpleMenuItem.create({item_code:"01002", name: "Dried Scallop Fish Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0461", menu_item: menu_category1_menu_item39, price:8800.00, is_on_promotion:false}]) + # Ebiko Prawn Paste + menu_category1_menu_item40 = SimpleMenuItem.create({item_code:"01002", name: "Ebiko Prawn Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0471", menu_item: menu_category1_menu_item40, price:11800.00, is_on_promotion:false}]) +# Seafood +menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", alt_name: "Pork", order_by: 8,created_by: "SYSTEM DEFAULT"}) + # Promfret + menu_category1_menu_item41 = SimpleMenuItem.create({item_code:"01002", name: "Promfret", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0481", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}]) + # Garoupa + menu_category1_menu_item42 = SimpleMenuItem.create({item_code:"01002", name: "Garoupa", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Small",item_instance_code:"II0491", menu_item: menu_category1_menu_item42, price:13800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Medium",item_instance_code:"II0492", menu_item: menu_category1_menu_item42, price:18800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Large",item_instance_code:"II0493", menu_item: menu_category1_menu_item42, price:23900.00, is_on_promotion:false}]) + # Sliced Fish + menu_category1_menu_item43 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Fish", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0502", menu_item: menu_category1_menu_item43, price:4800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0501", menu_item: menu_category1_menu_item43, price:9600.00, is_on_promotion:false}]) + # Fresh Sea Prawns + menu_category1_menu_item44 = SimpleMenuItem.create({item_code:"01002", name: "Fresh Sea Prawns", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0512", menu_item: menu_category1_menu_item44, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0511", menu_item: menu_category1_menu_item44, price:19600.00, is_on_promotion:false}]) + # Drunken Prawns + menu_category1_menu_item45 = SimpleMenuItem.create({item_code:"01002", name: "Drunken Prawns", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0522", menu_item: menu_category1_menu_item45, price:11000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0521", menu_item: menu_category1_menu_item45, price:22000.00, is_on_promotion:false}]) + # Fish Maw + menu_category1_menu_item46 = SimpleMenuItem.create({item_code:"01002", name: "Fish Maw", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0532", menu_item: menu_category1_menu_item46, price:11000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0531", menu_item: menu_category1_menu_item46, price:22000.00, is_on_promotion:false}]) + # Fresh Cittlefish + menu_category1_menu_item47 = SimpleMenuItem.create({item_code:"01002", name: "Fresh Cittlefish", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0542", menu_item: menu_category1_menu_item47, price:4700.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0541", menu_item: menu_category1_menu_item47, price:9400.00, is_on_promotion:false}]) + # Sea Cucumber + menu_category1_menu_item48 = SimpleMenuItem.create({item_code:"01002", name: "Sea Cucumber", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0552", menu_item: menu_category1_menu_item48, price:28800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0551", menu_item: menu_category1_menu_item48, price:57600.00, is_on_promotion:false}]) + # Fresh Scallop + menu_category1_menu_item49 = SimpleMenuItem.create({item_code:"01002", name: "Fresh Scallop", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0562", menu_item: menu_category1_menu_item49, price:28800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0561", menu_item: menu_category1_menu_item49, price:57600.00, is_on_promotion:false}]) + # Japanese Crab Stick + menu_category1_menu_item50 = SimpleMenuItem.create({item_code:"01002", name: "Japanese Crab Stick", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0572", menu_item: menu_category1_menu_item50, price:4400.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0571", menu_item: menu_category1_menu_item50, price:8800.00, is_on_promotion:false}]) + # Fish Head + menu_category1_menu_item51 = SimpleMenuItem.create({item_code:"01002", name: "Fish Head", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0582", menu_item: menu_category1_menu_item51, price:2800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0581", menu_item: menu_category1_menu_item51, price:5600.00, is_on_promotion:false}]) + # 10-Head Abalone + menu_category1_menu_item52 = SimpleMenuItem.create({item_code:"01002", name: "10-Head Abalone", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0592", menu_item: menu_category1_menu_item52, price:15000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0591", menu_item: menu_category1_menu_item52, price:30000.00, is_on_promotion:false}]) + # Red Clams + menu_category1_menu_item53 = SimpleMenuItem.create({item_code:"01002", name: "Red Clams", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0602", menu_item: menu_category1_menu_item53, price:12000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0601", menu_item: menu_category1_menu_item53, price:24000.00, is_on_promotion:false}]) + # Scallop + menu_category1_menu_item54 = SimpleMenuItem.create({item_code:"01002", name: "Scallop", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0612", menu_item: menu_category1_menu_item54, price:19000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0611", menu_item: menu_category1_menu_item54, price:38000.00, is_on_promotion:false}]) + # Baby Octopus + menu_category1_menu_item55 = SimpleMenuItem.create({item_code:"01002", name: "Baby Octopus", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0622", menu_item: menu_category1_menu_item55, price:2900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0621", menu_item: menu_category1_menu_item55, price:58000.00, is_on_promotion:false}]) + # Fresh Cuttlefish + menu_category1_menu_item56 = SimpleMenuItem.create({item_code:"01002", name: "Fresh Cuttlefish", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0632", menu_item: menu_category1_menu_item56, price:10.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0631", menu_item: menu_category1_menu_item56, price:10.00, is_on_promotion:false}]) + # Squid Rings + menu_category1_menu_item57 = SimpleMenuItem.create({item_code:"01002", name: "Squid Rings", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0042", menu_item: menu_category1_menu_item57, price:3400.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0641", menu_item: menu_category1_menu_item57, price:6800.00, is_on_promotion:false}]) + # Green Mussels + menu_category1_menu_item58 = SimpleMenuItem.create({item_code:"01002", name: "Green Mussels", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0652", menu_item: menu_category1_menu_item58, price:6500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0651", menu_item: menu_category1_menu_item58, price:13000.00, is_on_promotion:false}]) + # Live Crab + menu_category1_menu_item59 = SimpleMenuItem.create({item_code:"01002", name: "Live Crab", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0661", menu_item: menu_category1_menu_item59, price:60.00, is_on_promotion:false}]) + # Fresh Flower Crabs + menu_category1_menu_item60 = SimpleMenuItem.create({item_code:"01002", name: "Fresh Flower Crabs", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0671", menu_item: menu_category1_menu_item60, price:60.00, is_on_promotion:false}]) + # Live Lobster + menu_category1_menu_item61 = SimpleMenuItem.create({item_code:"01002", name: "Live Lobster", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0681", menu_item: menu_category1_menu_item61, price:150.00, is_on_promotion:false}]) + # Live Mantis + menu_category1_menu_item62 = SimpleMenuItem.create({item_code:"01002", name: "Live Mantis", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0691", menu_item: menu_category1_menu_item62, price:150.00, is_on_promotion:false}]) +# Dumpling +menu_category9 = MenuCategory.create({menu: menu, code:"C009", name: "Dumpling", alt_name: "Chicken", order_by: 9, created_by: "SYSTEM DEFAULT"}) + # Pork and Chives Dumpling + menu_category1_menu_item63 = SimpleMenuItem.create({item_code:"01002", name: "Pork and Chives Dumpling", alt_name: "Twin Pot",menu_category: menu_category9 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0702", menu_item: menu_category1_menu_item63, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0701", menu_item: menu_category1_menu_item63, price:6000.00, is_on_promotion:false}]) + # Prawn Dumpling + menu_category1_menu_item64 = SimpleMenuItem.create({item_code:"01002", name: " Prawn Dumpling ", alt_name: "Twin Pot",menu_category: menu_category9 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0712", menu_item: menu_category1_menu_item64, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0711", menu_item: menu_category1_menu_item64, price:8000.00, is_on_promotion:false}]) + # Prawn Roll Dumpling + menu_category1_menu_item65 = SimpleMenuItem.create({item_code:"01002", name: "Prawn Roll Dumpling", alt_name: "Twin Pot",menu_category: menu_category9 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0722", menu_item: menu_category1_menu_item65, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0721", menu_item: menu_category1_menu_item65, price:6000.00, is_on_promotion:false}]) + # Pork Roll Dumpling + menu_category1_menu_item66 = SimpleMenuItem.create({item_code:"01002", name: "Pork Roll Dumpling", alt_name: "Twin Pot",menu_category: menu_category9 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0732", menu_item: menu_category1_menu_item66, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0731", menu_item: menu_category1_menu_item66, price:5000.00, is_on_promotion:false}]) + # Assorted Dumpling Platter + menu_category1_menu_item67 = SimpleMenuItem.create({item_code:"01002", name: "Assorted Dumpling Platter", alt_name: "Twin Pot",menu_category: menu_category9 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0741", menu_item: menu_category1_menu_item67, price:7800.00, is_on_promotion:false}]) +# Tofu & Beancurd +menu_category10 = MenuCategory.create({menu: menu, code:"C0010", name: "Tofu & Beancurd", alt_name: "Soup_base", order_by: 10,created_by: "SYSTEM DEFAULT"}) + # Signature Homemade Fish Tofu + menu_category1_menu_item68 = SimpleMenuItem.create({item_code:"01002", name: "Signature Homemade Fish Tofu ", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0751", menu_item: menu_category1_menu_item68, price:1500.00, is_on_promotion:false}]) + # SilkenTofu + menu_category1_menu_item69 = SimpleMenuItem.create({item_code:"01002", name: "SilkenTofu", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0762", menu_item: menu_category1_menu_item69, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0761", menu_item: menu_category1_menu_item69, price:2000.00, is_on_promotion:false}]) + # IceTofu + menu_category1_menu_item70 = SimpleMenuItem.create({item_code:"01002", name: "IceTofu", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0772", menu_item: menu_category1_menu_item70, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0771", menu_item: menu_category1_menu_item70, price:4000.00, is_on_promotion:false}]) + # Fried Beancurd Skin + menu_category1_menu_item71 = SimpleMenuItem.create({item_code:"01002", name: "Fried Beancurd Skin", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0782", menu_item: menu_category1_menu_item71, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0781", menu_item: menu_category1_menu_item71, price:8000.00, is_on_promotion:false}]) + # Tofu Puff + menu_category1_menu_item72 = SimpleMenuItem.create({item_code:"01002", name: "Tofu Puff Platter", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0792", menu_item: menu_category1_menu_item72, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0791", menu_item: menu_category1_menu_item72, price:4000.00, is_on_promotion:false}]) + # Dried Beancurd Stick + menu_category1_menu_item73 = SimpleMenuItem.create({item_code:"01002", name: "Dried Beancurd Stick", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0802", menu_item: menu_category1_menu_item73, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0801", menu_item: menu_category1_menu_item73, price:4000.00, is_on_promotion:false}]) +# Mushroom +menu_category12 = MenuCategory.create({menu: menu, code:"C0012", name: "Mushroom", alt_name: "Beef_and_mutton", order_by: 12,created_by: "SYSTEM DEFAULT"}) + # Black Fungus + menu_category1_menu_item74 = SimpleMenuItem.create({item_code:"01002", name: "Black Fungus", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0812", menu_item: menu_category1_menu_item74, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0811", menu_item: menu_category1_menu_item74, price:3600.00, is_on_promotion:false}]) + # White and Hon Shimeiji + menu_category1_menu_item75 = SimpleMenuItem.create({item_code:"01002", name: "White and Hon Shimeiji", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0822", menu_item: menu_category1_menu_item75, price:2800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0821", menu_item: menu_category1_menu_item75, price:5600.00, is_on_promotion:false}]) +# Drumstick Musroom + menu_category1_menu_item76 = SimpleMenuItem.create({item_code:"01002", name: "Drumstick Musroom", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0832", menu_item: menu_category1_menu_item76, price:2300.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0831", menu_item: menu_category1_menu_item76, price:4600.00, is_on_promotion:false}]) +# Enoki Mushroom + menu_category1_menu_item77 = SimpleMenuItem.create({item_code:"01002", name: "Enoki Mushroom", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0824", menu_item: menu_category1_menu_item77, price:2300.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0841", menu_item: menu_category1_menu_item77, price:4600.00, is_on_promotion:false}]) +# Fresh Mushroom + menu_category1_menu_item78 = SimpleMenuItem.create({item_code:"01002", name: "Fresh Mushroom", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0852", menu_item: menu_category1_menu_item78, price:2800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0851", menu_item: menu_category1_menu_item78, price:5600.00, is_on_promotion:false}]) +# Abalone Mushroom + menu_category1_menu_item79 = SimpleMenuItem.create({item_code:"01002", name: "Abalone Mushroom", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0862", menu_item: menu_category1_menu_item79, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0861", menu_item: menu_category1_menu_item79, price:3600.00, is_on_promotion:false}]) +# Snow Fungus + menu_category1_menu_item80 = SimpleMenuItem.create({item_code:"01002", name: "Snow Fungus", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0872", menu_item: menu_category1_menu_item80, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0871", menu_item: menu_category1_menu_item80, price:3600.00, is_on_promotion:false}]) +# Assorted Mushroom Platter + menu_category1_menu_item81 = SimpleMenuItem.create({item_code:"01002", name: "Assorted Mushroom Platter", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0881", menu_item: menu_category1_menu_item81, price:10000.00, is_on_promotion:false}]) +# Vegetables +menu_category13 = MenuCategory.create({menu: menu, code:"C0012", name: "Vegetables", alt_name: "Beef_and_mutton", order_by: 12,created_by: "SYSTEM DEFAULT"}) + # Baby Chinese Spinach + menu_category1_menu_item82 = SimpleMenuItem.create({item_code:"01002", name: "Baby Chinese Spinach", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0892", menu_item: menu_category1_menu_item82, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0891", menu_item: menu_category1_menu_item82, price:3000.00, is_on_promotion:false}]) + # Chinese Cabbage + menu_category1_menu_item83 = SimpleMenuItem.create({item_code:"01002", name: "Chinese Cabbage ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0902", menu_item: menu_category1_menu_item83, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0901", menu_item: menu_category1_menu_item83, price:3000.00, is_on_promotion:false}]) + # Lettuce + menu_category1_menu_item84 = SimpleMenuItem.create({item_code:"01002", name: "Lettuce ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0912", menu_item: menu_category1_menu_item84, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0911", menu_item: menu_category1_menu_item84, price:3600.00, is_on_promotion:false}]) + # Baby Romaine Lettuce + menu_category1_menu_item85 = SimpleMenuItem.create({item_code:"01002", name: "Baby Romaine Lettuce ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0922", menu_item: menu_category1_menu_item85, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0921", menu_item: menu_category1_menu_item85, price:3600.00, is_on_promotion:false}]) +# Baby Tang O + menu_category1_menu_item86 = SimpleMenuItem.create({item_code:"01002", name: "Baby Tang O", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0932", menu_item: menu_category1_menu_item86, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0931", menu_item: menu_category1_menu_item86, price:3000.00, is_on_promotion:false}]) +# Sliced Lotus Root + menu_category1_menu_item87 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Lotus Root", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0942", menu_item: menu_category1_menu_item87, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0941", menu_item: menu_category1_menu_item87, price:3600.00, is_on_promotion:false}]) +# Sliced Potato + menu_category1_menu_item88 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Potato ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0952", menu_item: menu_category1_menu_item88, price:1300.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0951", menu_item: menu_category1_menu_item88, price:2600.00, is_on_promotion:false}]) +# Sliced Winter Melon + menu_category1_menu_item89 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Winter Melon", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0962", menu_item: menu_category1_menu_item89, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0961", menu_item: menu_category1_menu_item89, price:2400.00, is_on_promotion:false}]) +# Fried Yam + menu_category1_menu_item90 = SimpleMenuItem.create({item_code:"01002", name: "Fried Yam ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0972", menu_item: menu_category1_menu_item90, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0971", menu_item: menu_category1_menu_item90, price:3600.00, is_on_promotion:false}]) +# Pearl Sweet Corn + menu_category1_menu_item91 = SimpleMenuItem.create({item_code:"01002", name: "Pearl Sweet Corn", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0982", menu_item: menu_category1_menu_item91, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0981", menu_item: menu_category1_menu_item91, price:3000.00, is_on_promotion:false}]) +# Baby Lady's Finger + menu_category1_menu_item92 = SimpleMenuItem.create({item_code:"01002", name: "Baby Lady's Finger", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0992", menu_item: menu_category1_menu_item92, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0991", menu_item: menu_category1_menu_item92, price:2400.00, is_on_promotion:false}]) +# Baby Corn + menu_category1_menu_item93 = SimpleMenuItem.create({item_code:"01002", name: "Baby Corn", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1002", menu_item: menu_category1_menu_item93, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1001", menu_item: menu_category1_menu_item93, price:3600.00, is_on_promotion:false}]) +# Asparagus + menu_category1_menu_item94 = SimpleMenuItem.create({item_code:"01002", name: "Asparagus", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1012", menu_item: menu_category1_menu_item94, price:1900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1011", menu_item: menu_category1_menu_item94, price:3800.00, is_on_promotion:false}]) +# Brocolli + menu_category1_menu_item95 = SimpleMenuItem.create({item_code:"01002", name: "Brocolli", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1022", menu_item: menu_category1_menu_item95, price:1900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1021", menu_item: menu_category1_menu_item95, price:3800.00, is_on_promotion:false}]) +# White Radish + menu_category1_menu_item96 = SimpleMenuItem.create({item_code:"01002", name: "White Radish", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1032", menu_item: menu_category1_menu_item96, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1031", menu_item: menu_category1_menu_item96, price:2400.00, is_on_promotion:false}]) +# Xiao Bai Chai + menu_category1_menu_item97 = SimpleMenuItem.create({item_code:"01002", name: "Xiao Bai Chai", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1042", menu_item: menu_category1_menu_item97, price:1900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1041", menu_item: menu_category1_menu_item97, price:3800.00, is_on_promotion:false}]) +# Bean Leaf + menu_category1_menu_item98 = SimpleMenuItem.create({item_code:"01002", name: "Bean Leaf", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1052", menu_item: menu_category1_menu_item98, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1051", menu_item: menu_category1_menu_item98, price:2400.00, is_on_promotion:false}]) +# Chayote Vine + menu_category1_menu_item99 = SimpleMenuItem.create({item_code:"01002", name: "Chayote Vine", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1062", menu_item: menu_category1_menu_item99, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1061", menu_item: menu_category1_menu_item99, price:2400.00, is_on_promotion:false}]) +# Kai Lan + menu_category1_menu_item100 = SimpleMenuItem.create({item_code:"01002", name: "Kai Lan ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1072", menu_item: menu_category1_menu_item100, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1071", menu_item: menu_category1_menu_item100, price:2400.00, is_on_promotion:false}]) +# Cabbage + menu_category1_menu_item101 = SimpleMenuItem.create({item_code:"01002", name: "Cabbage", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1082", menu_item: menu_category1_menu_item101, price:1900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1081", menu_item: menu_category1_menu_item101, price:3800.00, is_on_promotion:false}]) +# Pumpkin + menu_category1_menu_item102 = SimpleMenuItem.create({item_code:"01002", name: "Pumpkin", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1092", menu_item: menu_category1_menu_item102, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1091", menu_item: menu_category1_menu_item102, price:2400.00, is_on_promotion:false}]) +# Sweet Potato + menu_category1_menu_item103 = SimpleMenuItem.create({item_code:"01002", name: "Sweet Potato", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1102", menu_item: menu_category1_menu_item103, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1101", menu_item: menu_category1_menu_item103, price:2400.00, is_on_promotion:false}]) +# Red Carrot + menu_category1_menu_item104 = SimpleMenuItem.create({item_code:"01002", name: "Red Carrot", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1112", menu_item: menu_category1_menu_item104, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1111", menu_item: menu_category1_menu_item104, price:2400.00, is_on_promotion:false}]) +# Kangkung + menu_category1_menu_item105 = SimpleMenuItem.create({item_code:"01002", name: "Kangkung", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1122", menu_item: menu_category1_menu_item105, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1121", menu_item: menu_category1_menu_item105, price:2400.00, is_on_promotion:false}]) +# Others +menu_category14 = MenuCategory.create({menu: menu, code:"C0013", name: "Others", alt_name: "Pork", order_by: 13,created_by: "SYSTEM DEFAULT"}) + # Quail’s Egg + menu_category1_menu_item106 = SimpleMenuItem.create({item_code:"01002", name: "Quail’s Egg", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1132", menu_item: menu_category1_menu_item106, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1131", menu_item: menu_category1_menu_item106, price:3000.00, is_on_promotion:false}]) +# Sliced Kelp + menu_category1_menu_item107 = SimpleMenuItem.create({item_code:"01002", name: "Sliced Kelp", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1142", menu_item: menu_category1_menu_item107, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1141", menu_item: menu_category1_menu_item107, price:3600.00, is_on_promotion:false}]) +# Crystal Vermicelli + menu_category1_menu_item108 = SimpleMenuItem.create({item_code:"01002", name: "Crystal Vermicelli", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1152", menu_item: menu_category1_menu_item108, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1151", menu_item: menu_category1_menu_item108, price:3600.00, is_on_promotion:false}]) +# Duck Blood + menu_category1_menu_item109 = SimpleMenuItem.create({item_code:"01002", name: "Duck Blood", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1162", menu_item: menu_category1_menu_item109, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1161", menu_item: menu_category1_menu_item109, price:2400.00, is_on_promotion:false}]) +# HK Fried Fish Skin + menu_category1_menu_item110 = SimpleMenuItem.create({item_code:"01002", name: "HK Fried Fish Skin", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1172", menu_item: menu_category1_menu_item110, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1171", menu_item: menu_category1_menu_item110, price:14000.00, is_on_promotion:false}]) +# Bamboo Shoot + menu_category1_menu_item111 = SimpleMenuItem.create({item_code:"01002", name: "Bamboo Shoot", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1182", menu_item: menu_category1_menu_item111, price:2300.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1181", menu_item: menu_category1_menu_item111, price:4600.00, is_on_promotion:false}]) +# Fried Dough Sticks + menu_category1_menu_item112 = SimpleMenuItem.create({item_code:"01002", name: "Fried Dough Sticks", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1192", menu_item: menu_category1_menu_item112, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1191", menu_item: menu_category1_menu_item112, price:2000.00, is_on_promotion:false}]) +# Noodles +menu_category15 = MenuCategory.create({menu: menu, code:"C0014", name: "Noodles", alt_name: "Chicken", order_by: 14, created_by: "SYSTEM DEFAULT"}) +# Potato Thin Vermicelli + menu_category1_menu_item113 = SimpleMenuItem.create({item_code:"01002", name: "Potato Thin Vermicelli", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1202", menu_item: menu_category1_menu_item113, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1201", menu_item: menu_category1_menu_item113, price:3000.00, is_on_promotion:false}]) +# Potato Wide Vermicelli + menu_category1_menu_item114 = SimpleMenuItem.create({item_code:"01002", name: "Potato Wide Vermicelli", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1212", menu_item: menu_category1_menu_item114, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1211", menu_item: menu_category1_menu_item114, price:3000.00, is_on_promotion:false}]) +# Rice Cake + menu_category1_menu_item115 = SimpleMenuItem.create({item_code:"01002", name: "Rice Cake ", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1222", menu_item: menu_category1_menu_item115, price:1900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1221", menu_item: menu_category1_menu_item115, price:3800.00, is_on_promotion:false}]) +# La Mian + menu_category1_menu_item116 = SimpleMenuItem.create({item_code:"01002", name: "La Mian", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1231", menu_item: menu_category1_menu_item116, price:1800.00, is_on_promotion:false}]) +# Glass Noodle + menu_category1_menu_item117 = SimpleMenuItem.create({item_code:"01002", name: "Glass Noodle ", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1242", menu_item: menu_category1_menu_item117, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1241", menu_item: menu_category1_menu_item117, price:2400.00, is_on_promotion:false}]) +# Rice + menu_category1_menu_item118 = SimpleMenuItem.create({item_code:"01002", name: "Rice", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1251", menu_item: menu_category1_menu_item118, price:1000.00, is_on_promotion:false}]) +# Drinks +menu_category16 = MenuCategory.create({menu: menu, code:"C0015", name: "Drinks", alt_name: "Soup_base", order_by: 15,created_by: "SYSTEM DEFAULT"}) +# Hot Homemade Fruit Tea + menu_category1_menu_item119 = SimpleMenuItem.create({item_code:"01002", name: "Hot Homemade Fruit Tea", alt_name: "Twin Pot",menu_category: menu_category16 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1261", menu_item: menu_category1_menu_item119, price:1500.00, is_on_promotion:false}]) +# Chinese Tea + menu_category1_menu_item120 = SimpleMenuItem.create({item_code:"01002", name: "Chinese Tea", alt_name: "Twin Pot",menu_category: menu_category16 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1271", menu_item: menu_category1_menu_item120, price:1500.00, is_on_promotion:false}]) +# Juice +menu_category17 = MenuCategory.create({menu: menu, code:"C0016", name: "Juice", alt_name: "Beef_and_mutton", order_by: 16,created_by: "SYSTEM DEFAULT"}) +# Orange Juice + menu_category1_menu_item121 = SimpleMenuItem.create({item_code:"01002", name: "Orange Juice", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1281", menu_item: menu_category1_menu_item121, price:2000.00, is_on_promotion:false}]) +# Watermelon Juice + menu_category1_menu_item122 = SimpleMenuItem.create({item_code:"01002", name: "Watermelon Juice ", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1291", menu_item: menu_category1_menu_item122, price:2000.00, is_on_promotion:false}]) +# Lime Juice + menu_category1_menu_item123 = SimpleMenuItem.create({item_code:"01002", name: "Lime Juice", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1301", menu_item: menu_category1_menu_item123, price:2000.00, is_on_promotion:false}]) +# Sour Plum Juice + menu_category1_menu_item124 = SimpleMenuItem.create({item_code:"01002", name: "Sour Plum Juice ", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1311", menu_item: menu_category1_menu_item124, price:2000.00, is_on_promotion:false}]) +# Canned Drinks +menu_category18 = MenuCategory.create({menu: menu, code:"C0017", name: "Canned Drinks", alt_name: "Pork", order_by: 17,created_by: "SYSTEM DEFAULT"}) +# Coke + menu_category1_menu_item125 = SimpleMenuItem.create({item_code:"01002", name: "Coke ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1321", menu_item: menu_category1_menu_item125, price:1000.00, is_on_promotion:false}]) +# Coke Light + menu_category1_menu_item126 = SimpleMenuItem.create({item_code:"01002", name: "Coke Light ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1331", menu_item: menu_category1_menu_item126, price:1000.00, is_on_promotion:false}]) +# Sprite + menu_category1_menu_item127 = SimpleMenuItem.create({item_code:"01002", name: "Sprite ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1341", menu_item: menu_category1_menu_item127, price:1000.00, is_on_promotion:false}]) +# Red Bull + menu_category1_menu_item128 = SimpleMenuItem.create({item_code:"01002", name: "Red Bull ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1351", menu_item: menu_category1_menu_item128, price:1000.00, is_on_promotion:false}]) +# 100 Plus + menu_category1_menu_item129 = SimpleMenuItem.create({item_code:"01002", name: "100 Plus ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1361", menu_item: menu_category1_menu_item129, price:1000.00, is_on_promotion:false}]) +# POP Soda + menu_category1_menu_item130 = SimpleMenuItem.create({item_code:"01002", name: "POP Soda ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1371", menu_item: menu_category1_menu_item130, price:1000.00, is_on_promotion:false}]) +# Mineral Water + menu_category1_menu_item131 = SimpleMenuItem.create({item_code:"01002", name: "Mineral Water ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1381", menu_item: menu_category1_menu_item131, price:500.00, is_on_promotion:false}]) +# Beer +menu_category19 = MenuCategory.create({menu: menu, code:"C0018", name: "Beer", alt_name: "Chicken", order_by: 18, created_by: "SYSTEM DEFAULT"}) +# Myanmar Beer + menu_category1_menu_item132 = SimpleMenuItem.create({item_code:"01002", name: "Myanmar Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1392", menu_item: menu_category1_menu_item132, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1391", menu_item: menu_category1_menu_item132, price:3000.00, is_on_promotion:false}]) +# Tiger Beer + menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01002", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) +# Heineken Beer + menu_category1_menu_item134 = SimpleMenuItem.create({item_code:"01002", name: "Heineken Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1412", menu_item: menu_category1_menu_item134, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1411", menu_item: menu_category1_menu_item134, price:3600.00, is_on_promotion:false}]) +# Tsing Tao Beer + menu_category1_menu_item135 = SimpleMenuItem.create({item_code:"01002", name: "Tsing Tao Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1421", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) +# ABC Stout + menu_category1_menu_item136 = SimpleMenuItem.create({item_code:"01002", name: "ABC Stout ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1432", menu_item: menu_category1_menu_item136, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1431", menu_item: menu_category1_menu_item136, price:4000.00, is_on_promotion:false}]) +# Signature Hot Tea" +menu_category20 = MenuCategory.create({menu: menu, code:"C0019", name: "Signature Hot Tea", alt_name: "Chicken", order_by: 19, created_by: "SYSTEM DEFAULT"}) +puts "Beauty in the pot's menu setup" end +end From 34b1c26b0ba6acb494fb165b143f216fccf42547 Mon Sep 17 00:00:00 2001 From: Nweni Date: Thu, 15 Jun 2017 01:33:52 +0630 Subject: [PATCH 27/29] update --- app/models/order.rb | 16 ++++++++-------- app/models/sale.rb | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index bac7cd20..a53ba3cf 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -25,7 +25,7 @@ class Order < ApplicationRecord booking = nil if self.new_booking - + booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking", :checkin_at => Time.now.utc, :checkin_by => self.employee_name, :booking_status => "assign" }) @@ -228,11 +228,11 @@ class Order < ApplicationRecord bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") - .joins("left join orders on orders.order_id = booking_orders.order_id") + .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true) .group("bookings.booking_id") - # For PG + # For PG # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id end @@ -247,7 +247,7 @@ class Order < ApplicationRecord .joins("left join sales on sales.sale_id = bookings.sale_id") .where("sales.sale_status='completed'") .group("sales.sale_id") - # For PG + # For PG #bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id end @@ -263,7 +263,7 @@ class Order < ApplicationRecord .joins("left join sales on sales.sale_id = bookings.sale_id") .where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true) .group("bookings.booking_id") - # For PG + # For PG # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id end @@ -292,7 +292,7 @@ class Order < ApplicationRecord .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") - .where("(orders.status = 'new' or orders.status = 'billed')") + .where("(orders.status = 'new' or orders.status = 'billed')") # orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status, # orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id @@ -305,7 +305,7 @@ class Order < ApplicationRecord # left join sales on sales.sale_id = sale_orders.sale_id") # .where("(orders.status = 'new' or orders.status = 'billed')") # .group("orders.order_id") - # For PG + # For PG # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) # .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id") @@ -314,7 +314,7 @@ class Order < ApplicationRecord def self.search(search) if search # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) - where("order_id LIKE ?", "%#{search}%") + where("order_id LIKE ?", "%#{search}%") else find(:all) end diff --git a/app/models/sale.rb b/app/models/sale.rb index 426ece2d..67953c14 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -13,7 +13,7 @@ class Sale < ApplicationRecord has_many :sale_payments has_many :sale_orders has_many :bookings - + scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") } def generate_invoice_from_booking(booking_id, requested_by) @@ -57,11 +57,11 @@ class Sale < ApplicationRecord self.tax_type = "exclusive" # set cashier by current login - self.cashier_id = requested_by.id - self.cashier_name = requested_by.name - + # TODO: requested_by is string , can't cast to id. error occur. please fix + # self.cashier_id = requested_by.id + self.cashier_name = requested_by + self.requested_by = requested_by - self.requested_by = requested_by.name self.requested_at = DateTime.now.utc Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}" @@ -267,7 +267,7 @@ class Sale < ApplicationRecord def self.search(search) if search # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) - where("receipt_no LIKE ?", "%#{search}%",) + where("receipt_no LIKE ?", "%#{search}%",) else find(:all) end From a1a6adbdd66947578c70f7fdafc3922a0800fa10 Mon Sep 17 00:00:00 2001 From: Nweni Date: Thu, 15 Jun 2017 01:49:51 +0630 Subject: [PATCH 28/29] update --- db/seeds.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index 37484bef..458a0873 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -138,6 +138,9 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o #Create Adminstrator employee admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) +admin_employee = Employee.create({name: "Waiter 2", role: "waiter", password: "22222", emp_id:"222", created_by: "SYSTEM DEFAULT"}) +admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "33333", emp_id:"333", created_by: "SYSTEM DEFAULT"}) + order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"}) order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"}) request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"}) From 8d557cf7eb0b316cfd01fd3581b63bec79bd256b Mon Sep 17 00:00:00 2001 From: Nweni Date: Thu, 15 Jun 2017 09:39:30 +0630 Subject: [PATCH 29/29] remove put --- app/controllers/home_controller.rb | 1 - app/models/order.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index e84aef30..b89e7c63 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -10,7 +10,6 @@ class HomeController < ApplicationController @login_form.emp_id = params[:login_form][:emp_id] @login_form.password = params[:login_form][:password] @employee = Employee.login(@login_form.emp_id, @login_form.password) - puts @employee.role if @employee.role == "administrator" session[:session_token] = @employee.token_session redirect_to dashboard_path diff --git a/app/models/order.rb b/app/models/order.rb index a53ba3cf..b250c073 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -231,7 +231,7 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true) - .group("bookings.booking_id") + .group("bookings.booking_id,orders.status") # For PG # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id