From 49319d80cc8bbdadac07b9c2f15a6dff405de4fd Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Mon, 14 May 2018 11:38:39 +0630 Subject: [PATCH 01/15] Pull from master --- app/controllers/origami/shifts_controller.rb | 2 ++ app/models/shift_sale.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index acce6c65..2cea51a4 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -81,6 +81,8 @@ class Origami::ShiftsController < BaseOrigamiController #get tax shift_obj = ShiftSale.where('id =?',@shift.id) @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') + byebug + @total_waste = Sale.get_total_waste(@shift) #other payment details for mpu or visa like card @other_payment = ShiftSale.get_by_shift_other_payment(@shift) diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index 10b2de38..c2dac049 100755 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -94,6 +94,11 @@ class ShiftSale < ApplicationRecord end end + def self.get_total_waste(shift) + total_waste = Sale.select(" SUM(grand_total) as total_waste") + .where("sales.payment_status ='waste' and sale_status = 'waste'", shift.id) + end + def get_closing_balance(shift) shiftobj = ShiftSale.find(shift) closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash From 0b104b021b3513d7ec2857a5344829e0508079d2 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 14 May 2018 13:34:14 +0630 Subject: [PATCH 02/15] update add ordr --- app/views/origami/addorders/detail.html.erb | 2 +- app/views/origami/dashboard/index.html.erb | 4 ++-- app/views/origami/home/show.html.erb | 8 +++++++- config/environments/development.rb | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 391ba83b..65ea665b 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -17,7 +17,7 @@ <%if @menu.present? %> - <%=menu[0].name%> + <%=@menus[0].name%> <% end%> diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 4712a481..66f21ec2 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -222,9 +222,9 @@ $(function() { }); $(".qs_view").on('click', function() { - if ($('#server_mode').val() != "cloud") { + if ($('#server_mode').val() != "cloud") { document.getElementById('second_view').click(); - } + } window.location.href = '/origami/quick_service'; }); diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2915d3ca..e1b88f85 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -1010,7 +1010,13 @@ $('#add_order').on('click', function () { var dining_id = "<%= @dining.id %>"; - + var menus = JSON.parse(localStorage.getItem("menus")); + // if (menus != null) { + // console.log("menu"); + // menu_cache_append(menus); + // }else{ + // $("#menu_data").removeClass("hidden"); + // } window.location.href = '/origami/addorders/' + dining_id; }); diff --git a/config/environments/development.rb b/config/environments/development.rb index 2eda7ecf..d1fddff2 100755 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -55,5 +55,5 @@ Rails.application.configure do config.file_watcher = ActiveSupport::EventedFileUpdateChecker # Set Cable URL - config.action_cable.url = "ws://192.168.1.196:3002/cable" + # config.action_cable.url = "ws://192.168.1.196:3002/cable" end From 57c9cd4d6fa0480a90a6867ac1775385d872404f Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 14 May 2018 14:49:21 +0630 Subject: [PATCH 03/15] updaate loading menu cache --- app/views/origami/dashboard/index.html.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 66f21ec2..a0b0dc51 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -1,4 +1,7 @@
+

<%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %>

@@ -208,14 +211,23 @@ " id="server_mode">