Pull from master
This commit is contained in:
@@ -188,6 +188,14 @@ Add Base URL for DOEMAL
|
||||
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
|
||||
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
|
||||
|
||||
Add Feature for Quick Service
|
||||
** '0' means can not use quick service and '1' means can use quick service **
|
||||
=> settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }
|
||||
|
||||
Add Feature for Order and Reservation
|
||||
** '0' means can not use order reservation and '1' means can use order reservation **
|
||||
=> settings/lookups => { type:order_reservation, name: OrderReservation, value:'{0 or 1}' }
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
|
||||
@@ -101,6 +101,13 @@ $(function() {
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var url = "get_menu_category/"+menu_id;
|
||||
show_menu_item_list(url);
|
||||
|
||||
var sub_id = $(this).attr("data-sub-id");
|
||||
if (sub_id == "true") {
|
||||
var sub_url = "get_menu_sub_category/"+menu_id;
|
||||
sub_category = $(this).find('.sub_category_list');
|
||||
show_sub_category_list(sub_url,sub_category);
|
||||
}
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
@@ -457,9 +464,10 @@ $(function() {
|
||||
|
||||
var items = $('.selected-set');
|
||||
if (items.length >= min_qty) {
|
||||
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
item = get_set_item(items);
|
||||
customer_display_view(item,"set_add");
|
||||
}
|
||||
var option = []
|
||||
attribute_arr = []
|
||||
|
||||
@@ -786,8 +794,10 @@ $(function() {
|
||||
$('.add_to_order').attr('data-options',JSON.stringify(option_arr));
|
||||
$('.add_to_order').attr('data-opt',JSON.stringify(option_arr));
|
||||
var item_data = $(this);
|
||||
item = get_item(item_data,"add_to_order");
|
||||
customer_display_view(item,"add");
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
item = get_item(item_data,"add_to_order");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
show_item_detail(item_data,"add_to_order");
|
||||
calculate_sub_total();
|
||||
|
||||
@@ -796,8 +806,10 @@ $(function() {
|
||||
// click plus icon for add
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
var item_data = $(this);
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
}); //End Add Icon Click
|
||||
@@ -922,7 +934,9 @@ console.log(d_option)
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
customer_display_view(null,"reload");
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
}
|
||||
});
|
||||
// }else{
|
||||
@@ -1225,7 +1239,7 @@ console.log(d_option)
|
||||
|
||||
//click menu sidebar menu category
|
||||
|
||||
$(document).on('click', '.sub_click', function(event){
|
||||
$(document).on('click', '.sub_clickssss', function(event){
|
||||
event.preventDefault();
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var url = "get_menu_sub_category/"+menu_id;
|
||||
@@ -1260,11 +1274,11 @@ console.log(d_option)
|
||||
data = data.sub_category;
|
||||
|
||||
if (data.length>0) {
|
||||
if ((sub_category.hasClass('hidden'))) {
|
||||
// if ((sub_category.hasClass('hidden'))) {
|
||||
$(sub_category).removeClass('hidden');
|
||||
}else{
|
||||
$(sub_category).addClass('hidden');
|
||||
}
|
||||
// }else{
|
||||
// $(sub_category).addClass('hidden');
|
||||
// }
|
||||
|
||||
for(var i in data) {
|
||||
|
||||
|
||||
@@ -7,31 +7,46 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
var rowCount = $('.order_reserve_cable tbody tr').length+1;
|
||||
if(order.length > 0){
|
||||
$('.order_reserve_cable tbody').html("");
|
||||
$.each(order, function(key,value){
|
||||
var rowCount = key+1;
|
||||
var date = new Date(value.created_at);
|
||||
var deliveries = value["delivery"];
|
||||
var isPM = date.getHours() >= 12;
|
||||
var isMidday = date.getHours() == 12;
|
||||
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
date.getMinutes() || '00'].join(':') +
|
||||
(isPM ? ' PM' : 'AM');
|
||||
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ date.getDate();
|
||||
|
||||
var date = new Date(order.requested_time);
|
||||
var requested_time = date.getHours()+ ':' + date.getMinutes()+ '-' + date.getMinutes();
|
||||
|
||||
var isPM = date.getHours() >= 12;
|
||||
var isMidday = date.getHours() == 12;
|
||||
var result = document.querySelector('#result');
|
||||
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
date.getMinutes() || '00'].join(':') +
|
||||
(isPM ? ' PM' : 'AM');
|
||||
var delivery_type = "";
|
||||
if(deliveries.delivery_type == "service"){
|
||||
delivery_type = "DELIVERY";
|
||||
}else if(deliveries.delivery_type == "pick_up"){
|
||||
delivery_type = "PICK-UP";
|
||||
}else{
|
||||
delivery_type = "DIRECT DELIVERY";
|
||||
}
|
||||
|
||||
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+order.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
||||
+'<td width ="5%" class="align-left">'+rowCount
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'+time
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'+order.grand_total
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'
|
||||
+'<span class="font-10 col-blue">'+ order.status +'</span>'
|
||||
+'</td>'
|
||||
+' </tr>'
|
||||
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
||||
+'<td width ="5%" class="align-left">'+rowCount
|
||||
+'</td>'
|
||||
+'<td width ="20%" class="align-center">'+created_at
|
||||
+'</td>'
|
||||
+'<td width ="20%" class="align-center">'+time
|
||||
+'</td>'
|
||||
+'<td width ="20%" class="align-center">'+value.grand_total
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'
|
||||
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
||||
+'</td>'
|
||||
+' </tr>'
|
||||
|
||||
$('.order_reserve_cable tbody').append(row);
|
||||
});
|
||||
}
|
||||
|
||||
$('.order_reserve_cable tbody').append(row);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,8 +24,8 @@ $(function() {
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
$(function(){
|
||||
$('.first-1').click();
|
||||
});
|
||||
|
||||
$(".custom-tr").on("click", function(){
|
||||
@@ -38,6 +38,7 @@ $(function() {
|
||||
});
|
||||
|
||||
function refreshDetailData(){
|
||||
$('#requested_date_time').text("");
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
@@ -45,6 +46,7 @@ $(function() {
|
||||
$('#sub_total').text("0.00");
|
||||
$('#delivery_fee').text("0.00");
|
||||
$('#total_charges').text("0.00");
|
||||
$('#discount_amount').text("0.00");
|
||||
$('#total_tax').text("0.00");
|
||||
$('#grand_total').text("0.00");
|
||||
}
|
||||
@@ -63,6 +65,30 @@ $(function() {
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
var item_list = $('.summary-items');
|
||||
|
||||
var newDate = new Date(data.requested_time);
|
||||
var isPM = newDate.getHours() >= 12;
|
||||
var isMidday = newDate.getHours() == 12;
|
||||
var time = [newDate.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
newDate.getMinutes() || '00'].join(':') +
|
||||
(isPM ? ' PM' : 'AM');
|
||||
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
|
||||
|
||||
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
|
||||
var expDate = new Date(data.expected_waiting_time);
|
||||
var isPM = expDate.getHours() >= 12;
|
||||
var isMidday = expDate.getHours() == 12;
|
||||
var exptime = [expDate.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
expDate.getMinutes() || '00'].join(':') +
|
||||
(isPM ? ' PM' : 'AM');
|
||||
var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() > 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() > 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
|
||||
$('.expected_time').show();
|
||||
$('#expected_time').text(expected_time? expected_time : '');
|
||||
}else{
|
||||
$('.expected_time').hide();
|
||||
$('#expected_time').text('');
|
||||
}
|
||||
|
||||
item_list.empty();
|
||||
|
||||
if(items!=undefined && items!=""){
|
||||
@@ -84,13 +110,25 @@ $(function() {
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
if(data.discount_amount > 0){
|
||||
$("#discount").show();
|
||||
}
|
||||
|
||||
$('#requested_date_time').text(requested_date);
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
|
||||
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
|
||||
$('#discount_amount').text((parseFloat(data.discount_amount) > 0)? data.discount_amount : '0.0');
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
var address = delivery.address;
|
||||
if(delivery.township != null && delivery.township!=""){
|
||||
address += ', ' +delivery.township;
|
||||
}else if(delivery.direction_address!=null && delivery.direction_address!=""){
|
||||
address += ", (" +delivery.direction_address+")";
|
||||
}
|
||||
$('#requested_time').text(requested_date);
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
@@ -100,10 +138,12 @@ $(function() {
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.provider == "direct_delivery"){
|
||||
if(delivery.delivery_type == "service"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.provider == "self_pick_up"){
|
||||
}else if(delivery.delivery_type == "pick_up"){
|
||||
$("#delivery_info").text("(PICK-UP)");
|
||||
}else{
|
||||
$("#delivery_info").text("(DIRECT DELIVERY)");
|
||||
}
|
||||
|
||||
if(data.order_remark!=null && data.order_remark!=""){
|
||||
@@ -111,7 +151,7 @@ $(function() {
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("No."+sr_no);
|
||||
$("#sr_number").text("NO."+sr_no);
|
||||
if (data["receipt_no"]) {
|
||||
$("#contact_info").text(data["receipt_no"]);
|
||||
}else{
|
||||
@@ -126,11 +166,10 @@ $(function() {
|
||||
}
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
var requested_time = $("#requested_date_time").text();
|
||||
$("#requested_order_time").text(requested_time);
|
||||
showTimePicker(requested_time);
|
||||
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
@@ -141,20 +180,44 @@ $(function() {
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
});
|
||||
|
||||
function callback_url(callback,ref_no,order_id,status){
|
||||
function showTimePicker(requested_time){
|
||||
// var date = new Date(requested_time);
|
||||
// var isPM = date.getHours() >= 12;
|
||||
// var isMidday = date.getHours() == 12;
|
||||
// var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
// date.getMinutes() || '00'].join(':') +
|
||||
// (isPM ? 'pm' : 'am');
|
||||
// console.log(time);
|
||||
$('.timepicker').bootstrapMaterialDatePicker({
|
||||
format: 'HH:mm',
|
||||
useSeconds: false,
|
||||
clearButton: true,
|
||||
date: false
|
||||
});
|
||||
}
|
||||
|
||||
function callback_url(callback,ref_no,order_id,status,time,exptime){
|
||||
var url = 'order_reservation/update';
|
||||
var post_url = "order_reservation/send_status";
|
||||
var waiting_time = "";
|
||||
if(time!=undefined && time!=""){
|
||||
waiting_time = time;
|
||||
}
|
||||
var expected_time = "";
|
||||
if(exptime!=undefined && exptime!=""){
|
||||
expected_time = exptime;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: post_url,
|
||||
data: {url: callback, ref_no: ref_no, status: status},
|
||||
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
@@ -188,5 +251,27 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#save").on("click",function(){
|
||||
$("#waiting_timeErr").text("");
|
||||
var status = $("#status").text();
|
||||
var order_id = $('#order_id').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var requested_time = new Date($("#requested_date_time").text());
|
||||
var date_time = requested_time.getFullYear()+'-'+(requested_time.getMonth() > 10? requested_time.getMonth() : '0'+ (requested_time.getMonth() + 1))+'-'+(requested_time.getDate()> 10? requested_time.getDate() : '0' + requested_time.getDate());
|
||||
var waiting_time = new Date(date_time+' '+$("#waiting_time").val());
|
||||
// requested_time.setHours(requested_time.getHours() - 1);
|
||||
// console.log(requested_time);
|
||||
if(waiting_time.getTime() < requested_time.getTime()){
|
||||
var time_diff = (requested_time.getTime() - waiting_time.getTime());
|
||||
var expected_time = (Math.floor(time_diff) / 1000) / 60;
|
||||
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
|
||||
}else{
|
||||
$("#waiting_time").val("");
|
||||
$("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -85,4 +85,10 @@
|
||||
}
|
||||
.tr-active{
|
||||
background-color : #FFCDD2;
|
||||
}
|
||||
.div_order_margin {
|
||||
margin: 0px 0px 0px -5px !important
|
||||
}
|
||||
.div_card_order {
|
||||
margin: 0px -5px !important
|
||||
}
|
||||
@@ -47,9 +47,9 @@ class Api::BillController < Api::ApiController
|
||||
Promotion.promo_activate(@sale)
|
||||
|
||||
#BillBroadcastJob.perform_later(table)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
#end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
|
||||
@@ -6,9 +6,9 @@ class Api::CallWaitersController < ActionController::API
|
||||
@time = params[:time]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
# CallWaiterJob.perform_later(@table,@time)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
|
||||
end
|
||||
#end
|
||||
# get printer info
|
||||
@shop = Shop.first
|
||||
unique_code = "CallWaiterPdf"
|
||||
|
||||
@@ -59,10 +59,12 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
order_reservation = params
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||
|
||||
order_reservation = OrderReservation.find(order_reservation_id)
|
||||
# if ENV["SERVER_MODE"] != 'cloud'
|
||||
# ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
# end
|
||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||
|
||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
end
|
||||
|
||||
if flag
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
else
|
||||
|
||||
@@ -24,8 +24,7 @@ module TokenVerification
|
||||
end
|
||||
end
|
||||
|
||||
@user = Employee.
|
||||
(token)
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
|
||||
@@ -184,11 +184,9 @@ puts items_arr.to_json
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
# for second display
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
||||
|
||||
end
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
||||
#end
|
||||
result = {:status=> @status, :data => @sale }
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
@@ -56,6 +56,22 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
@current_user = current_user
|
||||
#quick service
|
||||
quick_service = Lookup.collection_of('quick_service')
|
||||
@quick_service = 0
|
||||
if !quick_service[0].nil?
|
||||
@quick_service = quick_service[0][1]
|
||||
end
|
||||
#order reservation
|
||||
order_reservation = Lookup.collection_of('order_reservation')
|
||||
@order_reservation = 0
|
||||
if !order_reservation.empty?
|
||||
order_reservation.each do |order_reserve|
|
||||
if order_reserve[0] == 'OrderReservation'
|
||||
@order_reservation = order_reserve[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -86,11 +86,12 @@ def create
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
|
||||
if status == true
|
||||
status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
|
||||
|
||||
if status == true && @membership_data["status"] == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
@out =false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
class Origami::OrderReservationController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@order = OrderReservation.all
|
||||
@order = OrderReservation.latest_order
|
||||
@count_on_order = OrderReservation.get_count_on_order
|
||||
end
|
||||
|
||||
def update
|
||||
@id = params[:order_id]
|
||||
@status = params[:status]
|
||||
@status = params[:status]
|
||||
expected_waiting_time = params[:expected_time]
|
||||
@order_reservation = OrderReservation.find(@id)
|
||||
|
||||
status = true
|
||||
@@ -25,7 +27,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
OrderReservation.update_order_reservation(@id, nil, "cancelled")
|
||||
result = {:status=> true, :message => "rejected" }
|
||||
else
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted")
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
|
||||
result = {:status=> true, :message => "accepted" }
|
||||
end
|
||||
end
|
||||
@@ -50,7 +52,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
status = params[:status]
|
||||
end
|
||||
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
|
||||
|
||||
render :json => response
|
||||
end
|
||||
|
||||
@@ -88,11 +88,11 @@ def create
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
|
||||
if status == true
|
||||
status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
|
||||
if status == true && @membership_data["status"] == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
@out =false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
def first_bill
|
||||
sale_id = params[:sale_id] # sale_id
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
member_info = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
@@ -99,6 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
shop_details = Shop.first
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
@@ -204,7 +205,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = 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)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@ class Origami::RequestBillsController < ApplicationController
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(@sale)
|
||||
#bill channel
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
#end
|
||||
if order.source == "quick_service"
|
||||
result = {:status=> @status, :data => @sale.sale_id }
|
||||
render :json => result.to_json
|
||||
|
||||
@@ -13,9 +13,9 @@ class Origami::SecondDisplayController < BaseOrigamiController
|
||||
else
|
||||
tax_profiles = nil
|
||||
end
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status]
|
||||
end
|
||||
# end
|
||||
end
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
|
||||
@@ -335,9 +335,9 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
Promotion.promo_activate(sale)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
#end
|
||||
render :json => { status: status }
|
||||
else
|
||||
render :json => { status: false, error_message: 'No Current Open Shift!'}
|
||||
|
||||
63
app/controllers/reports/order_reservation_controller.rb
Normal file
63
app/controllers/reports/order_reservation_controller.rb
Normal file
@@ -0,0 +1,63 @@
|
||||
class Reports::OrderReservationController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
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)
|
||||
end
|
||||
end
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
if @shift.present?
|
||||
@shift.each do |sh|
|
||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = sh
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: out }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -20,7 +20,7 @@ authorize_resource :class => false
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@tax_profiles = TaxProfile.order('order_by asc')
|
||||
@tax_profiles = TaxProfile.order('order_by asc').limit(2)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
|
||||
@@ -156,9 +156,9 @@ class DiningFacility < ApplicationRecord
|
||||
table = DiningFacility.find(table_id)
|
||||
#Send to background job for processing
|
||||
# CheckInBookingJob.perform_later(table)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "check_in_booking_channel",table: table
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
def self.checkin_time
|
||||
|
||||
@@ -78,6 +78,14 @@ class MenuCategory < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def get_sub_category
|
||||
menu_category = MenuCategory.find_by_menu_category_id(self.id)
|
||||
if menu_category
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# def generate_menu_category_code
|
||||
|
||||
@@ -321,9 +321,9 @@ class Order < ApplicationRecord
|
||||
end
|
||||
else
|
||||
msg = ' Print Error ! Please contact to service'
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||
end
|
||||
#end
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
else
|
||||
@@ -337,9 +337,9 @@ class Order < ApplicationRecord
|
||||
end
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -376,9 +376,9 @@ class Order < ApplicationRecord
|
||||
type = 'order'
|
||||
#Send to background job for processing
|
||||
# OrderBroadcastJob.perform_later(table,type)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||
end
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -532,9 +532,9 @@ class Order < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,7 +5,9 @@ class OrderReservation < ApplicationRecord
|
||||
before_create :generate_custom_id
|
||||
|
||||
has_many :order_reservation_items
|
||||
belongs_to :delivery
|
||||
has_one :delivery
|
||||
|
||||
scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
|
||||
|
||||
SEND_TO_KITCHEN = "send_to_kitchen"
|
||||
READY_TO_DELIVERY = "ready_to_deliver"
|
||||
@@ -19,7 +21,7 @@ class OrderReservation < ApplicationRecord
|
||||
order_reservation = OrderReservation.new
|
||||
order_reservation.order_reservation_type = order_reserve[:order_type]
|
||||
order_reservation.customer_id = order_reserve[:cus_info]
|
||||
order_reservation.requested_time = DateTime.parse(order_reserve[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
|
||||
order_reservation.requested_time = Time.parse(order_reserve[:requested_time]).utc
|
||||
order_reservation.callback_url = order_reserve[:callback_url]
|
||||
order_reservation.transaction_ref = order_reserve[:reference]
|
||||
if order_reserve[:order_info]
|
||||
@@ -27,9 +29,11 @@ class OrderReservation < ApplicationRecord
|
||||
order_reservation.payment_type = order_reserve[:payment_info][:payment_type]
|
||||
order_reservation.payment_status = order_reserve[:payment_info][:payment_status]
|
||||
order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref]
|
||||
order_reservation.taxes = order_reserve[:payment_info][:taxes]
|
||||
order_reservation.total_amount = order_reserve[:payment_info][:sub_total]
|
||||
order_reservation.total_tax = order_reserve[:payment_info][:total_tax]
|
||||
order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount]
|
||||
order_reservation.convenience_charge = order_reserve[:payment_info][:convenience_charge]
|
||||
order_reservation.grand_total = order_reserve[:payment_info][:grand_total]
|
||||
order_reservation.order_remark = order_reserve[:order_info][:order_remark]
|
||||
end
|
||||
@@ -130,96 +134,10 @@ class OrderReservation < ApplicationRecord
|
||||
|
||||
result = {:status=> true, :message => DELIVERED }
|
||||
return result
|
||||
# rebate_amount = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
# bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
|
||||
# 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_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
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# if !receipt_bill_a5_pdf.empty?
|
||||
# receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
# if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
# if receipt_bilA5[1] == '1'
|
||||
# unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# get member information
|
||||
# rebate = MembershipSetting.find_by_rebate(1)
|
||||
# credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
# if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
# member_info = Customer.get_member_account(customer)
|
||||
# if member_info["status"] == true
|
||||
# rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
#orders print out
|
||||
# if params[:type] == "quick_service"
|
||||
# booking = Booking.find_by_sale_id(sale_id)
|
||||
# if booking.dining_facility_id.to_i>0
|
||||
# table_id = booking.dining_facility_id
|
||||
# else
|
||||
# table_id = 0
|
||||
# end
|
||||
|
||||
# booking.booking_orders.each do |order|
|
||||
# # Order.pay_process_order_queue(order.order_id, table_id)
|
||||
# oqs = OrderQueueStation.new
|
||||
# oqs.pay_process_order_queue(order.order_id, table_id)
|
||||
# end
|
||||
|
||||
# end
|
||||
|
||||
#for card sale data
|
||||
# card_data = Array.new
|
||||
# card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
# if !card_sale_trans_ref_no.nil?
|
||||
# card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
# card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
# card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
# card_no = cash_sale_trans.pan.last(4)
|
||||
# card_no = card_no.rjust(19,"**** **** **** ")
|
||||
# card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||
# end
|
||||
# end
|
||||
|
||||
# get printer info
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# filename, sale_receipt_no, printer_name = 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)
|
||||
|
||||
# render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
def self.send_status_to_ordering(url,ref_no,status)
|
||||
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil)
|
||||
base_url = 'https://api.doemal.com'
|
||||
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
|
||||
order_reservation = Lookup.collection_of("order_reservation")
|
||||
@@ -238,10 +156,15 @@ class OrderReservation < ApplicationRecord
|
||||
Rails.logger.debug "Doemal URL" + base_url
|
||||
post_url = base_url + url
|
||||
|
||||
if !waiting_time.nil?
|
||||
send_params = {id: ref_no, waiting_time: waiting_time, status: status}
|
||||
else
|
||||
send_params = {id: ref_no, status: status}
|
||||
end
|
||||
|
||||
begin
|
||||
response = HTTParty.post(post_url,
|
||||
:body => { id: ref_no, status: status}.to_json,
|
||||
:body => send_params.to_json,
|
||||
:headers => {
|
||||
'Authorization' => 'Token token='+token,
|
||||
'Content-Type' => 'application/json',
|
||||
@@ -261,15 +184,29 @@ class OrderReservation < ApplicationRecord
|
||||
return response
|
||||
end
|
||||
|
||||
def self.update_order_reservation(id, sale_id, status)
|
||||
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil)
|
||||
order_reservation = OrderReservation.find(id)
|
||||
if sale_id.present?
|
||||
order_reservation.sale_id = sale_id
|
||||
end
|
||||
if !expected_waiting_time.nil?
|
||||
order_reservation.expected_waiting_time = DateTime.parse(expected_waiting_time).utc
|
||||
end
|
||||
order_reservation.status = status
|
||||
order_reservation.save
|
||||
end
|
||||
|
||||
def self.get_count_on_order
|
||||
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status").group("status")
|
||||
end
|
||||
|
||||
def self.get_pending_orders
|
||||
order_reservation = OrderReservation.select("order_reservations.*,deliveries.provider,deliveries.delivery_type")
|
||||
.joins(" JOIN deliveries as del on del.order_reservation_id=order_reservations.order_reservation_id")
|
||||
.where("order_reservations.status='new'")
|
||||
.order("order_reservations.order_reservation_id desc, order_reservations.created_at desc")
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
|
||||
|
||||
@@ -23,6 +23,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
if (amount_due >= 0)
|
||||
payment_status = false
|
||||
membership_data = nil
|
||||
#route to payment type
|
||||
case payment_method
|
||||
when "cash"
|
||||
@@ -52,11 +53,11 @@ class SalePayment < ApplicationRecord
|
||||
when "foc"
|
||||
payment_status = foc_payment
|
||||
when "paymal"
|
||||
payment_status = paymal_payment
|
||||
payment_status,membership_data = paymal_payment
|
||||
when "JunctionPay"
|
||||
payment_status = junction_pay_payment
|
||||
when "dinga"
|
||||
payment_status = dinga_payment
|
||||
payment_status,membership_data = dinga_payment
|
||||
else
|
||||
puts "it was something else"
|
||||
end
|
||||
@@ -73,7 +74,7 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
return true, self.save
|
||||
return true, self.save,membership_data
|
||||
else
|
||||
#record an payment in sale-audit
|
||||
# remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||
@@ -430,7 +431,7 @@ class SalePayment < ApplicationRecord
|
||||
sale_update_payment_status(0)
|
||||
end
|
||||
|
||||
return payment_status
|
||||
return payment_status,membership_data
|
||||
end
|
||||
|
||||
def junction_pay_payment
|
||||
@@ -480,7 +481,7 @@ class SalePayment < ApplicationRecord
|
||||
sale_update_payment_status(0)
|
||||
end
|
||||
|
||||
return payment_status
|
||||
return payment_status,membership_data
|
||||
|
||||
end
|
||||
|
||||
@@ -607,9 +608,9 @@ class SalePayment < ApplicationRecord
|
||||
type = 'payment'
|
||||
#Send to background job for processing
|
||||
# OrderBroadcastJob.perform_later(table,type)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||
end
|
||||
#end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -202,10 +202,12 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
y_position = cursor
|
||||
move_down line_move
|
||||
sub_total = 0.0
|
||||
total_qty = 0.0
|
||||
sale_items.each do |item|
|
||||
# check for item not to show
|
||||
if item.price != 0
|
||||
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||
total_qty += item.qty
|
||||
qty = item.qty
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
@@ -240,12 +242,15 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
move_down line_move
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||
end
|
||||
bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
|
||||
end
|
||||
bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
def all_total(sale_data,precision,delimiter)
|
||||
|
||||
@@ -196,10 +196,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
move_down line_move
|
||||
sub_total = 0.0
|
||||
total_qty = 0.0
|
||||
sale_items.each do |item|
|
||||
# check for item not to show
|
||||
if item.price != 0
|
||||
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||
total_qty += item.qty
|
||||
qty = item.qty
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
@@ -235,12 +237,15 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
move_down line_move
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||
end
|
||||
bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
|
||||
end
|
||||
bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
def all_total(sale_data,precision,delimiter)
|
||||
|
||||
@@ -33,7 +33,7 @@ class MenuItemImageUploader < CarrierWave::Uploader::Base
|
||||
|
||||
# Process files as they are uploaded:
|
||||
# process scale: [200, 300]
|
||||
process :resize_to_fit => [200, 150]
|
||||
process :resize_to_fit => [400, 250]#[200, 150]
|
||||
|
||||
#
|
||||
# def scale(width, height)
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>">
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
|
||||
<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">
|
||||
@@ -58,7 +58,7 @@
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>">
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%> " data-sub-id="<%=menu.get_sub_category%>">
|
||||
<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">
|
||||
@@ -67,7 +67,7 @@
|
||||
</li>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>">
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
|
||||
<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">
|
||||
@@ -490,11 +490,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<style type="text/css">
|
||||
.fadeInRight{
|
||||
-webkit-animation-duration: 350ms !important;
|
||||
}
|
||||
</style>
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
|
||||
<style type="text/css">
|
||||
.fadeInRight{
|
||||
-webkit-animation-duration: 350ms !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
jQuery(function(){
|
||||
id = "<%=@menu[0].id%>";
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<% if @quick_service == '1' %>
|
||||
<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" >
|
||||
@@ -26,6 +27,7 @@
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :quick_service %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<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" >
|
||||
@@ -34,6 +36,7 @@
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% if @order_reservation == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
|
||||
<div class="info-box bg-blue">
|
||||
<div class="icon" >
|
||||
@@ -42,6 +45,7 @@
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :order_reservation %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||
@@ -199,6 +203,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
<script>
|
||||
|
||||
$(".cashier_view").on('click', function() {
|
||||
@@ -206,7 +211,9 @@
|
||||
});
|
||||
|
||||
$(".qs_view").on('click', function() {
|
||||
document.getElementById('second_view').click();
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
document.getElementById('second_view').click();
|
||||
}
|
||||
window.location.href = '/origami/quick_service';
|
||||
});
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
swal ( "Opps",result.message ,"warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -364,7 +364,7 @@
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
swal ( "Opps",result.message ,"warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -826,7 +826,7 @@
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier' },
|
||||
async: false,
|
||||
success:function(result){
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if @order
|
||||
|
||||
json.(@order, :order_reservation_id,:order_reservation_type,:customer_id,
|
||||
:requested_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
|
||||
:payment_status,:payment_ref,:total_amount,:total_tax,
|
||||
:discount_amount,:grand_total,:status,:order_remark,
|
||||
:requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
|
||||
:payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
|
||||
:discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
|
||||
:reservation_remark,:sale_id)
|
||||
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
|
||||
if @delivery
|
||||
|
||||
@@ -2,19 +2,47 @@
|
||||
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
|
||||
<div class="container-fluid">
|
||||
<div class="row m-t--10">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px 0px 0px -5px !important ">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 div_order_margin">
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
<li class="nav-item active" data-color="#F44336" data-type="pending" style="background-color: #F44336;">
|
||||
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">1</p> <%= t :pending %></a>
|
||||
<li class="nav-item red m-b-10" data-color="#F44336" data-type="pending">
|
||||
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num p-t-15 p-b-5">
|
||||
<% if !@count_on_order.nil? %>
|
||||
<% @count_on_order.each do |count_order|
|
||||
if count_order.status == "new" %>
|
||||
<%= count_order.count %>
|
||||
<% end
|
||||
end %>
|
||||
<% end %></p> <%= t :pending %></a>
|
||||
</li>
|
||||
<li class="nav-item" data-color="#673AB7" data-type="processing" style="background-color: #673AB7;">
|
||||
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">2</p> <%= t :processing %></a>
|
||||
<li class="nav-item purple m-b-10" data-color="#673AB7" data-type="processing">
|
||||
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num p-t-15 p-b-5">
|
||||
<% if !@count_on_order.nil? %>
|
||||
<% @count_on_order.each do |count_order|
|
||||
if count_order.status == "accepted" %>
|
||||
<%= count_order.count %>
|
||||
<% end
|
||||
end %>
|
||||
<% end %></p> <%= t :processing %></a>
|
||||
</li>
|
||||
<li class="nav-item" data-color="#009688" data-type="delivery" style="background-color: #009688;">
|
||||
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">3</p> <%= t :delivering %></a>
|
||||
<li class="nav-item m-b-10" data-color="#009688" data-type="delivery" style="background-color: #009688;">
|
||||
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num p-t-15 p-b-5">
|
||||
<% if !@count_on_order.nil? %>
|
||||
<% @count_on_order.each do |count_order|
|
||||
if count_order.status == "send_to_kitchen" %>
|
||||
<%= count_order.count %>
|
||||
<% end
|
||||
end %>
|
||||
<% end %></p> <%= t :delivering %></a>
|
||||
</li>
|
||||
<li class="nav-item" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num">4</p> <%= t :completed %></a>
|
||||
<li class="nav-item m-b-10" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num p-t-15 p-b-5">
|
||||
<% if !@count_on_order.nil? %>
|
||||
<% @count_on_order.each do |count_order|
|
||||
if count_order.status == "ready_to_delivery" %>
|
||||
<%= count_order.count %>
|
||||
<% end
|
||||
end %>
|
||||
<% end %></p> <%= t :completed %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -31,14 +59,25 @@
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%d-%m-%Y") %>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
|
||||
</td>
|
||||
<td width ="20%" class="align-center">
|
||||
<%=order.grand_total%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<span class="font-10 col-blue"><%= order.status %></span>
|
||||
<span class="font-10 col-blue">
|
||||
<% if order.delivery.delivery_type == 'service' %>
|
||||
DELIVERY
|
||||
<% elsif order.delivery.delivery_type == 'pick_up' %>
|
||||
PICK-UP
|
||||
<% else %>
|
||||
DIRECT DELIVERY
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<%i+=1%>
|
||||
@@ -63,14 +102,25 @@
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
|
||||
</td>
|
||||
<td width ="20%" class="align-center">
|
||||
<%=order.grand_total%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<span class="font-10 col-blue"><%=order.status%></span>
|
||||
<span class="font-10 col-blue">
|
||||
<% if order.delivery.delivery_type == 'service' %>
|
||||
DELIVERY
|
||||
<% elsif order.delivery.delivery_type == 'pick_up' %>
|
||||
PICK-UP
|
||||
<% else %>
|
||||
DIRECT DELIVERY
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<%i+=1%>
|
||||
@@ -94,14 +144,25 @@
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
|
||||
</td>
|
||||
<td width ="20%" class="align-center">
|
||||
<%=order.grand_total%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<span class="font-10 col-blue"><%=order.status%></span>
|
||||
<span class="font-10 col-blue">
|
||||
<% if order.delivery.delivery_type == 'service' %>
|
||||
DELIVERY
|
||||
<% elsif order.delivery.delivery_type == 'pick_up' %>
|
||||
PICK-UP
|
||||
<% else %>
|
||||
DIRECT DELIVERY
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<%i+=1%>
|
||||
@@ -125,14 +186,26 @@
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<td width ="20%" class="align-center">
|
||||
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
|
||||
</td>
|
||||
<td width ="20%" class="align-center">
|
||||
<%=order.grand_total%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<span class="font-10 col-blue"><%=order.status%></span>
|
||||
<span class="font-10 col-blue">
|
||||
<%= order.delivery.to_json %>
|
||||
<% if order.delivery.delivery_type == 'service' %>
|
||||
DELIVERY
|
||||
<% elsif order.delivery.delivery_type == 'pick_up' %>
|
||||
PICK-UP
|
||||
<% else %>
|
||||
DIRECT DELIVERY
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<%i+=1%>
|
||||
@@ -147,16 +220,17 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px -5px !important ">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 div_card_order">
|
||||
<div class="card">
|
||||
<div class="card-header custom-card-header" style="color:">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td width ="30%" class="header-td align-left">
|
||||
<b class="col-pink font-16"><span id="sr_number"></span> </b>
|
||||
<span class="font-13"><span id="delivery_info"></span></span>
|
||||
<td width ="10%" class="header-td align-left">
|
||||
<b class="col-pink font-16"><span id="sr_number"></span></b>
|
||||
</td>
|
||||
<td width="40%" class="header-td align-left">
|
||||
<b><span class="font-15" id="requested_date_time"></span></b>
|
||||
</td>
|
||||
<td class="header-td align-left"></td>
|
||||
<td width ="50%" class="header-td font- align-right"><b><span id="contact_info"></span></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -187,7 +261,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td width ="70%" class="footer-td align-left">
|
||||
DELIVERY FEES (PICK-UP)
|
||||
DELIVERY FEES <span id="delivery_info"></span>
|
||||
</td>
|
||||
<td width ="30%" class="footer-td align-right" id="delivery_fee">0.00</td>
|
||||
</tr>
|
||||
@@ -197,6 +271,12 @@
|
||||
</td>
|
||||
<td width ="30%" class="footer-td align-right" id="total_charges">0.00</td>
|
||||
</tr>
|
||||
<tr id="discount">
|
||||
<td width ="70%" class="footer-td align-left">
|
||||
DISCOUNT
|
||||
</td>
|
||||
<td width ="30%" class="footer-td align-right" id="discount_amount">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width ="70%" class="footer-td align-left">
|
||||
GOVERNMENT TAX
|
||||
@@ -215,9 +295,6 @@
|
||||
</td>
|
||||
<td width ="30%" class="footer-td align-right col-blue" id="grand_total">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="order_remark"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width ="50%" class="footer-td align-left col-blue">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
|
||||
@@ -263,12 +340,20 @@
|
||||
<span class="font-13">NAME</span><br>
|
||||
<b id="customer_name"></b>
|
||||
</td>
|
||||
<td class="body-td align-right">
|
||||
<span class="font-13">REQUESTED TIME</span><br>
|
||||
<b id="requested_time"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
<span class="font-13">PHONE</span><br>
|
||||
<b id="phone"></b>
|
||||
</td>
|
||||
<td class="body-td align-right expected_time">
|
||||
<span class="font-13">EXPECTED WAITING TIME</span><br>
|
||||
<b id="expected_time"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
@@ -282,6 +367,12 @@
|
||||
<b id="delivery_to"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
<span class="font-13">REMARK</span><br>
|
||||
<b id="order_remark"></b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -293,9 +384,37 @@
|
||||
<p id="callback_url" class="hidden"></p>
|
||||
<p id="order_id" class="hidden"></p>
|
||||
<p id="status" class="hidden"></p>
|
||||
|
||||
<div class="modal fade" id="waiting_timeModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="waiting_timeModalLabel">Expected Waiting Time for <span id="requested_order_time"></span></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text" id="waiting_time" name="waiting_time" value="" class="timepicker form-control" placeholder="Expected Waiting Time">
|
||||
<span id="waiting_timeErr" style="color:red;"></span>
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="save" active="true">SAVE</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
$(function(){
|
||||
$("#discount").hide();
|
||||
$(".expected_time").hide();
|
||||
$('.first-1').click();
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -281,7 +281,7 @@
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
swal ( "Opps",result.message ,"warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -328,7 +328,6 @@
|
||||
var payment_amount = parseFloat($("#used_amount").text());
|
||||
setTimeout(function(){
|
||||
code=getQRCode();
|
||||
alert(code)
|
||||
if(sale_id != 0 && code != ""){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -345,7 +344,6 @@
|
||||
url: "<%=origami_payment_paymal_path%>",
|
||||
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
|
||||
success: function(result){
|
||||
alert(result)
|
||||
if(result.status == true){
|
||||
swal({
|
||||
title: "Information!",
|
||||
@@ -359,7 +357,7 @@
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
swal ( "Opps",result.message ,"warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -530,7 +530,6 @@ var customer_name = "<%= @customer.name %>";
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
console.log(jQuery.inArray("Master", payment_type))
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("VISA", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("JCB", payment_type)) != -1 ||
|
||||
@@ -1020,7 +1019,7 @@ console.log(jQuery.inArray("Master", payment_type))
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':cashier_type },
|
||||
async: false,
|
||||
success:function(result){
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<% if(@server_mode != 'cloud') %>
|
||||
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
|
||||
<% else %>
|
||||
<%= f.input :printer_name, :as => :select, :collection => [] %>
|
||||
<%= f.input :printer_name %>
|
||||
<% end %>
|
||||
<%= f.input :brand_name %>
|
||||
<%= f.input :printer_type %>
|
||||
|
||||
128
app/views/reports/order_reservation/_shift_sale_report_filter.html.erb
Executable file
128
app/views/reports/order_reservation/_shift_sale_report_filter.html.erb
Executable file
@@ -0,0 +1,128 @@
|
||||
<div class="p-l-15">
|
||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||
<% if period_type != false %>
|
||||
<div class="row">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label>
|
||||
<select name="period" id="sel_period" class="form-control">
|
||||
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
|
||||
<option value="0">Today</option>
|
||||
<option value="1">Yesterday</option>
|
||||
<option value="2">This week</option>
|
||||
<option value="3">Last week</option>
|
||||
<option value="4">Last 7 days</option>
|
||||
<option value="5">This month</option>
|
||||
<option value="6">Last month</option>
|
||||
<option value="7">Last 30 days</option>
|
||||
<option value="8">This year</option>
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
<% if defined? payments %>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
|
||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
<br>
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#custom_excel').hide();
|
||||
|
||||
$('#custom_excel').click(function(){
|
||||
var url = $('#custom_excel').attr('data-url');
|
||||
$('#frm_report').attr('action',url)
|
||||
$('#frm_report').submit();
|
||||
// window.location = url;
|
||||
});
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
});
|
||||
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
<% end %>
|
||||
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
// shift = $(".shift-id").text()
|
||||
// if (shift.length>0) {
|
||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||
// }
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||
|
||||
$('#item').change(function(){
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
248
app/views/reports/order_reservation/index.html.erb
Executable file
248
app/views/reports/order_reservation/index.html.erb
Executable file
@@ -0,0 +1,248 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
|
||||
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<th><%= tax.name %></th>
|
||||
<% end %>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
|
||||
<%= t("views.right_panel.detail.rnd_adj_sh") %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% 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
|
||||
|
||||
puts precision
|
||||
puts "predelidm"
|
||||
puts delimiter %>
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
<% discount_amt = 0 %>
|
||||
<% other_amt = 0 %>
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
<%if @sale_data %>
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%if result.customer.customer_type == "Takeaway"%>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%end%>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<%end%>
|
||||
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<% end %>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<td><%= tax.name %></td>
|
||||
<% end %>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
|
||||
<%= t("views.right_panel.detail.rnd_adj_sh") %>
|
||||
</td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
var check_arr = [];
|
||||
search_by_period();
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
search_by_period();
|
||||
|
||||
});
|
||||
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
|
||||
// OK button is clicked
|
||||
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
|
||||
new_date = new Date(date) ;
|
||||
month = parseInt(new_date.getMonth()+1)
|
||||
from = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
|
||||
$('#from').val(from)
|
||||
search_by_date();
|
||||
});
|
||||
$('#to').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
|
||||
new_date = new Date(date) ;
|
||||
month = parseInt(new_date.getMonth()+1)
|
||||
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
|
||||
$('#to').val(to)
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
function search_by_date(){
|
||||
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
|
||||
check_arr.push(to);
|
||||
|
||||
if(check_arr.length == 1){
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
shift.empty();
|
||||
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
|
||||
str = '<option value="0">--- All Shift ---</option>';
|
||||
$(data.message).each(function(index){
|
||||
|
||||
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
||||
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||
var shift_id = data.message[index].shift_id ;
|
||||
if(param_shift != ''){
|
||||
if(shift_id == param_shift){
|
||||
selected = 'selected = "selected"';
|
||||
}
|
||||
else{
|
||||
selected = '';
|
||||
}
|
||||
}else{
|
||||
selected = '';
|
||||
}
|
||||
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
||||
|
||||
// console.log(sh_date)
|
||||
})
|
||||
shift.append(str);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
106
app/views/reports/order_reservation/index.xls.erb
Executable file
106
app/views/reports/order_reservation/index.xls.erb
Executable file
@@ -0,0 +1,106 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
|
||||
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<th><%= tax.name %></th>
|
||||
<% end %>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
|
||||
<%= t("views.right_panel.detail.rnd_adj_sh") %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
<% discount_amt = 0 %>
|
||||
<% other_amt = 0 %>
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
<%if @sale_data %>
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<%if result.customer.customer_type == "Takeaway"%>
|
||||
<td>0.0</td>
|
||||
<%end%>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||
<%end%>
|
||||
|
||||
<td><%= result.grand_total %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><b><%= tax.st_amount.round(2) %></b></td>
|
||||
<% end %>
|
||||
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<td><%= tax.name %></td>
|
||||
<% end %>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
|
||||
<%= t("views.right_panel.detail.rnd_adj_sh") %>
|
||||
</td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
client = Mysql2::Client.new(config.symbolize_keys)
|
||||
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], config[:wait_timeout], 0]
|
||||
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], config[:pool], config[:wait_timeout], 0]
|
||||
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -436,6 +436,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :stock_check, :only => [:index, :show]
|
||||
resources :payment_method
|
||||
resources :product_sale, :only => [:index, :show]
|
||||
resources :order_reservation, :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"
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
development:
|
||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||
sx_provision_url: https://connect.pos-myanmar.com/bensai/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||
server_mode: cloud
|
||||
sx_provision_url: connect.pos-myanmar.com/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
|
||||
@@ -24,7 +24,7 @@ test:
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||
sx_provision_url: https://connect.pos-myanmar.com/api #192.168.1.147:3002/api
|
||||
sx_provision_url: connect.pos-myanmar.com/api #192.168.1.147:3002/api
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
|
||||
@@ -13,9 +13,11 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
|
||||
t.string :payment_type
|
||||
t.string :payment_status
|
||||
t.string :payment_ref
|
||||
t.json :taxes
|
||||
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :total_tax, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :discount_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :convenience_charge, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :status, :null => false, :default => "new"
|
||||
t.string :order_remark
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace :clear do
|
||||
SeedGenerator.where("id > 1").update(:current => 0, :next => 0)
|
||||
Receipt.delete_all
|
||||
ReceiptDetail.delete_all
|
||||
OrderReservation.delete_all
|
||||
OrderReservationItem.delete_all
|
||||
Delivery.delete_all
|
||||
puts "Clear Data Done."
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user