Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
console.log(cashier_type)
|
||||
|
||||
var payment_method = "";
|
||||
$('.payment-type').on('click',function(){
|
||||
$('.payment-type').css("background-color","#7a62d3")
|
||||
@@ -80,11 +83,19 @@
|
||||
url: "<%= origami_cash_ins_path %>",
|
||||
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
|
||||
success:function(result){
|
||||
window.location.href = '/origami';
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami';
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
$('#cash_out').on('click',function(){
|
||||
var reference = $('#reference').val();
|
||||
var remark = $('#remark').val();
|
||||
@@ -33,12 +34,22 @@
|
||||
url: "<%= origami_cash_outs_path %>",
|
||||
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
|
||||
success:function(result){
|
||||
window.location.href = '/origami';
|
||||
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami';
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -571,6 +571,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
console.log(payment_type)
|
||||
console.log(parseInt(jQuery.inArray("MPU", payment_type)))
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
@@ -654,7 +655,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Alipay Payment","warning");
|
||||
}
|
||||
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
|
||||
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
|
||||
|
||||
@@ -172,6 +172,8 @@
|
||||
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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';
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -55,7 +55,9 @@
|
||||
</button>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<% end %>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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!",
|
||||
|
||||
@@ -188,6 +188,8 @@
|
||||
<%end%>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<!-- <button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button> -->
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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';
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -20,11 +20,11 @@ class ActionController::Base
|
||||
end
|
||||
else
|
||||
#check for license file
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
else
|
||||
redirect_to activate_path
|
||||
end
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user