Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill

This commit is contained in:
phyusin
2018-02-19 17:40:02 +06:30
61 changed files with 2180 additions and 397 deletions

View File

@@ -1,4 +1,7 @@
$(function() { $(function() {
type = $('#type').val();
modify_order = $('#modify_order').val();
//click menu sidebar menu category //click menu sidebar menu category
$(".product").on("click", function(){ $(".product").on("click", function(){
var url = $(this).attr('data-ref'); var url = $(this).attr('data-ref');
@@ -83,9 +86,17 @@ $(function() {
//show menu item list when click menu category //show menu item list when click menu category
function show_menu_item_list(url_item){ function show_menu_item_list(url_item){
var menu_list = $('.menu_items_list'); var menu_list = $('.menu_items_list');
menu_list.empty(); menu_list.empty();
if (modify_order=="true" && type =="true") {
url_item = '../../../addorders/'+url_item;
}if(modify_order=="false" && type =="true"){
url_item = 'addorders/'+url_item
}else{
url_item = url_item;
}
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
@@ -112,8 +123,10 @@ $(function() {
if (JSON.stringify(menu_items[field].item_sets)!='[]') { if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = ''; fa_plus = '';
add = ''; add = '';
menu_item_box = 'set_item_box'; menu_item_box = 'add_icon';
data_target = 'sx_item_set_detailModal'; data_target = 'sx_item_set_detailModal';
data_modal = 'modal'
add_icon = "set_item_box"
code = menu_items[field].code; code = menu_items[field].code;
name = menu_items[field].name; name = menu_items[field].name;
instances = menu_items[field].instances; instances = menu_items[field].instances;
@@ -133,6 +146,8 @@ $(function() {
add = 'add' add = 'add'
menu_item_box = 'menu_item_box'; menu_item_box = 'menu_item_box';
data_target = 'sx_item_detailModal'; data_target = 'sx_item_detailModal';
data_modal = ''
add_icon = "add_icon"
$(instances).each(function(i){ $(instances).each(function(i){
if (instances[i].is_default === true) { if (instances[i].is_default === true) {
@@ -149,39 +164,51 @@ $(function() {
} }
if (menu_items[field].image) { if (menu_items[field].image) {
image_path = menu_items[field].image; if (modify_order) {
image_path = "../../"+menu_items[field].image;
}else{ }else{
image_path = "/image/logo.png"; image_path = menu_items[field].image;
} }
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">' }else{
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">' if (modify_order) {
+'<div class="col-md-9">'+ menu_items[field].name +'</div>' image_path = "../../image/logo.png";
+"<div class='col-md-3 add_icon' data-item-code='" }else{
+ menu_items[field].code +"' data-name='" image_path = "image/logo.png";
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '" }
+ price +"' data-instance-code = '"+ code +"' data-instance = '" }
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ options +"' data-image='"+image_path+"'>"
+"<i class='fa "+fa_plus+" '>"
+add+ '</i>'
+'</div>'
+'</div>'
+"<div class='"+menu_item_box+"' data-item-code='"
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
+ menu_items[field].code +"' data-instance = '" + menu_items[field].code +"' data-instance = '"
+JSON.stringify(menu_items[field].instances)+"' data-id = '" +JSON.stringify(menu_items[field].instances)+"' data-id = '"
+JSON.stringify(menu_items[field].attributes)+"' data-item = '" +JSON.stringify(menu_items[field].attributes)+"' data-item = '"
+JSON.stringify(item_attributes)+"' data-option = '" +JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '" +JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >" +JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
+"<i class='fa "+fa_plus+" '>"
+add+ '</i>'
+'</div>'
+'</div>'
+"<div class='"+add_icon+" p-t-65 m-r--5' data-item-code='"
+ menu_items[field].code +"' data-name='"
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ options +"' data-image='"+image_path+"' data-toggle='"
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
+JSON.stringify(menu_items[field].instances)+"'>"
+"<div class='card-block custom-card-block'>" // +"<div class='card-block custom-card-block'>"
+"<img id='logo' height='125px' src='"+image_path+"'>" // +"<img id='logo' height='' src='"+image_path+"'>"
+"</div>" // +"</div>"
+'<div class="card-footer custom-card-footer">' +'<div class="card-footer custom-card-footer" style="opacity:0.7">'
+'<span>'+ price +'</span>' +'<span>'+ price +'</span>'
+'</div>' +'</div>'
+'</div>'; +'</div>';
@@ -203,9 +230,11 @@ $(function() {
$('.set_change_qty').val(1); $('.set_change_qty').val(1);
change_qty_plus_minus("set_count","set_plus","set_minus"); change_qty_plus_minus("set_count","set_plus","set_minus");
data = $(this).parent().children().children('.add_icon'); data = $(this).parent().children().children('.add_icon');
// data = $(this).parent().siblings('.add_icon');
instances = $(this).data('instance'); //instances = $(this).data('instance');
item_sets = $(this).data('item-sets'); item_sets = $(this).data('item-sets');
instances = $(this).data('instances');
// item_sets = $(data).attr('data-item-sets');
for(var field in item_sets) { for(var field in item_sets) {
@@ -259,11 +288,11 @@ $(function() {
$('#set_change_qty').val(1); $('#set_change_qty').val(1);
$('#set_item_instances').text(instances); $('#set_item_instances').text(instances);
$('#set_name').text(data.attr('data-name')); $('#set_name').text($(this).attr('data-name'));
$('#set_item_code').text(data.attr('data-item-code')); $('#set_item_code').text($(this).attr('data-item-code'));
$('#set_total_price').text(data.attr('data-price')); $('#set_total_price').text($(this).attr('data-price'));
// $('#set_total_price').text(0); // $('#set_total_price').text(0);
$('#set_unit_price').text(data.attr('data-price')); $('#set_unit_price').text($(this).attr('data-price'));
// $('#set_unit_price').text(0); // $('#set_unit_price').text(0);
}); });
// click instance for add item set // click instance for add item set
@@ -423,7 +452,8 @@ $(function() {
change_qty_plus_minus("count","plus","minus"); change_qty_plus_minus("count","plus","minus");
data = $(this).parent().children().children('.add_icon'); // data = $(this).parent().children().children('.add_icon');
data = $(this).parent().siblings('.add_icon');
$('#total_price').text(data.attr('data-price')); $('#total_price').text(data.attr('data-price'));
attributes = $(this).data('id'); attributes = $(this).data('id');
@@ -432,11 +462,21 @@ $(function() {
item_options = $(this).data('option'); item_options = $(this).data('option');
if (data.attr('data-image')) { if (data.attr('data-image')) {
if (modify_order) {
image = "<img id='' width='200px' src='../../"+data.attr('data-image')+"'>";
}else{
image = "<img id='' width='200px' src='"+data.attr('data-image')+"'>"; image = "<img id='' width='200px' src='"+data.attr('data-image')+"'>";
}
}else{
if (modify_order) {
image = "<img id='' width='200px' src='../../image/logo.png'>";
}else{ }else{
image = "<img id='' width='200px' src='/image/logo.png'>"; image = "<img id='' width='200px' src='/image/logo.png'>";
} }
}
$('#modal_box_img').append(image); $('#modal_box_img').append(image);
instance_attributes = [] instance_attributes = []
@@ -708,52 +748,117 @@ $(function() {
} }
} }
// Pay Discount for Payment // Create Order
$("#create_order").on('click', function(e){ $("#create_order").on('click', function(e){
$(this).attr('disabled', 'disabled'); $(this).attr('disabled', 'disabled');
e.preventDefault(); e.preventDefault();
$("#oqs_loading_wrapper").show(); $("#oqs_loading_wrapper").show();
type = $('#type').val();
if (type == 'true') {
type = 'cashier'
var table_type = $('#table_type').text();
var table_id = $('#table_id').val();
var customer_id = $('#customer_id').val();
var booking_id = $('#booking_id').text();
var ajax_url = 'addorders/create';
}else{
type = 'cashier'
var table_type = $('#table_type').text();
var table_id = $('#table_id').text(); var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text(); var customer_id = $('#customer_id').text();
var booking_id = $('#booking_id').text(); var booking_id = $('#booking_id').text();
var ajax_url = '../addorders/create';
}
if (!booking_id.length > 0) { if (!booking_id.length > 0) {
var params = {'order_source': "cashier", 'order_type': "dine_in", var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id, 'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
'table_id': table_id, 'table_id': table_id,
'order_items': order_items }; 'order_items': order_items };
} }
var table_type = $('#table_type').text();
var order_items = JSON.stringify(get_order_item_rows());
var ajax_url = '../addorders/create';
var params = {'order_source': "cashier", 'order_type': "dine_in", var order_items = JSON.stringify(get_order_item_rows());
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "", 'customer_id': customer_id, 'guest_info': "",
'table_id': table_id, 'table_id': table_id,
'order_items': order_items }; 'order_items': order_items };
if (table_id.length>0) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
data: params, data: params,
dataType: "json", dataType: "json",
success:function(result){ success:function(result){
// $("#oqs_loading_wrapper").hide();
// swal({
// title: "Information !",
// text: 'Order has been successfully created',
// confirmButtonColor: "green",
// confirmButtonText: "Yes!",
// closeOnConfirm: false,
// }, function (isConfirm) {
// if (isConfirm) {
if(table_type == "Table"){ if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id window.location.href = "/origami/table/" + table_id
} }
else { else {
window.location.href = "/origami/room/" + table_id window.location.href = "/origami/room/" + table_id
} }
// } }
// }); });
}else{
$(this).removeAttr('disabled', '');
$("#oqs_loading_wrapper").hide();
swal("Opps","Please Select Table or Room","warning");
}
});
// Pay Discount for Payment
$("#create_pay_order").on('click', function(e){
$(this).attr('disabled', 'disabled');
e.preventDefault();
type = "quick_service"
$("#oqs_loading_wrapper").show();
console.log(modify_order)
if (modify_order == "true") {
console.log($('#sale_id').text())
var ajax_url = '../../../quick_service/update_modify_order';
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
var booking_id = $('#booking_id').text();
var sale_id = $('#sale_id').text();
}else{
var ajax_url = 'addorders/create';
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
var customer_id = $('#customer_id').val();
var booking_id = $('#booking_id').text();
var sale_id = ""
}
if (!booking_id.length > 0) {
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
'table_id': table_id,
'order_items': order_items };
}
var order_items = JSON.stringify(get_order_item_rows());
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",
'table_id': table_id,
'order_items': order_items,'sale_id': sale_id };
console.log(params)
$.ajax({
type: "POST",
url: ajax_url,
data: params,
dataType: "json",
success:function(result){
console.log(result)
if (result.status) {
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
}
} }
}); });
}); });
@@ -869,11 +974,21 @@ $(function() {
$("#back").on("click", function(){ $("#back").on("click", function(){
var table_id = $('#table_id').text(); var table_id = $('#table_id').text();
var table_type = $('#table_type').text(); var table_type = $('#table_type').text();
type = $('#type').val();
if (type == 'true') {
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
window.location.href = "/origami/dashboard"
}else{
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
if(table_type == "Table"){ if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id window.location.href = "/origami/table/" + table_id
}else { }else {
window.location.href = "/origami/room/" + table_id window.location.href = "/origami/room/" + table_id
} }
}
}); });
// Get Selected Class // Get Selected Class
@@ -984,6 +1099,14 @@ $(function() {
//show menu item list when click menu category //show menu item list when click menu category
function show_sub_category_list(url,sub_category){ function show_sub_category_list(url,sub_category){
if (modify_order == "true" && type =="true") {
var url = "../../../addorders/"+url;
}if(modify_order=="false" && type =="true"){
var url = 'addorders/'+url;
}else{
var url = url;
}
var menu_list = $('.sub_category_list'); var menu_list = $('.sub_category_list');
menu_list.empty(); menu_list.empty();
//Start Ajax //Start Ajax
@@ -998,7 +1121,12 @@ $(function() {
data = data.sub_category; data = data.sub_category;
if (data.length>0) { if (data.length>0) {
if ((sub_category.hasClass('hidden'))) {
$(sub_category).removeClass('hidden'); $(sub_category).removeClass('hidden');
}else{
$(sub_category).addClass('hidden');
}
for(var i in data) { for(var i in data) {
row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">' row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">'

View File

@@ -3,9 +3,11 @@ section .content{
} }
.custom-card-head{ .custom-card-head{
height: 40px; height: 40px;
background-color: #54A5AF; #background-color: #54A5AF;
background-color: #a1aade;
opacity: 0.8;
padding:5px; padding:5px;
color :#fff; color :#000000;
} }
.custom-card { .custom-card {
@@ -53,8 +55,13 @@ section .content{
.nav-tabs .nav-item { .nav-tabs .nav-item {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
margin-left:2px;
}
#ul-navbar{
border-left: 1px solid #54A5AF; border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF; border-right: 1px solid #54A5AF;
} }
.nav > li > a{ .nav > li > a{
color:#54A5AF; color:#54A5AF;
@@ -174,3 +181,64 @@ i.logout_icon{
position: relative; position: relative;
top: 5px; top: 5px;
} }
.text-white{
color: #fff;
}
/* Colors */
.purple {
background-color:#7a62d3;
}
.orange{
background-color:#FF7F50;
}
.red {
background-color:#F44336;
}
.green{
background-color: #009900;
}
.orange{
background-color: #FF8C00;
}
.blue{
background-color: blue;
}
/*For Menu List*/
.dropdown-toggle:after{
margin-left:15px;
}
.my-toggle{
padding: 15px 20px 10px 10px;
line-height:2;
}
.list-menu{
list-style: none;
margin-top:5px;
background-color: #eee;
border-bottom: 1px solid #fff;
}
.menu_list{
display: block;
background-color: #eeeeee;
border-bottom: .214rem solid #fff;
border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;
margin-bottom: -1px;
margin-top: 5px
}
.menu_click{
list-style: none;
margin-left:-40px;
border-bottom: .014rem solid #fff;
}
.list-menu > a:hover{
text-decoration: none;
}

View File

@@ -8,7 +8,8 @@ class BaseOrigamiController < ActionController::Base
protect_from_forgery with: :exception protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do |exception| rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message flash[:warning] = exception.message
redirect_to origami_root_path # redirect_to origami_root_path
redirect_to origami_dashboard_path
end end
def current_user def current_user

View File

@@ -126,6 +126,12 @@ class HomeController < ApplicationController
render :json => {:status=> "Success", :url => root_path }.to_json render :json => {:status=> "Success", :url => root_path }.to_json
end end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
private private
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
@@ -146,7 +152,8 @@ class HomeController < ApplicationController
#check if cashier has existing open cashier #check if cashier has existing open cashier
shift = ShiftSale.current_open_shift(employee.id) shift = ShiftSale.current_open_shift(employee.id)
if !shift.nil? if !shift.nil?
redirect_to origami_root_path redirect_to origami_dashboard_path
# redirect_to origami_root_path
else else
redirect_to new_origami_shift_path redirect_to new_origami_shift_path
end end
@@ -162,4 +169,5 @@ class HomeController < ApplicationController
redirect_to reports_dailysale_index_path redirect_to reports_dailysale_index_path
end end
end end
end end

View File

@@ -9,7 +9,10 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
end end
def detail def detail
@menu = MenuCategory.all.active today = DateTime.now
day = Date.today.wday
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
@table_id = params[:id] @table_id = params[:id]
@table = DiningFacility.find(@table_id) @table = DiningFacility.find(@table_id)
@booking = @table.get_booking @booking = @table.get_booking
@@ -44,6 +47,18 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
end end
end end
def get_menu()
if (params[:id])
puts params[:id]
#Pull this menu
@menu = Menu.find_by_id(params[:id])
@menu_category = MenuCategory.where("menu_id='#{@menu.id}'").order("order_by asc")
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
Menu.current_menu
end
end
def get_menu_sub_category () def get_menu_sub_category ()
id = params[:id] id = params[:id]
@@ -102,9 +117,13 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
if !params["booking_id"].nil? if !params["booking_id"].nil?
# check booking id is already completed. # check booking id is already completed.
booking = Booking.find(params[:booking_id]) booking = Booking.find(params[:booking_id])
if params[:table_id].to_i > 0
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
else
table_status = true
end
if booking if booking
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved' if table_status && booking.booking_status != 'moved'
if !booking.sale_id.nil? if !booking.sale_id.nil?
sale_status = check_order_with_booking(booking) sale_status = check_order_with_booking(booking)
if sale_status if sale_status
@@ -115,22 +134,32 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
@order.booking_id = params[:booking_id] @order.booking_id = params[:booking_id]
end end
else else
if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id]) sale_status = check_order_with_table(params[:table_id])
if sale_status if sale_status
return return_json_status_with_code(400, "bill requested") return return_json_status_with_code(400, "bill requested")
end end
end end
end
end #booking exists end #booking exists
else else
if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id]) sale_status = check_order_with_table(params[:table_id])
if sale_status if sale_status
# return false , @message = "bill requested" # return false , @message = "bill requested"
return return_json_status_with_code(400, "bill requested") return return_json_status_with_code(400, "bill requested")
end end
end end
end
@status, @booking = @order.generate @status, @booking = @order.generate
if @status && @booking && @order.source == 'quick_service'
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
result = {:status=> @status, :data => @sale }
render :json => result.to_json
end
end end
# render json for http status code # render json for http status code

View File

@@ -1,6 +1,7 @@
class Origami::CreditPaymentsController < BaseOrigamiController class Origami::CreditPaymentsController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit visa_amount # limit visa_amount
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)

View File

@@ -49,9 +49,16 @@ class Origami::CustomersController < BaseOrigamiController
def add_customer def add_customer
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
if(@sale_id[0,3] == "SAL") if(@sale_id[0,3] == "SAL")
@booking = Booking.find_by_sale_id(@sale_id) @booking = Booking.find_by_sale_id(@sale_id)
if @booking.dining_facility_id.to_i > 0
@dining_facility = DiningFacility.find(@booking.dining_facility_id) @dining_facility = DiningFacility.find(@booking.dining_facility_id)
else
@dining_facility = nil
end
else else
@booking_order = BookingOrder.find_by_order_id(@sale_id) @booking_order = BookingOrder.find_by_order_id(@sale_id)
@booking = Booking.find(@booking_order.booking_id) @booking = Booking.find(@booking_order.booking_id)

View File

@@ -0,0 +1,64 @@
class Origami::DashboardController < BaseOrigamiController
def index
@shop = Shop.first
today = DateTime.now.strftime('%Y-%m-%d')
# @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @top_products = Sale.top_products(today).sum('i.qty')
# @bottom_products = Sale.bottom_products(today).sum('i.qty')
# @hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
# .sum(:grand_total)
# @employee_sales = Sale.employee_sales(today)
# .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
# @inventories = StockJournal.inventory_balances(today).sum(:balance)
@total_sale = Sale.total_sale(today)
@total_count = Sale.total_count(today)
@total_card = Sale.total_card_sale(today)
@total_credit = Sale.credit_payment(today)
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(today)
@total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
pay = Sale.payment_sale('card', today)
@sale_data.push({'card' => pay.payment_amount})
else
pay = Sale.payment_sale(payment.payment_method, today)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
end
@summ_sale = Sale.summary_sale_receipt(today)
@total_customer = Sale.total_customer(today)
@total_dinein = Sale.total_dinein(today)
@total_takeaway = Sale.total_takeaway(today)
@total_other_customer = Sale.total_other_customer(today)
@total_membership = Sale.total_membership(today)
@total_order = Sale.total_order(today)
@total_accounts = Sale.total_account(today)
@account_data = Array.new
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
@top_items = Sale.top_items(today)
@total_foc_items = Sale.total_foc_items(today)
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
end
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
end

View File

@@ -4,9 +4,14 @@ class Origami::DiscountsController < BaseOrigamiController
#discount page show from origami index with selected order #discount page show from origami index with selected order
def index def index
sale_id = params[:id] sale_id = params[:id]
@cashier_type = params[:type]
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
@sale_data = Sale.find(sale_id) @sale_data = Sale.find(sale_id)
if @sale_data.bookings[0].dining_facility_id.to_i > 0
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
else
@table = nil
end
end end
@member_discount = MembershipSetting.find_by_discount(1) @member_discount = MembershipSetting.find_by_discount(1)
@@ -22,8 +27,15 @@ class Origami::DiscountsController < BaseOrigamiController
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find(sale_id) sale = Sale.find(sale_id)
if sale.bookings[0].dining_facility_id.to_i > 0
table_id = sale.bookings[0].dining_facility_id table_id = sale.bookings[0].dining_facility_id
table = DiningFacility.find(table_id) table = DiningFacility.find(table_id)
else
table = nil
table_id = nil
end
# sale.total_discount = overall_discount.to_f # sale.total_discount = overall_discount.to_f
# sale.total_amount = sub_total.to_f # sale.total_amount = sub_total.to_f
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax; # sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
@@ -33,7 +45,6 @@ class Origami::DiscountsController < BaseOrigamiController
#save sale item for discount #save sale item for discount
discount_items.each do |di| discount_items.each do |di|
origin_sale_item = SaleItem.find(di["id"]) origin_sale_item = SaleItem.find(di["id"])
puts origin_sale_item.to_json
sale_item = SaleItem.new sale_item = SaleItem.new
sale_item.sale_id = sale_id sale_item.sale_id = sale_id
@@ -54,6 +65,7 @@ class Origami::DiscountsController < BaseOrigamiController
action_by = current_user.id action_by = current_user.id
remark = "Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} " remark = "Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} "
sale_audit = SaleAudit.record_audit_discount(sale_item.sale_id,sale.cashier_id, action_by,remark,"ITEMDISCOUNT" ) sale_audit = SaleAudit.record_audit_discount(sale_item.sale_id,sale.cashier_id, action_by,remark,"ITEMDISCOUNT" )
end end
@@ -62,13 +74,26 @@ class Origami::DiscountsController < BaseOrigamiController
# Re-calc All Amount in Sale # Re-calc All Amount in Sale
if overall_discount.to_f > 0 if overall_discount.to_f > 0
action_by = current_user.id action_by = current_user.id
if table.nil?
remark = "Discount Overall Price [#{overall_discount}]| Receipt No #{sale.receipt_no} | Table- no Table "
else
remark = "Discount Overall Price [#{overall_discount}]| Receipt No #{sale.receipt_no} | Table- #{table.name} " remark = "Discount Overall Price [#{overall_discount}]| Receipt No #{sale.receipt_no} | Table- #{table.name} "
end
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"OVERALLDISCOUNT" ) sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"OVERALLDISCOUNT" )
end end
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f) sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
if !table.nil?
result = {:status=> "Success", :table_id => table_id, :table_type => table.type } result = {:status=> "Success", :table_id => table_id, :table_type => table.type }
else else
result = {:status=> "Success" }
end
else
if !table.nil?
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table.type } result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table.type }
else
result = {:status=> "Please, Check Again!" }
end
end end
@@ -81,8 +106,14 @@ class Origami::DiscountsController < BaseOrigamiController
discount_items = JSON.parse(params[:discount_items]) discount_items = JSON.parse(params[:discount_items])
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find(sale_id) sale = Sale.find(sale_id)
if sale.bookings[0].dining_facility_id.to_i > 0
table_id = sale.bookings[0].dining_facility_id table_id = sale.bookings[0].dining_facility_id
table = DiningFacility.find(table_id) table = DiningFacility.find(table_id)
else
table_id = nil
table = nil
end
if discount_items.length > 0 if discount_items.length > 0
#destroy sale item for discount #destroy sale item for discount
@@ -91,7 +122,11 @@ class Origami::DiscountsController < BaseOrigamiController
sale.total_amount = (sale.total_amount + sale_item.price.abs) sale.total_amount = (sale.total_amount + sale_item.price.abs)
action_by = current_user.id action_by = current_user.id
if table.nil?
remark = "Remove Item Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} | Table- No Table "
else
remark = "Remove Item Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} | Table- #{table.name} " remark = "Remove Item Discount Item Name ->#{sale_item.product_name}-Product Code ->#{sale_item.product_code} | Price [#{sale_item.price}] | Receipt No #{sale.receipt_no} | Table- #{table.name} "
end
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEITEMDISCOUNT" ) sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEITEMDISCOUNT" )
sale_item.destroy sale_item.destroy
@@ -102,11 +137,21 @@ class Origami::DiscountsController < BaseOrigamiController
# sale.save # sale.save
# Re-calc All Amount in Sale # Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount) sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
if table.nil?
result = {:status=> "Success"}
else
result = {:status=> "Success", :table_id => table_id, :table_type => table.type } result = {:status=> "Success", :table_id => table_id, :table_type => table.type }
end
else
if table.nil?
result = {:status=> "Please, Check Again!"}
else else
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table.type } result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table.type }
end end
end
render :json => result.to_json render :json => result.to_json
end end
@@ -116,9 +161,16 @@ class Origami::DiscountsController < BaseOrigamiController
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find(sale_id) sale = Sale.find(sale_id)
if sale.bookings[0].dining_facility_id.to_i > 0
table_id = sale.bookings[0].dining_facility_id table_id = sale.bookings[0].dining_facility_id
dining = DiningFacility.find(table_id) table = DiningFacility.find(table_id)
table_type = dining.type table_type = table.type
else
table_id = nil
table = nil
table_type = nil
end
discount_items = [] discount_items = []
#destroy all discount sale item #destroy all discount sale item
@@ -137,14 +189,28 @@ class Origami::DiscountsController < BaseOrigamiController
sale.sale_items.destroy(discount_items) sale.sale_items.destroy(discount_items)
action_by = current_user.id action_by = current_user.id
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{dining.name} " if table.nil?
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- No Table"
else
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{table.name} "
end
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" ) sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" )
# Re-calc All Amount in Sale # Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, 0) sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
result = {:status=> "Success", :table_id => table_id, :dining => dining.name, :table_type => table_type } if table.nil?
result = {:status=> "Success"}
else else
result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => dining.name, :table_type => table_type } result = {:status=> "Success", :table_id => table_id, :dining => table.name, :table_type => table_type }
end
else
if table.nil?
result = {:status=> "Please, Check Again!"}
else
result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => table.name, :table_type => table_type }
end
end end
render :json => result.to_json render :json => result.to_json

View File

@@ -2,7 +2,7 @@ class Origami::JcbController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit jcb_amount # limit jcb_amount
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total total = sale_data.grand_total

View File

@@ -2,7 +2,7 @@ class Origami::MasterController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit master_amount # limit master_amount
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total total = sale_data.grand_total

View File

@@ -1,7 +1,7 @@
class Origami::MpuController < BaseOrigamiController class Origami::MpuController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit mpu_amount # limit mpu_amount
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total total = sale_data.grand_total

View File

@@ -3,9 +3,15 @@ class Origami::OtherChargesController < BaseOrigamiController
def index def index
sale_id = params[:sale_id] sale_id = params[:sale_id]
@cashier_type = params[:type]
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
@sale_data = Sale.find(sale_id) @sale_data = Sale.find(sale_id)
if @sale_data.bookings[0].dining_facility_id.to_i > 0
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
else
@table = nil
end
end end
end end
@@ -16,8 +22,14 @@ class Origami::OtherChargesController < BaseOrigamiController
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find(sale_id) sale = Sale.find(sale_id)
if sale.bookings[0].dining_facility_id.to_i > 0
table_id = sale.bookings[0].dining_facility_id table_id = sale.bookings[0].dining_facility_id
table = DiningFacility.find(table_id) table = DiningFacility.find(table_id)
else
table_id = nil
table = nil
end
# sale.total_amount = sub_total.to_f # sale.total_amount = sub_total.to_f
# sale.grand_total = sub_total.to_f + sale.total_tax; # sale.grand_total = sub_total.to_f + sale.total_tax;
@@ -44,7 +56,12 @@ class Origami::OtherChargesController < BaseOrigamiController
sale_item.save sale_item.save
action_by = current_user.id action_by = current_user.id
if table.nil?
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->"
else
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->#{table.name}" remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->#{table.name}"
end
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"ADDOTHERCHARGES" ) sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"ADDOTHERCHARGES" )
end end
@@ -53,11 +70,13 @@ class Origami::OtherChargesController < BaseOrigamiController
# Re-calc All Amount in Sale # Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount) sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
end end
if !table.nil?
dining = {:table_id => table_id, :table_type => table.type } dining = {:table_id => table_id, :table_type => table.type }
render :json => dining.to_json render :json => dining.to_json
end end
end
#Shop Name in Navbor #Shop Name in Navbor
helper_method :shop_detail helper_method :shop_detail
def shop_detail def shop_detail

View File

@@ -2,6 +2,7 @@ class Origami::OthersPaymentsController < BaseOrigamiController
def index def index
@membership_rebate_balance = 0 @membership_rebate_balance = 0
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
@payment_method_setting = PaymentMethodSetting.all @payment_method_setting = PaymentMethodSetting.all
@rebate = MembershipSetting.find_by_rebate(1) @rebate = MembershipSetting.find_by_rebate(1)

View File

@@ -12,15 +12,21 @@ class Origami::PaymentsController < BaseOrigamiController
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1 # if bookings.count > 1
# for Multiple Booking # # for Multiple Booking
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
else # else
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
end # end
if bookings[0].dining_facility_id.to_i > 0
table = DiningFacility.find(bookings[0].dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
else
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# Print for First Bill to Customer # Print for First Bill to Customer
@@ -96,15 +102,21 @@ class Origami::PaymentsController < BaseOrigamiController
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1 # if bookings.count > 1
# for Multiple Booking # # for Multiple Booking
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
else # else
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
end # end
if bookings[0].dining_facility_id.to_i > 0
table = DiningFacility.find(bookings[0].dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
else
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
# For Print # For Print
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
@@ -142,12 +154,20 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
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_details, "Paid",current_balance,card_data,survey) 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_details, "Paid",current_balance,card_data,survey)
if params[:type] == "quick_service"
booking = Booking.find_by_sale_id(sale_id)
booking.booking_orders.each do |order|
Order.pay_process_order_queue(order.order_id,booking.dining_facility_id)
end
end
end end
end end
end end
def show def show
sale_id = params[:sale_id] sale_id = params[:sale_id]
@cashier_type = params[:type]
@member_discount = MembershipSetting.find_by_discount(1) @member_discount = MembershipSetting.find_by_discount(1)
@@ -164,6 +184,7 @@ class Origami::PaymentsController < BaseOrigamiController
@balance = 0.00 @balance = 0.00
@accountable_type = '' @accountable_type = ''
@table_no = '' @table_no = ''
@dining = ''
@shop = Shop::ShopDetail @shop = Shop::ShopDetail
@@ -213,10 +234,17 @@ class Origami::PaymentsController < BaseOrigamiController
#end customer amount #end customer amount
@sale_data.bookings.each do |sbk| @sale_data.bookings.each do |sbk|
if sbk.dining_facility_id.to_i >0
df = DiningFacility.find(sbk.dining_facility_id) df = DiningFacility.find(sbk.dining_facility_id)
@table_no = df.type + ' ' + df.name @table_no = df.type + ' ' + df.name
@checkin_time = sbk.checkin_at @checkin_time = sbk.checkin_at
@dining = df
break break
else
@table_no = nil
@checkin_time = nil
@dining = nil
end
end end
@sale_data.sale_payments.each do |spay| @sale_data.sale_payments.each do |spay|
@@ -251,15 +279,21 @@ class Origami::PaymentsController < BaseOrigamiController
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1 # if bookings.count > 1
# for Multiple Booking # # for Multiple Booking
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
else # else
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
end # end
if bookings[0].dining_facility_id.to_i > 0
table = DiningFacility.find(bookings[0].dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
else
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf" unique_code = "ReceiptBillPdf"
@@ -321,15 +355,21 @@ class Origami::PaymentsController < BaseOrigamiController
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1 # if bookings.count > 1
# for Multiple Booking # # for Multiple Booking
# table = DiningFacility.find(bookings[0].dining_facility_id)
# else
# table = DiningFacility.find(bookings[0].dining_facility_id)
# end
if bookings[0].dining_facility_id.to_i > 0
table = DiningFacility.find(bookings[0].dining_facility_id) table = DiningFacility.find(bookings[0].dining_facility_id)
else
table = DiningFacility.find(bookings[0].dining_facility_id)
end
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
else
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
# Re-call Sale Data # Re-call Sale Data
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)

View File

@@ -1,6 +1,7 @@
class Origami::PayparPaymentsController < BaseOrigamiController class Origami::PayparPaymentsController < BaseOrigamiController
def create def create
sale_id = params[:sale_id] sale_id = params[:sale_id]
@cashier_type = params[:type]
redeem_amount = params[:redeem_amount] redeem_amount = params[:redeem_amount]
membership_id = params[:membership_id] membership_id = params[:membership_id]
payment_method = "paypar" payment_method = "paypar"

View File

@@ -0,0 +1,26 @@
class Origami::PendingOrderController < BaseOrigamiController
def index
# @dining= DiningFacility.where("status = 'occupied'")
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
@sale = Sale.pending_order
end
def show
@sales = Sale.pending_order
@sale = Sale.find(params[:sale_id])
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
@booking = BookingOrder.find_by_order_id(@order).booking_id
puts "sssssssssss"
puts @booking
if Booking.find(@booking).dining_facility_id.to_i > 0
@table_id = Booking.find(@booking).dining_facility_id
@dining = DiningFacility.find(@table_id)
else
@table_id = nil
@dining = nil
end
end
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
end

View File

@@ -0,0 +1,221 @@
class Origami::QuickServiceController < ApplicationController
# before_action :set_dining, only: [:detail]
def index
today = DateTime.now
day = Date.today.wday
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
@zone = Zone.all
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
# @tables = Table.all.active.order('zone_id asc').group("zone_id")
# @rooms = Room.all.active.order('zone_id asc').group("zone_id")
# @all_table = Table.all.active.order('status desc')
# @all_room = Room.all.active.order('status desc')
render "origami/addorders/detail"
end
def modify_order
today = DateTime.now
day = Date.today.wday
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
if(params[:id][0,3] == "BKI")
@table_id = nil
@table = nil
@booking = Booking.find(params[:id])
else
@table_id = params[:id]
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
end
@sale_id = params[:sale_id]
if @booking
@booking_id = @booking.booking_id
@order_items = Array.new
@booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if (order.status == "new")
@obj_order = order
@customer = order.customer
@date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end
end
else
@booking = nil
end
render "origami/addorders/detail"
end
def update_modify_order
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
is_extra_time = false
extra_time = ''
items_arr = []
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
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
if i["parent_order_item_id"]
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
else
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
end
items_arr.push(items)
}
# begin
@order = Order.new
@order.source = params[:order_source]
@order.order_type = params[:order_type]
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
@order.items = items_arr
@order.guest = params[:guest_info]
@order.table_id = params[:table_id] # this is dining facilities's id
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time
#Create Table Booking or Room Booking
if !params["booking_id"].nil?
# check booking id is already completed.
booking = Booking.find(params[:booking_id])
if params[:table_id].to_i > 0
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
else
table_status = true
end
if booking
if table_status && booking.booking_status != 'moved'
if !booking.sale_id.nil?
sale_status = check_order_with_booking(booking)
if sale_status
return return_json_status_with_code(400, "bill requested")
end
else
@order.new_booking = false
@order.booking_id = params[:booking_id]
end
else
if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id])
if sale_status
return return_json_status_with_code(400, "bill requested")
end
end
end
end #booking exists
else
if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id])
if sale_status
# return false , @message = "bill requested"
return return_json_status_with_code(400, "bill requested")
end
end
end
@status, @booking = @order.generate
if @status && @booking && @order.source == 'quick_service'
if params[:sale_id]
@sale = Sale.find(params[:sale_id])
if @order.table_id.to_i > 0
@table_id = @order.table_id
else
@table_id = nil
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
def get_menu_category ()
if (params[:id])
puts params[:id]
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
MenuCategory.current_menu
end
end
def get_menu_sub_category ()
id = params[:id]
if (id)
#Pull this menu
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
# puts @menu.menu_items[1].item_attributes.to_json
return @sub_menu
end
end
def get_all_product()
@product = Product.all
end
# render json for http status code
def return_json_status_with_code(code, msg)
render status: code, json: {
message: msg,
booking_id: booking_id
}.to_json
end
def check_order_with_table(table_id)
table = DiningFacility.find(table_id)
if table
booking = table.get_current_booking
# puts booking
if booking
if !booking.sale_id.nil?
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return false
end
else
@order.new_booking = false
@order.booking_id = booking.booking_id
return false
end
end
end
end
# this can always true
def check_order_with_booking(booking)
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return false
else
@order.new_booking = false
@order.booking_id = params[:booking_id]
return false
end
end
end

View File

@@ -2,6 +2,7 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
payment_method = params[:payment_method] payment_method = params[:payment_method]
@cashier_type = params[:type]
@membership_rebate_balance=0 @membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)

View File

@@ -3,7 +3,13 @@ class Origami::SaleEditController < BaseOrigamiController
# Index for sale item void OR edit # Index for sale item void OR edit
def edit def edit
sale_id = params[:sale_id] sale_id = params[:sale_id]
if params[:table_id]
@table_id = params[:table_id] @table_id = params[:table_id]
else
@table_id = nil
end
@cashier_type = params[:type]
@saleobj = Sale.find(sale_id) @saleobj = Sale.find(sale_id)
end end

View File

@@ -7,8 +7,13 @@ class Origami::SalesController < BaseOrigamiController
@sale = Sale.find(params[:sale_id]) @sale = Sale.find(params[:sale_id])
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id @order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
@booking = BookingOrder.find_by_order_id(@order).booking_id @booking = BookingOrder.find_by_order_id(@order).booking_id
if Booking.find(@booking).dining_facility_id.to_i>0
@table_id = Booking.find(@booking).dining_facility_id @table_id = Booking.find(@booking).dining_facility_id
@dining = DiningFacility.find(@table_id) @dining = DiningFacility.find(@table_id)
else
@table_id = nil
@dining = nil
end
end end
def add_to_existing_invoice def add_to_existing_invoice

View File

@@ -1,13 +1,18 @@
class Origami::SurveysController < BaseOrigamiController class Origami::SurveysController < BaseOrigamiController
def new def new
@survey = Survey.new()
@survey = Survey.new
@id = params[:id] @id = params[:id]
@cashier_type = params[:type]
if(@id[0,3] == "SAL") if(@id[0,3] == "SAL")
@sale = Sale.find(@id) @sale = Sale.find(@id)
@receipt_no = @sale.receipt_no @receipt_no = @sale.receipt_no
@grand_total = @sale.grand_total @grand_total = @sale.grand_total
@booking = Booking.find_by_sale_id(@id) @booking = Booking.find_by_sale_id(@id)
if @booking.dining_facility_id.to_i>0
@dining_facility = DiningFacility.find(@booking.dining_facility_id) @dining_facility = DiningFacility.find(@booking.dining_facility_id)
@table_type = @dining_facility.type @table_type = @dining_facility.type
@survey_data = Survey.find_by_dining_name(@dining_facility.name) @survey_data = Survey.find_by_dining_name(@dining_facility.name)
@@ -15,6 +20,11 @@ class Origami::SurveysController < BaseOrigamiController
if !survey_process.nil? if !survey_process.nil?
@survey_data = survey_process @survey_data = survey_process
end end
else
@dining_facility = nil
@table_type = nil
end
else else
@dining_facility = DiningFacility.find(@id) @dining_facility = DiningFacility.find(@id)
@table_type = @dining_facility.type @table_type = @dining_facility.type
@@ -25,10 +35,25 @@ class Origami::SurveysController < BaseOrigamiController
end end
def create def create
@type = params[:cashier_type]
@sale_id = params[:sale_id]
if params[:table_id].to_i>0
@dining_facility = DiningFacility.find(params[:table_id]) @dining_facility = DiningFacility.find(params[:table_id])
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil) shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
else
sale = Sale.find(@sale_id)
shift = ShiftSale.find(sale.shift_sale_id)
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(shift.cashier_terminal_id,nil)
end
if @type == "quick_service"
@url = "/origami/sale/"+@sale_id+"/"+@type+"/payment"
else
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
end
if params[:survey_id].nil? || params[:survey_id] == "" if params[:survey_id].nil? || params[:survey_id] == ""
@survey = Survey.new(survey_params) @survey = Survey.new(survey_params)
@@ -61,15 +86,34 @@ class Origami::SurveysController < BaseOrigamiController
def create_survey def create_survey
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id) if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
@type = params[:cashier_type]
@sale_id = params[:sale_id]
sale = Sale.find(@sale_id)
if @type != "quick_service"
dining_facility = DiningFacility.find(params[:dining_id]) dining_facility = DiningFacility.find(params[:dining_id])
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil) cashier_zone = cashier_zone.cashier_terminal_id
else
shift = ShiftSale.find(sale.shift_sale_id)
cashier_zone = shift.cashier_terminal_id
end
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_terminal_id,nil)
if @type != "quick_service"
survey = Survey.find_by_dining_name(dining_facility.name) survey = Survey.find_by_dining_name(dining_facility.name)
else
survey = nil
end
if survey.nil? if survey.nil?
survey = Survey.new survey = Survey.new
if @type != "quick_service"
survey.dining_name = dining_facility.name survey.dining_name = dining_facility.name
end
survey.receipt_no = params[:receipt_no] survey.receipt_no = params[:receipt_no]
survey.shift_id = shift_by_terminal.id survey.shift_id = shift_by_terminal.id
survey.created_by = current_user.name survey.created_by = current_user.name

View File

@@ -1,7 +1,7 @@
class Origami::UnionpayController < BaseOrigamiController class Origami::UnionpayController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit unionpay_amount # limit unionpay_amount
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total total = sale_data.grand_total
@@ -23,8 +23,6 @@ class Origami::UnionpayController < BaseOrigamiController
others = others + sale_payment.payment_amount others = others + sale_payment.payment_amount
end end
end end
puts "unionpaycount"
puts @unionpaycount
@can_unionpay = total - @unionpaycount - others @can_unionpay = total - @unionpaycount - others
@member_discount = MembershipSetting.find_by_discount(1) @member_discount = MembershipSetting.find_by_discount(1)
@sub_total = sale_data.total_amount @sub_total = sale_data.total_amount

View File

@@ -1,7 +1,7 @@
class Origami::VisaController < BaseOrigamiController class Origami::VisaController < BaseOrigamiController
def index def index
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit visa_amount # limit visa_amount
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total total = sale_data.grand_total

View File

@@ -41,6 +41,7 @@ class Origami::VoidController < BaseOrigamiController
# end # end
# end # end
if sale.bookings[0].dining_facility_id.to_i > 0
table_avaliable = true table_avaliable = true
table_count = 0 table_count = 0
table = sale.bookings[0].dining_facility table = sale.bookings[0].dining_facility
@@ -64,10 +65,17 @@ class Origami::VoidController < BaseOrigamiController
table.status = 'available' table.status = 'available'
table.save table.save
end end
else
table = nil
end
# FOr Sale Audit # FOr Sale Audit
action_by = current_user.id action_by = current_user.id
if table.nil?
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table -> nil"
else
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}" remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
end
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" ) sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
# For Print # For Print
@@ -80,13 +88,21 @@ class Origami::VoidController < BaseOrigamiController
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1 if bookings.count > 1
# for Multiple Booking # for Multiple Booking
table = DiningFacility.find(bookings[0].dining_facility_id) if bookings[0].dining_facility_id.to_i>0
else
table = DiningFacility.find(bookings[0].dining_facility_id) table = DiningFacility.find(bookings[0].dining_facility_id)
end end
end
if bookings[0].dining_facility_id.to_i > 0
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
else
shift = ShiftSale.find(sale.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf" unique_code = "ReceiptBillPdf"

View File

@@ -165,4 +165,5 @@ class DiningFacility < ApplicationRecord
ActionCable.server.broadcast "checkin_channel",table: table ActionCable.server.broadcast "checkin_channel",table: table
end end
end end
end end

View File

@@ -4,7 +4,7 @@ class Menu < ApplicationRecord
validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to
# validates_format_of :valid_days, :with => /\A([0-7]{1}(,[0-7]{1})*)?\Z/i # validates_format_of :valid_days, :with => /\A([0-7]{1}(,[0-7]{1})*)?\Z/i
#Default Scope to pull the active version only #Default Scope to pull the active version only
default_scope { where(is_active: true).order("created_at desc") } default_scope { where(is_active: true).order("created_at asc") }
def self.current_menu def self.current_menu
today = DateTime.now today = DateTime.now

View File

@@ -23,25 +23,31 @@ class Order < ApplicationRecord
def generate def generate
booking = nil booking = nil
if self.new_booking if self.new_booking
if self.table_id.to_i > 0
table_id = self.table_id
else
table_id = nil
end
#add extra time #add extra time
if self.is_extra_time && self.extra_time if self.is_extra_time && self.extra_time
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking", booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i, :checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
:checkin_by => self.employee_name, :checkin_by => self.employee_name,
:booking_status => "assign" }) :booking_status => "assign" })
else else
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking", booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
:checkin_at => Time.now.utc, :checkin_by => self.employee_name, :checkin_at => Time.now.utc, :checkin_by => self.employee_name,
:booking_status => "assign" }) :booking_status => "assign" })
end end
#end extra time #end extra time
if self.table_id.to_i > 0
table = DiningFacility.find(self.table_id) table = DiningFacility.find(self.table_id)
table.status = "occupied" table.status = "occupied"
table.save table.save
end
else else
booking = Booking.find(self.booking_id) booking = Booking.find(self.booking_id)
#add extra time #add extra time
@@ -65,7 +71,9 @@ class Order < ApplicationRecord
BookingOrder.create({:booking_id => booking.booking_id, :order => self}) BookingOrder.create({:booking_id => booking.booking_id, :order => self})
#Send order to queue one it done! #Send order to queue one it done!
if self.source != "quick_service"
process_order_queue process_order_queue
end
#send order to broadcast job #send order to broadcast job
send_order_broadcast(booking) send_order_broadcast(booking)
@@ -100,7 +108,9 @@ class Order < ApplicationRecord
BookingOrder.create({:booking_id => booking.booking_id, :order => self}) BookingOrder.create({:booking_id => booking.booking_id, :order => self})
#Send order to queue one it done! #Send order to queue one it done!
if self.source != "quick_service"
process_order_queue process_order_queue
end
#send order to broadcast job #send order to broadcast job
send_order_broadcast(booking) send_order_broadcast(booking)
@@ -203,8 +213,6 @@ class Order < ApplicationRecord
def re_order_items(form_items) #reorder inputs items as parents and child def re_order_items(form_items) #reorder inputs items as parents and child
parent_id = Array.new parent_id = Array.new
parents = Array.new parents = Array.new
puts form_items
puts "hhhhh"
parents_and_children_items = Array.new parents_and_children_items = Array.new
new_items_list = Array.new new_items_list = Array.new
@@ -300,6 +308,12 @@ class Order < ApplicationRecord
end end
#Process order items and send to order queue
def self.pay_process_order_queue(id,table_id)
#Send to background job for processing
OrderQueueProcessorJob.perform_later(id, table_id)
end
def check_cup_status(status) def check_cup_status(status)
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running" if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
return true return true
@@ -309,12 +323,14 @@ class Order < ApplicationRecord
#send order items and send to order queue #send order items and send to order queue
def send_order_broadcast(booking) def send_order_broadcast(booking)
if self.table_id.to_i > 0
table = DiningFacility.find(booking.dining_facility_id) table = DiningFacility.find(booking.dining_facility_id)
type = 'order' type = 'order'
#Send to background job for processing #Send to background job for processing
# OrderBroadcastJob.perform_later(table,type) # OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type ActionCable.server.broadcast "order_channel",table: table,type:type
end end
end
#Origami: Cashier : to view order Table #Origami: Cashier : to view order Table
def self.get_order_table def self.get_order_table

