From dc2637ed39b1761ed15b2e3c08343a022b3ac000 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 15 Jan 2018 16:32:20 +0630 Subject: [PATCH 01/18] change process flow for extra time --- app/controllers/api/orders_controller.rb | 21 ++++++------------- .../origami/addorders_controller.rb | 19 ++++++----------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 1616be04..deb1039e 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -54,22 +54,13 @@ class Api::OrdersController < Api::ApiController extra_time = '' params[:order_items].each { |i| - if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30' || i["item_instance_code"] == 'Extie45' || i["item_instance_code"] == 'Extie15' + i["item_instance_code"] = i["item_instance_code"].downcase.to_s + if i["item_instance_code"].include? "ext" is_extra_time = true - if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30' - t = Time.now - time = 30*60*i["quantity"].to_i - extra_time = Time.at(time) - elsif i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie15' - time = 15*60*i["quantity"].to_i - extra_time = Time.at(time) - elsif i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extie45' - time = 45*60*i["quantity"].to_i - extra_time = Time.at(time) - else - t = Time.now - time = 60*60*i["quantity"].to_i - extra_time = Time.at(time) + arr_exts = i["item_instance_code"].split("_") + if arr_exts[1].match(/^(\d)+$/) + time = arr_exts[1].to_i*60*i["quantity"].to_i + extra_time = Time.at(time) end end } diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 9a06af0b..6b4200da 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -67,20 +67,13 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController items_arr = [] JSON.parse(params[:order_items]).each { |i| - if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30' || i["item_instance_code"] == 'Extie45' || i["item_instance_code"] == 'Extie15' + i["item_instance_code"] = i["item_instance_code"].downcase.to_s + if i["item_instance_code"].include? "ext" is_extra_time = true - if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30' - time = 30*60*i["quantity"].to_i - extra_time = Time.at(time) - elsif i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie15' - time = 15*60*i["quantity"].to_i - extra_time = Time.at(time) - elsif i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extie45' - time = 45*60*i["quantity"].to_i - extra_time = Time.at(time) - else - time = 60*60*i["quantity"].to_i - extra_time = Time.at(time) + arr_exts = i["item_instance_code"].split("_") + if arr_exts[1].match(/^(\d)+$/) + time = arr_exts[1].to_i*60*i["quantity"].to_i + extra_time = Time.at(time) end end items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]} From b480f8cd61fea214a604771f8f5c0bc3ce93b57b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 15 Jan 2018 16:47:41 +0630 Subject: [PATCH 02/18] update payment detail show --- app/views/origami/payments/show.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 78660997..97c4d216 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -313,8 +313,8 @@ } payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment") - console.log(payment_type) if ($("#server_mode").val() != "cloud") { // first bill not used in cloud + if (member_id && member_discount) { if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ $("#credit_payment").hide(); @@ -457,9 +457,9 @@ var credit = $('#credit').text(); var card = $('#card').text(); - if (credit <= 0) { - calculate_member_discount(sale_id); - } + if (credit <= 0) { + calculate_member_discount(sale_id); + } $.ajax({type: "POST", url: "<%= origami_payment_cash_path %>", From fb989572b1c89bad7b3612df17898478af2e6372 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 15 Jan 2018 17:48:35 +0630 Subject: [PATCH 03/18] update room for first bill --- app/controllers/origami/void_controller.rb | 3 ++ app/views/origami/home/show.html.erb | 2 +- app/views/origami/rooms/show.html.erb | 60 +++++++++++++--------- 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index a0c4a23b..0d368224 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -63,6 +63,7 @@ class Origami::VoidController < BaseOrigamiController member_info = nil rebate_amount = nil + current_balance = nil # For Cashier by Zone bookings = Booking.where("sale_id='#{sale_id}'") @@ -87,7 +88,9 @@ class Origami::VoidController < BaseOrigamiController if customer.membership_id != nil && rebate member_info = Customer.get_member_account(customer) rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + current_balance = SaleAudit.paymal_search(sale_id) end + # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) # Calculate Food and Beverage Total diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index fc1a5b20..372efa83 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -576,7 +576,7 @@ swal ( "Oops" , "Please select an table!" , "warning" ); } }else{ - swal("Opps","You are not authorized for void","warning") + swal("Opps","You are not authorized for Discount","warning") } return false; }); diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index f8dc69f0..00350f1b 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -367,17 +367,21 @@ - + - - - <% if ENV["SERVER_MODE"] != "cloud" %> - - <% end %> + <% if ENV["SERVER_MODE"] == "cloud" %> + + <% else %> + <%if @membership.discount && @obj_sale.customer.membership_id %> + + <%else%> + + <%end%> + <%end%> <% end %> @@ -393,6 +397,7 @@