merge master
This commit is contained in:
@@ -315,6 +315,7 @@ $(function() {
|
||||
$(".options-list").empty();
|
||||
|
||||
rowCount = $('.selected-instance');
|
||||
setCount = $('.selected-set');
|
||||
item_options = $(this).data('option');
|
||||
|
||||
min_qty = $(this).data('min-qty');
|
||||
@@ -335,19 +336,19 @@ $(function() {
|
||||
$(".options-list").append(row);
|
||||
}
|
||||
}
|
||||
if($(this).hasClass('selected-instance') == true){
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
// qty = $('#set_change_qty').val();
|
||||
qty = document.getElementById("set_count").value;
|
||||
total = qty*price;
|
||||
var total_price = +sub_total - +total;
|
||||
$(this).removeClass('selected-instance');
|
||||
$(".options-list").empty();
|
||||
$(this).removeAttr('data-options');
|
||||
$('#instance_option').text('')
|
||||
}else {
|
||||
// if($(this).hasClass('selected-instance') == true){
|
||||
// sub_total = $('#set_total_price').text();
|
||||
// name = $(this).data('name');
|
||||
// price = $(this).data('price');
|
||||
// // qty = $('#set_change_qty').val();
|
||||
// qty = document.getElementById("set_count").value;
|
||||
// total = qty*price;
|
||||
// var total_price = +sub_total - +total;
|
||||
// $(this).removeClass('selected-instance');
|
||||
// $(".options-list").empty();
|
||||
// $(this).removeAttr('data-options');
|
||||
// $('#instance_option').text('')
|
||||
// }else {
|
||||
if (rowCount.length+1 <= max_qty) {
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
@@ -358,12 +359,55 @@ $(function() {
|
||||
total = qty*price;
|
||||
var total_price = +sub_total + +total;
|
||||
$(this).addClass('selected-instance');
|
||||
|
||||
set = "<div class='selected-set card custom-card' style='margin-bottom:10px !important'"
|
||||
+"' data-name='"+$(this).data('name')
|
||||
+"' data-code='"+code
|
||||
+"' data-price='"+$(this).data('price')
|
||||
+"' data-option='"+JSON.stringify($(this).data('option'))
|
||||
+"' data-min-qty='"+$(this).data('min-qty')
|
||||
+"' data-max-qty='"+$(this).data('max-qty')
|
||||
+"' data-parent-code='"+$(this).data('parent-code')
|
||||
+"' data-parent-id='"+$(this).data('parent-id')
|
||||
+"' data-sub-item='true"
|
||||
+"'>"
|
||||
|
||||
+'<div class="card-block" style="background-color:#54A5AF;">'
|
||||
+' <button type="button" class="close" id="remove_set" style="font-size: 20px;">×</button>'
|
||||
+'<span style="color:#fff">'+$(this).data('name')+'</span>'
|
||||
+'</div>'
|
||||
+'<div class="card-block custom-card-block">'
|
||||
|
||||
+' <small style="float:" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
// +'<div class="card-footer custom-card-footer">'
|
||||
// +' <span>'+$(this).data('price')+'</span>'
|
||||
// // +' <small style="float:right" id="instance_option"></small>'
|
||||
// +'</div>'
|
||||
+'</div>'
|
||||
$(".selected-set-list").append(set);
|
||||
}else{
|
||||
swal("Alert !", 'Maximum Qty is ' + max_qty + " items", "warning");
|
||||
}
|
||||
}
|
||||
// }
|
||||
$('#set_unit_price').text(price);
|
||||
$('#set_total_price').text(total_price);
|
||||
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
// click add order
|
||||
$(document).on('click', '#remove_set', function(event){
|
||||
code = $(this).parent().parent('.selected-set').attr('data-code');
|
||||
instance = $(".selected-instance");
|
||||
console.log(code)
|
||||
$(instance).each(function(i){
|
||||
if ($(instance[i]).attr('data-code')==code){
|
||||
console.log($(instance[i]))
|
||||
$(instance[i]).removeClass("selected-instance")
|
||||
}
|
||||
});
|
||||
$(this).parent().parent('.selected-set').remove();
|
||||
});
|
||||
|
||||
// click add order
|
||||
$(document).on('click', '.set_order', function(event){
|
||||
@@ -637,15 +681,17 @@ $(function() {
|
||||
|
||||
|
||||
if(group == "set_menu"){
|
||||
|
||||
instance = $(".selected-instance");
|
||||
$(instance).each(function(i){
|
||||
if ($(instance[i]).attr('data-code')==code){
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
$(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
||||
$(instance[i]).children().children('#instance_option').text(option_arr);
|
||||
}
|
||||
});
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
$(".selected-set:last").attr('data-options',JSON.stringify(option_arr));
|
||||
$(".selected-set:last").children().children('#instance_option').text(option_arr);
|
||||
// instance = $(".selected-instance");
|
||||
// $(instance).each(function(i){
|
||||
// if ($(instance[i]).attr('data-code')==code){
|
||||
// option_arr = get_selected_attributes('selected-option');
|
||||
// $(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
||||
// $(instance[i]).children().children('#instance_option').text(option_arr);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
if(group == "set_menu_default"){
|
||||
|
||||
@@ -32,6 +32,26 @@ $(document).ready(function() {
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#modal-slimscroll').slimScroll({
|
||||
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
$('#modal-set-slimscroll').slimScroll({
|
||||
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
// $('.delete').click(function(){
|
||||
// var method = $(this).attr('data-method');
|
||||
|
||||
@@ -387,3 +387,22 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun
|
||||
function setHeaderBreadCrumb(params){
|
||||
$("#others_payment").html(params);
|
||||
}
|
||||
|
||||
//show hide nav bar for webview
|
||||
function showHideNavbar(webview,page=""){
|
||||
if(webview){
|
||||
$("nav.navbar").addClass("hidden");
|
||||
$("section").addClass("section-margin");
|
||||
$(".page-loader-wrapper").addClass("hidden");
|
||||
if(page!=""){
|
||||
$("#back").hide();
|
||||
}
|
||||
}else{
|
||||
$("nav.navbar").removeClass("hidden");
|
||||
$("section").removeClass("section-margin");
|
||||
$(".page-loader-wrapper").removeClass("hidden");
|
||||
if(page!=""){
|
||||
$("#back").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,4 +431,9 @@ iframe {
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
}
|
||||
/* End iframe */
|
||||
/* End iframe */
|
||||
|
||||
/* section class for webview */
|
||||
.section-margin {
|
||||
margin-top: -50px;
|
||||
}
|
||||
47
app/controllers/api/survey_controller.rb
Normal file
47
app/controllers/api/survey_controller.rb
Normal file
@@ -0,0 +1,47 @@
|
||||
class Api::SurveyController < Api::ApiController
|
||||
# before_action :authenticate
|
||||
|
||||
def index
|
||||
dining_facility = DiningFacility.find(params[:id])
|
||||
survey_data = Survey.find_by_dining_name(dining_facility.name)
|
||||
countries = Lookup.collection_of("country")
|
||||
if !countries.nil? || !survey_data.nil?
|
||||
render :json => { :status => true, :data => { :countries => countries, :survey_data => survey_data} }
|
||||
else
|
||||
render :json => { :status => true, :error_message => "There is no data" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
dining_facility = DiningFacility.find(params[: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)
|
||||
|
||||
if params[:survey_id]
|
||||
survey = Survey.find(params[:survey_id])
|
||||
else
|
||||
survey = Survey.new
|
||||
end
|
||||
survey.dining_name = dining_facility.name
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.child = params[:child]
|
||||
survey.adult = params[:adult]
|
||||
survey.male = params[:male]
|
||||
survey.female = params[:female]
|
||||
survey.local = params[:local]
|
||||
survey.created_by = current_login_employee.name
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.foreigner = params[:foreigner].to_json
|
||||
survey.save!
|
||||
|
||||
render :json => { :status => true }
|
||||
end
|
||||
|
||||
# private
|
||||
# def survey_params
|
||||
# params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner,
|
||||
# :dining_name,:created_by,:total_customer,:total_amount)
|
||||
# end
|
||||
|
||||
end
|
||||
@@ -7,7 +7,8 @@ class BaseOrigamiController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
helper_method :shop_detail, :current_token
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
# redirect_to origami_root_path
|
||||
@@ -33,5 +34,17 @@ class BaseOrigamiController < ActionController::Base
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
|
||||
#check webview
|
||||
def check_mobile
|
||||
status = false
|
||||
authenticate_with_http_token do |token, options|
|
||||
session[:session_token] = token
|
||||
end
|
||||
|
||||
if session[:session_token] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i
|
||||
status = true
|
||||
end
|
||||
return status
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,13 +2,23 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
# before_action :set_dining, only: [:detail]
|
||||
|
||||
def index
|
||||
@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')
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@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')
|
||||
end
|
||||
|
||||
def detail
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@menus = Menu.all
|
||||
|
||||
@@ -9,7 +9,6 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def get_customer
|
||||
|
||||
filter = params[:filter]
|
||||
type = params[:type]
|
||||
|
||||
@@ -47,7 +46,11 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def add_customer
|
||||
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
@page = params[:page]
|
||||
|
||||
@@ -3,6 +3,11 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def index
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
sale_id = params[:id]
|
||||
@cashier_type = params[:type]
|
||||
if Sale.exists?(sale_id)
|
||||
|
||||
@@ -3,6 +3,11 @@ class Origami::HomeController < BaseOrigamiController
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@@ -14,6 +19,11 @@ class Origami::HomeController < BaseOrigamiController
|
||||
|
||||
# origami table detail
|
||||
def show
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
|
||||
@@ -56,19 +56,19 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def moving
|
||||
change_to = params[:change_to] #new
|
||||
change_from = params[:change_from] #original
|
||||
bookings = Booking.where('dining_facility_id=?',change_from)
|
||||
def moving
|
||||
change_to = params[:change_to] #new
|
||||
change_from = params[:change_from] #original
|
||||
bookings = Booking.where('dining_facility_id=?',change_from)
|
||||
|
||||
booking_array = Array.new
|
||||
bookings.each do | booking |
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
booking_array.push(booking)
|
||||
end
|
||||
end
|
||||
booking_array = Array.new
|
||||
bookings.each do | booking |
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
booking_array.push(booking)
|
||||
end
|
||||
end
|
||||
|
||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||
|
||||
# get printer info
|
||||
@from = (DiningFacility.find(change_from)).name
|
||||
@@ -78,9 +78,16 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
@date = DateTime.now
|
||||
@shop = Shop::ShopDetail
|
||||
unique_code = "MoveTablePdf"
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by)
|
||||
end
|
||||
|
||||
pdf_no = PrintSetting.where(:unique_code => unique_code).count
|
||||
#print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer_array = []
|
||||
printer_array = PrintSetting.where(:unique_code => unique_code)
|
||||
for i in 0..pdf_no
|
||||
if i != pdf_no
|
||||
print_settings = printer_array[i]
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
class Origami::OrdersController < BaseOrigamiController
|
||||
def show
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
|
||||
@@ -2,6 +2,11 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def index
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
if Sale.exists?(sale_id)
|
||||
|
||||
@@ -431,13 +431,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
#calculate cash acmount
|
||||
cash = saleObj.total_amount
|
||||
|
||||
if saleObj.discount_type == "member_discount"
|
||||
saleObj.update_attributes(rounding_adjustment: 0)
|
||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0,order_source)
|
||||
end
|
||||
|
||||
saleObj.update_attributes(rounding_adjustment: 0)
|
||||
|
||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||
puts "FOC"
|
||||
puts saleObj.to_json
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
||||
# For Cashier by Zone
|
||||
|
||||
@@ -16,7 +16,7 @@ class Origami::RequestBillsController < ApplicationController
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
order = Order.find(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
|
||||
table = DiningFacility.find(check_booking.dining_facility_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)
|
||||
@@ -33,6 +33,8 @@ class Origami::RequestBillsController < ApplicationController
|
||||
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(@sale)
|
||||
#bill channel
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
if order.source == "quick_service"
|
||||
result = {:status=> @status, :data => @sale.sale_id }
|
||||
render :json => result.to_json
|
||||
|
||||
@@ -5,9 +5,18 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
|
||||
@@ -2,6 +2,11 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def index
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
dining_id = params[:dining_id]
|
||||
@cashier_type = params[:type]
|
||||
@table = DiningFacility.find(dining_id)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
class Origami::SurveysController < BaseOrigamiController
|
||||
def new
|
||||
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@survey = Survey.new
|
||||
@id = params[:id]
|
||||
@cashier_type = params[:type]
|
||||
|
||||
@@ -3,18 +3,26 @@ class Reports::SaleitemController < BaseReportController
|
||||
def index
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
shift_sale_range = ''
|
||||
|
||||
shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
|
||||
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
if to.blank?
|
||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
||||
else
|
||||
|
||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
if shift_sale.shift_closed_at.blank?
|
||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
|
||||
else
|
||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@type = params[:sale_type]
|
||||
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
|
||||
|
||||
@@ -54,8 +62,8 @@ class Reports::SaleitemController < BaseReportController
|
||||
|
||||
def show
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
puts "aaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
@@ -68,8 +76,8 @@ class Reports::SaleitemController < BaseReportController
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||
# @totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||
# @sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
|
||||
@@ -134,24 +134,36 @@ class License
|
||||
def verify_license
|
||||
api_token = read_license_no_decrypt("api_token")
|
||||
@params = { query: {lookup_type: "application", api_token: api_token} }
|
||||
response = self.class.get("/verify", @params)
|
||||
|
||||
begin
|
||||
response = self.class.get("/verify", @params)
|
||||
@varified = response.parsed_response
|
||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||
if (@varified["status"])
|
||||
if (!check_expired(@varified["renewable_date"]))
|
||||
return true
|
||||
end
|
||||
else
|
||||
delete_license_file
|
||||
end
|
||||
|
||||
rescue SocketError => e
|
||||
Rails.logger.debug "In Socket errror"
|
||||
return true
|
||||
rescue => e
|
||||
@varified = response.parsed_response
|
||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||
if (@varified["status"])
|
||||
if (!check_expired(@varified["renewable_date"]))
|
||||
return true
|
||||
end
|
||||
else
|
||||
delete_license_file
|
||||
end
|
||||
rescue SocketError => e
|
||||
Rails.logger.debug "In SocketError No Internet connection ! "
|
||||
return true
|
||||
rescue HTTParty::Error
|
||||
Rails.logger.debug "Server Error HTTParty"
|
||||
return true
|
||||
rescue Net::OpenTimeout
|
||||
Rails.logger.debug "connection Timeout"
|
||||
return true
|
||||
rescue OpenURI::HTTPError
|
||||
Rails.logger.debug "Can't connect server"
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
# Check Expired before 30 days
|
||||
def check_expiring(renewal_date_str)
|
||||
if !renewal_date_str.empty?
|
||||
@@ -164,7 +176,6 @@ class License
|
||||
def check_expired(renewal_date_str)
|
||||
expired_date_str = read_license("renewable_date")
|
||||
renewal_date = DateTime.parse(renewal_date_str)
|
||||
|
||||
if(renewal_date_str != expired_date_str)
|
||||
update_license("renewable_date", renewal_date_str)
|
||||
end
|
||||
@@ -345,7 +356,8 @@ class License
|
||||
f.write("job.push.period.time.ms=10000\n")
|
||||
f.write("job.pull.period.time.ms=10000\n")
|
||||
f.write("initial.load.create.first=true\n")
|
||||
f.write("initial.load.use.extract.job.enabled=true\n")
|
||||
f.write("initial.load.use.extract.job.enabled=true\n")
|
||||
f.write("rest.api.enable=true\n")
|
||||
f.close
|
||||
|
||||
# read from license file
|
||||
@@ -368,7 +380,8 @@ class License
|
||||
f.write("external.id=001\n")
|
||||
f.write("job.routing.period.time.ms=5000\n")
|
||||
f.write("job.push.period.time.ms=10000\n")
|
||||
f.write("job.pull.period.time.ms=10000\n")
|
||||
f.write("job.pull.period.time.ms=10000\n")
|
||||
f.write("rest.api.enable=true\n")
|
||||
# f.write("initial.load.create.first=true\n")
|
||||
# f.write("initial.load.use.extract.job.enabled=true\n")
|
||||
f.close
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class PrintSetting < ApplicationRecord
|
||||
# validations
|
||||
validates_presence_of :name, :unique_code, :printer_name, :brand_name, :api_settings, :page_width, :page_height, :print_copies
|
||||
validates_presence_of :name, :unique_code, :printer_name, :brand_name, :api_settings, :page_width, :page_height, :print_copies, :header_font_size, :item_font_size
|
||||
|
||||
def self.get_precision_delimiter
|
||||
PrintSetting.find_by_unique_code("ReceiptBillPdf")
|
||||
|
||||
@@ -361,6 +361,8 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
compute_tax(sale, total_taxable, total_discount, order_source)
|
||||
|
||||
sale.total_amount = subtotal_price
|
||||
sale.total_discount = total_discount
|
||||
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
|
||||
@@ -371,8 +373,6 @@ class Sale < ApplicationRecord
|
||||
# adjust_rounding
|
||||
sale.rounding_adjustment = compute_adjust_rounding(sale.grand_total)
|
||||
|
||||
compute_tax(sale, total_taxable, total_discount, order_source)
|
||||
|
||||
sale.save!
|
||||
end
|
||||
|
||||
@@ -806,6 +806,15 @@ def self.get_by_shift_sale(from,to,status)
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to)
|
||||
end
|
||||
|
||||
def self.get_by_shift_sale_by_item(from,to,status)
|
||||
query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date,
|
||||
shift_closed_at As closing_date," +
|
||||
" grand_total AS grand_total, cash_sales AS cash," +
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" , from)
|
||||
end
|
||||
|
||||
def self.get_item_query(type)
|
||||
|
||||
if type == "revenue" || type.nil?
|
||||
|
||||
@@ -263,10 +263,12 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
self.payment_method = "foc"
|
||||
self.payment_amount = self.received_amount
|
||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
# self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
self.outstanding_amount = 0.00
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
sale_update_payment_status(self.received_amount)
|
||||
# sale_update_payment_status(self.received_amount)
|
||||
sale_update_payment_status(0)
|
||||
return payment_status
|
||||
end
|
||||
|
||||
@@ -470,7 +472,7 @@ class SalePayment < ApplicationRecord
|
||||
elsif paid_amount.to_f > 0 #|| paid_amount != "0.0"
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
elsif method_status && paid_amount.to_f == 0
|
||||
elsif method_status && paid_amount.to_f == 0 && is_credit == 0
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
end
|
||||
|
||||
@@ -405,9 +405,15 @@
|
||||
<p class="hidden" id="set_item_code"></p>
|
||||
<p></p>
|
||||
|
||||
<div class="options-list">
|
||||
<div class="" id="modal-slimscroll" data-height="250">
|
||||
<div class="options-list" style="margin-top:-5px">
|
||||
</div>
|
||||
|
||||
<div class='selected-set-list'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="instance-list row"></div>
|
||||
@@ -585,5 +591,12 @@
|
||||
//end Ajax
|
||||
}
|
||||
//end show list function
|
||||
|
||||
/* check webview loaded*/
|
||||
var webview = '';
|
||||
<%if @webview %>
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
||||
@@ -274,6 +274,9 @@
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var page = "<%= @page %>";
|
||||
$(function() {
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
/*$('.datepicker').datepicker({
|
||||
setDate: '12-12-1999',
|
||||
format : 'dd-mm-yyyy',
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_order %></div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -257,6 +257,9 @@
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_DISCOUNTS_);
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var id = $("#table_id").text();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="<%= @webview==true ? 'col-lg-12 col-md-12 col-sm-12' : 'col-lg-10 col-md-10 col-sm-10' %>">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
@@ -116,7 +116,7 @@
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<div class="<%= @webview==true ? 'hidden' : 'col-lg-2 col-md-2 col-sm-2' %>">
|
||||
<!-- <button id="refreshbutton" type="button" class="btn btn-block radius-btn"> Refresh off </button> -->
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
@@ -139,6 +139,8 @@
|
||||
<!-- Column One -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview,"index");
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
|
||||
@@ -604,6 +604,9 @@
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function () {
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
@@ -870,6 +873,8 @@
|
||||
})
|
||||
|
||||
$('#add_invoice').on('click', function () {
|
||||
$("#first_bill").prop('disabled',true);
|
||||
$("#pay").prop('disabled',true);
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
||||
var ajax_url = "/origami/sale/append_order";
|
||||
@@ -886,6 +891,8 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
$("#first_bill").removeAttr('disabled');
|
||||
$("#pay").removeAttr('disabled');
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -253,6 +253,10 @@
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
|
||||
@@ -212,6 +212,10 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_OTHER_CHARGES_);
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
|
||||
@@ -542,6 +542,9 @@
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
// $(".tables").on('click', function(){
|
||||
// var customer_id=$(".customer-id").text();
|
||||
// show_customer_details(customer_id);
|
||||
@@ -838,6 +841,8 @@ $('#back').on('click',function(){
|
||||
})
|
||||
|
||||
$('#add_invoice').on('click',function(){
|
||||
$("#first_bill").prop('disabled',true);
|
||||
$("#pay").prop('disabled',true);
|
||||
var dining_id = "<%= @room.id %>"
|
||||
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
||||
var ajax_url = "/origami/sale/append_order";
|
||||
@@ -854,6 +859,8 @@ $('#add_invoice').on('click',function(){
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
$("#first_bill").removeAttr('disabled');
|
||||
$("#pay").removeAttr('disabled');
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -336,6 +336,10 @@
|
||||
var cashier_type = '<%= @cashier_type %>';
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_SPLIT_BILL_);
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$('#back').on('click',function(){
|
||||
backToOrigami();
|
||||
})
|
||||
|
||||
@@ -6,73 +6,122 @@
|
||||
<%= f.error_notification %>
|
||||
<div class="form-inputs p-l-10">
|
||||
<% if !@survey_data.nil? %>
|
||||
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10' }%>
|
||||
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10' }%>
|
||||
<%= f.input :male , input_html: { value: @survey_data.male, class: 'col-md-10' }%>
|
||||
<%= f.input :female , input_html: { value: @survey_data.female, class: 'col-md-10' }%>
|
||||
<%= f.input :total_customer, input_html: { value: @survey_data.total_customer, class: 'col-md-10'} %>
|
||||
<%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-10' }%>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Foreigner</label>
|
||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Number</label>
|
||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||
<br>
|
||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :male , input_html: { value: @survey_data.male, class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :female , input_html: { value: @survey_data.female, class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.input :total_customer, input_html: { value: @survey_data.total_customer, class: 'col-md-11'} %>
|
||||
<%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-11' }%>
|
||||
<!--<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;"> -->
|
||||
<!-- <legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend> -->
|
||||
<fieldset class="form-group">
|
||||
<label class="bmd-label-static">Foreigner Lists</label>
|
||||
<div class="row clearfix foreignerDiv">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Foreigner</label>
|
||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Number</label>
|
||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||
<br>
|
||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden" id="newTemplate" >
|
||||
</div>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<%= f.input :child , input_html: { class: 'col-md-10' }%>
|
||||
<%= f.input :adult , input_html: { class: 'col-md-10' }%>
|
||||
<%= f.input :male , input_html: { class: 'col-md-10' }%>
|
||||
<%= f.input :female , input_html: { class: 'col-md-10' }%>
|
||||
<%= f.input :total_customer, input_html: { class: 'col-md-10'} %>
|
||||
<%= f.input :local , input_html: { class: 'col-md-10' }%>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Foreigner</label>
|
||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
<%= f.input :child , input_html: { class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Number</label>
|
||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||
<%= f.input :adult , input_html: { class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||
<br>
|
||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="hidden" id="newTemplate" >
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :male , input_html: { class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :female , input_html: { class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.input :total_customer, input_html: { class: 'col-md-11'} %>
|
||||
<%= f.input :local , input_html: { class: 'col-md-11' }%>
|
||||
|
||||
</div>
|
||||
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
|
||||
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Foreigner</label>
|
||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Number</label>
|
||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||
<br>
|
||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden" id="newTemplate" >
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%if !@dining_facility.nil? %>
|
||||
<input type="hidden" name="table_id" id="table_id" value="<%= @dining_facility.id %>">
|
||||
<input type="hidden" name="table_type" id="table_type" value="<%= @table_type %>">
|
||||
@@ -95,8 +144,8 @@
|
||||
<%= 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 :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
</div>
|
||||
<div class="form-actions form-inputs p-l-10">
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -196,13 +245,21 @@
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$('.foreignerDiv').removeClass("hidden");
|
||||
setHeaderBreadCrumb(_SURVEY_);
|
||||
<% if !@survey_data.nil? %>
|
||||
addSurveyForeignerLists(<%= @survey_data.foreigner.to_json.html_safe %>);
|
||||
<% end %>
|
||||
//click add button for new row
|
||||
$('#addForeigner').on('click',function(){
|
||||
$('#newTemplate').removeClass('hidden');
|
||||
|
||||
var text_box = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
@@ -213,7 +270,35 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-danger" id="removeRow">Remove</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('#newTemplate').append(text_box);
|
||||
});
|
||||
|
||||
//click add button for new row
|
||||
$('#newTemplate').on('click','#addForeigner',function(){
|
||||
$('#newTemplate').removeClass('hidden');
|
||||
|
||||
var text_box = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>'
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control">'
|
||||
+'</div>'
|
||||
@@ -292,4 +377,84 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function addSurveyForeignerLists(foreigner_lists){
|
||||
if((foreigner_lists != undefined) && (foreigner_lists != null) && (foreigner_lists != "")){
|
||||
$('.foreignerDiv').remove();
|
||||
$('#newTemplate').removeClass('hidden');
|
||||
foreigner_lists = foreigner_lists.substring(1, (foreigner_lists.length - 1)).replace(new RegExp('"', "g"),'').split(",");
|
||||
var arr_foreigner = {};
|
||||
$.each(foreigner_lists,function(key,value){
|
||||
if(!value.match(/^[0-9]+$/)){
|
||||
arr_foreigner[value] = 0;
|
||||
}else{
|
||||
$.each(arr_foreigner,function(k,val){
|
||||
if(arr_foreigner[k] == 0){
|
||||
arr_foreigner[k] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// console.log(foreigner_lists);
|
||||
// console.log(arr_foreigner);
|
||||
$.each(arr_foreigner, function(key,value){
|
||||
if(Object.keys(arr_foreigner)[0] == key){
|
||||
var fgn_template = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>'
|
||||
// if (key.toString() == '<%= ct.value.to_s %>')
|
||||
// var selected = "selected";
|
||||
// else
|
||||
// var selected = "";
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control" value="'+value+'">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-success" id="addForeigner">Add</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
}else{
|
||||
var fgn_template = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>'
|
||||
// if (key.toString() == '<%= ct.value.to_s %>')
|
||||
// var selected = "selected";
|
||||
// else
|
||||
// var selected = "";
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control" value="'+value+'">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-danger" id="removeRow">Remove</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
}
|
||||
|
||||
$('#newTemplate').append(fgn_template);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -10,6 +10,9 @@
|
||||
<%= f.input :unique_code %>
|
||||
<%= f.input :template %>
|
||||
<%= f.input :font %>
|
||||
|
||||
<%= f.input :header_font_size %>
|
||||
<%= f.input :item_font_size %>
|
||||
<%
|
||||
if(@server_mode != 'cloud')
|
||||
%>
|
||||
@@ -19,7 +22,6 @@
|
||||
%>
|
||||
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :brand_name %>
|
||||
<%= f.input :printer_type %>
|
||||
<%= f.input :api_settings %>
|
||||
|
||||
@@ -325,7 +325,8 @@
|
||||
var str = '';
|
||||
var param_shift = '<%= params[:shift_name]%>';
|
||||
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
url = '<%= reports_get_shift_by_sale_item_path %>';
|
||||
console.log(url)
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
console.log(data)
|
||||
|
||||
|
||||
@@ -27,15 +27,29 @@
|
||||
|
||||
<tbody>
|
||||
<% @employees.each do |employee| %>
|
||||
<tr>
|
||||
<td><%= link_to employee.name,settings_employee_path(employee) %></td>
|
||||
<td><%= employee.role %></td>
|
||||
<td><%= employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td>
|
||||
<%= link_to t("views.btn.edit"), edit_settings_employee_path(employee),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if current_login_employee.role == "administrator" %>
|
||||
<tr>
|
||||
<td><%= link_to employee.name,settings_employee_path(employee) %></td>
|
||||
<td><%= employee.role %></td>
|
||||
<td><%= employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td>
|
||||
<%= link_to t("views.btn.edit"), edit_settings_employee_path(employee),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% if employee.role != "administrator" %>
|
||||
<tr>
|
||||
<td><%= link_to employee.name,settings_employee_path(employee) %></td>
|
||||
<td><%= employee.role %></td>
|
||||
<td><%= employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td>
|
||||
<%= link_to t("views.btn.edit"), edit_settings_employee_path(employee),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<% total_female = 0 %>
|
||||
<% total_local = 0 %>
|
||||
<% total_customer = 0 %>
|
||||
<% total_foreigner = 0 %>
|
||||
<% if !@surveys.nil? %>
|
||||
<% @surveys.each do |survey| %>
|
||||
<% total_child = total_child.to_i + survey.child.to_i %>
|
||||
@@ -80,8 +81,11 @@
|
||||
<% foreigner_lists = foreign.split(",") %>
|
||||
<% if !foreigner_lists.empty? %>
|
||||
<% foreigner_lists.each do |fgn| %>
|
||||
<% unless fgn.match(/[^[:digit:]]+/)
|
||||
total_foreigner = total_foreigner.to_i + fgn.to_i
|
||||
end %>
|
||||
<% if !fgn.scan(/\D/).empty? %>
|
||||
<%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %><br>
|
||||
<%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %><br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -97,7 +101,8 @@
|
||||
<td><strong><%= total_male %></strong></td>
|
||||
<td><strong><%= total_female %></strong></td>
|
||||
<td><strong><%= total_customer %></strong></td>
|
||||
<td colspan="2"><strong><%= total_local %></strong></td>
|
||||
<td><strong><%= total_local %></strong></td>
|
||||
<td><strong><%= total_foreigner %></strong></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -12,7 +12,7 @@ class ActionController::Base
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# authenticate_session_token
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
else8
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
|
||||
15
config/license.yml
Normal file
15
config/license.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
iv_key: rwOZKWcQho6fE4V+A2zFuQ==
|
||||
shop_name: AMZ_Test
|
||||
email: aungmyo.zaw@code2lab.com
|
||||
telephone:
|
||||
fax:
|
||||
address:
|
||||
dbhost: dNzh66R80remB694OEds96OpuyZ4wmHeHFdQh0KwjYFvTInK6+pCN/y6HdbyIlqqjcBHkqPjkjzw45PznLn7hA==
|
||||
dbschema: 4vooJDxgWdFv/8V7Qx8tzR/8B8T2c5U4XvYcF+2KOoA=
|
||||
dbusername: Xc8ELRsW7N/f8KsVikMBlg==
|
||||
dbpassword: HMg+TbLxmfYrDFI4IIAd4g==
|
||||
api_token: bisryXiEnbTJlZwghAnIByQpiRUMouu
|
||||
app_token: LycQXJYBZGeCygjIEKdlBXnjIGMiMzgmt
|
||||
plan_sku: 84hdnSCgkfhvItY7uB/pPQ==
|
||||
renewable_date: 8E6Ecz8QXAMSlKZnIzn0pQ==
|
||||
plan_name: 4cMIO0n/JzGFPIccXM6u5A==
|
||||
@@ -72,7 +72,7 @@ en:
|
||||
payment: "Payment"
|
||||
backend: "Backend"
|
||||
date_time: "DateTime"
|
||||
dine_in_order: "Dine In Order"
|
||||
dine_in_cashier: "Dine-in Cashier"
|
||||
quick_service: "Quick Service"
|
||||
|
||||
views:
|
||||
|
||||
@@ -67,7 +67,7 @@ mm:
|
||||
payment: "ငွေပေးချေမှု"
|
||||
backend: "နောက်ကွယ်"
|
||||
date_time: "ရက်စွဲအချိန်"
|
||||
dine_in_order: "Dine In Order"
|
||||
dine_in_cashier: "Dine-in Cashier"
|
||||
quick_service: "Quick Service"
|
||||
|
||||
views:
|
||||
|
||||
@@ -78,6 +78,8 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post "check_in" => "check_in_process#check_in_process"
|
||||
post "request_time" => "check_in_process#request_time"
|
||||
post "call_waiter" => "call_waiters#index"
|
||||
get "survey/:id" => "survey#index"
|
||||
post "survey/:id" => "survey#create"
|
||||
end
|
||||
|
||||
|
||||
@@ -417,8 +419,9 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :stock_check, :only => [:index, :show]
|
||||
resources :payment_method
|
||||
resources :product_sale, :only => [:index, :show]
|
||||
|
||||
get "saleitem/get_shift_by_date", to: "saleitem#show", as: "get_shift_by_sale_item"
|
||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||
|
||||
end
|
||||
|
||||
# ----------- Inventory ---------------------------
|
||||
|
||||
@@ -12,8 +12,13 @@
|
||||
|
||||
development:
|
||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||
<<<<<<< HEAD
|
||||
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||
server_mode: cloud
|
||||
=======
|
||||
sx_provision_url: connect.smartsales.asia/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||
server_mode: application
|
||||
>>>>>>> fe01948dd322688f7d59acd0d002b569dbbd40e2
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
|
||||
t.string :name, :null => false
|
||||
t.string :unique_code, :null => false
|
||||
t.string :template
|
||||
t.string :font, :default => ""
|
||||
t.string :font, :default => ""
|
||||
t.integer :header_font_size, :null => false, :default => 11
|
||||
t.integer :item_font_size, :null => false, :default => 9
|
||||
t.string :printer_name, :null => false
|
||||
t.string :api_settings
|
||||
t.string :brand_name
|
||||
|
||||
Reference in New Issue
Block a user