View File

@@ -1225,6 +1225,83 @@ end
return query return query
end end
def self.add_to_existing_pending_invoice(dining,sale_id,booking)
existing_booking = Booking.find_by_sale_id(sale_id)
if dining.to_i > 0
table = DiningFacility.find(dining)
table.bookings.each do |booking|
# if !booking.checkout_at.nil?
# existing_booking.update_attributes(checkout_at: checkout_at)
# end
if booking.sale_id.nil?
booking.booking_orders.each do |booking_order|
booking.booking_status = 'moved'
order = Order.find(booking_order.order_id)
order.status = 'billed'
order.order_items.each do |item|
item.order_item_status = 'billed'
end
# create sale item
saleobj = Sale.find(sale_id)
order.order_items.each do |orer_item|
saleobj.add_item (orer_item)
end
# Re-compute for add
saleobj.compute
saleobj.save
order.save
booking.save
end
booking_order = BookingOrder.where('booking_id=?',booking)
booking_order.each do |bo|
bo.booking_id = existing_booking.booking_id
bo.save
end
end
end
else
if booking.sale_id.nil?
booking.booking_orders.each do |booking_order|
booking.booking_status = 'moved'
order = Order.find(booking_order.order_id)
order.status = 'billed'
order.order_items.each do |item|
item.order_item_status = 'billed'
end
# create sale item
saleobj = Sale.find(sale_id)
order.order_items.each do |orer_item|
saleobj.add_item (orer_item)
end
# Re-compute for add
saleobj.compute
saleobj.save
order.save
booking.save
end
booking_order = BookingOrder.where('booking_id=?',booking)
booking_order.each do |bo|
bo.booking_id = existing_booking.booking_id
bo.save
end
end
end
end
def self.pending_order
query = Sale.all
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
end
private private
def generate_custom_id def generate_custom_id

