Pull from master
This commit is contained in:
@@ -200,6 +200,12 @@ Add Feature for Order and Reservation
|
|||||||
** '0' means can not use order reservation and '1' means can use order 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}' }
|
=> settings/lookups => { type:order_reservation, name: OrderReservation, value:'{0 or 1}' }
|
||||||
|
|
||||||
|
For Price 0 in receipt bill
|
||||||
|
2) settings/lookups => { type:show_price, name:Shoe Price, value:1 }
|
||||||
|
|
||||||
|
For Price 0 in receipt bill
|
||||||
|
2) settings/lookups => { type:order_by, name:Order By, value:name }
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
1. Migration
|
1. Migration
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ $(function() {
|
|||||||
// $(".menu_sub_category").on("click", function(){
|
// $(".menu_sub_category").on("click", function(){
|
||||||
$('.sub_category_list').addClass("hidden");
|
$('.sub_category_list').addClass("hidden");
|
||||||
var menu_id = $(this).attr("data-id");
|
var menu_id = $(this).attr("data-id");
|
||||||
console.log(menu_id);
|
|
||||||
var url = "get_menu_category/"+menu_id;
|
var url = "get_menu_category/"+menu_id;
|
||||||
show_menu_item_list(url,menu_id);
|
show_menu_item_list(url,menu_id);
|
||||||
});
|
});
|
||||||
@@ -1092,7 +1091,12 @@ $(function() {
|
|||||||
if (type == true) {
|
if (type == true) {
|
||||||
var table_type = $('#table_id').find("option:selected").data('type');
|
var table_type = $('#table_id').find("option:selected").data('type');
|
||||||
var table_id = $('#table_id').val();
|
var table_id = $('#table_id').val();
|
||||||
window.location.href = "/origami/dashboard";
|
if(window.location.href.includes("modify_order")){
|
||||||
|
var link_url = window.location.href.split("/");
|
||||||
|
window.location.href = "/origami/quick_service/pending_order/"+link_url[link_url.length - 1];
|
||||||
|
}else{
|
||||||
|
window.location.href = "/origami/dashboard";
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
var table_type = $('#table_type').text();
|
var table_type = $('#table_type').text();
|
||||||
var table_id = $('#table_id').text();
|
var table_id = $('#table_id').text();
|
||||||
|
|||||||
@@ -6,68 +6,73 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
table = data.table
|
|
||||||
time = data.time
|
|
||||||
|
|
||||||
// for Notificaiotn message
|
var hostname = location.hostname.trim();
|
||||||
var element = "#notify-wrapper"
|
if(data.from == "" || hostname == data.from)
|
||||||
var animateEnter = "";
|
|
||||||
var animateExit = "";
|
|
||||||
|
|
||||||
if (time == 'print_error') {
|
|
||||||
var colorName = "alert-danger";
|
|
||||||
var placementFrom = "center";
|
|
||||||
var placementAlign = "center";
|
|
||||||
var text = " Hello <br> "+table ;
|
|
||||||
style =""
|
|
||||||
}else{
|
|
||||||
var colorName = "alert-warning";
|
|
||||||
var placementFrom = "top";
|
|
||||||
var placementAlign = "center";
|
|
||||||
var text = " Calling Waiter <br> "+table.name ;
|
|
||||||
style ="width:180px !important;"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (text != null || colorName != null){
|
|
||||||
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
|
||||||
if (colorName === null || colorName === '') { colorName = 'bg-black'; }
|
|
||||||
if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
|
|
||||||
if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
|
|
||||||
var allowDismiss = true;
|
|
||||||
|
|
||||||
$.notify({
|
|
||||||
message: text
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
element: element,
|
table = data.table
|
||||||
type: colorName,
|
time = data.time
|
||||||
allow_dismiss: allowDismiss,
|
|
||||||
timer: 200000000000000,
|
// for Notificaiotn message
|
||||||
placement: {
|
var element = "#notify-wrapper"
|
||||||
from: placementFrom,
|
var animateEnter = "";
|
||||||
align: placementAlign
|
var animateExit = "";
|
||||||
},
|
|
||||||
animate: {
|
if (time == 'print_error') {
|
||||||
enter: animateEnter,
|
var colorName = "alert-danger";
|
||||||
exit: animateExit
|
var placementFrom = "center";
|
||||||
},
|
var placementAlign = "center";
|
||||||
template: '<div data-notify="container" style="'+style+'" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
var text = " Hello <br> "+table ;
|
||||||
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
|
style =""
|
||||||
'<span data-notify="icon"></span> ' +
|
}else{
|
||||||
'<span data-notify="title">{1}</span> ' +
|
var colorName = "alert-warning";
|
||||||
'<span data-notify="message">{2}</span>' +
|
var placementFrom = "top";
|
||||||
'<div class="progress" data-notify="progressbar">' +
|
var placementAlign = "center";
|
||||||
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
|
var text = " Calling Waiter <br> "+table.name ;
|
||||||
'</div>' +
|
style ="width:180px !important;"
|
||||||
'<a href="{3}" target="{4}" data-notify="url"></a>' +
|
}
|
||||||
'</div>'
|
|
||||||
});
|
|
||||||
|
if (text != null || colorName != null){
|
||||||
|
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
||||||
|
if (colorName === null || colorName === '') { colorName = 'bg-black'; }
|
||||||
|
if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
|
||||||
|
if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
|
||||||
|
var allowDismiss = true;
|
||||||
|
|
||||||
|
$.notify({
|
||||||
|
message: text
|
||||||
|
},
|
||||||
|
{
|
||||||
|
element: element,
|
||||||
|
type: colorName,
|
||||||
|
allow_dismiss: allowDismiss,
|
||||||
|
timer: 200000000000000,
|
||||||
|
placement: {
|
||||||
|
from: placementFrom,
|
||||||
|
align: placementAlign
|
||||||
|
},
|
||||||
|
animate: {
|
||||||
|
enter: animateEnter,
|
||||||
|
exit: animateExit
|
||||||
|
},
|
||||||
|
template: '<div data-notify="container" style="'+style+'" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||||
|
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
|
||||||
|
'<span data-notify="icon"></span> ' +
|
||||||
|
'<span data-notify="title">{1}</span> ' +
|
||||||
|
'<span data-notify="message">{2}</span>' +
|
||||||
|
'<div class="progress" data-notify="progressbar">' +
|
||||||
|
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<a href="{3}" target="{4}" data-notify="url"></a>' +
|
||||||
|
'</div>'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//end Notificaiotn message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//end Notificaiotn message
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ App.checkin = App.cable.subscriptions.create('CheckInBookingChannel', {
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
if($('.table_'+data.table.id).hasClass('green')){
|
var hostname = location.hostname.trim();
|
||||||
$('.table_'+data.table.id).removeClass('green');
|
if(data.from == "" || hostname == data.from){
|
||||||
$('.table_'+data.table.id).addClass('blue');
|
if($('.table_'+data.table.id).hasClass('green')){
|
||||||
}
|
$('.table_'+data.table.id).removeClass('green');
|
||||||
$('.new_text_'+data.table.id).removeClass('hide');
|
$('.table_'+data.table.id).addClass('blue');
|
||||||
}
|
}
|
||||||
|
$('.new_text_'+data.table.id).removeClass('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,38 +3,40 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var order = data.data;
|
var hostname = location.hostname.trim();
|
||||||
var shop_code = data.shop_code;
|
if(data.from == "" || hostname == data.from){
|
||||||
if(order.length > 0){
|
var order = data.data;
|
||||||
var order_lists = "";
|
var shop_code = data.shop_code;
|
||||||
$.each(order, function(key, value){
|
if(order.length > 0){
|
||||||
if(key==0){
|
var order_lists = "";
|
||||||
order_lists = value.order_reservation_id;
|
$.each(order, function(key, value){
|
||||||
}else if(key == (order.length - 1)){
|
if(key==0){
|
||||||
order_lists += ' and ' + value.order_reservation_id;
|
order_lists = value.order_reservation_id;
|
||||||
}else{
|
}else if(key == (order.length - 1)){
|
||||||
order_lists += ', ' + value.order_reservation_id;
|
order_lists += ' and ' + value.order_reservation_id;
|
||||||
|
}else{
|
||||||
|
order_lists += ', ' + value.order_reservation_id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// alert(order_lists);
|
||||||
|
if (typeof checkNewOrderAlert !== 'undefined' && $.isFunction(checkNewOrderAlert)) {
|
||||||
|
checkNewOrderAlert(shop_code, order_lists);
|
||||||
}
|
}
|
||||||
});
|
// $("#notify_new_order_lists").text(order_lists);
|
||||||
|
// if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){
|
||||||
// alert(order_lists);
|
// $("#"+shop_code+"_notify_new_order").removeClass("hidden");
|
||||||
if (typeof checkNewOrderAlert !== 'undefined' && $.isFunction(checkNewOrderAlert)) {
|
// }
|
||||||
checkNewOrderAlert(shop_code, order_lists);
|
// $("#"+shop_code+"_notify_new_order").on('shown.bs.modal', function(e){
|
||||||
|
// // $(document).off('focusin.modal');
|
||||||
|
// $("#"+shop_code+"_notify_new_order").focus();
|
||||||
|
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
|
||||||
|
// $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
|
||||||
|
// $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
|
||||||
|
// }).on('hide.bs.modal', function (e) {
|
||||||
|
// $("#"+shop_code+"_notify_new_order").addClass("hidden");
|
||||||
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
}
|
}
|
||||||
// $("#notify_new_order_lists").text(order_lists);
|
|
||||||
// if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){
|
|
||||||
// $("#"+shop_code+"_notify_new_order").removeClass("hidden");
|
|
||||||
// }
|
|
||||||
// $("#"+shop_code+"_notify_new_order").on('shown.bs.modal', function(e){
|
|
||||||
// // $(document).off('focusin.modal');
|
|
||||||
// $("#"+shop_code+"_notify_new_order").focus();
|
|
||||||
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
|
|
||||||
// $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
|
|
||||||
// $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
|
|
||||||
// }).on('hide.bs.modal', function (e) {
|
|
||||||
// $("#"+shop_code+"_notify_new_order").addClass("hidden");
|
|
||||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,20 +3,23 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var order = data.data;
|
var hostname = location.hostname.trim();
|
||||||
var shop_code = data.shop_code;
|
if(data.from == "" || hostname == data.from)
|
||||||
if(order.length > 0){
|
{
|
||||||
var order_lists = "";
|
var order = data.data;
|
||||||
$.each(order, function(key, value){
|
var shop_code = data.shop_code;
|
||||||
if(key==0){
|
if(order.length > 0){
|
||||||
order_lists = value.order_reservation_id;
|
var order_lists = "";
|
||||||
}else if(key == (order.length - 1)){
|
$.each(order, function(key, value){
|
||||||
order_lists += ' and ' + value.order_reservation_id;
|
if(key==0){
|
||||||
}else{
|
order_lists = value.order_reservation_id;
|
||||||
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);
|
// alert(order_lists);
|
||||||
if (typeof checkOrderReadyToKitchenAlert !== 'undefined' && $.isFunction(checkOrderReadyToKitchenAlert)) {
|
if (typeof checkOrderReadyToKitchenAlert !== 'undefined' && $.isFunction(checkOrderReadyToKitchenAlert)) {
|
||||||
@@ -37,5 +40,6 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
|||||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,19 +4,22 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var order = data.data;
|
var hostname = location.hostname.trim();
|
||||||
var shop_code = data.shop_code;
|
if(data.from == "" || hostname == data.from)
|
||||||
if(order.length > 0){
|
{
|
||||||
var order_lists = "";
|
var order = data.data;
|
||||||
$.each(order, function(key, value){
|
var shop_code = data.shop_code;
|
||||||
if(key==0){
|
if(order.length > 0){
|
||||||
order_lists = value.order_reservation_id;
|
var order_lists = "";
|
||||||
}else if(key == (order.length - 1)){
|
$.each(order, function(key, value){
|
||||||
order_lists += ' and ' + value.order_reservation_id;
|
if(key==0){
|
||||||
}else{
|
order_lists = value.order_reservation_id;
|
||||||
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);
|
// alert(order_lists);
|
||||||
if (typeof checkOrderSendToKitchen !== 'undefined' && $.isFunction(checkOrderSendToKitchen)) {
|
if (typeof checkOrderSendToKitchen !== 'undefined' && $.isFunction(checkOrderSendToKitchen)) {
|
||||||
@@ -37,5 +40,6 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
|||||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ App.order = App.cable.subscriptions.create('CheckinChannel', {
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
|
var hostname = location.hostname.trim();
|
||||||
|
if(data.from == "" || hostname == data.from)
|
||||||
|
{
|
||||||
$.each(data.table,function(key,value){
|
$.each(data.table,function(key,value){
|
||||||
if($('.table_'+value.table_id).hasClass('blue')){
|
if($('.table_'+value.table_id).hasClass('blue')){
|
||||||
$('.table_'+value.table_id).removeClass('blue');
|
$('.table_'+value.table_id).removeClass('blue');
|
||||||
@@ -22,5 +25,6 @@ App.order = App.cable.subscriptions.create('CheckinChannel', {
|
|||||||
$('.new_text_'+value.table_id).removeClass('hide');
|
$('.new_text_'+value.table_id).removeClass('hide');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ App.order = App.cable.subscriptions.create('OrderChannel', {
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
|
var hostname = location.hostname.trim();
|
||||||
|
console.log(hostname)
|
||||||
|
console.log(data.from)
|
||||||
|
if(data.from == "" || hostname == data.from)
|
||||||
|
{
|
||||||
if (data.type == 'order') {
|
if (data.type == 'order') {
|
||||||
$('.table_'+data.table.id).removeClass('green');
|
$('.table_'+data.table.id).removeClass('green');
|
||||||
$('.table_'+data.table.id).addClass('blue');
|
$('.table_'+data.table.id).addClass('blue');
|
||||||
@@ -14,6 +19,7 @@ App.order = App.cable.subscriptions.create('OrderChannel', {
|
|||||||
$('.new_text_'+data.table.id).html('');
|
$('.new_text_'+data.table.id).html('');
|
||||||
$('.new_text_'+data.table.id).removeClass('hide')
|
$('.new_text_'+data.table.id).removeClass('hide')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,83 +6,86 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var oqs_id = $('.oqs_active').attr('data-id');
|
var hostname = location.hostname.trim();
|
||||||
items = data.order;
|
if(data.from == "" || hostname == data.from){
|
||||||
for(var field in items) {
|
var oqs_id = $('.oqs_active').attr('data-id');
|
||||||
var price = parseFloat(items[field].price).toFixed(2);
|
items = data.order;
|
||||||
if (items[field]["options"] == "[]" || items[field]["options"] == "") {
|
for(var field in items) {
|
||||||
var options = "";
|
var price = parseFloat(items[field].price).toFixed(2);
|
||||||
}else{
|
if (items[field]["options"] == "[]" || items[field]["options"] == "") {
|
||||||
var options = items[field]["options"];
|
var options = "";
|
||||||
}
|
}else{
|
||||||
//for count
|
var options = items[field]["options"];
|
||||||
test = document.getElementsByClassName("oqs_count");
|
}
|
||||||
|
//for count
|
||||||
|
test = document.getElementsByClassName("oqs_count");
|
||||||
|
|
||||||
for (var i = 0; i < test.length; i++) {
|
for (var i = 0; i < test.length; i++) {
|
||||||
oqs_count_id = $(".oqs_count"+i).attr("data-id");
|
oqs_count_id = $(".oqs_count"+i).attr("data-id");
|
||||||
oqs_count = $(".oqs_count"+i).text();
|
oqs_count = $(".oqs_count"+i).text();
|
||||||
if ( oqs_count_id == items[field]["order_queue_station_id"]) {
|
if ( oqs_count_id == items[field]["order_queue_station_id"]) {
|
||||||
oqs_count_total = +oqs_count +1 ;
|
oqs_count_total = +oqs_count +1 ;
|
||||||
$(".oqs_count"+i).text(oqs_count_total)
|
$(".oqs_count"+i).text(oqs_count_total)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//end count
|
//end count
|
||||||
|
|
||||||
var date = new Date(items[field]["created_at"]);
|
var date = new Date(items[field]["created_at"]);
|
||||||
// var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
// var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||||
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
|
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
|
||||||
|
|
||||||
if (oqs_id == items[field]["order_queue_station_id"]) {
|
if (oqs_id == items[field]["order_queue_station_id"]) {
|
||||||
var table_type = (items[field]["table_type"] != null) ? items[field]["table_type"]:"";
|
var table_type = (items[field]["table_type"] != null) ? items[field]["table_type"]:"";
|
||||||
var zone = (items[field]["zone"] != null) ? "-"+items[field]["zone"]:"No Table";
|
var zone = (items[field]["zone"] != null) ? "-"+items[field]["zone"]:"No Table";
|
||||||
(name === 'true') ? 'Y' :'N';
|
(name === 'true') ? 'Y' :'N';
|
||||||
row ='<div class="card queue_station animated shake queue_station_box" data-order-no="'+items[field]["order_id"]+'">'
|
row ='<div class="card queue_station animated shake queue_station_box" data-order-no="'+items[field]["order_id"]+'">'
|
||||||
+'<strong class="hidden">'+items[field]["order_id"]+'</strong>'
|
+'<strong class="hidden">'+items[field]["order_id"]+'</strong>'
|
||||||
+'<div class="card-block">'
|
+'<div class="card-block">'
|
||||||
|
|
||||||
|
|
||||||
+'<div class="row">'
|
+'<div class="row">'
|
||||||
+'<span class="col-md-4 order-zone-type font-13">'+table_type+''+ zone+'</span>'
|
+'<span class="col-md-4 order-zone-type font-13">'+table_type+''+ zone+'</span>'
|
||||||
+'<span class="order-zone hidden font-14">'+ zone +'</span>'
|
+'<span class="order-zone hidden font-14">'+ zone +'</span>'
|
||||||
+'<span class="col-md-8"><small class="float-right font-13">'+items[field]["order_id"]+'</small></span>'
|
+'<span class="col-md-8"><small class="float-right font-13">'+items[field]["order_id"]+'</small></span>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+'<p class="m-b--10">'
|
+'<p class="m-b--10">'
|
||||||
+'<span class="order-item font-15">'+ items[field]["item_name"] +'- </span>'
|
+'<span class="order-item font-15">'+ items[field]["item_name"] +'- </span>'
|
||||||
+'<span class="order-qty"> [x'+ items[field]["qty"] +'] </span>'
|
+'<span class="order-qty"> [x'+ items[field]["qty"] +'] </span>'
|
||||||
+'</p>'
|
+'</p>'
|
||||||
|
|
||||||
+'<br/><p class="card-text item-options">'+ options +'</p>'
|
+'<br/><p class="card-text item-options">'+ options +'</p>'
|
||||||
|
|
||||||
+'<span class="card-text">'
|
+'<span class="card-text">'
|
||||||
+'<span class="text-muted">Order at - '
|
+'<span class="text-muted">Order at - '
|
||||||
+'<span class="order-at">'+ show_date +'</span> <br>'
|
+'<span class="order-at">'+ show_date +'</span> <br>'
|
||||||
|
|
||||||
+'Order By - <span class="order-by">'+ items[field]["item_order_by"] +'</span> '
|
+'Order By - <span class="order-by">'+ items[field]["item_order_by"] +'</span> '
|
||||||
+'</span> '
|
+'</span> '
|
||||||
+'</span>'
|
+'</span>'
|
||||||
|
|
||||||
+'<p class="hidden order-customer">'+ items[field]["customer_name"] +'</p> '
|
+'<p class="hidden order-customer">'+ items[field]["customer_name"] +'</p> '
|
||||||
+'<p class="hidden assigned-order-item">'+ items[field]["assigned_order_item_id"] +'</p> '
|
+'<p class="hidden assigned-order-item">'+ items[field]["assigned_order_item_id"] +'</p> '
|
||||||
+'</div>'
|
+'</div>'
|
||||||
|
|
||||||
+'<div class="card-footer">'
|
+'<div class="card-footer">'
|
||||||
+'<button id="edit_'+ items[field]["assigned_order_item_id"]+'" class="btn btn-warning order-item order-item-edit">EDIT</button>'
|
+'<button id="edit_'+ items[field]["assigned_order_item_id"]+'" class="btn btn-warning order-item order-item-edit">EDIT</button>'
|
||||||
+' <button id="assigned_queue_' + items[field]["assigned_order_item_id"] +'" class="btn btn-primary order-item order-complete">COMPLETE</button>'
|
+' <button id="assigned_queue_' + items[field]["assigned_order_item_id"] +'" class="btn btn-primary order-item order-complete">COMPLETE</button>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+'</div>';
|
+'</div>';
|
||||||
$('.oqs_append').append(row);
|
$('.oqs_append').append(row);
|
||||||
}
|
}
|
||||||
}//end looping
|
}//end looping
|
||||||
|
|
||||||
var $divs = $("div.queue_station");
|
var $divs = $("div.queue_station");
|
||||||
var SortListDivs = $divs.sort(function (a, b) {
|
var SortListDivs = $divs.sort(function (a, b) {
|
||||||
|
|
||||||
first = $(a).attr('data-order-no');
|
first = $(a).attr('data-order-no');
|
||||||
next = $(b).attr('data-order-no');
|
next = $(b).attr('data-order-no');
|
||||||
|
|
||||||
return parseInt(next.substring(4, 16)) - parseInt(first.substring(4, 16));
|
return parseInt(next.substring(4, 16)) - parseInt(first.substring(4, 16));
|
||||||
});
|
});
|
||||||
$("#oqs_container").html(SortListDivs);
|
$("#oqs_container").html(SortListDivs);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,50 +4,53 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var shop_code = data.shop_code;
|
var hostname = location.hostname.trim();
|
||||||
var order = data.data;
|
if(data.from == "" || hostname == data.from){
|
||||||
if(order.length > 0){
|
var shop_code = data.shop_code;
|
||||||
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').html("");
|
var order = data.data;
|
||||||
$("."+shop_code+" > .nav-item.red > a > p.num").text(order.length);
|
if(order.length > 0){
|
||||||
$.each(order, function(key,value){
|
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').html("");
|
||||||
var active_class = "";
|
$("."+shop_code+" > .nav-item.red > a > p.num").text(order.length);
|
||||||
if(key==0){
|
$.each(order, function(key,value){
|
||||||
active_class = "tr-active";
|
var active_class = "";
|
||||||
showNewOrder(order[key],shop_code);
|
if(key==0){
|
||||||
}
|
active_class = "tr-active";
|
||||||
var rowCount = key+1;
|
showNewOrder(order[key],shop_code);
|
||||||
var date = new Date(value.created_at);
|
}
|
||||||
var time = timeFormat(date);
|
var rowCount = key+1;
|
||||||
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(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 delivery_type = "";
|
var delivery_type = "";
|
||||||
if(value.provider == "food2u" || value.provider == "yangondoor2door"){
|
if(value.provider == "food2u" || value.provider == "yangondoor2door"){
|
||||||
delivery_type = "DELIVERY";
|
delivery_type = "DELIVERY";
|
||||||
}else if(value.provider == "pick_up"){
|
}else if(value.provider == "pick_up"){
|
||||||
delivery_type = "PICK-UP";
|
delivery_type = "PICK-UP";
|
||||||
}else{
|
}else{
|
||||||
delivery_type = "DIRECT DELIVERY";
|
delivery_type = "DIRECT DELIVERY";
|
||||||
}
|
}
|
||||||
|
|
||||||
row = '<tr class="custom-tr first-'+rowCount+' '+active_class+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
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 width ="5%" class="align-left">'+rowCount
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'<td width ="20%" class="align-center">'+created_at
|
+'<td width ="20%" class="align-center">'+created_at
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'<td width ="20%" class="align-center">'+time
|
+'<td width ="20%" class="align-center">'+time
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'<td width ="20%" class="align-center">'+value.grand_total
|
+'<td width ="20%" class="align-center">'+value.grand_total
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'<td width ="30%" class="align-center">'
|
+'<td width ="30%" class="align-center">'
|
||||||
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+' </tr>';
|
+' </tr>';
|
||||||
|
|
||||||
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').append(row);
|
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').append(row);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
customTableClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
customTableClick();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,33 +5,36 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayChannel', {
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var data_obj = data.data;
|
var hostname = location.hostname.trim();
|
||||||
var status = data.status;
|
if(data.from == "" || hostname == data.from){
|
||||||
var count = 0
|
var data_obj = data.data;
|
||||||
var sub_total = 0
|
var status = data.status;
|
||||||
if (data.status == "order") {
|
var count = 0
|
||||||
for(var i in data_obj) {
|
var sub_total = 0
|
||||||
|
if (data.status == "order") {
|
||||||
|
for(var i in data_obj) {
|
||||||
|
|
||||||
sub_total = sub_total + (data_obj[i].price * data_obj[i].qty)
|
sub_total = sub_total + (data_obj[i].price * data_obj[i].qty)
|
||||||
count += 1
|
count += 1
|
||||||
row ='<tr>'
|
row ='<tr>'
|
||||||
+'<td>'+count+'</td>'
|
+'<td>'+count+'</td>'
|
||||||
+'<td class="item-name">'+data_obj[i].item_name+'</td>'
|
+'<td class="item-name">'+data_obj[i].item_name+'</td>'
|
||||||
+'<td class="item-attr">'+data_obj[i].qty +'</td>'
|
+'<td class="item-attr">'+data_obj[i].qty +'</td>'
|
||||||
+ '<td class="item-attr">'+data_obj[i].qty*data_obj[i].price +'</td>'
|
+ '<td class="item-attr">'+data_obj[i].qty*data_obj[i].price +'</td>'
|
||||||
+'</tr>'
|
+'</tr>'
|
||||||
$(".second_display_items").append(row);
|
$(".second_display_items").append(row);
|
||||||
}//end looping
|
}//end looping
|
||||||
}else{
|
}else{
|
||||||
$('#s_sub_total').empty();
|
$('#s_sub_total').empty();
|
||||||
$('#s_sub_total').append(data_obj.total_amount);
|
$('#s_sub_total').append(data_obj.total_amount);
|
||||||
$('#s_total_discount').empty();
|
$('#s_total_discount').empty();
|
||||||
$('#s_total_discount').append(data_obj.total_discount);
|
$('#s_total_discount').append(data_obj.total_discount);
|
||||||
$('#s_tatal_tax').empty();
|
$('#s_tatal_tax').empty();
|
||||||
$('#s_tatal_tax').append(data_obj.total_tax);
|
$('#s_tatal_tax').append(data_obj.total_tax);
|
||||||
$('#s_grand_total').empty();
|
$('#s_grand_total').empty();
|
||||||
$('#s_grand_total').append(data_obj.grand_total);
|
$('#s_grand_total').append(data_obj.grand_total);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,161 +6,163 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var items = data.data;
|
var hostname = location.hostname.trim();
|
||||||
var tax = data.tax_profiles;
|
if(data.from == "" || hostname == data.from){
|
||||||
var status= data.status
|
var items = data.data;
|
||||||
if (status == "reload") {
|
var tax = data.tax_profiles;
|
||||||
jQuery('#s_reload').click();
|
var status= data.status
|
||||||
}
|
if (status == "reload") {
|
||||||
$('#second_display_slider').addClass("hidden")
|
jQuery('#s_reload').click();
|
||||||
$('#second_display_items').removeClass("hidden")
|
|
||||||
|
|
||||||
|
|
||||||
// append items
|
|
||||||
if (status == "add") {
|
|
||||||
for(var i in items) {
|
|
||||||
qty = parseInt(items[i].qty);
|
|
||||||
append = 0;
|
|
||||||
price = items[i].price;
|
|
||||||
|
|
||||||
instance_name = items[i].instance;
|
|
||||||
if (instance_name == "undefined"){
|
|
||||||
instance = '';
|
|
||||||
}else{
|
|
||||||
instance = "("+items[i].instance+")";
|
|
||||||
}
|
|
||||||
|
|
||||||
// d_option = items[i].options;
|
|
||||||
// if (d_option){
|
|
||||||
// option_name = "-"+items[i].options;
|
|
||||||
// }else{
|
|
||||||
// option_name = '';
|
|
||||||
// }
|
|
||||||
|
|
||||||
d_option = items[i].opt;
|
|
||||||
if (items[i].click_type != "add_icon"){
|
|
||||||
option_name = "-"+items[i].options;
|
|
||||||
data_option = items[i].options ;
|
|
||||||
}else{
|
|
||||||
option_name = ' ';
|
|
||||||
data_option = '[]';
|
|
||||||
}
|
|
||||||
|
|
||||||
var rowCount = $('.second_display_items tbody tr').length+1;
|
|
||||||
var item_row = $('.second_display_items tbody tr');
|
|
||||||
|
|
||||||
$(item_row).each(function(j){
|
|
||||||
var item_code = $(item_row[j]).attr('data-code');
|
|
||||||
var instance_code = $(item_row[j]).attr('data-instance-code');
|
|
||||||
var r_option = $(item_row[j]).attr('data-options');
|
|
||||||
if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) {
|
|
||||||
if (qty > 1) {
|
|
||||||
qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;
|
|
||||||
}else{
|
|
||||||
qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(item_row[j]).children('#item_qty').text(qty);
|
|
||||||
parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2)));
|
|
||||||
append =1;
|
|
||||||
}else{
|
|
||||||
if (qty > 1) {
|
|
||||||
qty = qty;
|
|
||||||
}else{
|
|
||||||
qty = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (append===0) {
|
|
||||||
row ="<tr class='item_box' data-price ='"
|
|
||||||
+price+ "' 'data-instance ='"
|
|
||||||
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
|
|
||||||
+items[i].instance_code+"' data-attributes='"
|
|
||||||
+items[i].attributes+"' data-options ='"
|
|
||||||
+data_option+"' data-opt ='"
|
|
||||||
+items[i].options+"' data-row ='"+rowCount+ "'>"
|
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
|
||||||
+'<td class="item-cell-name" id="item_name" >' + items[i].name+ ' ' + instance + ' ' + option_name +'</td>'
|
|
||||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
|
||||||
+'<td class="item-cell-price" id="item_price">'
|
|
||||||
+ parseFloat(price).toFixed(2)
|
|
||||||
+'</td>'
|
|
||||||
+'</tr>';
|
|
||||||
$(".second_display_items tbody").append(row);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
$('#second_display_slider').addClass("hidden")
|
||||||
if (status == "set_add") {
|
$('#second_display_items').removeClass("hidden")
|
||||||
// var option_arr = [];
|
|
||||||
var attribute_arr = [];
|
|
||||||
var rowCount = $('.second_display_items tbody tr').length+1;
|
// append items
|
||||||
for(var i in items) {
|
if (status == "add") {
|
||||||
code = items[i].code;
|
for(var i in items) {
|
||||||
item_code = items[i].item_code;
|
qty = parseInt(items[i].qty);
|
||||||
name = items[i].name;
|
append = 0;
|
||||||
item_name = items[i].item_name;
|
|
||||||
qty = items[i].qty;
|
|
||||||
price = items[i].price;
|
price = items[i].price;
|
||||||
option = items[i].option;
|
|
||||||
sub_item = items[i].sub_item;
|
instance_name = items[i].instance;
|
||||||
total = qty * price ;
|
if (instance_name == "undefined"){
|
||||||
// option_arr.push(option);
|
instance = '';
|
||||||
row ="<tr class='item_box' data-price ='"
|
}else{
|
||||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
instance = "("+items[i].instance+")";
|
||||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
}
|
||||||
+code+"' data-attributes='"
|
|
||||||
+attribute_arr+"' data-options ='"
|
// d_option = items[i].options;
|
||||||
+option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
// if (d_option){
|
||||||
|
// option_name = "-"+items[i].options;
|
||||||
|
// }else{
|
||||||
|
// option_name = '';
|
||||||
|
// }
|
||||||
|
|
||||||
|
d_option = items[i].opt;
|
||||||
|
if (items[i].click_type != "add_icon"){
|
||||||
|
option_name = "-"+items[i].options;
|
||||||
|
data_option = items[i].options ;
|
||||||
|
}else{
|
||||||
|
option_name = ' ';
|
||||||
|
data_option = '[]';
|
||||||
|
}
|
||||||
|
|
||||||
|
var rowCount = $('.second_display_items tbody tr').length+1;
|
||||||
|
var item_row = $('.second_display_items tbody tr');
|
||||||
|
|
||||||
|
$(item_row).each(function(j){
|
||||||
|
var item_code = $(item_row[j]).attr('data-code');
|
||||||
|
var instance_code = $(item_row[j]).attr('data-instance-code');
|
||||||
|
var r_option = $(item_row[j]).attr('data-options');
|
||||||
|
if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) {
|
||||||
|
if (qty > 1) {
|
||||||
|
qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;
|
||||||
|
}else{
|
||||||
|
qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(item_row[j]).children('#item_qty').text(qty);
|
||||||
|
parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2)));
|
||||||
|
append =1;
|
||||||
|
}else{
|
||||||
|
if (qty > 1) {
|
||||||
|
qty = qty;
|
||||||
|
}else{
|
||||||
|
qty = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (append===0) {
|
||||||
|
row ="<tr class='item_box' data-price ='"
|
||||||
|
+price+ "' 'data-instance ='"
|
||||||
|
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
|
||||||
|
+items[i].instance_code+"' data-attributes='"
|
||||||
|
+items[i].attributes+"' data-options ='"
|
||||||
|
+data_option+"' data-opt ='"
|
||||||
|
+items[i].options+"' data-row ='"+rowCount+ "'>"
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name + ''+option+'</td>'
|
+'<td class="item-cell-name" id="item_name" >' + items[i].name+ ' ' + instance + ' ' + option_name +'</td>'
|
||||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
+'<td class="item-cell-price" id="item_price">'
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
+ parseFloat(total).toFixed(2)
|
+ parseFloat(price).toFixed(2)
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'</tr>';
|
+'</tr>';
|
||||||
$(".second_display_items tbody").append(row);
|
$(".second_display_items tbody").append(row);
|
||||||
rowCount = rowCount + 1;
|
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
//end apend items
|
|
||||||
var total_price = 0;
|
|
||||||
var taxable_amount = 0;
|
|
||||||
var total_discount = 0
|
|
||||||
var total_tax_amount = 0
|
|
||||||
var item_row = $('.second_display_items tbody tr');
|
|
||||||
//calculate Sub Total
|
|
||||||
$(item_row).each(function(i){
|
|
||||||
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
|
||||||
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
|
||||||
total_price += qty*unit_price;
|
|
||||||
});
|
|
||||||
//calculate Tax Amount
|
|
||||||
for(var i in tax) {
|
|
||||||
// substract , to give after discount
|
|
||||||
var total_tax = total_price - total_discount
|
|
||||||
// include or execulive
|
|
||||||
if (tax[i].inclusive){
|
|
||||||
rate = tax[i].rate
|
|
||||||
divided_value = (100 + rate)/rate
|
|
||||||
total_tax_amount = total_tax_amount + (total_tax / divided_value)
|
|
||||||
}else{
|
|
||||||
total_tax_amount = total_tax_amount + (total_tax * tax[i].rate / 100)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//end calculate Tax amount
|
if (status == "set_add") {
|
||||||
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
// var option_arr = [];
|
||||||
var fixed_taxable_amount = parseFloat(total_tax_amount).toFixed(2);
|
var attribute_arr = [];
|
||||||
var fixed_grand_total = parseFloat(total_price + total_tax_amount).toFixed(2);
|
var rowCount = $('.second_display_items tbody tr').length+1;
|
||||||
|
for(var i in items) {
|
||||||
|
code = items[i].code;
|
||||||
|
item_code = items[i].item_code;
|
||||||
|
name = items[i].name;
|
||||||
|
item_name = items[i].item_name;
|
||||||
|
qty = items[i].qty;
|
||||||
|
price = items[i].price;
|
||||||
|
option = items[i].option;
|
||||||
|
sub_item = items[i].sub_item;
|
||||||
|
total = qty * price ;
|
||||||
|
// option_arr.push(option);
|
||||||
|
row ="<tr class='item_box' data-price ='"
|
||||||
|
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||||
|
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||||
|
+code+"' data-attributes='"
|
||||||
|
+attribute_arr+"' data-options ='"
|
||||||
|
+option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
||||||
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
|
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name + ''+option+'</td>'
|
||||||
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
|
+ parseFloat(total).toFixed(2)
|
||||||
|
+'</td>'
|
||||||
|
+'</tr>';
|
||||||
|
$(".second_display_items tbody").append(row);
|
||||||
|
rowCount = rowCount + 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//end apend items
|
||||||
|
var total_price = 0;
|
||||||
|
var taxable_amount = 0;
|
||||||
|
var total_discount = 0
|
||||||
|
var total_tax_amount = 0
|
||||||
|
var item_row = $('.second_display_items tbody tr');
|
||||||
|
//calculate Sub Total
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||||
|
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||||
|
total_price += qty*unit_price;
|
||||||
|
});
|
||||||
|
//calculate Tax Amount
|
||||||
|
for(var i in tax) {
|
||||||
|
// substract , to give after discount
|
||||||
|
var total_tax = total_price - total_discount
|
||||||
|
// include or execulive
|
||||||
|
if (tax[i].inclusive){
|
||||||
|
rate = tax[i].rate
|
||||||
|
divided_value = (100 + rate)/rate
|
||||||
|
total_tax_amount = total_tax_amount + (total_tax / divided_value)
|
||||||
|
}else{
|
||||||
|
total_tax_amount = total_tax_amount + (total_tax * tax[i].rate / 100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//end calculate Tax amount
|
||||||
|
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||||
|
var fixed_taxable_amount = parseFloat(total_tax_amount).toFixed(2);
|
||||||
|
var fixed_grand_total = parseFloat(total_price + total_tax_amount).toFixed(2);
|
||||||
|
|
||||||
$('#s_sub_total').empty();
|
$('#s_sub_total').empty();
|
||||||
$('#s_sub_total').append(fixed_total_price);
|
$('#s_sub_total').append(fixed_total_price);
|
||||||
$('#s_tatal_tax').empty();
|
$('#s_tatal_tax').empty();
|
||||||
$('#s_tatal_tax').append(fixed_taxable_amount);
|
$('#s_tatal_tax').append(fixed_taxable_amount);
|
||||||
$('#s_grand_total').empty();
|
$('#s_grand_total').empty();
|
||||||
$('#s_grand_total').append(fixed_grand_total);
|
$('#s_grand_total').append(fixed_grand_total);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,12 @@ class Api::BillController < Api::ApiController
|
|||||||
Promotion.promo_activate(@sale)
|
Promotion.promo_activate(@sale)
|
||||||
|
|
||||||
#BillBroadcastJob.perform_later(table)
|
#BillBroadcastJob.perform_later(table)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "bill_channel",table: table
|
from = request.subdomain + "." + request.domain
|
||||||
#end
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "bill_channel",table: table, from: from
|
||||||
else
|
else
|
||||||
@status = false
|
@status = false
|
||||||
@error_message = "No Current Open Shift"
|
@error_message = "No Current Open Shift"
|
||||||
|
|||||||
@@ -6,9 +6,12 @@ class Api::CallWaitersController < ActionController::API
|
|||||||
@time = params[:time]
|
@time = params[:time]
|
||||||
@table = DiningFacility.find(@table_id)
|
@table = DiningFacility.find(@table_id)
|
||||||
# CallWaiterJob.perform_later(@table,@time)
|
# CallWaiterJob.perform_later(@table,@time)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
|
from = request.subdomain + "." + request.domain
|
||||||
#end
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from
|
||||||
# get printer info
|
# get printer info
|
||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
unique_code = "CallWaiterPdf"
|
unique_code = "CallWaiterPdf"
|
||||||
|
|||||||
@@ -6,7 +6,16 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
booking = dining_facility.get_current_checkout_booking
|
booking = dining_facility.get_current_checkout_booking
|
||||||
if !booking.nil?
|
if !booking.nil?
|
||||||
|
|
||||||
DiningFacility.check_in_booking(params[:dining_id])
|
# DiningFacility.check_in_booking(params[:dining_id])
|
||||||
|
|
||||||
|
table = DiningFacility.find(params[:dining_id])
|
||||||
|
#Send to background job for processing
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "check_in_booking_channel",table: table,from:from
|
||||||
|
|
||||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||||
|
|||||||
@@ -73,7 +73,12 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
|
|
||||||
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation,shop_code: shop_code
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation,shop_code: shop_code,from:from
|
||||||
else
|
else
|
||||||
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
||||||
end
|
end
|
||||||
|
|||||||
0
app/controllers/crm/customers_controller.rb
Executable file → Normal file
0
app/controllers/crm/customers_controller.rb
Executable file → Normal file
@@ -181,6 +181,12 @@ puts params[:id]
|
|||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
|
||||||
|
if @status && @booking
|
||||||
|
if params[:order_source] != "quick_service"
|
||||||
|
process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Order.send_customer_view(@booking)
|
# Order.send_customer_view(@booking)
|
||||||
|
|
||||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||||
@@ -188,8 +194,12 @@ puts params[:id]
|
|||||||
|
|
||||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||||
# for second display
|
# for second display
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
||||||
#end
|
#end
|
||||||
result = {:status=> @status, :data => @sale }
|
result = {:status=> @status, :data => @sale }
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
@@ -240,6 +250,81 @@ puts params[:id]
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def process_order_queue(order_id,table_id,order_source)
|
||||||
|
print_status = nil
|
||||||
|
cup_status = nil
|
||||||
|
|
||||||
|
#Send to background job for processing
|
||||||
|
order = Order.find(order_id)
|
||||||
|
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||||
|
|
||||||
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
cup_status = `#{"sudo service cups status"}`
|
||||||
|
print_status = check_cup_status(cup_status)
|
||||||
|
end
|
||||||
|
|
||||||
|
if print_status
|
||||||
|
if !sidekiq.nil?
|
||||||
|
OrderQueueProcessorJob.perform_later(order_id, table_id)
|
||||||
|
else
|
||||||
|
if order
|
||||||
|
oqs = OrderQueueStation.new
|
||||||
|
oqs.process_order(order, table_id, order_source)
|
||||||
|
end
|
||||||
|
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
|
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
cup_start = `#{"sudo service cups start"}`
|
||||||
|
cup_status = `#{"sudo service cups status"}`
|
||||||
|
print_status = check_cup_status(cup_status)
|
||||||
|
end
|
||||||
|
|
||||||
|
if print_status
|
||||||
|
if !sidekiq.nil?
|
||||||
|
OrderQueueProcessorJob.perform_later(order_id, table_id)
|
||||||
|
else
|
||||||
|
if order
|
||||||
|
oqs = OrderQueueStation.new
|
||||||
|
oqs.process_order(order, table_id, order_source)
|
||||||
|
end
|
||||||
|
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
|
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
from = ""
|
||||||
|
msg = ' Print Error ! Please contact to service'
|
||||||
|
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error',from:from
|
||||||
|
end
|
||||||
|
if !sidekiq.nil?
|
||||||
|
OrderQueueProcessorJob.perform_later(order_id, table_id)
|
||||||
|
else
|
||||||
|
if order
|
||||||
|
oqs = OrderQueueStation.new
|
||||||
|
oqs.process_order(order, table_id, order_source)
|
||||||
|
end
|
||||||
|
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
|
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_cup_status(status)
|
||||||
|
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
0
app/controllers/origami/customers_controller.rb
Executable file → Normal file
0
app/controllers/origami/customers_controller.rb
Executable file → Normal file
@@ -88,41 +88,49 @@ class Origami::ProductCommissionsController < BaseOrigamiController
|
|||||||
commissioner_id = params[:commissioner_id]
|
commissioner_id = params[:commissioner_id]
|
||||||
@sale_item = SaleItem.find(sale_item_id)
|
@sale_item = SaleItem.find(sale_item_id)
|
||||||
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
||||||
@commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.id, true).take
|
# @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.item_code, true).take
|
||||||
|
|
||||||
|
Commission.all.each do |com|
|
||||||
|
if com.product_code.include? @menu_item.item_code && com.active == true
|
||||||
|
@commission = Commission.find(com.id)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
||||||
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
||||||
|
if !@commission.nil? && @commissioner.commission_id == @commission.commission_id
|
||||||
if !@product_commission.nil?
|
if !@product_commission.nil?
|
||||||
if @product_commission.commissioner_id == @commissioner.id
|
if @product_commission.commissioner_id == @commissioner.id
|
||||||
@product_commission.destroy
|
@product_commission.destroy
|
||||||
deselect = true
|
deselect = true
|
||||||
else
|
else
|
||||||
@product_commission.commissioner_id = @commissioner.id
|
@product_commission.commissioner_id = @commissioner.id
|
||||||
deselect = false
|
deselect = false
|
||||||
end
|
|
||||||
else
|
|
||||||
@product_commission = ProductCommission.new
|
|
||||||
@product_commission.product_code = @menu_item.id
|
|
||||||
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
|
|
||||||
unless @commission.nil?
|
|
||||||
@product_commission.commission_id = @commission.id
|
|
||||||
if @commission.commission_type == 'Percentage'
|
|
||||||
@product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0)
|
|
||||||
@product_commission.amount = @product_commission.price * @sale_item.qty
|
|
||||||
elsif @commission.commission_type == 'Net Amount'
|
|
||||||
@product_commission.price = @commission.amount
|
|
||||||
@product_commission.amount = @product_commission.price * @sale_item.qty
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
@product_commission = ProductCommission.new
|
||||||
|
@product_commission.product_code = @menu_item.item_code
|
||||||
|
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
|
||||||
|
unless @commission.nil?
|
||||||
|
@product_commission.commission_id = @commission.id
|
||||||
|
if @commission.commission_type == 'Percentage'
|
||||||
|
@product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0)
|
||||||
|
@product_commission.amount = @product_commission.price * @sale_item.qty
|
||||||
|
elsif @commission.commission_type == 'Net Amount'
|
||||||
|
@product_commission.price = @commission.amount
|
||||||
|
@product_commission.amount = @product_commission.price * @sale_item.qty
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@product_commission.commissioner_id = @commissioner.id
|
||||||
|
@product_commission.qty = @sale_item.qty
|
||||||
|
@product_commission.sale_id = @sale_item.sale_id
|
||||||
|
@product_commission.sale_item_id = @sale_item.sale_item_id
|
||||||
|
end
|
||||||
|
if @product_commission.save
|
||||||
|
render json: {status: true, deselect: deselect}
|
||||||
|
else
|
||||||
|
render json: {status: false, deselect: deselect}
|
||||||
end
|
end
|
||||||
@product_commission.commissioner_id = @commissioner.id
|
|
||||||
@product_commission.qty = @sale_item.qty
|
|
||||||
@product_commission.sale_id = @sale_item.sale_id
|
|
||||||
@product_commission.sale_item_id = @sale_item.sale_item_id
|
|
||||||
end
|
|
||||||
if @product_commission.save
|
|
||||||
render json: {status: true, deselect: deselect}
|
|
||||||
else
|
|
||||||
render json: {status: false, deselect: deselect}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ class Origami::SecondDisplayController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
tax_profiles = nil
|
tax_profiles = nil
|
||||||
end
|
end
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status]
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
#Shop Name in Navbor
|
#Shop Name in Navbor
|
||||||
|
|||||||
@@ -337,9 +337,13 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
Promotion.promo_activate(sale)
|
Promotion.promo_activate(sale)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "bill_channel",table: table
|
from = request.subdomain + "." + request.domain
|
||||||
#end
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "bill_channel",table: table,from:from
|
||||||
|
|
||||||
render :json => { status: status }
|
render :json => { status: status }
|
||||||
else
|
else
|
||||||
render :json => { status: false, error_message: 'No Current Open Shift!'}
|
render :json => { status: false, error_message: 'No Current Open Shift!'}
|
||||||
|
|||||||
@@ -157,15 +157,25 @@ class DiningFacility < ApplicationRecord
|
|||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
# CheckInBookingJob.perform_later(table)
|
# CheckInBookingJob.perform_later(table)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
#if ENV["SERVER_MODE"] != 'cloud'
|
||||||
ActionCable.server.broadcast "check_in_booking_channel",table: table
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "check_in_booking_channel",table: table,from:from
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.checkin_time
|
def self.checkin_time
|
||||||
table = DiningFacility.get_checkin_booking
|
table = DiningFacility.get_checkin_booking
|
||||||
if table.length > 0
|
if table.length > 0
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
ActionCable.server.broadcast "checkin_channel",table: table
|
ActionCable.server.broadcast "checkin_channel",table: table,from:from
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
class DisplayImage < ApplicationRecord
|
class DisplayImage < ApplicationRecord
|
||||||
belongs_to :shop
|
belongs_to :shop
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class MenuCategory < ApplicationRecord
|
|||||||
validates_presence_of :code, :name, :menu, :order_by
|
validates_presence_of :code, :name, :menu, :order_by
|
||||||
validates_uniqueness_of :code
|
validates_uniqueness_of :code
|
||||||
|
|
||||||
default_scope { order('name asc') }
|
default_scope { order('order_by asc') }
|
||||||
scope :active, -> {where("is_available = 1")}
|
scope :active, -> {where("is_available = 1")}
|
||||||
|
|
||||||
def self.destroyCategory(menu_category)
|
def self.destroyCategory(menu_category)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class MenuItem < ApplicationRecord
|
|||||||
validates_presence_of :item_code, :name, :type, :min_qty,:account_id
|
validates_presence_of :item_code, :name, :type, :min_qty,:account_id
|
||||||
validates_uniqueness_of :item_code
|
validates_uniqueness_of :item_code
|
||||||
|
|
||||||
default_scope { order('name asc') }
|
default_scope { order('item_code asc') }
|
||||||
|
|
||||||
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }
|
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }
|
||||||
scope :set_menu_item, -> { where(type: 'SetMenuItem') }
|
scope :set_menu_item, -> { where(type: 'SetMenuItem') }
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ class Order < ApplicationRecord
|
|||||||
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||||
|
|
||||||
#Send order to queue one it done!
|
#Send order to queue one it done!
|
||||||
if self.source != "quick_service"
|
# if self.source != "quick_service"
|
||||||
process_order_queue
|
# process_order_queue
|
||||||
end
|
# end
|
||||||
|
|
||||||
#send order to broadcast job
|
#send order to broadcast job
|
||||||
send_order_broadcast(booking)
|
send_order_broadcast(booking)
|
||||||
@@ -108,9 +108,9 @@ class Order < ApplicationRecord
|
|||||||
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||||
|
|
||||||
#Send order to queue one it done!
|
#Send order to queue one it done!
|
||||||
if self.source != "quick_service"
|
# if self.source != "quick_service"
|
||||||
process_order_queue
|
# process_order_queue
|
||||||
end
|
# end
|
||||||
|
|
||||||
#send order to broadcast job
|
#send order to broadcast job
|
||||||
send_order_broadcast(booking)
|
send_order_broadcast(booking)
|
||||||
@@ -283,69 +283,7 @@ class Order < ApplicationRecord
|
|||||||
# Counter number of quantityf
|
# Counter number of quantityf
|
||||||
end
|
end
|
||||||
|
|
||||||
#Process order items and send to order queue
|
|
||||||
def process_order_queue
|
|
||||||
print_status = nil
|
|
||||||
cup_status = nil
|
|
||||||
|
|
||||||
#Send to background job for processing
|
|
||||||
order = Order.find(self.id)
|
|
||||||
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != 'cloud'
|
|
||||||
cup_status = `#{"sudo service cups status"}`
|
|
||||||
print_status = check_cup_status(cup_status)
|
|
||||||
end
|
|
||||||
|
|
||||||
if print_status
|
|
||||||
if !sidekiq.nil?
|
|
||||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
|
||||||
else
|
|
||||||
if order
|
|
||||||
oqs = OrderQueueStation.new
|
|
||||||
oqs.process_order(order, self.table_id, self.source)
|
|
||||||
end
|
|
||||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
|
||||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if ENV["SERVER_MODE"] != 'cloud'
|
|
||||||
cup_start = `#{"sudo service cups start"}`
|
|
||||||
cup_status = `#{"sudo service cups status"}`
|
|
||||||
print_status = check_cup_status(cup_status)
|
|
||||||
end
|
|
||||||
|
|
||||||
if print_status
|
|
||||||
if !sidekiq.nil?
|
|
||||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
|
||||||
else
|
|
||||||
if order
|
|
||||||
oqs = OrderQueueStation.new
|
|
||||||
oqs.process_order(order, self.table_id, self.source)
|
|
||||||
end
|
|
||||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
|
||||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if ENV["SERVER_MODE"] != 'cloud'
|
|
||||||
|
|
||||||
msg = ' Print Error ! Please contact to service'
|
|
||||||
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
|
||||||
end
|
|
||||||
if !sidekiq.nil?
|
|
||||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
|
||||||
else
|
|
||||||
if order
|
|
||||||
oqs = OrderQueueStation.new
|
|
||||||
oqs.process_order(order, self.table_id, self.source)
|
|
||||||
end
|
|
||||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
|
||||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
#Process order items and send to order queue
|
#Process order items and send to order queue
|
||||||
def self.pay_process_order_queue(id,table_id)
|
def self.pay_process_order_queue(id,table_id)
|
||||||
# if ENV["SERVER_MODE"] != 'cloud'
|
# if ENV["SERVER_MODE"] != 'cloud'
|
||||||
@@ -378,9 +316,13 @@ class Order < ApplicationRecord
|
|||||||
type = 'order'
|
type = 'order'
|
||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
# OrderBroadcastJob.perform_later(table,type)
|
# OrderBroadcastJob.perform_later(table,type)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
from = request.subdomain + "." + request.domain
|
||||||
#end
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -534,11 +476,78 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
|
from = request.subdomain + "." + request.domain
|
||||||
#end
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status,from:from
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Process order items and send to order queue
|
||||||
|
# def process_order_queue
|
||||||
|
# print_status = nil
|
||||||
|
# cup_status = nil
|
||||||
|
|
||||||
|
# #Send to background job for processing
|
||||||
|
# order = Order.find(self.id)
|
||||||
|
# sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||||
|
|
||||||
|
# if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
# cup_status = `#{"sudo service cups status"}`
|
||||||
|
# print_status = check_cup_status(cup_status)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# if print_status
|
||||||
|
# if !sidekiq.nil?
|
||||||
|
# OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||||
|
# else
|
||||||
|
# if order
|
||||||
|
# oqs = OrderQueueStation.new
|
||||||
|
# oqs.process_order(order, self.table_id, self.source)
|
||||||
|
# end
|
||||||
|
# # assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||||
|
# # ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
|
# end
|
||||||
|
# else
|
||||||
|
# if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
# cup_start = `#{"sudo service cups start"}`
|
||||||
|
# cup_status = `#{"sudo service cups status"}`
|
||||||
|
# print_status = check_cup_status(cup_status)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# if print_status
|
||||||
|
# if !sidekiq.nil?
|
||||||
|
# OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||||
|
# else
|
||||||
|
# if order
|
||||||
|
# oqs = OrderQueueStation.new
|
||||||
|
# oqs.process_order(order, self.table_id, self.source)
|
||||||
|
# end
|
||||||
|
# # assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||||
|
# # ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
|
# end
|
||||||
|
# else
|
||||||
|
# if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
|
||||||
|
# msg = ' Print Error ! Please contact to service'
|
||||||
|
# ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||||
|
# end
|
||||||
|
# if !sidekiq.nil?
|
||||||
|
# OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||||
|
# else
|
||||||
|
# if order
|
||||||
|
# oqs = OrderQueueStation.new
|
||||||
|
# oqs.process_order(order, self.table_id, self.source)
|
||||||
|
# end
|
||||||
|
# assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||||
|
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
|
|||||||
@@ -116,7 +116,19 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
order = Order.find(order_id)
|
order = Order.find(order_id)
|
||||||
order_items = order.order_items
|
order_items = order.order_items
|
||||||
|
|
||||||
Order.pay_process_order_queue(order_id,table_id)
|
# Order.pay_process_order_queue(order_id,table_id)
|
||||||
|
# if order
|
||||||
|
# oqs = OrderQueueStation.new
|
||||||
|
# oqs.process_order(order, table_id)
|
||||||
|
# end
|
||||||
|
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||||
|
|
||||||
if table_id.to_i > 0
|
if table_id.to_i > 0
|
||||||
# get dining
|
# get dining
|
||||||
dining = DiningFacility.find(table_id)
|
dining = DiningFacility.find(table_id)
|
||||||
|
|||||||
@@ -317,9 +317,15 @@ class OrderReservation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
order_reservation = OrderReservation.where("status='new'")
|
order_reservation = OrderReservation.where("status='new'")
|
||||||
if order_reservation.length > 0
|
if order_reservation.length > 0
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
|
from = request.subdomain + "." + request.domain
|
||||||
end
|
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
# if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
# ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -332,9 +338,15 @@ class OrderReservation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
|
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
|
||||||
if order_reservation.length > 0
|
if order_reservation.length > 0
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
|
from = request.subdomain + "." + request.domain
|
||||||
end
|
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
# if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
# ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -347,9 +359,15 @@ class OrderReservation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
|
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
|
||||||
if order_reservation.length > 0
|
if order_reservation.length > 0
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
|
from = request.subdomain + "." + request.domain
|
||||||
end
|
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
# if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
# ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,9 @@ class Promotion < ApplicationRecord
|
|||||||
else
|
else
|
||||||
item = OrderItem.find_by_item_code(promo_product)
|
item = OrderItem.find_by_item_code(promo_product)
|
||||||
end
|
end
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion", item.price)
|
source = Order.find(item.order_id).source
|
||||||
|
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion", item.price,source)
|
||||||
|
|
||||||
puts "Charged - " + charge_qty.to_s
|
puts "Charged - " + charge_qty.to_s
|
||||||
puts "FOC - " + foc_qty.to_s
|
puts "FOC - " + foc_qty.to_s
|
||||||
@@ -150,10 +152,12 @@ class Promotion < ApplicationRecord
|
|||||||
promotion_qty = foc_qty
|
promotion_qty = foc_qty
|
||||||
end
|
end
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product)
|
item = OrderItem.find_by_item_instance_code(promo_product)
|
||||||
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price)
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price,source)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.update_existing_item(qty, item, sale_id, type, item_price)
|
|
||||||
|
def self.update_existing_item(qty, item, sale_id, type, item_price,source)
|
||||||
|
|
||||||
sale_item = SaleItem.new
|
sale_item = SaleItem.new
|
||||||
sale_item.product_code = item.item_code
|
sale_item.product_code = item.item_code
|
||||||
@@ -171,50 +175,54 @@ class Promotion < ApplicationRecord
|
|||||||
sale_item.sale_id = sale_id
|
sale_item.sale_id = sale_id
|
||||||
sale_item.save
|
sale_item.save
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount)
|
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount,nil,source)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||||
|
|
||||||
if same
|
if same
|
||||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off)
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
||||||
else
|
else
|
||||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off)
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.give_promotion_nett_price(same, promo_product, foc_min_qty, orderitem, sale_id)
|
def self.give_promotion_nett_price(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||||
|
|
||||||
if same
|
if same
|
||||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0]) # need to specify with menu item instance
|
item = OrderItem.find_by_item_instance_code(orderitem[0]) # need to specify with menu item instance
|
||||||
price = item.price.to_i - promo_product.net_price.to_i
|
price = item.price.to_i - promo_product.net_price.to_i
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
|
|
||||||
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price,source)
|
||||||
else
|
else
|
||||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||||
price = item.price - promo_product.net_price
|
price = item.price - promo_product.net_price
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price,source)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.give_promotion_discount(same, promo_product, foc_min_qty, orderitem, sale_id)
|
def self.give_promotion_discount(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||||
|
|
||||||
if same
|
if same
|
||||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
||||||
# total = orderitem[1].to_i * item.price
|
# total = orderitem[1].to_i * item.price
|
||||||
total = item.price
|
total = item.price
|
||||||
price = calculate_discount(total, promo_product.percentage)
|
price = calculate_discount(total, promo_product.percentage)
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion discount", price,source)
|
||||||
else
|
else
|
||||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||||
# give total qty is 1
|
# give total qty is 1
|
||||||
@@ -224,7 +232,8 @@ class Promotion < ApplicationRecord
|
|||||||
# total = item.price * foc_qty
|
# total = item.price * foc_qty
|
||||||
total = item.price
|
total = item.price
|
||||||
price = calculate_discount(total, promo_product.percentage)
|
price = calculate_discount(total, promo_product.percentage)
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
|
source = Order.find(item.order_id).source
|
||||||
|
update_existing_item(foc_qty, item, sale_id, "promotion discount", price,source)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -425,6 +425,7 @@ class Sale < ApplicationRecord
|
|||||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||||
customer = Customer.find(sale.customer_id)
|
customer = Customer.find(sale.customer_id)
|
||||||
# #Creat new tax records
|
# #Creat new tax records
|
||||||
|
|
||||||
if sale.payment_status != 'foc'
|
if sale.payment_status != 'foc'
|
||||||
tax_profiles.each do |tax|
|
tax_profiles.each do |tax|
|
||||||
# customer.tax_profiles.each do |cus_tax|
|
# customer.tax_profiles.each do |cus_tax|
|
||||||
@@ -456,28 +457,27 @@ class Sale < ApplicationRecord
|
|||||||
sale_tax.save
|
sale_tax.save
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sale_tax = SaleTax.new(:sale => sale)
|
sale_tax = SaleTax.new(:sale => sale)
|
||||||
sale_tax.tax_name = tax.name
|
sale_tax.tax_name = tax.name
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
|
|
||||||
# substract , to give after discount
|
# substract , to give after discount
|
||||||
total_tax = total_taxable - total_discount
|
total_tax = total_taxable - total_discount
|
||||||
#include or execulive
|
#include or execulive
|
||||||
if tax.inclusive
|
if tax.inclusive
|
||||||
rate = tax.rate
|
rate = tax.rate
|
||||||
divided_value = (100 + rate)/rate
|
divided_value = (100 + rate)/rate
|
||||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
else
|
else
|
||||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||||
end
|
end
|
||||||
#new taxable amount is standard rule for step by step
|
#new taxable amount is standard rule for step by step
|
||||||
if shop.calc_tax_order
|
if shop.calc_tax_order
|
||||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
end
|
end
|
||||||
|
sale_tax.inclusive = tax.inclusive
|
||||||
sale_tax.inclusive = tax.inclusive
|
sale_tax.save
|
||||||
sale_tax.save
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
@@ -2542,32 +2542,32 @@ end
|
|||||||
if current_user.nil?
|
if current_user.nil?
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
else
|
else
|
||||||
query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
else
|
else
|
||||||
query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
shift = ShiftSale.current_open_shift(current_user.id)
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
if !shift.nil?
|
if !shift.nil?
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
else
|
else
|
||||||
query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2575,19 +2575,19 @@ end
|
|||||||
else
|
else
|
||||||
if current_user.nil?
|
if current_user.nil?
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
else
|
else
|
||||||
shift = ShiftSale.current_open_shift(current_user.id)
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
if !shift.nil?
|
if !shift.nil?
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ? and sales.shift_sale_id=?",today,shift.id)
|
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ? and sales.shift_sale_id=?",today,shift.id)
|
||||||
.sum("a.qty")
|
.count()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2697,7 +2697,7 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.all_receipts
|
def self.all_receipts
|
||||||
query = Sale.select("sale_payments.created_at as receipt_close_time,
|
query = Sale.select("sales.*,sale_payments.created_at as receipt_close_time,
|
||||||
case when (sale_audits.action='SALEPAYMENT') then sale_audits.remark else 0 end as remark,
|
case when (sale_audits.action='SALEPAYMENT') then sale_audits.remark else 0 end as remark,
|
||||||
case when (sale_taxes.tax_name='Service Charges') then sale_taxes.tax_payable_amount else 0 end as service_charges,
|
case when (sale_taxes.tax_name='Service Charges') then sale_taxes.tax_payable_amount else 0 end as service_charges,
|
||||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||||
|
|||||||
@@ -609,7 +609,12 @@ class SalePayment < ApplicationRecord
|
|||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
# OrderBroadcastJob.perform_later(table,type)
|
# OrderBroadcastJob.perform_later(table,type)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
#if ENV["SERVER_MODE"] != 'cloud'
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -186,6 +186,51 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items,precision,delimiter)
|
def add_line_item_row(sale_items,precision,delimiter)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
show_price = Lookup.find_by_lookup_type("show_price").value
|
||||||
|
|
||||||
|
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||||
|
if item.status != 'Discount' && item.qty > 0
|
||||||
|
total_qty += item.qty
|
||||||
|
end
|
||||||
|
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
|
||||||
|
|
||||||
|
if !show_price.nil? && show_price.value.to_i>0
|
||||||
|
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||||
|
else
|
||||||
|
if item.price != 0
|
||||||
|
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down line_move
|
||||||
|
y_position = cursor
|
||||||
|
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_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 item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||||
|
|
||||||
if precision.to_i > 0
|
if precision.to_i > 0
|
||||||
item_name_width = (self.item_width+self.price_width)
|
item_name_width = (self.item_width+self.price_width)
|
||||||
item_qty_front_width = (self.item_width+self.price_width) + 5
|
item_qty_front_width = (self.item_width+self.price_width) + 5
|
||||||
@@ -199,58 +244,30 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
item_total_front_width = item_name_width + 5
|
item_total_front_width = item_name_width + 5
|
||||||
item_total_end_width = self.total_width + 4
|
item_total_end_width = self.total_width + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
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
|
|
||||||
if item.status != 'Discount' && item.qty > 0
|
|
||||||
total_qty += item.qty
|
|
||||||
end
|
|
||||||
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
|
|
||||||
|
|
||||||
|
pad_top(15) {
|
||||||
y_position = cursor
|
bounding_box([0,y_position], :width =>self.item_width) do
|
||||||
|
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||||
pad_top(15) {
|
end
|
||||||
bounding_box([0,y_position], :width =>self.item_width) do
|
|
||||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
|
||||||
end
|
|
||||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
|
||||||
if show_alt_name
|
if show_alt_name
|
||||||
if !(item.product_alt_name).empty?
|
if !(item.product_alt_name).empty?
|
||||||
move_down 2
|
move_down 2
|
||||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
text "(#{item.product_alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
text "(#{item.product_alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
move_down line_move
|
end
|
||||||
}
|
move_down line_move
|
||||||
end
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
|
||||||
|
|
||||||
move_down line_move
|
|
||||||
y_position = cursor
|
|
||||||
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
|
|
||||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
|
||||||
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
|
||||||
end
|
|
||||||
|
|
||||||
def all_total(sale_data,precision,delimiter)
|
def all_total(sale_data,precision,delimiter)
|
||||||
move_down line_move
|
move_down line_move
|
||||||
item_name_width = self.item_width
|
item_name_width = self.item_width
|
||||||
|
|||||||
@@ -180,6 +180,50 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items,precision,delimiter)
|
def add_line_item_row(sale_items,precision,delimiter)
|
||||||
|
|
||||||
|
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
|
||||||
|
show_price = Lookup.find_by_lookup_type("show_price")
|
||||||
|
|
||||||
|
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||||
|
if item.status != 'Discount' && item.qty > 0
|
||||||
|
total_qty += item.qty
|
||||||
|
end
|
||||||
|
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
|
||||||
|
|
||||||
|
if !show_price.nil? && show_price.value.to_i>0
|
||||||
|
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||||
|
else
|
||||||
|
if item.price != 0
|
||||||
|
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down line_move
|
||||||
|
y_position = cursor
|
||||||
|
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_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 item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||||
if precision.to_i > 0
|
if precision.to_i > 0
|
||||||
item_name_width = (self.item_width+self.price_width)
|
item_name_width = (self.item_width+self.price_width)
|
||||||
item_qty_front_width = (self.item_width+self.price_width) + 5
|
item_qty_front_width = (self.item_width+self.price_width) + 5
|
||||||
@@ -194,55 +238,27 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
item_total_end_width = self.total_width + 4
|
item_total_end_width = self.total_width + 4
|
||||||
end
|
end
|
||||||
y_position = cursor
|
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
|
|
||||||
if item.status != 'Discount' && item.qty > 0
|
|
||||||
total_qty += item.qty
|
|
||||||
end
|
|
||||||
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
|
|
||||||
|
|
||||||
y_position = cursor
|
pad_top(15) {
|
||||||
|
bounding_box([0,y_position], :width =>self.item_width) do
|
||||||
|
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||||
|
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
|
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
|
||||||
pad_top(15) {
|
if show_alt_name
|
||||||
bounding_box([0,y_position], :width =>self.item_width) do
|
if !(item.product_alt_name).empty?
|
||||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
move_down 2
|
||||||
end
|
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
text "(#{item.product_alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
|
||||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
|
||||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
|
||||||
|
|
||||||
if show_alt_name
|
|
||||||
if !(item.product_alt_name).empty?
|
|
||||||
move_down 2
|
|
||||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
|
||||||
text "(#{item.product_alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
move_down line_move
|
end
|
||||||
}
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
stroke_horizontal_rule
|
|
||||||
|
|
||||||
move_down line_move
|
move_down line_move
|
||||||
y_position = cursor
|
}
|
||||||
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
|
|
||||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
|
||||||
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
0
app/views/crm/customers/_card_read_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_card_read_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_crm_customer.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/_crm_customer.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_new_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_new_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/edit.html.erb
Executable file → Normal file
0
app/views/crm/customers/edit.html.erb
Executable file → Normal file
0
app/views/crm/customers/edit.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/edit.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/index.html.erb
Executable file → Normal file
0
app/views/crm/customers/index.html.erb
Executable file → Normal file
0
app/views/crm/customers/index.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/index.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/new.html.erb
Executable file → Normal file
0
app/views/crm/customers/new.html.erb
Executable file → Normal file
0
app/views/crm/customers/show.html.erb
Executable file → Normal file
0
app/views/crm/customers/show.html.erb
Executable file → Normal file
0
app/views/crm/customers/show.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/show.json.jbuilder
Executable file → Normal file
@@ -104,10 +104,12 @@ $(document).ready(function(){
|
|||||||
$('#qty-update').on('click', function(){
|
$('#qty-update').on('click', function(){
|
||||||
var qty_weight = $("input[name='qty_weight']").val();
|
var qty_weight = $("input[name='qty_weight']").val();
|
||||||
|
|
||||||
if(parseInt(qty_weight) > parseInt(original_value)){
|
if(parseInt(qty_weight) >= parseInt(original_value)){
|
||||||
swal("Alert!", "Not allowed over quantity", "warning");
|
swal("Alert!", "Not allowed over quantity", "warning");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var remarks = $("textarea[name='remarks']").val();
|
var remarks = $("textarea[name='remarks']").val();
|
||||||
var order_items_id = $(this).attr('data-id');
|
var order_items_id = $(this).attr('data-id');
|
||||||
|
|||||||
0
app/views/origami/customers/index.html.erb
Executable file → Normal file
0
app/views/origami/customers/index.html.erb
Executable file → Normal file
@@ -5,7 +5,13 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
|||||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||||
|
|
||||||
if (menu.menu_categories)
|
if (menu.menu_categories)
|
||||||
json.categories menu.menu_categories do |category|
|
order_by = Lookup.find_by_lookup_type("order_by")
|
||||||
|
if !order_by.nil? && order_by.value == "name"
|
||||||
|
categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
||||||
|
else
|
||||||
|
categories = menu.menu_categories
|
||||||
|
end
|
||||||
|
json.categories categories do |category|
|
||||||
|
|
||||||
menu_category = MenuCategory.find_by_menu_category_id(category.id)
|
menu_category = MenuCategory.find_by_menu_category_id(category.id)
|
||||||
if !menu_category.nil?
|
if !menu_category.nil?
|
||||||
@@ -25,10 +31,14 @@ if (menu.menu_categories)
|
|||||||
json.parent_id category.menu_category_id
|
json.parent_id category.menu_category_id
|
||||||
json.is_available category.is_available
|
json.is_available category.is_available
|
||||||
|
|
||||||
|
if !order_by.nil? && order_by.value == "name"
|
||||||
|
menu_items = MenuItem.unscoped.where("menu_category_id = ?",category.id).order("name asc")
|
||||||
|
else
|
||||||
|
menu_items = category.menu_items
|
||||||
|
end
|
||||||
|
|
||||||
if category.menu_items
|
if category.menu_items
|
||||||
json.items category.menu_items do |item|
|
json.items menu_items do |item|
|
||||||
if item.is_available
|
if item.is_available
|
||||||
json.partial! 'origami/addorders/menu_item', item: item
|
json.partial! 'origami/addorders/menu_item', item: item
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -113,6 +113,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
|
<div class="m-r-20" align="right">
|
||||||
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- customer light box -->
|
<!-- customer light box -->
|
||||||
@@ -256,6 +262,7 @@
|
|||||||
getCardNo();
|
getCardNo();
|
||||||
$("#sxModal").hide();
|
$("#sxModal").hide();
|
||||||
customer_mamber_card_no = $("#paypar_account_no").val();
|
customer_mamber_card_no = $("#paypar_account_no").val();
|
||||||
|
|
||||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -429,7 +436,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#sxModal .btn_cancel").on('click',function(){
|
$(".btn_cancel").on('click',function(){
|
||||||
$("#sxModal").hide();
|
$("#sxModal").hide();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -108,6 +108,13 @@
|
|||||||
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
|
<div class="m-r-20" align="right">
|
||||||
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- customer light box -->
|
<!-- customer light box -->
|
||||||
|
|||||||
@@ -601,10 +601,11 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$("#back").on('click', function() {
|
$("#back").on('click', function() {
|
||||||
localStorage.removeItem('cash');
|
localStorage.removeItem('cash');
|
||||||
customer_display_view(null,"reload");
|
customer_display_view(null,"reload");
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami/table/'+ dining_id;
|
window.location.href = '/origami/table/'+ dining_id;
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/quick_service';
|
window.location.href = '/origami/quick_service/pending_order/'+sale_id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@
|
|||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<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" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
<% if current_user.role != "waiter" || @status != "sale"%>
|
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
<button type="button" id="addorder" class="btn bg-blue btn-block">Update Order</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
<!-- <% if @status != "order"%>
|
<!-- <% if @status != "order"%>
|
||||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||||
@@ -215,10 +215,11 @@ $(document).ready(function(){
|
|||||||
$('#addorder').on('click', function () {
|
$('#addorder').on('click', function () {
|
||||||
var table_id = "<%=@table_id%>";
|
var table_id = "<%=@table_id%>";
|
||||||
var booking_id = "<%=@bookings.booking_id%>";
|
var booking_id = "<%=@bookings.booking_id%>";
|
||||||
|
var sale_id = $("#sale_id").val();
|
||||||
if (table_id) {
|
if (table_id) {
|
||||||
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+$('#sale_id').val();
|
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+sale_id;
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/quick_service/modify_order/'+ booking_id+"/" +$('#sale_id').val();
|
window.location.href = '/origami/quick_service/modify_order/'+ booking_id+"/" +sale_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -213,7 +213,6 @@
|
|||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
|
|
||||||
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
|
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<% if current_login_employee.role == "cashier" %>
|
||||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
@@ -224,6 +223,30 @@
|
|||||||
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
|
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||||
@@ -344,7 +367,6 @@ $(document).on('click', '.access_modal', function(event){
|
|||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
|
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
|
||||||
// var ajax_url = "/origami/sale/" + sale_id + '/void';
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="container margin-top-20">
|
<div class="container margin-top-20">
|
||||||
<div class="card row">
|
<div class="card row">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@@ -50,3 +57,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card ">
|
<div class="card ">
|
||||||
<% unless @sale_data.blank? %>
|
<% unless @sale_data.blank? %>
|
||||||
@@ -38,3 +44,5 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
||||||
|
|
||||||
@@ -147,4 +153,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
@@ -129,4 +135,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
@@ -108,4 +115,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
@@ -81,4 +88,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
@@ -103,4 +109,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
@@ -223,4 +230,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
@@ -105,4 +112,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="container margin-top-20">
|
<div class="container margin-top-20">
|
||||||
<div class="card row">
|
<div class="card row">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@@ -50,3 +57,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
@@ -63,4 +69,6 @@
|
|||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
@@ -80,4 +87,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -24,7 +24,7 @@ test:
|
|||||||
# instead read values from the environment.
|
# instead read values from the environment.
|
||||||
production:
|
production:
|
||||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||||
sx_provision_url: connect.pos-myanmar.com/api #192.168.1.147:3002/api
|
sx_provision_url: connect.smartsales.asia/api #192.168.1.147:3002/api
|
||||||
server_mode: application
|
server_mode: application
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
|
|||||||
@@ -2,13 +2,11 @@ class CreateDisplayImages < ActiveRecord::Migration[5.1]
|
|||||||
def change
|
def change
|
||||||
create_table :display_images do |t|
|
create_table :display_images do |t|
|
||||||
t.integer :shop_id
|
t.integer :shop_id
|
||||||
|
t.string :name
|
||||||
t.binary :image
|
t.binary :image
|
||||||
t.string :created_by
|
t.string :created_by
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
|
||||||
drop_table :display_images
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -3,11 +3,11 @@ namespace :consolidate do
|
|||||||
task :receipt => :environment do
|
task :receipt => :environment do
|
||||||
# Receipt.delete_all
|
# Receipt.delete_all
|
||||||
sales = Sale.all_receipts
|
sales = Sale.all_receipts
|
||||||
puts sales.to_json
|
|
||||||
shop = Shop.find(1)
|
shop = Shop.find(1)
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
puts sale.to_json
|
|
||||||
shift = ShiftSale.find(sale.shift_sale_id)
|
if sale.shift_sale_id.present?
|
||||||
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
receipt = Receipt.new
|
receipt = Receipt.new
|
||||||
receipt.client_code = shop.client_code
|
receipt.client_code = shop.client_code
|
||||||
receipt.client_name = shop.client_name
|
receipt.client_name = shop.client_name
|
||||||
@@ -48,6 +48,7 @@ puts sales.to_json
|
|||||||
receipt.cancle = (sale.payment_status=="void") ? false : true # void is cancel
|
receipt.cancle = (sale.payment_status=="void") ? false : true # void is cancel
|
||||||
receipt.remarks = sale.remark
|
receipt.remarks = sale.remark
|
||||||
receipt.save
|
receipt.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -68,10 +69,10 @@ puts sales.to_json
|
|||||||
@item_sequence = 1
|
@item_sequence = 1
|
||||||
sale_count = sales.to_a.count
|
sale_count = sales.to_a.count
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
|
|
||||||
if sale.qty > 0
|
if sale.qty > 0
|
||||||
|
|
||||||
if sale.item_instance_code !=nil
|
if sale.item_instance_code !=nil
|
||||||
|
byebug
|
||||||
menu_category = MenuCategory.find(MenuItem.find_by_item_code(sale.product_code).menu_category_id)
|
menu_category = MenuCategory.find(MenuItem.find_by_item_code(sale.product_code).menu_category_id)
|
||||||
name = menu_category.name
|
name = menu_category.name
|
||||||
code = menu_category.code
|
code = menu_category.code
|
||||||
@@ -90,7 +91,9 @@ puts sales.to_json
|
|||||||
|
|
||||||
@receipt_no = sale.receipt_no
|
@receipt_no = sale.receipt_no
|
||||||
@requested_at = sale.requested_at
|
@requested_at = sale.requested_at
|
||||||
|
if @receipt_no == '20171130-10464'
|
||||||
|
byebug
|
||||||
|
end
|
||||||
if sale_id == sale.sale_id || count == 0 || @z ==0
|
if sale_id == sale.sale_id || count == 0 || @z ==0
|
||||||
@total_qty += sale.qty
|
@total_qty += sale.qty
|
||||||
@total_gross_sales += sale.price
|
@total_gross_sales += sale.price
|
||||||
@@ -109,14 +112,14 @@ puts sales.to_json
|
|||||||
receipt.receipt_date = @requested_at #requet-at
|
receipt.receipt_date = @requested_at #requet-at
|
||||||
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
||||||
receipt.item_sequence = @item_sequence
|
receipt.item_sequence = @item_sequence
|
||||||
receipt.category_code = ''
|
receipt.category_code = sale.product_code
|
||||||
receipt.category_name = ''
|
receipt.category_name = sale.product_name
|
||||||
receipt.sub_category_code = 0
|
receipt.sub_category_code = 0
|
||||||
receipt.sub_category_name = 0
|
receipt.sub_category_name = 0
|
||||||
receipt.report_group_code = 0
|
receipt.report_group_code = 0
|
||||||
receipt.report_group_name = 0
|
receipt.report_group_name = 0
|
||||||
receipt.item_code = ''
|
receipt.item_code = (sale.product_code.to_s=="NULL") ? "0" : sale.product_code
|
||||||
receipt.item_name = ''
|
receipt.item_name = sale.product_name
|
||||||
receipt.qty = @total_qty
|
receipt.qty = @total_qty
|
||||||
receipt.transaction_type = "Tender"
|
receipt.transaction_type = "Tender"
|
||||||
receipt.gross_sales = @total_gross_sales
|
receipt.gross_sales = @total_gross_sales
|
||||||
@@ -158,14 +161,14 @@ puts sales.to_json
|
|||||||
receipt.receipt_date = sale.requested_at #requet-at
|
receipt.receipt_date = sale.requested_at #requet-at
|
||||||
receipt.transaction_date = sale.requested_at #before disco/after tax /after/ser_char
|
receipt.transaction_date = sale.requested_at #before disco/after tax /after/ser_char
|
||||||
receipt.item_sequence = @item_sequence
|
receipt.item_sequence = @item_sequence
|
||||||
receipt.category_code = name
|
receipt.category_code = sale.product_code
|
||||||
receipt.category_name = code
|
receipt.category_name = sale.product_name
|
||||||
receipt.sub_category_code = 0
|
receipt.sub_category_code = 0
|
||||||
receipt.sub_category_name = 0
|
receipt.sub_category_name = 0
|
||||||
receipt.report_group_code = 0
|
receipt.report_group_code = 0
|
||||||
receipt.report_group_name = 0
|
receipt.report_group_name = 0
|
||||||
receipt.item_code = menu_name
|
receipt.item_code = (menu_code.to_s=="NULL") ? "0" : sale.product_code
|
||||||
receipt.item_name = menu_code
|
receipt.item_name = menu_name
|
||||||
receipt.qty = sale.qty
|
receipt.qty = sale.qty
|
||||||
receipt.transaction_type = (sale.status==nil) ? "Sales" : sale.status
|
receipt.transaction_type = (sale.status==nil) ? "Sales" : sale.status
|
||||||
receipt.gross_sales = sale.price
|
receipt.gross_sales = sale.price
|
||||||
@@ -208,14 +211,14 @@ puts sales.to_json
|
|||||||
receipt.receipt_date = @requested_at #requet-at
|
receipt.receipt_date = @requested_at #requet-at
|
||||||
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
||||||
receipt.item_sequence = @item_sequence
|
receipt.item_sequence = @item_sequence
|
||||||
receipt.category_code = ''
|
receipt.category_code = sale.product_code
|
||||||
receipt.category_name = ''
|
receipt.category_name = sale.product_name
|
||||||
receipt.sub_category_code = 0
|
receipt.sub_category_code = 0
|
||||||
receipt.sub_category_name = 0
|
receipt.sub_category_name = 0
|
||||||
receipt.report_group_code = 0
|
receipt.report_group_code = 0
|
||||||
receipt.report_group_name = 0
|
receipt.report_group_name = 0
|
||||||
receipt.item_code = ''
|
receipt.item_code = (menu_code.to_s=="NULL") ? "0" : sale.product_code
|
||||||
receipt.item_name = ''
|
receipt.item_name = menu_name
|
||||||
receipt.qty = @total_qty
|
receipt.qty = @total_qty
|
||||||
receipt.transaction_type = "Tender"
|
receipt.transaction_type = "Tender"
|
||||||
receipt.gross_sales = @total_gross_sales
|
receipt.gross_sales = @total_gross_sales
|
||||||
|
|||||||
5
spec/models/display_image_spec.rb
Normal file
5
spec/models/display_image_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe DisplayImage, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user