diff --git a/app/controllers/origami/cash_ins_controller.rb b/app/controllers/origami/cash_ins_controller.rb
index 1207d486..030b56e1 100755
--- a/app/controllers/origami/cash_ins_controller.rb
+++ b/app/controllers/origami/cash_ins_controller.rb
@@ -8,31 +8,32 @@ class Origami::CashInsController < BaseOrigamiController
amount = params[:amount]
payment_method = params[:payment_method]
payment_method_reference = params[:payment_method_reference]
+ type = params[:type]
p_jour = PaymentJournal.new
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
shift = ShiftSale.current_open_shift(current_user.id)
current_shift = ShiftSale.current_shift
- # set cashier
+ # set cashier
if shift != nil
shift = shift
else
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
if open_cashier.count>0
-
- shift = ShiftSale.current_open_shift(open_cashier[0].id)
-
- if shift
- shift = ShiftSale.current_open_shift(shift.id)
- else
- shift = ShiftSale.current_open_shift(current_shift.id)
- end
- else
- shift = Employee.find(current_shift.employee_id).name
- end
+ shift = ShiftSale.current_open_shift(open_cashier[0].id)
+
+ if shift
+ shift = ShiftSale.current_open_shift(shift.id)
+ else
+ shift = ShiftSale.current_open_shift(current_shift.id)
+ end
+ else
+ shift = Employee.find(current_shift.employee_id).name
+
end
+ end
shift.cash_in = shift.cash_in + amount.to_f
shift.save
diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb
index 4fa6002b..d6230993 100644
--- a/app/controllers/origami/pending_order_controller.rb
+++ b/app/controllers/origami/pending_order_controller.rb
@@ -62,7 +62,13 @@ class Origami::PendingOrderController < BaseOrigamiController
@table_id = nil
@dining = nil
end
+ end
+ def cash_ins
+ render "origami/cash_ins/new"
+ end
+ def cash_outs
+ render "origami/cash_outs/new"
end
end
diff --git a/app/views/origami/cash_ins/new.html.erb b/app/views/origami/cash_ins/new.html.erb
index bda159e2..0b27a62f 100755
--- a/app/views/origami/cash_ins/new.html.erb
+++ b/app/views/origami/cash_ins/new.html.erb
@@ -56,6 +56,9 @@
diff --git a/app/views/origami/cash_outs/new.html.erb b/app/views/origami/cash_outs/new.html.erb
index 64b3909f..32f43099 100755
--- a/app/views/origami/cash_outs/new.html.erb
+++ b/app/views/origami/cash_outs/new.html.erb
@@ -25,6 +25,7 @@
diff --git a/app/views/origami/pending_order/completed_sale.html.erb b/app/views/origami/pending_order/completed_sale.html.erb
index 8f986f2c..507d698e 100644
--- a/app/views/origami/pending_order/completed_sale.html.erb
+++ b/app/views/origami/pending_order/completed_sale.html.erb
@@ -172,6 +172,8 @@
<% if current_user.role != "waiter" %>
+
+
<% end %>
@@ -201,7 +203,13 @@ $(document).ready(function(){
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
+ $('#cash_in').on('click',function(){
+ window.location.href = '/origami/quick_service/cash_ins';
+ })
+ $('#cash_out').on('click',function(){
+ window.location.href = '/origami/quick_service/cash_outs';
+ })
});
diff --git a/app/views/origami/pending_order/index.html.erb b/app/views/origami/pending_order/index.html.erb
index 58e94451..673dd8e2 100644
--- a/app/views/origami/pending_order/index.html.erb
+++ b/app/views/origami/pending_order/index.html.erb
@@ -55,7 +55,9 @@
<% if current_user.role != "waiter" %>
- <% end %>
+
+
+ <% end %>
@@ -83,6 +85,14 @@
warnBeforeRedirect(linkURL);
});
+ $('#cash_in').on('click',function(){
+ window.location.href = '/origami/quick_service/cash_ins';
+ })
+
+ $('#cash_out').on('click',function(){
+ window.location.href = '/origami/quick_service/cash_outs';
+ })
+
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb
index 05dca72c..15d3aa12 100644
--- a/app/views/origami/pending_order/show.html.erb
+++ b/app/views/origami/pending_order/show.html.erb
@@ -188,6 +188,8 @@
<%end%>
<% if current_user.role != "waiter" %>
+
<% end %>
@@ -321,5 +323,13 @@ $(document).ready(function(){
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
}
});
+
+ $('#cash_in').on('click',function(){
+ window.location.href = '/origami/quick_service/cash_ins';
+ })
+
+ $('#cash_out').on('click',function(){
+ window.location.href = '/origami/quick_service/cash_outs';
+ })
});
diff --git a/config/routes.rb b/config/routes.rb
index 6b888e1d..77e26bbb 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -110,6 +110,8 @@ scope "(:locale)", locale: /en|mm/ do
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' }
+ get "quick_service/cash_ins" => "pending_order#cash_ins"
+ get "quick_service/cash_outs" => "pending_order#cash_outs"
resources :cash_ins, only: [:new, :create]
resources :cash_outs, only: [:new, :create]