View File

@@ -385,6 +385,7 @@ class SalePayment < ApplicationRecord
sale_count = 0 sale_count = 0
booking = Booking.find_by_sale_id(sale_obj.id) booking = Booking.find_by_sale_id(sale_obj.id)
if booking if booking
if booking.dining_facility_id.to_i > 0
table = DiningFacility.find(booking.dining_facility_id) table = DiningFacility.find(booking.dining_facility_id)
bookings = table.bookings bookings = table.bookings
bookings.each do |tablebooking| bookings.each do |tablebooking|
@@ -413,6 +414,7 @@ class SalePayment < ApplicationRecord
ActionCable.server.broadcast "order_channel",table: table,type:type ActionCable.server.broadcast "order_channel",table: table,type:type
end end
end end
end
def rebat(sObj) def rebat(sObj)
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items) rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)

View File

@@ -110,9 +110,12 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
end end
if sale_data.bookings[0].dining_facility_id.to_i > 0
bounding_box([self.description_width - 2,y_position], :width => self.price_num_width, :height => self.item_height) do bounding_box([self.description_width - 2,y_position], :width => self.price_num_width, :height => self.item_height) do
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
end end
end
move_down 5 move_down 5
y_position = cursor y_position = cursor
@@ -125,8 +128,14 @@ class ReceiptBillPdf < Prawn::Document
move_down 5 move_down 5
y_position = cursor y_position = cursor
if sale_data.bookings[0].dining_facility_id.to_i > 0
time =sale_data.receipt_date.strftime('%d-%m-%Y') +"("+ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') +"-"+ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p')+")"
else
time = time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p')
end
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
text "Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left text "Date : #{ time }",:size => self.item_font_size,:align => :left
end end

