merge with 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
|
||||
|
||||
@@ -33,9 +33,25 @@ $(document).on('turbolinks:load', function() {
|
||||
|
||||
$(".tables").on("click", function(){
|
||||
|
||||
var table_id = $(this).val();
|
||||
$('#table_id').val(table_id);
|
||||
oqs_id = $("#oqs_id").val();
|
||||
active = $(this).hasClass('selected-table');
|
||||
if (active) {
|
||||
$(this).removeClass('bg-blue');
|
||||
$(this).addClass('green');
|
||||
$(this).removeClass('selected-table');
|
||||
}else{
|
||||
$(this).removeClass('green');
|
||||
$(this).addClass('bg-blue');
|
||||
$(this).addClass('selected-table');
|
||||
}
|
||||
var list = document.getElementsByClassName('selected-table');
|
||||
var i;
|
||||
var table_id =[];
|
||||
for (i = 0; i < list.length; i++) {
|
||||
table_id.push(list[i].value);
|
||||
}
|
||||
$('#table_id').val(table_id);
|
||||
|
||||
oqs_id = $("#oqs_id").val();
|
||||
if (table_id){
|
||||
var table = table_id
|
||||
}else{
|
||||
|
||||
@@ -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
|
||||
@@ -822,7 +834,6 @@ $(function() {
|
||||
option_name = ' ';
|
||||
data_option = '[]';
|
||||
}
|
||||
console.log(d_option)
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var item_row = $('.summary-items tbody tr');
|
||||
|
||||
@@ -830,7 +841,7 @@ console.log(d_option)
|
||||
item_code = $(item_row[i]).attr('data-code');
|
||||
instance_code = $(item_row[i]).attr('data-instance-code');
|
||||
r_option = $(item_row[i]).attr('data-opt');
|
||||
console.log(r_option)
|
||||
|
||||
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
|
||||
if (qty > 1) {
|
||||
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
||||
@@ -922,7 +933,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 +1238,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 +1273,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) {
|
||||
|
||||
|
||||
40
app/assets/javascripts/channels/check_new_order.js
Normal file
40
app/assets/javascripts/channels/check_new_order.js
Normal file
@@ -0,0 +1,40 @@
|
||||
App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
if(key==0){
|
||||
order_lists = value.order_reservation_id;
|
||||
}else if(key == (order.length - 1)){
|
||||
order_lists += ' and ' + value.order_reservation_id;
|
||||
}else{
|
||||
order_lists += ', ' + value.order_reservation_id;
|
||||
}
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_new_order'),
|
||||
text: "You have new orders. <br/>"+
|
||||
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderReadyToDeliveryChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
if(key==0){
|
||||
order_lists = value.order_reservation_id;
|
||||
}else if(key == (order.length - 1)){
|
||||
order_lists += ' and ' + value.order_reservation_id;
|
||||
}else{
|
||||
order_lists += ', ' + value.order_reservation_id;
|
||||
}
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_order_ready_to_delivery'),
|
||||
text: "You have orders that are ready to deliver. <br/>"+
|
||||
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSendToKitchenChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
if(key==0){
|
||||
order_lists = value.order_reservation_id;
|
||||
}else if(key == (order.length - 1)){
|
||||
order_lists += ' and ' + value.order_reservation_id;
|
||||
}else{
|
||||
order_lists += ', ' + value.order_reservation_id;
|
||||
}
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_order_send_to_kitchen'),
|
||||
text: "You have to send order to kitchen. <br/>"+
|
||||
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,38 +1,52 @@
|
||||
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||
|
||||
App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
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("");
|
||||
$(".nav-item.red > a > p.num").text(order.length);
|
||||
$.each(order, function(key,value){
|
||||
var active_class = "";
|
||||
if(key==0){
|
||||
active_class = "tr-active";
|
||||
showNewOrder(order[key]);
|
||||
}
|
||||
var rowCount = key+1;
|
||||
var date = new Date(value.created_at);
|
||||
var time = timeFormat(date);
|
||||
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+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(value.delivery_type == "service"){
|
||||
delivery_type = "DELIVERY";
|
||||
}else if(value.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>'
|
||||
|
||||
$('.order_reserve_cable tbody').append(row);
|
||||
row = '<tr class="custom-tr first-'+rowCount+' '+active_class+'" 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>';
|
||||
|
||||
$('.custom-table.order_reserve_cable tbody').append(row);
|
||||
});
|
||||
}
|
||||
|
||||
customTableClick();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -13,6 +13,16 @@ $(document).ready(function() {
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#table-slimscroll').slimScroll({
|
||||
height: height,
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#order-detail-slimscroll').slimScroll({
|
||||
height: height-$('#order-detail-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
$("#discount").hide();
|
||||
$(".expected_time").hide();
|
||||
$(function() {
|
||||
$('.first-1').click();
|
||||
});
|
||||
|
||||
customTableClick();
|
||||
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("Accepted");
|
||||
$('#accepted').text("ACCEPT");
|
||||
$('#accepted').attr("data-value","accepted");
|
||||
}else if(type == "processing"){
|
||||
$(".second-1").click();
|
||||
@@ -24,113 +31,19 @@ $(function() {
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
$(".custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var sr_no = $(this).attr("data-sr-no");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url,sr_no);
|
||||
});
|
||||
|
||||
function refreshDetailData(){
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
$('.summary-items').html("");
|
||||
$('#sub_total').text("0.00");
|
||||
$('#delivery_fee').text("0.00");
|
||||
$('#total_charges').text("0.00");
|
||||
$('#total_tax').text("0.00");
|
||||
$('#grand_total').text("0.00");
|
||||
}
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url,sr_no){
|
||||
$('.summary-items').html("");
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
if(items!=undefined && items!=""){
|
||||
if(items.length > 0){
|
||||
for(var i in items) {
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.provider == "direct_delivery"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.provider == "self_pick_up"){
|
||||
$("#delivery_info").text("(PICK-UP)");
|
||||
}
|
||||
|
||||
if(data.order_remark!=null && data.order_remark!=""){
|
||||
$("#order_remark").text(data.order_remark);
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("No."+sr_no);
|
||||
if (data["receipt_no"]) {
|
||||
$("#contact_info").text(data["receipt_no"]);
|
||||
}else{
|
||||
$("#contact_info").text(data["order_reservation_id"]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
$("#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);
|
||||
if($(this).text().trim() == "ACCEPT"){
|
||||
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});
|
||||
}else{
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
}
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
@@ -141,52 +54,250 @@ $(function() {
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
});
|
||||
|
||||
function callback_url(callback,ref_no,order_id,status){
|
||||
var url = 'order_reservation/update';
|
||||
var post_url = "order_reservation/send_status";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: post_url,
|
||||
data: {url: callback, ref_no: ref_no, status: status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
text: "Order has been "+data.message,
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#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!");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function customTableClick(){
|
||||
$(".custom-table .custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var sr_no = $(this).attr("data-sr-no");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url,sr_no);
|
||||
});
|
||||
}
|
||||
|
||||
function refreshDetailData(){
|
||||
$('#requested_date_time').text("");
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
$('.summary-items').html("");
|
||||
$('#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");
|
||||
}
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url,sr_no){
|
||||
$('.summary-items').html("");
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
var item_list = $('.summary-items');
|
||||
|
||||
var newDate = new Date(data.requested_time);
|
||||
var time = timeFormat(newDate);
|
||||
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 exptime = timeFormat(expDate);
|
||||
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!=""){
|
||||
if(items.length > 0){
|
||||
for(var i in items) {
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.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((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;
|
||||
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);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.delivery_type == "service"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}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!=""){
|
||||
$("#order_remark").text(data.order_remark);
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("NO."+sr_no);
|
||||
if (data["receipt_no"]) {
|
||||
$("#contact_info").text(data["receipt_no"]);
|
||||
}else{
|
||||
$("#contact_info").text(data["order_reservation_id"]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
function showTimePicker(requested_time){
|
||||
// var date = new Date(requested_time);
|
||||
// var time = timeFormat(date);
|
||||
// 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, waiting_time: waiting_time},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
text: "Order has been "+data.message,
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function timeFormat(date){
|
||||
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');
|
||||
return time;
|
||||
}
|
||||
|
||||
function showNewOrder(order_reservation){
|
||||
// console.log(order_reservation);
|
||||
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
|
||||
var date = new Date(order_reservation.requested_time);
|
||||
var time = timeFormat(date);
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() > 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
text: "You have new order <b>" + order_reservation.order_reservation_id + "</b> at <b>"+requested_date+"</b>",
|
||||
type: 'success',
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -361,6 +361,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
|
||||
function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type) {
|
||||
$("#loading_wrapper").hide();
|
||||
var jobj = $.parseJSON(resMsg);
|
||||
$("#reference_no").val(jobj.REFNUM);
|
||||
if(jobj.STATUS == "Approved"){
|
||||
$.ajax({type: "POST",
|
||||
url: "/origami/payment/"+payment_type,
|
||||
|
||||
@@ -87,7 +87,7 @@ select.form-control {
|
||||
}
|
||||
|
||||
.green{
|
||||
background-color: #009900;
|
||||
background-color: #009900 !important;
|
||||
}
|
||||
.left{
|
||||
margin-left:1px;
|
||||
@@ -104,4 +104,20 @@ select.form-control {
|
||||
i.logout_icon{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.table-block{
|
||||
padding: 24px 8px 0 0;
|
||||
}
|
||||
|
||||
.label-align{
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.table-float{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.table-width{
|
||||
width: 100%;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
10
app/channels/check_new_order_channel.rb
Normal file
10
app/channels/check_new_order_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CheckNewOrderChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "check_new_order_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
end
|
||||
10
app/channels/check_order_ready_to_delivery_channel.rb
Normal file
10
app/channels/check_order_ready_to_delivery_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CheckOrderReadyToDeliveryChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "check_order_ready_to_delivery_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
end
|
||||
10
app/channels/check_order_send_to_kitchen_channel.rb
Normal file
10
app/channels/check_order_send_to_kitchen_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CheckOrderSendToKitchenChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "check_order_send_to_kitchen_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
end
|
||||
@@ -59,10 +59,11 @@ 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
|
||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||
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
|
||||
|
||||
@@ -39,7 +39,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
@membership_types = Lookup.collection_of("member_group_type")
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
@taxes = TaxProfile.where(:group_type => 'cashier')
|
||||
|
||||
@filter = filter
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status)
|
||||
byebug
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
|
||||
@@ -5,7 +5,8 @@ class Oqs::HomeController < BaseOqsController
|
||||
# @queue_items_details = queue_items_query(false)
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
@tables = DiningFacility.all.active.order('status desc')
|
||||
# @tables = DiningFacility.all.active.order('status desc')
|
||||
@tables = DiningFacility.where(:type => 'Table').order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@filter = params[:filter]
|
||||
@@ -161,9 +162,9 @@ class Oqs::HomeController < BaseOqsController
|
||||
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
|
||||
end
|
||||
|
||||
if table_id.to_i>0
|
||||
table = "and df.id = '#{table_id}' "
|
||||
|
||||
if !table_id.empty?
|
||||
tableId = table_id.to_a.map{|h| h}.join(",")
|
||||
table = "and df.id IN (#{tableId})"
|
||||
else
|
||||
table = ''
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
@taxes = TaxProfile.where(:group_type => 'cashier')
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# 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
|
||||
|
||||
@@ -3,6 +3,8 @@ class Origami::MoveroomController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@webview = check_mobile
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
|
||||
@@ -3,6 +3,8 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@webview = check_mobile
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
|
||||
@@ -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})
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@sale = Sale.pending_sale
|
||||
@order = Sale.pending_order
|
||||
|
||||
@completed = Sale.completed_sale
|
||||
end
|
||||
def show
|
||||
@sales = Sale.pending_sale
|
||||
@orders = Sale.pending_order
|
||||
@completed = Sale.completed_sale
|
||||
@id = params[:sale_id]
|
||||
if(@id[0,3] == "SAL")
|
||||
@sale = Sale.find(@id)
|
||||
@@ -41,4 +42,27 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def completed_sale
|
||||
@sales = Sale.pending_sale
|
||||
@orders = Sale.pending_order
|
||||
@completed = Sale.completed_sale
|
||||
@id = params[:sale_id]
|
||||
|
||||
@sale = Sale.find(@id)
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||
@bookings = Booking.find(@booking)
|
||||
@status = "sale"
|
||||
|
||||
if @bookings.dining_facility_id.to_i > 0
|
||||
@table_id = Booking.find(@bookings.booking_id).dining_facility_id
|
||||
@dining = DiningFacility.find(@table_id)
|
||||
else
|
||||
@table_id = nil
|
||||
@dining = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@@ -45,16 +45,21 @@ class MenuCategory < ApplicationRecord
|
||||
from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S"))
|
||||
to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S"))
|
||||
current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S"))
|
||||
|
||||
|
||||
from = from_t.hour * 3600 + from_t.min*60 + from_t.sec
|
||||
to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec
|
||||
current = current_t.hour * 3600 + current_t.min*60+current_t.sec
|
||||
|
||||
if from > to
|
||||
h = to_t.hour
|
||||
if h < 12 # before noon
|
||||
if h == 0
|
||||
to = 24
|
||||
to = to * 3600 + to_t.min* 60 + to_t.sec
|
||||
else
|
||||
|
||||
h += 24
|
||||
to = h*3600 + to_t.min* 60 + to_t.sec
|
||||
end
|
||||
else # (after) noon
|
||||
if h > 12
|
||||
@@ -64,13 +69,9 @@ class MenuCategory < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
# from = from.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
||||
# to = to.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
||||
# current = current.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
||||
|
||||
day = Date.today.wday
|
||||
dayresult = menu.valid_days.include?(day.to_s)
|
||||
|
||||
|
||||
if current.between?(from, to) && menu.valid_days.include?(day.to_s)
|
||||
return true
|
||||
else
|
||||
@@ -78,6 +79,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
|
||||
|
||||
@@ -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,58 @@ 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.*,del.provider,del.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
|
||||
|
||||
def self.check_new_order
|
||||
order_reservation = OrderReservation.where("status='new'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_order_send_to_kitchen
|
||||
today = Time.now.utc
|
||||
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_order_ready_to_delivery
|
||||
today = Time.now.utc
|
||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
|
||||
|
||||
@@ -2604,6 +2604,13 @@ end
|
||||
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
|
||||
.group("bookings.booking_id")
|
||||
end
|
||||
def self.completed_sale
|
||||
query = Sale.all
|
||||
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||
query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
|
||||
.group("sales.sale_id")
|
||||
end
|
||||
|
||||
def self.all_receipts
|
||||
query = Sale.select("sale_payments.created_at as receipt_close_time,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,15 +196,17 @@ 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
|
||||
product_name = item.product_name
|
||||
|
||||
total_qty += item.qty
|
||||
|
||||
y_position = cursor
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<!-- Column One -->
|
||||
<div class="row clearfix" style="">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<div class="body p-l-10">
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
||||
<div class="form-group col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="label-align">Select Station</label>
|
||||
<span class="hidden" id="oqs_active"></span>
|
||||
<select class="form-control select oqs_click" name="oqs_id" id="oqs_id">
|
||||
<option value="0" data-id="0">Processed</option>
|
||||
@@ -15,16 +16,6 @@
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
|
||||
<span class="hidden" id="table_id"></span>
|
||||
<select class="form-control select tables" name="table_id" id="tables">
|
||||
<option value="">Select Table</option>
|
||||
<% @tables.each do |table| %>
|
||||
<option value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></option>
|
||||
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<!--
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
|
||||
<span class="hidden" id="room_id"></span>
|
||||
@@ -44,67 +35,64 @@
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="tab-content" id="custom-slimscroll" style="">
|
||||
<div class="tab-pane in active" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
|
||||
<%
|
||||
@queue_completed_item.each do |qid|
|
||||
%>
|
||||
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
|
||||
<div class="card-block">
|
||||
<div class="row">
|
||||
<%if qid.type.present?%>
|
||||
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
|
||||
<%else%>
|
||||
<span class="col-md-4 order-zone-type font-13"></span>
|
||||
<%end%>
|
||||
<div class="tab-pane in active" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
|
||||
<%
|
||||
@queue_completed_item.each do |qid|
|
||||
%>
|
||||
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
|
||||
<div class="card-block">
|
||||
<div class="row">
|
||||
<%if qid.type.present?%>
|
||||
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
|
||||
<%else%>
|
||||
<span class="col-md-4 order-zone-type font-13"></span>
|
||||
<%end%>
|
||||
|
||||
<span class="order-zone hidden font-13"><%= qid.zone %></span>
|
||||
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
|
||||
</div>
|
||||
<p class="m-b--10">
|
||||
<span class="order-item font-16">
|
||||
<%= qid.item_name %>
|
||||
</span> [x
|
||||
<span class="order-qty">
|
||||
<%= qid.qty %>
|
||||
</span> ]
|
||||
<% if !qid.set_menu_items.nil? %>
|
||||
<% qid.set_menu_items.each do |item_instance|%>
|
||||
<br><span class="font-12">
|
||||
<%= item_instance %>
|
||||
<span class="order-zone hidden font-13"><%= qid.zone %></span>
|
||||
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
|
||||
</div>
|
||||
<p class="m-b--10">
|
||||
<span class="order-item font-16">
|
||||
<%= qid.item_name %>
|
||||
</span> [x
|
||||
<span class="order-qty">
|
||||
<%= qid.qty %>
|
||||
</span> ]
|
||||
<% if !qid.set_menu_items.nil? %>
|
||||
<% qid.set_menu_items.each do |item_instance|%>
|
||||
<br><span class="font-12">
|
||||
<%= item_instance %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<span class="card-text">
|
||||
<span class="text-muted">Order at -
|
||||
<span class="order-at font-13">
|
||||
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||
</span> <br>
|
||||
Order By - <span class="order-by font-13">
|
||||
<%= qid.item_order_by %>
|
||||
</span>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<span class="card-text">
|
||||
<span class="text-muted">Order at -
|
||||
<span class="order-at font-13">
|
||||
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||
</span> <br>
|
||||
Order By - <span class="order-by font-13">
|
||||
<%= qid.item_order_by %>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<p class="hidden order-status">completed</p>
|
||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
</span>
|
||||
<p class="hidden order-status">completed</p>
|
||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Column Two -->
|
||||
@@ -151,6 +139,35 @@
|
||||
</div>
|
||||
-->
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 table-block">
|
||||
<p class="hidden filter"><%= @filter %></p>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="tab-content" id="table-slimscroll" style="">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#table" id="defaultOpen">Table</a></li>
|
||||
<li><a data-toggle="tab" href="#room">Room</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="table" class="tab-pane fade">
|
||||
<% @tables.each do |table| %>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
|
||||
<button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="room" class="tab-pane fade">
|
||||
<% @rooms.each do |room| %>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
|
||||
<button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- OQS Buttons -->
|
||||
<br>
|
||||
@@ -168,4 +185,6 @@
|
||||
window.location.href = '/dashboard';
|
||||
});
|
||||
});
|
||||
document.getElementById("defaultOpen").click();
|
||||
|
||||
</script>
|
||||
|
||||
973
app/views/origami/addorders/detail.html.erb
Executable file → Normal file
973
app/views/origami/addorders/detail.html.erb
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -204,8 +204,7 @@
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
@@ -244,15 +243,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -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){
|
||||
}
|
||||
|
||||
@@ -200,8 +200,7 @@ $('#jcb_pay').on('click',function(){
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
@@ -247,8 +246,5 @@ $('#jcb_pay').on('click',function(){
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -198,7 +198,6 @@
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
|
||||
$(this).off("click");
|
||||
@@ -245,8 +244,5 @@
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -166,6 +166,10 @@
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$(".tables").on('click', function(){
|
||||
$('.tables').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
|
||||
@@ -284,6 +284,10 @@ end
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$(".tables").on('click', function(){
|
||||
$('.tables').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
|
||||
@@ -204,9 +204,8 @@
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
@@ -244,15 +243,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -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("%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%>
|
||||
@@ -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,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%>
|
||||
@@ -147,16 +219,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 +260,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 +270,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 +294,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 +339,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 TIME</span><br>
|
||||
<b id="expected_time"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
@@ -282,6 +366,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 +383,32 @@
|
||||
<p id="callback_url" class="hidden"></p>
|
||||
<p id="order_id" class="hidden"></p>
|
||||
<p id="status" class="hidden"></p>
|
||||
<script type="text/javascript">
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
</script>
|
||||
<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>
|
||||
|
||||
<div id="notify_new_order"></div>
|
||||
<div id="notify_order_send_to_kitchen"></div>
|
||||
<div id="notify_order_ready_to_delivery"></div>
|
||||
@@ -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){
|
||||
}
|
||||
|
||||
207
app/views/origami/pending_order/completed_sale.html.erb
Normal file
207
app/views/origami/pending_order/completed_sale.html.erb
Normal file
@@ -0,0 +1,207 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#pending_order" role="tab">Pending</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content m-t-15">
|
||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @completed.each do |sale| %>
|
||||
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane " id="pending_order" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @sales.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %></span>
|
||||
</div>
|
||||
<% else%>
|
||||
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Order No: <span id="receipt_no">
|
||||
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% else%>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<% if @status == 'sale' %>
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
<% else%>
|
||||
Customer : <%= @order.customer.name rescue "-" %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @status == 'sale' %>
|
||||
<% sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% else%>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@order_items.each do |order_item|
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<% if @status == 'sale' %>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "quick_service";
|
||||
$(document).ready(function(){
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||
})
|
||||
$(".completed").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
|
||||
})
|
||||
$('#reprint').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
});
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
});
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/quick_service/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -2,31 +2,50 @@
|
||||
<div class="row clearfix">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong id="order-title"> PENDING ORDER </strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns">
|
||||
<% @sale.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @order.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
<div class="tab-content m-t-15">
|
||||
<div class="tab-pane" id="completed" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @completed.each do |sale| %>
|
||||
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane active" id="pending_order" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @sale.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @order.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
@@ -46,6 +65,10 @@
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||
})
|
||||
$(".completed").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
|
||||
})
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
||||
|
||||
@@ -1,154 +1,171 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong id="order-title"> PENDING ORDER </strong>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns">
|
||||
<% @sales.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content m-t-15">
|
||||
<div class="tab-pane" id="completed" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @completed.each do |sale| %>
|
||||
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane active" id="pending_order" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @sales.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %></span>
|
||||
</div>
|
||||
<% else%>
|
||||
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Order No: <span id="receipt_no">
|
||||
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% else%>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<% if @status == 'sale' %>
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
<% else%>
|
||||
Customer : <%= @order.customer.name rescue "-" %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @status == 'sale' %>
|
||||
<% sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% else%>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@order_items.each do |order_item|
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %></span>
|
||||
</div>
|
||||
<% else%>
|
||||
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Order No: <span id="receipt_no">
|
||||
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% end%>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<% if @status == 'sale' %>
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
<% else%>
|
||||
Customer : <%= @order.customer.name rescue "-" %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @status == 'sale' %>
|
||||
<% sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% else%>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@order_items.each do |order_item|
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<% if @status == 'sale' %>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
@@ -182,6 +199,10 @@ $(document).ready(function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||
})
|
||||
$(".completed").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
|
||||
})
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
||||
|
||||
@@ -202,7 +202,6 @@
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
@@ -250,8 +249,5 @@
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -201,9 +201,8 @@
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
console.log(amount);
|
||||
console.log($("#validamount").attr("value"));
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$("#reference_no_Err").html("");
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
@@ -244,14 +243,11 @@
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -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>
|
||||
@@ -100,6 +100,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
get "quick_service/pending_order" => "pending_order#index"
|
||||
get "quick_service/pending_order/:sale_id" => "pending_order#show"
|
||||
get "quick_service/completed_sale/:sale_id" => "pending_order#completed_sale"
|
||||
|
||||
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
|
||||
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
|
||||
@@ -436,6 +437,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,4 +12,16 @@ end
|
||||
|
||||
every 1.minutes do
|
||||
runner "DiningFacility.checkin_time"
|
||||
end
|
||||
|
||||
every 3.minutes do
|
||||
runner "OrderReservation.check_new_order"
|
||||
end
|
||||
|
||||
every 5.minutes do
|
||||
runner "OrderReservation.check_order_send_to_kitchen"
|
||||
end
|
||||
|
||||
every 5.minutes do
|
||||
runner "OrderReservation.check_order_ready_to_delivery"
|
||||
end
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
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
|
||||
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