From 7de795ee272b34393bbec4f347eabe22839b9029 Mon Sep 17 00:00:00 2001
From: NyanLinHtut "+type+""+type+"
"
$(value).each(function(i){
row +="";
+ +type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"";
});
- $(".options-list").append(row);
+ $(".options-list").append(row);
}
$('.set-item').attr('data-code',instances[0]['code']);
$('.set-item').attr('data-name',instances[0]['name']);
@@ -313,8 +311,8 @@ $(function() {
$('#set_unit_price').text($(this).attr('data-price'));
// $('#set_unit_price').text(0);
});
- // click instance for add item set
- $(document).on('click', '.instance_box', function(event){
+ // click instance for add item set
+ $(document).on('click', '.instance_box', function(event){
$(".options-list").empty();
@@ -326,18 +324,18 @@ $(function() {
max_qty = $(this).data('max-qty');
code = $(this).data('code');
-
+
if (rowCount.length+1 <= max_qty) {
- for(var field in item_options) {
+ for(var field in item_options) {
value = item_options[field]["values"];
type = item_options[field]["type"];
row = "'+rowCount+''
+' ';
$(".second_display_items tbody").append(row);
-
+
}
}
}
@@ -117,28 +117,29 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
+'' + items[i].name+ ' ' + instance + ' ' + option_name +' '
+'' + qty + ' '
- +''
+ +' '
+ parseFloat(price).toFixed(2)
- +' '
+ +''
+''+rowCount+' '
+'' + item_name+ ' ' + name + ''+option+' '
+'' + qty + ' '
- +''
+ +' '
+ parseFloat(total).toFixed(2)
- +' '
+ +''
+'';
$(".second_display_items tbody").append(row);
rowCount = rowCount + 1;
-
+
}
}
//remove item
if(status == "remove"){
for(var i in items) {
- var item_code = items[i].item_code;
+ var item_code = items[i].instance_code;
$("#order-items-table tbody > tr.item_box_"+item_code+"").remove();
}
}
//remove item
//update item qty
if(status == "update_qty"){
+
for(var i in items) {
- var item_code = items[i].item_code;
+ var item_code = items[i].instance_code;
var item_qty = parseInt(items[i].qty);
var item_price = parseFloat(items[i].price);
var item_total = parseFloat(item_qty * item_price).toFixed(2);
@@ -157,8 +158,8 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
$(item_row).each(function(i){
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
- total_price += qty*unit_price;
- });
+ total_price += qty*unit_price;
+ });
//calculate Tax Amount
for(var i in tax) {
// substract , to give after discount
@@ -177,13 +178,12 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
var fixed_taxable_amount = parseFloat(total_tax_amount).toFixed(2);
var fixed_grand_total = parseFloat(total_price + total_tax_amount).toFixed(2);
- $('#s_sub_total').empty();
+ $('#s_sub_total').empty();
$('#s_sub_total').append(fixed_total_price);
- $('#s_tatal_tax').empty();
+ $('#s_tatal_tax').empty();
$('#s_tatal_tax').append(fixed_taxable_amount);
- $('#s_grand_total').empty();
+ $('#s_grand_total').empty();
$('#s_grand_total').append(fixed_grand_total);
}
}
});
-
diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb
index 2f67a484..521f58a3 100755
--- a/app/controllers/api/payments_controller.rb
+++ b/app/controllers/api/payments_controller.rb
@@ -31,7 +31,7 @@ class Api::PaymentsController < Api::ApiController
if @status
sale_payment = SalePayment.new
status, @sale, @membership_data = sale_payment.process_payment(sale, current_login_employee, sale.grand_total, "paymal",params[:card_no])
-
+
if status == true && @membership_data["status"] == true
sale_payment = SalePayment.new
status = sale_payment.process_payment(sale, current_login_employee, 0, "cash")
@@ -95,7 +95,7 @@ class Api::PaymentsController < Api::ApiController
@message = membership_data["message"]
end
else
- @status = false
+ @status = false
@message = "No gateway url!"
end
diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb
index d4486da5..22442fb0 100755
--- a/app/controllers/origami/addorders_controller.rb
+++ b/app/controllers/origami/addorders_controller.rb
@@ -1,10 +1,10 @@
class Origami::AddordersController < BaseOrigamiController
# before_action :set_dining, only: [:detail]
-
+
def index
@webview = false
if check_mobile
- @webview = true
+ @webview = true
end
@tables = Table.all.active.order('zone_id asc').group("zone_id")
@@ -17,7 +17,7 @@ class Origami::AddordersController < BaseOrigamiController
@cashier_type = params[:type]
@webview = false
if check_mobile
- @webview = true
+ @webview = true
end
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@@ -29,7 +29,7 @@ class Origami::AddordersController < BaseOrigamiController
@menus = []
@menu = []
# else
- # @menus = Menu.all
+ # @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@@ -57,10 +57,10 @@ class Origami::AddordersController < BaseOrigamiController
def get_menu_category ()
if (params[:id])
-
+
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
-
+
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
@@ -96,9 +96,9 @@ class Origami::AddordersController < BaseOrigamiController
return @sub_menu
end
end
-
+
def get_all_product()
- @product = Product.all
+ @product = Product.all
end
def create
@@ -108,7 +108,7 @@ class Origami::AddordersController < BaseOrigamiController
extra_time = ''
items_arr = []
- JSON.parse(params[:order_items]).each { |i|
+ JSON.parse(params[:order_items]).each { |i|
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
if i["item_instance_code"].include? "ext"
is_extra_time = true
@@ -192,25 +192,25 @@ class Origami::AddordersController < BaseOrigamiController
type = 'order'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
-
+
end
if params[:order_source] != "quick_service" && params[:order_source] != "food_court"
process_order_queue(@order.order_id,@order.table_id,@order.source)
- end
- end
+ end
+ end
# Order.send_customer_view(@booking)
-
+
if current_user.role != "waiter" && params[:create_type] == "create_pay"
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
-
+
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
-
- # for second display
+
+ # for second display
if @order.source == 'quick_service'
from = getCloudDomain #get sub domain in cloud mode
- ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
+ ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
end
#end
result = {:status=> @status, :data => @sale }
@@ -220,7 +220,7 @@ class Origami::AddordersController < BaseOrigamiController
result = {:status=> @status, :data => 0 }
render :json => result.to_json
end
-
+
end
# render json for http status code
@@ -266,9 +266,9 @@ class Origami::AddordersController < BaseOrigamiController
def process_order_queue(order_id,table_id,order_source)
print_status = nil
cup_status = nil
-
+
#Send to background job for processing
- order = Order.find(order_id)
+ order = Order.find(order_id)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
if ENV["SERVER_MODE"] != 'cloud'
cup_status = `#{"sudo service cups status"}`
@@ -307,7 +307,7 @@ class Origami::AddordersController < BaseOrigamiController
else
if ENV["SERVER_MODE"] != 'cloud'
from = ""
- msg = ' Print Error ! Please contact to service'
+ msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error',from:from
end
if !sidekiq.nil?
@@ -342,7 +342,7 @@ class Origami::AddordersController < BaseOrigamiController
return from
end
-
+
private
# def set_dining
diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index 59aaec3a..794908fa 100755
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -8,14 +8,14 @@ class Origami::PaymentsController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
member_info = nil
-
+
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
- # if bookings.count > 1
+ # if bookings.count > 1
# # for Multiple Booking
# table = DiningFacility.find(bookings[0].dining_facility_id)
# else
- # table = DiningFacility.find(bookings[0].dining_facility_id)
+ # table = DiningFacility.find(bookings[0].dining_facility_id)
# end
shift = ShiftSale.current_open_shift(current_user.id)
if !shift.nil?
@@ -48,7 +48,7 @@ class Origami::PaymentsController < BaseOrigamiController
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
- if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
+ if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
else
@@ -59,7 +59,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
#shop detail
- ## shop_detail = Shop.first
+ ## shop_detail = Shop.first
# customer= Customer.where('customer_id=' +.customer_id)
customer = Customer.find(sale_data.customer_id)
# rounding adjustment
@@ -71,14 +71,14 @@ class Origami::PaymentsController < BaseOrigamiController
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
rounding_adj = new_total-sale_data.grand_total
- sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj)
+ sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj)
end
end
#end rounding adjustment
#record for sale audit
action_by = current_user.name
type = "FIRST_BILL"
-
+
remark = "#{action_by} print out first bill for Receipt No #{sale_data.receipt_no}"
sale_audit = SaleAudit.record_audit_sale(sale_id,remark,action_by,type )
# get member information
@@ -102,12 +102,12 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
- filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil,nil,nil)
+ filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil,nil,nil)
- result = {
- :filepath => filename,
- :printer_model => print_settings.brand_name,
- :printer_url => print_settings.api_settings
+ result = {
+ :filepath => filename,
+ :printer_model => print_settings.brand_name,
+ :printer_url => print_settings.api_settings
}
# Mobile Print
@@ -127,7 +127,7 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
- #shop_detail = Shop.first
+ #shop_detail = Shop.first
# rounding adjustment
if !path.include? ("credit_payment")
if shop_detail.is_rounding_adj
@@ -138,12 +138,12 @@ class Origami::PaymentsController < BaseOrigamiController
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
- saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
+ saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
end
end
#end rounding adjustment
-
+
sale_payment = SalePayment.new
if path.include? ("credit_payment")
sale_payment.process_payment(saleObj, current_user, cash, "cash", nil, true)
@@ -166,7 +166,7 @@ class Origami::PaymentsController < BaseOrigamiController
table = DiningFacility.find(bookings.dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
-
+
type = 'payment'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
@@ -193,11 +193,11 @@ class Origami::PaymentsController < BaseOrigamiController
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
- if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
+ if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
# else
-
+
end
end
end
@@ -208,16 +208,16 @@ class Origami::PaymentsController < BaseOrigamiController
# get member information
rebate = MembershipSetting.find_by_rebate(1)
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
-
+
if customer.membership_id != nil && rebate && credit_data.nil?
member_info = Customer.get_member_account(customer)
-
+
if member_info["status"] == true
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
end
end
-
+
#orders print out
if params[:type] == "quick_service"
booking = Booking.find_by_sale_id(sale_id)
@@ -226,7 +226,7 @@ class Origami::PaymentsController < BaseOrigamiController
else
table_id = 0
end
-
+
latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
if !latest_order.nil?
latest_order_no = latest_order.order_id
@@ -241,13 +241,13 @@ class Origami::PaymentsController < BaseOrigamiController
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
end
-
+
end
#for card sale data
card_data = Array.new
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
- if !card_sale_trans_ref_no.nil?
+ if !card_sale_trans_ref_no.nil?
card_sale_trans_ref_no.each do |cash_sale_trans|
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
@@ -259,7 +259,7 @@ class Origami::PaymentsController < BaseOrigamiController
#card_balance amount for Paymal payment
card_balance_amount = SaleAudit.getCardBalanceAmount(sale_id)
-
+
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
@@ -274,10 +274,16 @@ class Origami::PaymentsController < BaseOrigamiController
#end
end
- end
+ end
end
def show
+ display_type = Lookup.find_by_lookup_type("display_type")
+ if !display_type.nil? && display_type.value.to_i ==2
+ @display_type = display_type.value
+ else
+ @display_type = nil
+ end
path = request.fullpath
sale_id = params[:sale_id]
@trans_flag = true
@@ -287,11 +293,11 @@ class Origami::PaymentsController < BaseOrigamiController
else
@cashier_type = params[:type]
end
-
+
if path.include? ("credit_payment")
@sale_payment = SalePayment.get_credit_amount_due_left(sale_id)
end
-
+
@member_discount = MembershipSetting.find_by_discount(1)
@membership_rebate_balance=0
@@ -326,15 +332,15 @@ class Origami::PaymentsController < BaseOrigamiController
lookup_changable_tax = Lookup.collection_of('changable_tax')
if !lookup_changable_tax.empty?
lookup_changable_tax.each do |changable_tax|
- if changable_tax[0].downcase == "change"
- if changable_tax[1] == '0'
+ if changable_tax[0].downcase == "change"
+ if changable_tax[1] == '0'
@changable_tax = false
end
end
end
end
-
- @shop = shop_detail #show shop info
+
+ @shop = shop_detail #show shop info
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
@@ -373,7 +379,7 @@ class Origami::PaymentsController < BaseOrigamiController
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@rounding_adj = new_total-saleObj.grand_total
- saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
+ saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
@sale_data.grand_total = new_total
@sale_data.old_grand_total = saleObj.grand_total
@sale_data.rounding_adjustment = @rounding_adj
@@ -418,11 +424,11 @@ class Origami::PaymentsController < BaseOrigamiController
end
end
end
- end
+ end
#end customer amount
- #paymal payment
+ #paymal payment
@sale_data.bookings.each do |sbk|
if sbk.dining_facility_id.to_i >0
@@ -444,13 +450,13 @@ class Origami::PaymentsController < BaseOrigamiController
@sale_payment_data = SalePayment.get_sale_payments(@sale_data)
end
@sale_payment_data.each do |spay|
- if spay.payment_method == "cash"
+ if spay.payment_method == "cash"
@cash += spay.payment_amount
end
- if spay.payment_method !="creditnote"
+ if spay.payment_method !="creditnote"
@other_payment += spay.payment_amount
end
-
+
if spay.payment_method == "mpu"
@other += spay.payment_amount
elsif spay.payment_method == "paypar"
@@ -485,7 +491,7 @@ class Origami::PaymentsController < BaseOrigamiController
member_info = nil
latest_order_no = nil
saleObj = Sale.find(sale_id)
-
+
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
@@ -494,11 +500,11 @@ class Origami::PaymentsController < BaseOrigamiController
if !latest_order.nil?
latest_order_no = latest_order.order_id
end
- # if bookings.count > 1
+ # if bookings.count > 1
# # for Multiple Booking
# table = DiningFacility.find(bookings[0].dining_facility_id)
# else
- # table = DiningFacility.find(bookings[0].dining_facility_id)
+ # table = DiningFacility.find(bookings[0].dining_facility_id)
# end
shift = ShiftSale.current_open_shift(current_user.id)
if !shift.nil?
@@ -512,14 +518,14 @@ class Origami::PaymentsController < BaseOrigamiController
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
- end
+ end
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
- if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
+ if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
else
@@ -531,7 +537,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
#shop detail
- #shop_detail = Shop.first
+ #shop_detail = Shop.first
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
@@ -543,7 +549,7 @@ class Origami::PaymentsController < BaseOrigamiController
#for card sale data
card_data = Array.new
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
- if !card_sale_trans_ref_no.nil?
+ if !card_sale_trans_ref_no.nil?
card_sale_trans_ref_no.each do |cash_sale_trans|
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
@@ -566,20 +572,20 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
-
- result = {
+
+ result = {
:status => true,
- :filepath => filename,
- :printer_model => print_settings.brand_name,
- :printer_url => print_settings.api_settings
+ :filepath => filename,
+ :printer_model => print_settings.brand_name,
+ :printer_url => print_settings.api_settings
}
-
+
# Mobile Print
render :json => result.to_json
# end
end
- def foc
+ def foc
cash = params[:cash]
sale_id = params[:sale_id]
sub_total = params[:sub_total]
@@ -598,7 +604,7 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0,order_source)
end
-
+
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
sale_payment = SalePayment.new
@@ -612,7 +618,7 @@ class Origami::PaymentsController < BaseOrigamiController
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
end
-
+
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
@@ -629,17 +635,17 @@ class Origami::PaymentsController < BaseOrigamiController
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
- end
-
+ end
+
# Re-call Sale Data
saleObj = Sale.find(sale_id)
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
-
+
#shop detail
- #shop_detail = Shop.first
+ #shop_detail = Shop.first
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
@@ -652,11 +658,11 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil,nil,nil)
- result = {
+ result = {
:status => true,
- :filepath => filename,
- :printer_model => print_settings.brand_name,
- :printer_url => print_settings.api_settings
+ :filepath => filename,
+ :printer_model => print_settings.brand_name,
+ :printer_url => print_settings.api_settings
}
# Mobile Print
@@ -669,26 +675,26 @@ class Origami::PaymentsController < BaseOrigamiController
else
table_id = 0
end
-
+
booking.booking_orders.each do |order|
Order.pay_process_order_queue(order.order_id,table_id)
end
end
# end
- end
+ end
end
def rounding_adj
saleObj = Sale.find(params[:sale_id])
@shop = shop_detail
-
+
if @shop.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
- b = saleObj.grand_total / 25 # Division
+ b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
- if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
+ if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
@@ -697,12 +703,12 @@ class Origami::PaymentsController < BaseOrigamiController
end
#print function for receipt
- def print
+ def print
filename = params[:filename]
receipt_no = params[:receipt_no]
printer_name = params[:printer_name]
cashier_type = params[:type]
-
+
if cashier_type.strip.downcase == "doemal_order"
unique_code = "ReceiptBillOrderPdf"
else
@@ -720,7 +726,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
- if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
+ if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
# else
@@ -734,12 +740,12 @@ class Origami::PaymentsController < BaseOrigamiController
print_settings=PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
-
- result = {
+
+ result = {
:status => true,
- :filepath => filename,
- :printer_model => print_settings.brand_name,
- :printer_url => print_settings.api_settings
+ :filepath => filename,
+ :printer_model => print_settings.brand_name,
+ :printer_url => print_settings.api_settings
}
Rails.logger.debug "$$$$$$$$$ result ::"
Rails.logger.debug result
@@ -755,7 +761,7 @@ class Origami::PaymentsController < BaseOrigamiController
tax_type = params[:tax_type]
sale = Sale.find(sale_id)
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount,nil,order_source,tax_type)
-
+
render json: JSON.generate({:status => true})
end
@@ -768,4 +774,4 @@ class Origami::PaymentsController < BaseOrigamiController
return from
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/origami/quick_service_controller.rb b/app/controllers/origami/quick_service_controller.rb
index 98e61545..f13d0dab 100644
--- a/app/controllers/origami/quick_service_controller.rb
+++ b/app/controllers/origami/quick_service_controller.rb
@@ -6,7 +6,7 @@ class Origami::QuickServiceController < ApplicationController
redirect_to root_path
end
end
-
+
def index
today = DateTime.now
day = Date.today.wday
@@ -14,7 +14,7 @@ class Origami::QuickServiceController < ApplicationController
@menus = []
@menu = []
# else
- # @menus = Menu.all
+ # @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@zone = Zone.all
@@ -28,20 +28,20 @@ class Origami::QuickServiceController < ApplicationController
else
@display_type = nil
end
-
+
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
- if dine_in[0].downcase == "dineincashier"
- if dine_in[1] == '1'
+ if dine_in[0].downcase == "dineincashier"
+ if dine_in[1] == '1'
@quick_service_only = false
end
end
end
end
-
+
render "origami/addorders/detail"
end
@@ -53,7 +53,7 @@ class Origami::QuickServiceController < ApplicationController
@menus = []
@menu = []
# else
- # @menus = Menu.all
+ # @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
if(params[:id][0,3] == "BKI")
@@ -65,7 +65,7 @@ class Origami::QuickServiceController < ApplicationController
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
end
-
+
@sale_id = params[:sale_id]
if @booking
@@ -96,7 +96,7 @@ class Origami::QuickServiceController < ApplicationController
@cashier_type = "quick_service"
items_arr = []
- JSON.parse(params[:order_items]).each { |i|
+ JSON.parse(params[:order_items]).each { |i|
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
if i["item_instance_code"].include? "ext"
is_extra_time = true
@@ -169,7 +169,7 @@ class Origami::QuickServiceController < ApplicationController
end
@status, @booking = @order.generate
- if(params[:sale_id][0,3] == "SAL")
+ if(params[:sale_id][0,3] == "SAL")
if @status && @booking && @order.source == 'quick_service'
if params[:sale_id]
@sale = Sale.find(params[:sale_id])
@@ -180,17 +180,17 @@ class Origami::QuickServiceController < ApplicationController
end
update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking)
end
-
+
result = {:status=> true, :data => @sale }
render :json => result.to_json
- end
+ end
elsif (params[:sale_id][0,3] == "BKI")
result = {:status=> true, :data => 'OK' }
- render :json => result.to_json
+ render :json => result.to_json
else
result = {:status=> true, :data => nil }
render :json => result.to_json
- end
+ end
end
@@ -216,9 +216,9 @@ class Origami::QuickServiceController < ApplicationController
return @sub_menu
end
end
-
+
def get_all_product()
- @product = Product.all
+ @product = Product.all
end
# render json for http status code
diff --git a/app/controllers/origami/second_display_controller.rb b/app/controllers/origami/second_display_controller.rb
index d28d7b06..21c0674d 100644
--- a/app/controllers/origami/second_display_controller.rb
+++ b/app/controllers/origami/second_display_controller.rb
@@ -9,7 +9,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
def customer_view
display_type = Lookup.find_by_lookup_type("display_type")
- if !display_type.nil? && display_type.value.to_i == 2
+ if !display_type.nil? && display_type.value.to_i == 2
if params[:status]!= "billed"
tax_profiles = TaxProfile.all.order("order_by asc")
else
@@ -17,7 +17,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
end
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
- else
+ else
from = ""
end
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 415e8f2c..90530096 100755
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -139,7 +139,16 @@
Team Viewer