View File

@@ -45,7 +45,7 @@
<% end %> <% end %>
<% if can? :index, :home %> <% if can? :index, :home %>
<li> <li>
<a href="<%= origami_root_path %>"> <a href="<%= origami_dashboard_path %>">
<i class="material-icons">monetization_on</i> <i class="material-icons">monetization_on</i>
<span><%= t :origami %></span> <span><%= t :origami %></span>
</a> </a>

View File

@@ -1,15 +1,61 @@
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
<div id="oqs_loading_wrapper" style="display:none;"> <div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div> <div id="oqs_loading"></div>
</div> </div>
<% type = request.path_info.include?('quick_service')%>
<% modify_order = request.path_info.include?('modify_order')%>
<input type="hidden" name="type" id="type" value="<%=type%>">
<input type="hidden" name="type" id="modify_order" value="<%=modify_order%>">
<div class="row m-t--20"> <div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<ul class="nav nav-tabs flex-column" role="tablist" > <!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;">
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
</a>
<ul class="dropdown-menu menu_list" style="width:90%">
<% @menus.each do |menu| %>
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>">
<a class="nav-link" data-toggle="tab" href="" role="tab"><%=menu.name%></a>
</li>
<%end%>
</ul> -->
<li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
<!-- <i class="material-icons material-icons m-l-50 p-r-30">arrow_drop_down</i> -->
</a>
<ul class="ml-menu menu_list aria-hidden " style="">
<% @menus.each do |menu| %>
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>" style="">
<a class="nav-link" data-toggle="tab" href="" role="tab" style="text-transform: lowercase;"><%=menu.name%></a>
</li>
<%end%>
</ul>
</li>
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<% @menu.each do |menu| %> <% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %> <% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %> <% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %> <% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %> <% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>"> <li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
@@ -29,42 +75,120 @@
</a> </a>
</li> </li>
<% end%> <% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%> <% end%>
<% end %> <% end %>
<%end %> <%end %>
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
</ul> </ul>
</div> </div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10"> <div class="col-md-7 col-lg-7 col-sm-7 m-t-10">
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 10px;"> <div class="card-columns custom-card-columns menu_items_list" style="column-gap: 10px;">
<!-- append data --> <!-- append data -->
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<% else %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
</div> </div>
</div> </div>
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10"> <div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i> <% if type && modify_order%>
<button type="button" class="btn btn-lg btn-default waves-effect col-md-4" id='back'>
<!-- <i class="material-icons">reply</i> -->
Back Back
</button> </button>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-7" id='pending_order'>Pending Order
</button>
<%elsif !modify_order && type%>
<button type="button" class="btn btn-lg btn-default waves-effect col-md-2" id='back' style=" padding: .5rem 0.15rem !important;">
<!-- <i class="material-icons">reply</i> -->
Back
</button>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button>
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
<input type="hidden" name="table_id" value="" id="table_id">
<%else%>
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>Back
</button>
<%end%>
<br> <br>
<div class="card-header"> <div class="card-header" style="padding: 0.5rem 0.25rem">
<% if type %>
<div class="row clearfix">
<div class="col-md-6 col-lg-6 col-sm-12">
<strong id="order-title" class="font-14">ORDER DETAILS </strong>
</div>
<% if modify_order %>
<% if @table.nil? %>
<div class="col-md-6 col-lg-6 col-sm-6">Table : </div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"></p>
<% else%>
<div class="col-md-6 col-lg-6 col-sm-6">Table : <%=@table.name%></div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<% end%>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
<p class="hidden" id="sale_id"><%=@sale_id%></p>
<% else%>
<p class="hidden" id="table_type"></p>
<% end%>
</div>
<% else %>
<div> <div>
<strong id="order-title" class="font-14">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span> <strong id="order-title" class="font-14">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
<p class="hidden" id="table_id"><%=@table_id%></p> <p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p> <p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p> <p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p> <p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
</div>
<% end%>
</div> </div>
</div>
<div class="card-block"> <div class="card-block">
<div class="card-text" style="max-height:550px; overflow:auto""> <div class="card-text" id="order-detail-slimscroll" data-height="180">
<table class="table table-striped summary-items"> <table class="table table-striped summary-items" id="order-items-table" >
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
@@ -78,14 +202,28 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="card-footer custom-card-footer"> <div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
<table class="table" id="order-charges-table" border="0">
<!-- <table class="table" id="order-charges-table" border="0">
<tr> <tr>
<td class="charges-name"><strong>Sub Total:</strong></td> <td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="sub_total">0.00</strong></td> <td class="item-attr"><strong id="sub_total">0.00</strong></td>
</tr> </tr>
</table> </table> -->
<button type="button" class="btn btn-primary btn-block create" id="create_order" disabled="disabled">Create Order</button> <% if type && modify_order%>
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
<button type="button" class="btn btn-primary btn-lg create col-md-10" id="create_pay_order" disabled="disabled">Update Order & Pay</button>
<%elsif !modify_order && type%>
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
<button type="button" class="btn btn-primary btn-lg create col-md-6" id="create_pay_order" disabled="disabled">Create & Pay</button>
<button type="button" class="btn btn-primary btn-lg create col-md-5" id="create_order" disabled="disabled">Create Order</button>
<%else%>
<button type="button" class="btn btn-primary btn-lg create col-md-10" id="create_order" disabled="disabled">Create Order</button>
<%end%>
</div> </div>
</div> </div>
</div> </div>
@@ -180,7 +318,6 @@
<div class="col-md-7 item-detail"> <div class="col-md-7 item-detail">
<h5>Attributes</h5> <h5>Attributes</h5>
<div class="attributes-list"> <div class="attributes-list">
</div> </div>
<hr> <hr>
<h5>Options</h5> <h5>Options</h5>
@@ -194,11 +331,7 @@
<div class="mr-auto"> <div class="mr-auto">
<h4 class=" pull-left">Total : <span id="total_price"></span></h4> <h4 class=" pull-left">Total : <span id="total_price"></span></h4>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<button type="button" class="btn btn-default " data-dismiss="modal" id="close">Close</button> <button type="button" class="btn btn-default " data-dismiss="modal" id="close">Close</button>
</div> </div>
@@ -281,4 +414,147 @@
</div> </div>
</div> </div>
<% if type && !modify_order%>
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="margin-top: -1rem;">
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">&times;</button>
</div>
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
<%@zone.each do |zone| %>
<h5>Zone : <%=zone.name%></h5>
<div class="card-columns" style="column-count: 7;">
<%zone.tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<% color="red"%>
<% else %>
<% color="orange"%>
<% end %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<% color="blue"%>
<% else %>
<% color="orange"%>
<% end %>
<% end %>
<% else %>
<% color="green"%>
<% end %>
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<%end%>
</div>
<%end%>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
&nbsp; &nbsp;
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
</div>
</div>
</div>
</div>
</div>
<% end %>
<script>
$(document).ready(function () {
$(".tables").on('click', function () {
$('.tables').css('background-color','');
$('.tables').removeClass('purple')
var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var type = $(this).attr("data-type");
$(this).css('background-color','purple');
$(this).addClass('purple')
$('.confirm_table').attr("data-id",dining_id)
$('.confirm_table').attr("data-name",name)
$('.confirm_table').attr("data-type",type)
});
$(".confirm_table").on('click', function () {
var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var type = $(this).attr("data-type");
$('#table_id').val(dining_id)
$('#table_type').text(type)
$('.select_table').text(name)
console.log(type)
});
$('#pending_order').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
});
$(document).on('click', '.menu_click', function(event){
var menu_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url);
});
//End menu category Click
//show menu item list when click menu category
function show_menu_cat_list(name, url_item){
var menu_list = $('.menu_items_list');
menu_list.empty();
var menu_cat = $('.category_list');
menu_cat.empty();
$(".main_menu").text(name)
if (modify_order=="true" && type =="true") {
url_item = '../../../addorders/'+url_item;
}if(modify_order=="false" && type =="true"){
url_item = 'addorders/'+url_item
}else{
url_item = url_item;
}
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
for(var i in data) {
if (data[i].is_available == true) {
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
+' <div class="card-block custom-card-block">'
+' <p>'+ data[i].name +'<p>'
+' <p>'+ data[i].code +' <p>'
+' </div>'
+' </div>';
$('.menu_items_list').append(row);
list = '<li class="nav-item menu_category sub_click" data-id="'+ data[i].id +'">'
+'<p class="hidden menu-id">'+ data[i].id +'</p> '
+'<a class="nav-link" data-toggle="tab" href="" role="tab"> '+ data[i].name +''
+'<ul class=" sub_category_list hidden fadeInTop animated"'
+'id="sub_category_list">'
+'</ul>'
+'</a>'
+'</li>';
$('.category_list').append(list);
}
}
}
});
//end Ajax
}
//end show list function
});
</script>

View File

@@ -0,0 +1 @@
json.array! @menu_category

View File

@@ -111,10 +111,11 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10"> <div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button> <button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div> </div>
</div> </div>
</div> </div>
<span id="cashier_type" class="hidden"><%=@cashier_type%></span>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){} if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
@@ -122,6 +123,7 @@
$('#validamount').attr("value",parseFloat("<%= @can_credit %>") - parseFloat(localStorage.getItem("cash"))); $('#validamount').attr("value",parseFloat("<%= @can_credit %>") - parseFloat(localStorage.getItem("cash")));
} }
}); });
cashier_type = $('#cashier_type').text();
$(document).on('click', '.cashier_number', function(event){ $(document).on('click', '.cashier_number', function(event){
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@@ -165,6 +167,7 @@
return false; return false;
} }
}); });
$('#credit_pay').on('click',function(){ $('#credit_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
@@ -184,7 +187,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id +"/"+ cashier_type + "/payment";
}); });
} }
} }

View File

@@ -32,7 +32,6 @@
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"> <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12"> <input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
<!-- <input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>"> -->
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
@@ -115,8 +114,13 @@
<span class="patch_method"></span> <span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" /> <input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%if !@dining_facility.nil?%>
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" /> <input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" /> <input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<%else%>
<input type="hidden" id="table_id" name="table_id" value="" />
<input type="hidden" id="type" name="type" value="" />
<%end%>
<%= f.error_notification %> <%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group"> <div class="form-group">
@@ -258,6 +262,7 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(function() { $(function() {
/*$('.datepicker').datepicker({ /*$('.datepicker').datepicker({
setDate: '12-12-1999', setDate: '12-12-1999',
@@ -416,6 +421,7 @@
if(customer_name != ""){ if(customer_name != ""){
customer = '(' + customer_name + ')'; customer = '(' + customer_name + ')';
} }
swal({ swal({
title: "Confirmation !", title: "Confirmation !",
text: 'Are You Sure to assign this customer' + customer + '!', text: 'Are You Sure to assign this customer' + customer + '!',
@@ -435,11 +441,15 @@
{ {
var id = $("#table_id").val(); var id = $("#table_id").val();
var type = $("#type").val(); var type = $("#type").val();
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") { if (type=="Table") {
window.location.href = '/origami/table/'+id window.location.href = '/origami/table/'+id
}else{ }else{
window.location.href = '/origami/room/'+id window.location.href = '/origami/room/'+id
} }
}
}else{ }else{
swal("Alert!", "Record not found!", "error"); swal("Alert!", "Record not found!", "error");
location.reload(); location.reload();
@@ -452,11 +462,17 @@
$('#back').on('click',function(){ $('#back').on('click',function(){
var id = $("#table_id").val() var id = $("#table_id").val()
var type = $("#type").val() var type = $("#type").val()
var sale_id = $("#sale_id").val()
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") { if (type=="Table") {
window.location.href = '/origami/table/'+id window.location.href = '/origami/table/'+id
}else{ }else{
window.location.href = '/origami/room/'+id window.location.href = '/origami/room/'+id
} }
}
}) })
</script> </script>

View File

@@ -0,0 +1,245 @@
<div class="container-fluid">
<div class="block-header">
<h2><%= t :dashboard %></h2>
</div>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<!-- Widgets -->
<div class="row clearfix">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-cyan hover-expand-effect">
<div class="icon">
<i class="material-icons">help</i>
</div>
<div class="content">
<div class="text"><%= t :sale_count %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_count%>" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-pink hover-expand-effect">
<div class="icon">
<i class="material-icons">attach_money</i>
</div>
<div class="content">
<div class="text"><%= t :total_sale %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_sale%>" data-speed="15" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-light-green hover-expand-effect">
<div class="icon">
<i class="material-icons">person_add</i>
</div>
<div class="content">
<div class="text"><%= t :total_credit %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_credit%>" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-orange hover-expand-effect">
<div class="icon">
<i class="material-icons">credit_card</i>
</div>
<div class="content">
<div class="text"><%= t :total_card %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_card%>" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
</div>
<!-- #END# Widgets -->
<!-- Widgets -->
<div class="row clearfix">
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
<div class="info-box bg-purple">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;">Quick Service</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
<div class="info-box bg-green">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;">Cashier</div>
</div>
</div>
</div>
<!-- #END# Widgets -->
<!-- CPU Usage -->
<div class="row clearfix">
<% if !@summ_sale.nil? %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
<h6><%= t :sale %></h6>
<table class="table">
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : </td>
<td align="right"><%= @summ_sale.total_receipt %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.grand_total") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
</tr>
</table>
<table class="table">
<% if !(@total_payment_methods.nil?) %>
<% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %>
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
<tr>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= data[""+pay_mth+""] %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
<% if !total_card.nil? %>
<tr>
<td><%= t("views.right_panel.detail.card_sale") %> : </td>
<td align="right">
<%= total_card["card"].to_f %>
</td>
</tr>
<% end %>
<% end %>
</table>
</div>
</div>
</div>
<% end %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
<h6><%= t :customer %></h6>
<table class="table">
<% if !@total_customer.nil? %>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
<td align="right"><%= @total_customer %></td>
</tr>
<% end %>
<% if !@total_dinein.nil? %>
<tr>
<td><%= t("views.right_panel.detail.dine_in") %> : </td>
<td align="right"><%= @total_dinein.total_dinein_cus %></td>
</tr>
<% end %>
<% if !@total_takeaway.nil? %>
<tr>
<td><%= t("views.right_panel.detail.takeaway") %> : </td>
<td align="right"><%= @total_takeaway.total_take_cus %></td>
</tr>
<% end %>
<% if !@total_other_customer.nil? %>
<tr>
<td><%= t :customer %> : </td>
<td align="right"><%= @total_other_customer.total_cus %></td>
</tr>
<% end %>
<% if !@total_membership.nil? %>
<tr>
<td><%= t("views.right_panel.detail.membership") %> : </td>
<td align="right"><%= @total_membership.total_memb_cus %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
<h6><%= t("views.right_panel.detail.order") %></h6>
<table class="table">
<% if !@total_order.nil? %>
<tr>
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : </td>
<td align="right" width="60px"><%= @total_order.total_order %></td>
</tr>
<% end %>
<% if !@total_accounts.nil? %>
<% @total_accounts.each do |account| %>
<tr>
<td width="40px"><%= account.title %> (Account) : </td>
<td align="right" width="60px">
<% @account_data.each do |data| %>
<% acc = account.title %>
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% if !@top_items.nil? %>
<tr>
<td width="40px"><%= t :top %> <%= t("views.right_panel.detail.item") %> : </td>
<td align="right" width="60px"><%= @top_items.item_name %>
<br>(<%= @top_items.item_total_price %>)</td>
</tr>
<% end %>
<% if !@total_foc_items.nil? %>
<tr>
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : </td>
<td align="right" width="60px"><%= @total_foc_items.to_int %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});
$(".qs_view").on('click', function() {
window.location.href = '/origami/quick_service';
});
</script>

View File

@@ -13,8 +13,14 @@
<div class="card-block"> <div class="card-block">
<div class="card-title row"> <div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<%if !@table.nil?%>
<span class="hidden" id ="table_id" value="<%=@table.id%>"><%=@table.id%></span> <span class="hidden" id ="table_id" value="<%=@table.id%>"><%=@table.id%></span>
<span class="hidden" id="table_type" value="<%=@table.type%>"><%=@table.type%></span> <span class="hidden" id="table_type" value="<%=@table.type%>"><%=@table.type%></span>
<%else%>
<span class="hidden" id ="table_id" value="<%=@table%>"><%=@table%></span>
<span class="hidden" id="table_type" value="<%=@table%>"><%=@table%></span>
<%end%>
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p> <p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
<p class="m-l-10">Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p> <p class="m-l-10">Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> --> <!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
@@ -225,18 +231,22 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){ $(document).ready(function(){
$('#back').on('click',function(){ $('#back').on('click',function(){
var id = $("#table_id").text(); var id = $("#table_id").text();
var type = $("#table_type").text(); var type = $("#table_type").text();
console.log(id); var sale_id = $('#sale-id').text();
console.log(type); if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") { if (type=="Table") {
window.location.href = '/origami/table/'+id window.location.href = '/origami/table/'+id
}else{ }else{
window.location.href = '/origami/room/'+id window.location.href = '/origami/room/'+id
} }
}
}) })
$(".cashier_number").on('click', function(event){ $(".cashier_number").on('click', function(event){
@@ -404,12 +414,16 @@
title: "Information!", title: "Information!",
text: result.status, text: result.status,
}, function () { }, function () {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){ if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id window.location.href = "/origami/table/" + result.table_id
} }
else { else {
window.location.href = "/origami/room/" + result.table_id window.location.href = "/origami/room/" + result.table_id
} }
}
}); });
} }
}); });
@@ -451,12 +465,16 @@
text: result.status, text: result.status,
type: "success", type: "success",
}, function () { }, function () {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){ if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id window.location.href = "/origami/table/" + result.table_id
} }
else { else {
window.location.href = "/origami/room/" + result.table_id window.location.href = "/origami/room/" + result.table_id
} }
}
}); });
} }
}); });
@@ -474,12 +492,16 @@
text: result.status, text: result.status,
type: "success", type: "success",
}, function () { }, function () {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){ if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id window.location.href = "/origami/table/" + result.table_id
} }
else { else {
window.location.href = "/origami/room/" + result.table_id window.location.href = "/origami/room/" + result.table_id
} }
}
}); });
} }
}); });
@@ -519,12 +541,16 @@
confirmButtonText: 'OK', confirmButtonText: 'OK',
confirmButtonColor: btn_color, confirmButtonColor: btn_color,
}, function () { }, function () {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){ if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id window.location.href = "/origami/table/" + result.table_id
} }
else { else {
window.location.href = "/origami/room/" + result.table_id window.location.href = "/origami/room/" + result.table_id
} }
}
}); });
} }
}); });

View File

@@ -118,9 +118,13 @@
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<!-- <button id="refreshbutton" type="button" class="btn btn-block radius-btn"> Refresh off </button> --> <!-- <button id="refreshbutton" type="button" class="btn btn-block radius-btn"> Refresh off </button> -->
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %> <button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %> <i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button> </button>
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
<!-- <button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
</button> -->
<%end%> <%end%>
<%if current_login_employee.role != "waiter" %> <%if current_login_employee.role != "waiter" %>
<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_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
@@ -242,7 +246,7 @@ $('#close_cashier').on('click',function(e){
}) })
$('#back').on('click',function(){ $('#back').on('click',function(){
window.location.href = '/dashboard'; window.location.href = '/origami/dashboard';
}) })
function warnBeforeRedirect(linkURL) { function warnBeforeRedirect(linkURL) {

View File

@@ -514,6 +514,7 @@
</div> </div>
</div> </div>
<script> <script>
cashier_type = "cashier"
$(document).ready(function () { $(document).ready(function () {
/* start check first bill or not*/ /* start check first bill or not*/
var receipt_no = ""; var receipt_no = "";
@@ -583,7 +584,7 @@
var sale_id = "<%= @dining.id %>"; var sale_id = "<%= @dining.id %>";
} }
//var table_id = $('.tables').attr("data-id"); //var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id + "/surveys" window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
}); });
// bind customer to order or sale // bind customer to order or sale
@@ -596,7 +597,7 @@
} }
var table_id = $('.tables').attr("data-id"); var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id + "/customers" window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers"
}); });
@@ -617,7 +618,7 @@
} }
if (sale_id != "") { if (sale_id != "") {
window.location.href = '/origami/' + sale_id + '/other_charges' window.location.href = '/origami/' + sale_id + "/"+cashier_type+ '/other_charges'
} }
else { else {
swal ( "Oops" , "Please select an table!" , "warning" ); swal ( "Oops" , "Please select an table!" , "warning" );
@@ -638,7 +639,7 @@
} }
if (sale_id != "") { if (sale_id != "") {
window.location.href = '/origami/' + sale_id + '/discount' window.location.href = '/origami/' + sale_id+ "/"+cashier_type+'/discount'
} }
else { else {
swal ( "Oops" , "Please select an table!" , "warning" ); swal ( "Oops" , "Please select an table!" , "warning" );
@@ -714,7 +715,7 @@
$('#pay').on('click', function () { $('#pay').on('click', function () {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/payment"; window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}); });
// Bill Request // Bill Request
@@ -812,7 +813,7 @@
var dining_id = "<%= @dining.id %>" var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>" var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
if ($(this).attr('active')=== "true") { if ($(this).attr('active')=== "true") {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit"; window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
}else{ }else{
swal("Opps","You are not authorized for void","warning") swal("Opps","You are not authorized for void","warning")
} }

View File

@@ -114,11 +114,12 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button> <button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
@@ -140,7 +141,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
}); });
} }
} }
@@ -228,7 +229,7 @@ $('#jcb_pay').on('click',function(){
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
}); });
} }
} }

View File

@@ -115,11 +115,12 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button> <button type="button" class="btn btn-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
@@ -141,7 +142,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
}); });
} }
} }
@@ -226,7 +227,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
}); });
} }
} }

View File

@@ -116,7 +116,7 @@
</div> </div>
<div class="col-md-1 col-lg-1 col-sm-1"> <div class="col-md-1 col-lg-1 col-sm-1">
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button> <button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
</div> </div>
</div> </div>
@@ -125,6 +125,7 @@
$(document).ready(function() { $(document).ready(function() {
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){} if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else { else {
$('#validamount').attr("value",parseFloat("<%= @can_mpu %>") - parseFloat(localStorage.getItem("cash"))); $('#validamount').attr("value",parseFloat("<%= @can_mpu %>") - parseFloat(localStorage.getItem("cash")));
@@ -143,7 +144,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"; window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment/others_payment";
}); });
} }
} }
@@ -198,6 +199,7 @@
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>"; var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click"); $(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
@@ -230,7 +232,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
}); });
} }
} }

View File

@@ -197,13 +197,19 @@
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<!-- Action Panel --> <!-- Action Panel -->
<div> <div>
<%if !@table.nil?%>
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/<%=@table.type.downcase%>/<%=@table.id%>'"><i class="material-icons">reply</i> Back </button> <button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/<%=@table.type.downcase%>/<%=@table.id%>'"><i class="material-icons">reply</i> Back </button>
<%else%>
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%=@sale_data.sale_id%>/<%=@cashier_type%>/payment'"><i class="material-icons">reply</i> Back </button>
<%end%>
<button id="charge_other" class="btn bg-primary btn-block action-btn">Enter</button> <button id="charge_other" class="btn bg-primary btn-block action-btn">Enter</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){ $(document).ready(function(){
$(".cashier_number").on('click', function(event){ $(".cashier_number").on('click', function(event){
if(event.handled !== true) { if(event.handled !== true) {
@@ -313,12 +319,16 @@
title: "Information!", title: "Information!",
text: "Success", text: "Success",
}, function () { }, function () {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){ if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id window.location.href = "/origami/table/" + result.table_id
} }
else { else {
window.location.href = "/origami/room/" + result.table_id window.location.href = "/origami/room/" + result.table_id
} }
}s
}); });
} }
}); });

View File

@@ -9,7 +9,6 @@
</span> </span>
</ol> </ol>
</div> --> </div> -->
<div class="row"> <div class="row">
<div class="col-lg-11col-md-11 col-sm-11"> <div class="col-lg-11col-md-11 col-sm-11">
<div > <div >
@@ -22,13 +21,14 @@
</div> </div>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10"> <div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button> <button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div> </div>
</div> </div>
</div> </div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>"> <input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<script type="text/javascript"> <script type="text/javascript">
/* start check first bill or not*/ /* start check first bill or not*/
var cashier_type = "<%= @cashier_type %>";
var receipt_no = ""; var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){ if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
@@ -47,10 +47,10 @@
$('.others-payment').on('click',function(){ $('.others-payment').on('click',function(){
var input_type = $(this).attr("data-type"); var input_type = $(this).attr("data-type");
var sale_id = $(this).attr("data-sale-id"); var sale_id = $(this).attr("data-sale-id");
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment/" + input_type; window.location.href = '/origami/sale/'+ sale_id +"/"+ cashier_type + "/payment/others_payment/" + input_type;
}) })
$('#back').on('click',function(){ $('#back').on('click',function(){
window.location.href = '/origami/sale/<%= @sale_id %>/payment/'; window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/';
}) })
</script> </script>

View File

@@ -2,7 +2,6 @@
<div id="loading_wrapper" style="display:none;"> <div id="loading_wrapper" style="display:none;">
<div id="loading"></div> <div id="loading"></div>
</div> </div>
<div class="row clearfix"> <div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="card"> <div class="card">
@@ -14,13 +13,15 @@
</div> </div>
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Table No :</strong> <%=@table_no%></div> <div class="col-lg-6 col-md-6 col-sm-6"><strong>Table No :</strong> <%=@table_no%></div>
<span class="hidden" id="dining"><%if !@dining.nil?%><%= @dining.id%><%end%></span>
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Sale ID :</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></div> <div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Sale ID :</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></div>
</div> </div>
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <%= @sale_data.customer.name%> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span> <div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <%= @sale_data.customer.name%> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
<span class="hidden" id="member_discount"><%= @member_discount%></span></div> <span class="hidden" id="member_discount"><%= @member_discount%></span></div>
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %></div> <div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
<%end%></div>
</div> </div>
</div> </div>
</div> </div>
@@ -296,13 +297,23 @@
</button> </button>
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button> <button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button> <button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
<% if @cashier_type=="quick_service" %>
<hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<!-- Waiter Buttons --> <!-- Waiter Buttons -->
<%end %>
</div> </div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>"> <input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
</div> </div>
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){ $(document).ready(function(){
/* start check first bill or not*/ /* start check first bill or not*/
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -315,9 +326,10 @@
payment_type = ''; payment_type = '';
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
console.log("ssssssssssss")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment") payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
if (member_id && member_discount) { if (member_id && member_discount) {
console.log("fffffffffffff")
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide(); $("#credit_payment").hide();
} else{ } else{
@@ -337,7 +349,11 @@
$("#back").on('click', function() { $("#back").on('click', function() {
localStorage.removeItem('cash'); localStorage.removeItem('cash');
if (cashier_type=="cashier") {
window.location.href = '/origami/table/'+ dining_id; window.location.href = '/origami/table/'+ dining_id;
}else{
window.location.href = '/origami/quick_service';
}
}); });
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){ if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){
@@ -349,6 +365,83 @@
update_balance(); update_balance();
}); });
// bind survey to order or sale
$("#survey").on('click', function () {
var sale = $('#sale_id').text();
if (sale) {
var sale_id = sale
} else {
var sale_id = $('#dining').text();
}
//var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"
});
// bind customer to order or sale
$("#customer").on('click', function () {
var sale = $('#sale_id').text();
if (sale) {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').attr('data-order');
}
var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers"
});
// Add Other Charges
$('#other-charges').click(function () {
var sale = $('#sale_id').text();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').attr('data-order');
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
});
// Discount for Payment
$('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').text();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').attr('data-order');
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
swal("Opps","You are not authorized for Discount","warning")
}
return false;
});
$('#edit').on('click', function () {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
if ($(this).attr('active')=== "true") {
if (dining_id) {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else{
swal("Opps","You are not authorized for void","warning")
}
});
$(document).on('click', '.cashier_number', function(event){ $(document).on('click', '.cashier_number', function(event){
if(event.handled !== true) { if(event.handled !== true) {
var original_value; var original_value;
@@ -407,19 +500,20 @@
}); });
$( document ).ready(function() { $( document ).ready(function() {
// Disable click event cash to prevent // Disable click event cash to prevent
$(".payment .cash-color").off('click'); $(".payment .cash-color").off('click');
$('#credit_payment').click(function() { $('#credit_payment').click(function() {
var sale_id = $('#sale_id').text(); var sale_id = $('#sale_id').text();
window.location.href = '/origami/sale/'+ sale_id + "/payment/credit_payment" window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/credit_payment"
return false; return false;
}); });
$('#card_payment').click(function() { $('#card_payment').click(function() {
localStorage.setItem("cash",$('#cash').text() ); localStorage.setItem("cash",$('#cash').text() );
var sale_id = $('#sale_id').text(); var sale_id = $('#sale_id').text();
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment" window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment"
return false; return false;
}); });
@@ -465,7 +559,7 @@
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>", url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id, data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
async: false, async: false,
success:function(result){ success:function(result){
/* start delete receipt no in first bill*/ /* start delete receipt no in first bill*/
@@ -492,7 +586,11 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
if (cashier_type=="cashier") {
window.location.href = '/origami'; window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}); });
}else{ }else{
$('#pay').text("Pay"); $('#pay').text("Pay");
@@ -504,7 +602,11 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
if (cashier_type=="cashier") {
window.location.href = '/origami'; window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}); });
} }
} }
@@ -525,7 +627,11 @@
type: 'POST', type: 'POST',
url: ajax_url, url: ajax_url,
success: function () { success: function () {
window.location.href = '/origami/'; if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
} }
}) })
}); });
@@ -573,7 +679,11 @@
title: "Information!", title: "Information!",
text: 'Thank You !', text: 'Thank You !',
}, function () { }, function () {
if (cashier_type=="cashier") {
window.location.href = '/origami'; window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}); });
} }

View File

@@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10"> <div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button> <button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> Back </button>
</div> </div>
<div> <div>

View File

@@ -0,0 +1,47 @@
<div class="container-fluid">
<div class="row clearfix">
<!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<div id="custom-slimscroll">
<div class="card-columns">
<% @sale.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button>
</div>
</div>
</div>
<script>
cashier_type = "quick_service"
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
})
</script>

View File

@@ -0,0 +1,147 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<div id="custom-slimscroll">
<div class="card-columns">
<% @sales.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
</div>
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<%= @sale.receipt_no rescue '' %>
</span>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
</div>
</div>
<div class="card-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
</div>
</div>
<div id="order-detail-slimscroll" data-height="160">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<%
sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<% #unless sale_item.price <= 0 %>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
#end
end
%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<tr>
<%if @sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
});
$('#addorder').on('click', function () {
var table_id = "<%=@table_id%>";
var booking_id = "<%=@booking%>";
if (table_id) {
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+$('#sale_id').val();
}else{
window.location.href = '/origami/quick_service/modify_order/'+ booking_id+"/" +$('#sale_id').val();
}
});
});
</script>

View File

@@ -103,11 +103,12 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button> <button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){} if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else { else {
@@ -185,7 +186,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment" window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"
}); });
}else{ }else{

View File

@@ -714,7 +714,7 @@ $('#pay').on('click',function() {
type: "POST", type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj", url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){ success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
} }
}); });

View File

@@ -128,6 +128,7 @@
</div> </div>
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>";
// Bill Request // Bill Request
$(document).ready(function () { $(document).ready(function () {
@@ -196,7 +197,12 @@
$('#back').on('click', function () { $('#back').on('click', function () {
var table_id = '<%= @table_id %>' var table_id = '<%= @table_id %>'
var sale_id = "<%= @saleobj.sale_id %>"
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id; window.location.href = '/origami/table/' + table_id;
}
}) })
$('#cancel_all_void').on('click', function () { $('#cancel_all_void').on('click', function () {
@@ -221,8 +227,13 @@
url: ajax_url, url: ajax_url,
data: 'sale_id=' + sale_id, data: 'sale_id=' + sale_id,
success: function (result) { success: function (result) {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id; window.location.href = '/origami/table/' + table_id;
} }
}
}); });
}) })
</script> </script>

View File

@@ -117,7 +117,7 @@
data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal, data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
success:function(result){ success:function(result){
if(result){ if(result){
window.location.href = '/origami'; window.location.href = '/origami/dashboard';
} }
} }
}); });

View File

@@ -73,13 +73,25 @@
<div class="hidden" id="newTemplate" > <div class="hidden" id="newTemplate" >
</div> </div>
<%if !@dining_facility.nil?%>
<input type="hidden" name="table_id" value="<%= @dining_facility.id %>">
<input type="hidden" name="table_type" value="<%= @table_type %>">
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
<%else%>
<input type="hidden" name="table_id" value="0">
<input type="hidden" name="table_type" value="0">
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => 0 } %>
<%end%>
<input type="hidden" name="sale_id" value="<%=@id%>">
<input type="hidden" name="cashier_type" value="<%=@cashier_type%>">
<% if !@survey_data.nil? %> <% if !@survey_data.nil? %>
<input type="hidden" name="survey_id" value=<%= @survey_data.id %> /> <input type="hidden" name="survey_id" value=<%= @survey_data.id %> />
<% else %> <% else %>
<input type="hidden" name="survey_id" /> <input type="hidden" name="survey_id" />
<% end %> <% end %>
<input type="hidden" name="table_id" value="<%=@dining_facility.id%>">
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %> <%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %> <%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
<%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %> <%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %>
@@ -182,6 +194,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){ $(document).ready(function(){
//click add button for new row //click add button for new row
$('#addForeigner').on('click',function(){ $('#addForeigner').on('click',function(){
@@ -260,17 +273,21 @@
return false; return false;
} }
}); });
// click back button for redirect // click back button for redirect
$('#back').on('click',function(){ $('#back').on('click',function(){
table_type = '<%=@table_type%>'; table_type = $('#table_type').val()
table_id = '<%=@dining_facility.id%>'; table_id = $('#table_id').val()
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/<%= @id %>/<%= @cashier_type %>/payment/';
}else{
if(table_type == "Table"){ if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id window.location.href = "/origami/table/" + table_id
} }
else { else {
window.location.href = "/origami/room/" + table_id window.location.href = "/origami/room/" + table_id
} }
}
}); });
}); });

View File

@@ -1,12 +1,3 @@
<!-- <div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= '/origami/table/@dining_facility.id' %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.survey") %></li>
<span class="float-right">
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/table/'+@dining_facility.id.to_s %>
</span>
</ol>
</div> -->
<%= render 'form', survey: @survey %> <%= render 'form', survey: @survey %>

View File

@@ -170,7 +170,7 @@ $('#pay').on('click',function() {
// location.reload(); // location.reload();
} }
}); });
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
}); });
$('#back').on('click',function(){ $('#back').on('click',function(){
var lookup_split_bill = '<%= @split_bill %>'; var lookup_split_bill = '<%= @split_bill %>';

View File

@@ -115,11 +115,13 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button> <button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
@@ -143,7 +145,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
}); });
} }
} }
@@ -230,7 +232,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
}); });
} }
} }

View File

@@ -115,11 +115,12 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button> <button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
@@ -143,7 +144,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
}); });
} }
} }
@@ -232,7 +233,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
}); });
} }
} }

View File

@@ -92,7 +92,7 @@
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button> <button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> Back </button>
</div> </div>
</div> </div>

View File

@@ -84,6 +84,17 @@ scope "(:locale)", locale: /en|mm/ do
#--------- Cashier ------------# #--------- Cashier ------------#
namespace :origami do namespace :origami do
get "dashboard" => "dashboard#index"
get "quick_service" => "quick_service#index"
get "quick_service/pending_order" => "pending_order#index"
get "quick_service/pending_order/:sale_id" => "pending_order#show"
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
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' }
resources :cash_ins, only: [:new, :create] resources :cash_ins, only: [:new, :create]
resources :cash_outs, only: [:new, :create] resources :cash_outs, only: [:new, :create]
@@ -93,7 +104,8 @@ scope "(:locale)", locale: /en|mm/ do
resources :customers #add customer type resources :customers #add customer type
end end
post 'moving' => "movetable#moving" post 'moving' => "movetable#moving"
get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit" get "/table/:table_id/sale/:sale_id/:type/edit" => "sale_edit#edit"
get "/table/sale/:sale_id/:type/edit" => "sale_edit#edit"
post 'item_void' => "sale_edit#item_void" post 'item_void' => "sale_edit#item_void"
post 'item_foc' => "sale_edit#item_foc" post 'item_foc' => "sale_edit#item_foc"
post 'item_edit' => "sale_edit#item_edit" post 'item_edit' => "sale_edit#item_edit"
@@ -119,11 +131,11 @@ scope "(:locale)", locale: /en|mm/ do
# post '/:booking_id' => 'home#item_show' # post '/:booking_id' => 'home#item_show'
# Other Charges # Other Charges
get "/:sale_id/other_charges" => "other_charges#index" get "/:sale_id/:type/other_charges" => "other_charges#index"
post "/:sale_id/other_charges" => "other_charges#create" post "/:sale_id/other_charges" => "other_charges#create"
# Discount # Discount
get "/:id/discount" => "discounts#index" get "/:id/:type/discount" => "discounts#index"
post "/:id/discount" => "discounts#create" post "/:id/discount" => "discounts#create"
get "/:id/remove_all_discount" => "discounts#remove_all_discount" get "/:id/remove_all_discount" => "discounts#remove_all_discount"
post "/:id/remove_discount_items" => "discounts#remove_discount_items" post "/:id/remove_discount_items" => "discounts#remove_discount_items"
@@ -152,7 +164,7 @@ scope "(:locale)", locale: /en|mm/ do
#--------- Payment ------------# #--------- Payment ------------#
post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj', :as => "calculate_rouding_adjs" post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj', :as => "calculate_rouding_adjs"
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => {:format => 'json'} get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => {:format => 'json'}
get 'sale/:sale_id/payment' => 'payments#show' get 'sale/:sale_id/:type/payment' => 'payments#show'
post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'} post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'}
post 'payment/cash' => 'payments#create' post 'payment/cash' => 'payments#create'
@@ -165,15 +177,15 @@ scope "(:locale)", locale: /en|mm/ do
post 'payment/credit' => 'credit_payments#create' post 'payment/credit' => 'credit_payments#create'
post 'payment/voucher' => 'voucher_payments#create' post 'payment/voucher' => 'voucher_payments#create'
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" get 'sale/:sale_id/:type/payment/credit_payment' => "credit_payments#index"
get 'sale/:sale_id/payment/others_payment' => "others_payments#index" get 'sale/:sale_id/:type/payment/others_payment' => "others_payments#index"
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index" get 'sale/:sale_id/:type/payment/others_payment/MPU' => "mpu#index"
get 'sale/:sale_id/payment/others_payment/VISA' => "visa#index" get 'sale/:sale_id/:type/payment/others_payment/VISA' => "visa#index"
get 'sale/:sale_id/payment/others_payment/Master' => "master#index" get 'sale/:sale_id/:type/payment/others_payment/Master' => "master#index"
get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#index" get 'sale/:sale_id/:type/payment/others_payment/JCB' => "jcb#index"
get 'sale/:sale_id/payment/others_payment/UNIONPAY' => "unionpay#index" get 'sale/:sale_id/:type/payment/others_payment/UNIONPAY' => "unionpay#index"
get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index" get 'sale/:sale_id/:type/payment/others_payment/Redeem' => "redeem_payments#index"
get 'sale/:sale_id/payment/others_payment/Voucher' => "voucher#index" get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index"
#---------Void --------------# #---------Void --------------#
post 'sale/:sale_id/void' => 'void#overall_void' post 'sale/:sale_id/void' => 'void#overall_void'
@@ -186,26 +198,27 @@ scope "(:locale)", locale: /en|mm/ do
#---------Add Customer --------------# #---------Add Customer --------------#
#resources :customers #resources :customers
get '/:sale_id/customers', to: "customers#add_customer" get '/:sale_id/:type/customers', to: "customers#add_customer"
get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details" get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
post '/:sale_id/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table post '/:sale_id/:type/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
post '/:sale_id/get_customer' => "customers#get_customer" post '/:sale_id/get_customer' => "customers#get_customer"
get '/:id/surveys', to: "surveys#new" get '/:id/:type/surveys', to: "surveys#new"
match '/:id/create_survey', to: "surveys#create", as: "create_surveys", via: [:post, :patch, :put] match '/:id/create_survey', to: "surveys#create", as: "create_surveys", via: [:post, :patch, :put]
get '/addorders/get_menu/:id' => "addorders#get_menu",:as => "get_menu", :defaults => { :format => 'json' }
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' } get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
get '/addorders/get_menu_sub_category/:id' => "addorders#get_menu_sub_category",:as => "get_menu_sub_category", :defaults => { :format => 'json' } get '/addorders/get_menu_sub_category/:id' => "addorders#get_menu_sub_category",:as => "get_menu_sub_category", :defaults => { :format => 'json' }
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' } get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
get '/:addorders/:id' => "addorders#detail" get '/:addorders/:id' => "addorders#detail"
post '/:addorders/create' => "addorders#create", :defaults => { :format => 'json' } post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
resources :commissions resources :commissions
resources :commissioners resources :commissioners
resources :addorders # resources :addorders
resources :in_duties resources :in_duties
# product_commission # product_commission
@@ -224,7 +237,9 @@ scope "(:locale)", locale: /en|mm/ do
get '/table/:dining_id/split_bills' => 'split_bill#index' get '/table/:dining_id/split_bills' => 'split_bill#index'
get '/room/:dining_id/split_bills' => 'split_bill#index' get '/room/:dining_id/split_bills' => 'split_bill#index'
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills" post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
post '/split_bills/surveys', to: 'surveys#create_survey' post '/split_bills/surveys', to: 'surveys#create_survey'
end end
#--------- Waiter/Ordering Station ------------# #--------- Waiter/Ordering Station ------------#