Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into sqa-1804-001

This commit is contained in:
phyusin
2018-05-10 12:40:11 +06:30
34 changed files with 1378 additions and 939 deletions

View File

@@ -1,7 +1,9 @@
$(function() {
var role = $('#role').val();
localStorage.removeItem("menus")
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
//click menu sidebar menu category
$(".product").on("click", function(){
var url = $(this).attr('data-ref');
@@ -62,8 +64,8 @@ $(function() {
+JSON.stringify(item_attributes)+"' data-id = '"
+JSON.stringify(item_attributes)+"' data-item = '"
+JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
+JSON.stringify(product[field].options)+"'data-opt = '"
+JSON.stringify(product[field].options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons'>"
+'view_list</i>'
@@ -76,8 +78,8 @@ $(function() {
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"'>"
+ JSON.stringify(product[field].options) +"' data-opt = '"
+ JSON.stringify(product[field].options) +"' data-image='"+image_path+"'>"
// +"<div class='card-block custom-card-block'>"
// +"<img id='logo' height='125px' src='"+image_path+"'>"
@@ -96,8 +98,8 @@ $(function() {
}
//end show list function
//click menu sidebar menu category
$('.menu_category').on("click", function(){
// event.preventDefault();
$(document).on('click', '.menu_category', function(e){
e.preventDefault();
$('.sub_category_list').addClass("hidden");
var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id;
@@ -105,7 +107,7 @@ $(function() {
var sub_id = $(this).attr("data-sub-id");
if (sub_id == "true") {
var sub_url = "get_menu_sub_category/"+menu_id;
sub_category = $(this).find('.sub_category_list');
sub_category = $(this).siblings('.sub_category_list');
show_sub_category_list(sub_url,sub_category,menu_id);
}
});
@@ -113,9 +115,11 @@ $(function() {
//click menu sidebar menu category
$(document).on('click', '.menu_sub_category', function(event){
event.preventDefault();
// event.preventDefault();
// $(".menu_sub_category").on("click", function(){
$('.sub_category_list').addClass("hidden");
var menu_id = $(this).attr("data-id");
console.log(menu_id);
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url,menu_id);
});
@@ -133,117 +137,6 @@ $(function() {
for(var ii in categories) {
if (categories[ii]["id"] == menu_id) {
var menu_items = categories[ii]["items"];
// for(var field in menu_items) {
// if (menu_items[field].is_sub_item == false) {
// instances = menu_items[field].instances ;
// if (!instances.length > 0) {
// swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
// }
// if (instances.length > 0) {
// qty = 1;
// options = [];
// price = 0;
// if (JSON.stringify(menu_items[field].item_sets)!='[]') {
// fa_plus = '';
// add = '';
// menu_item_box = 'add_icon';
// data_target = 'sx_item_set_detailModal';
// data_modal = 'modal'
// add_icon = "set_item_box"
// code = menu_items[field].code;
// name = menu_items[field].name;
// instances = menu_items[field].instances;
// $(instances).each(function(i){
// if (instances[i].is_default == true) {
// price = parseFloat(instances[i].price).toFixed(2);
// }else{
// price = 0;
// }
// });
// is_available = menu_items[field].is_available ;
// is_on_promotion = 0;
// item_attributes = menu_items[field].attributes;
// promotion_price = menu_items[field].promotion_price;
// }else{
// fa_plus = 'material-icons';
// add = 'view_list'
// menu_item_box = 'menu_item_box';
// data_target = 'sx_item_detailModal';
// data_modal = ''
// add_icon = "add_icon"
// $(instances).each(function(i){
// if (instances[i].is_default === true) {
// code = instances[i].code;
// name = instances[i].name;
// price = parseFloat(instances[i].price).toFixed(2);
// is_available = instances[i].is_available ;
// is_on_promotion = instances[i].is_on_promotion;
// item_attributes = instances[i].values;
// promotion_price = instances[i].promotion_price;
// code = instances[i].code;
// }
// });
// }
// if (menu_items[field].image) {
// if (modify_order) {
// image_path = "../../"+menu_items[field].image;
// }else{
// image_path = menu_items[field].image;
// }
// }else{
// if (modify_order) {
// image_path = "../../image/logo.png";
// }else{
// image_path = "image/logo.png";
// }
// }
// row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
// +'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
// +'<div class="col-md-9">'+ menu_items[field].name +'</div>'
// +"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
// + menu_items[field].code +"' data-instance = '"
// +JSON.stringify(menu_items[field].instances)+"' data-id = '"
// +JSON.stringify(menu_items[field].attributes)+"' data-item = '"
// +JSON.stringify(item_attributes)+"' data-option = '"
// +JSON.stringify(menu_items[field].options)+"'data-opt = '"
// +JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
// +JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
// +"<i class='fa "+fa_plus+" '>"
// +add+ '</i>'
// +'</div>'
// +'</div>'
// +"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
// + menu_items[field].code +"' data-name='"
// + menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
// + price +"' data-instance-code = '"+ code +"' data-instance = '"
// + name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
// + JSON.stringify(item_attributes) +"' data-options = '"
// + JSON.stringify(menu_items[field].options) +"' data-opt = '"
// + JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
// +data_modal+"' data-target='."+data_target+"' data-item-sets = '"
// +JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
// +JSON.stringify(menu_items[field].instances)+"'>"
// // +"<div class='card-block custom-card-block'>"
// // +"<img id='logo' height='' src='"+image_path+"'>"
// // +"</div>"
// +'<div class="card-footer custom-card-footer" style="opacity:0.7">'
// +'<span>'+ price +'</span>'
// +'</div>'
// +'</div>';
// $('.menu_items_list').append(row);
// }
// //end instances in menu-items alest 1 instance
// }
// //end is_sub_item false
// }
show_menu_list(menu_items);
}
}
@@ -273,117 +166,6 @@ $(function() {
menu_items_list.empty();
menu_items = data.menu_items;
show_menu_list(menu_items);
// for(var field in menu_items) {
// if (menu_items[field].is_sub_item == false) {
// instances = menu_items[field].instances ;
// if (!instances.length > 0) {
// swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
// }
// if (instances.length > 0) {
// qty = 1;
// options = [];
// price = 0;
// if (JSON.stringify(menu_items[field].item_sets)!='[]') {
// fa_plus = '';
// add = '';
// menu_item_box = 'add_icon';
// data_target = 'sx_item_set_detailModal';
// data_modal = 'modal'
// add_icon = "set_item_box"
// code = menu_items[field].code;
// name = menu_items[field].name;
// instances = menu_items[field].instances;
// $(instances).each(function(i){
// if (instances[i].is_default == true) {
// price = parseFloat(instances[i].price).toFixed(2);
// }else{
// price = 0;
// }
// });
// is_available = menu_items[field].is_available ;
// is_on_promotion = 0;
// item_attributes = menu_items[field].attributes;
// promotion_price = menu_items[field].promotion_price;
// }else{
// fa_plus = 'material-icons';
// add = 'view_list'
// menu_item_box = 'menu_item_box';
// data_target = 'sx_item_detailModal';
// data_modal = ''
// add_icon = "add_icon"
// $(instances).each(function(i){
// if (instances[i].is_default === true) {
// code = instances[i].code;
// name = instances[i].name;
// price = parseFloat(instances[i].price).toFixed(2);
// is_available = instances[i].is_available ;
// is_on_promotion = instances[i].is_on_promotion;
// item_attributes = instances[i].values;
// promotion_price = instances[i].promotion_price;
// code = instances[i].code;
// }
// });
// }
// if (menu_items[field].image) {
// if (modify_order) {
// image_path = "../../"+menu_items[field].image;
// }else{
// image_path = menu_items[field].image;
// }
// }else{
// if (modify_order) {
// image_path = "../../image/logo.png";
// }else{
// image_path = "image/logo.png";
// }
// }
// row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
// +'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
// +'<div class="col-md-9">'+ menu_items[field].name +'</div>'
// +"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
// + menu_items[field].code +"' data-instance = '"
// +JSON.stringify(menu_items[field].instances)+"' data-id = '"
// +JSON.stringify(menu_items[field].attributes)+"' data-item = '"
// +JSON.stringify(item_attributes)+"' data-option = '"
// +JSON.stringify(menu_items[field].options)+"'data-opt = '"
// +JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
// +JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
// +"<i class='fa "+fa_plus+" '>"
// +add+ '</i>'
// +'</div>'
// +'</div>'
// +"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
// + menu_items[field].code +"' data-name='"
// + menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
// + price +"' data-instance-code = '"+ code +"' data-instance = '"
// + name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
// + JSON.stringify(item_attributes) +"' data-options = '"
// + JSON.stringify(menu_items[field].options) +"' data-opt = '"
// + JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
// +data_modal+"' data-target='."+data_target+"' data-item-sets = '"
// +JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
// +JSON.stringify(menu_items[field].instances)+"'>"
// // +"<div class='card-block custom-card-block'>"
// // +"<img id='logo' height='' src='"+image_path+"'>"
// // +"</div>"
// +'<div class="card-footer custom-card-footer" style="opacity:0.7">'
// +'<span>'+ price +'</span>'
// +'</div>'
// +'</div>';
// $('.menu_items_list').append(row);
// }
// //end instances in menu-items alest 1 instance
// }
// //end is_sub_item false
// }
}
});
//end Ajax
@@ -409,22 +191,26 @@ show_menu_list(menu_items);
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
value = item_sets[field]["instances"];
$(value).each(function(i){
$(value).each(function(i){
menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
for(var i in menus) {
var categories = menus[i]["categories"];
for(var j in menus) {
var categories = menus[j]["categories"];
for(var ii in categories) {
var items = categories[ii]["items"];
for(var iii in items) {
var result = items[iii]["instances"];
for(var iv in result) {
if (value[i]["id"] == result[iv]["id"]) {
for(var v in result) {
if (value[i]["id"] == result[v]["id"]) {
console.log("ssssssss")
row = '<div class="col-md-4 " >'
+"<div class='card custom-card instance_box' data-name='"+result[iv]["name"]
+"' data-code='"+result[iv]["code"]
+"' data-price='"+result[iv]["price"]
+"<div class='card custom-card instance_box' data-name='"+result[v]["name"]
+"' data-code='"+result[v]["code"]
+"' data-price='"+result[v]["price"]
+"' data-option='"+JSON.stringify(items[iii]["options"])
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
@@ -433,14 +219,14 @@ show_menu_list(menu_items);
+"' data-sub-item='true"
+"'>"
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<span class="">'+result[iv]["name"]+'</span>'
+'<span class="">'+result[v]["name"]+'</span>'
+'</div>'
+'<div class="card-block custom-card-block">'
+'<img id="" src="/image/logo.png" height="40px">'
+' <small style="float:" id="instance_option"></small>'
+'</div>'
+'<div class="card-footer custom-card-footer">'
+' <span>'+result[iv]["price"]+'</span>'
+' <span>'+result[v]["price"]+'</span>'
// +' <small style="float:right" id="instance_option"></small>'
+'</div>'
+'</div>'
@@ -452,6 +238,8 @@ show_menu_list(menu_items);
}
}
}else{
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
url = '../../../addorders/get_item_instance/'+value[i]["id"];
console.log("ssssssss")
@@ -1376,7 +1164,6 @@ show_menu_list(menu_items);
$(".keypress_qty").on('keyup change', function (){
// $('.keypress_qty').keyup(function(e){
id = $(this).attr('id');
value = $(this).val();
@@ -1430,10 +1217,6 @@ show_menu_list(menu_items);
var categories = menus[j]["categories"];
for(var ii in categories) {
if (menu_id == categories[ii]["parent_id"]) {
console.log("parrrrrrrrrrrrrrrrr");
console.log(categories[ii]["parent_id"]);
console.log(menu_id);
$(sub_category).removeClass('hidden');
row = '<li class="menu_sub_category fadeInTop" data-id="'+categories[ii].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ categories[ii].name+'</a>'
@@ -1469,7 +1252,7 @@ show_menu_list(menu_items);
// }
for(var i in data) {
row = '<li class="menu_category fadeInTop" data-id="'+data[i].id+'">'
row = '<li class="menu_sub_category fadeInTop" data-id="'+data[i].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
+'</li>' ;
$(sub_category).append(row);

View File

@@ -19,13 +19,12 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
// alert(order_lists);
swal({
html: true,
title: 'Information',
target: document.getElementById('notify_new_order'),
text: "You have new orders. <br/>"+
target: document.getElementById("notify_new_order"),
text: "You have new orders <br/>"+
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
type: 'success',
timer: 1000,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
@@ -34,6 +33,8 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
swal.close();
}
});
// $("#notify_new_order_lists").text(order_lists);
// $("#notify_new_order").modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -19,13 +19,12 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
// alert(order_lists);
swal({
html: true,
title: 'Information',
target: document.getElementById('notify_order_ready_to_delivery'),
text: "You have orders that are ready to deliver. <br/>"+
target: document.getElementById("notify_order_ready_to_delivery"),
text: "You have orders that are ready to deliver <br/>"+
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
type: 'success',
timer: 1000,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
@@ -34,6 +33,8 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
swal.close();
}
});
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
// $("#notify_order_ready_to_delivery").modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -19,13 +19,12 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
// alert(order_lists);
swal({
html: true,
title: 'Information',
target: document.getElementById('notify_order_send_to_kitchen'),
text: "You have to send order to kitchen. <br/>"+
target: document.getElementById("notify_order_send_to_kitchen"),
text: "You have to send order to kitchen <br/>"+
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
type: 'success',
timer: 1000,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
@@ -34,6 +33,8 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
swal.close();
}
});
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
// $("#notify_order_send_to_kitchen").modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -17,7 +17,7 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
var rowCount = key+1;
var date = new Date(value.created_at);
var time = timeFormat(date);
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+date.getDate());
var created_at = date.getFullYear() +'-'+ (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >=10?date.getDate() : '0'+date.getDate());
var delivery_type = "";
if(value.delivery_type == "service"){

View File

@@ -2,6 +2,9 @@
$(function() {
$("#discount").hide();
$(".expected_time").hide();
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(function() {
$('.first-1').click();
});
@@ -11,6 +14,9 @@ $(function() {
$(".nav-item").on("click", function(){
type = $(this).attr("data-type");
refreshDetailData();
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("ACCEPT");
@@ -24,9 +30,14 @@ $(function() {
$('#accepted').text("READY TO DELIVERY");
$('#accepted').attr("data-value","delivery");
}else if(type == "completed"){
// $('#cancel').hide();
$(".fourth-1").click();
$('#accepted').text("PICK-UP");
$('#accepted').text("COMPLETE");
$('#accepted').attr("data-value","completed");
}else if(type == "processed"){
$(".fifth-1").click();
// $('#accepted').hide();
// $('#cancel').hide();
}
// console.log(type);
});
@@ -36,7 +47,6 @@ $(function() {
$("#status").text($(this).attr("data-value"));
var requested_time = $("#requested_date_time").text();
$("#requested_order_time").text(requested_time);
showTimePicker(requested_time);
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
}else{
var status = $(this).attr("data-value");
@@ -48,38 +58,117 @@ $(function() {
});
$("#cancel").on("click", function(){
var status = $(this).attr("data-value");
var order_status = $("#order_status").text();
$("#status").text($(this).attr("data-value"));
if(order_status!="new" && order_status!= "accepted" && order_status!="send_to_kitchen"){
$("#AccessCodeModal").modal({show: true, backdrop: false, keyboard: false});
}else{
$("#rejected_reasonModal").modal({show: true, backdrop: false, keyboard: false});
}
});
$(".send_status").on("click",function(){
$("#reject_reasonErr").html("");
if($('#reject_reason').val() != ""){
var order_status = $("#order_status").text();
var status = $("#status").text();
var order_id = $('#order_id').text();
var callback = $('#callback_url').text();
var ref_no = $('#ref_no').text();
callback_url(callback,ref_no,order_id,status);
var reason = "";
var approved_code = $("#approved_code").text();
if(order_status == 'ready_to_delivery'){
reason = "VOID || " + $('#reject_reason').val();
}else{
reason = $('#reject_reason').val();
}
callback_url(callback,ref_no,order_id,status,"","","",reason,approved_code);
}else{
$("#reject_reasonErr").html("This is required field");
}
});
$("#save").on("click",function(){
$("#waiting_timeErr").text("");
$(".timer_type").on("click",function(){
if($(this).hasClass("selected-item")){
$(this).removeClass("selected-item");
}else{
$(this).addClass("selected-item");
}
});
$(".time_interval").on("click",function(){
var type = '';
if($(".timer_type").hasClass("selected-item")){
type = 'after';
}
var minutes = $(this).attr("data-value");
// console.log(type);
// console.log($(this).attr("data-value"));
var status = $("#status").text();
var order_id = $('#order_id').text();
var ref_no = $('#ref_no').text();
var callback = $('#callback_url').text();
var requested_time = new Date($("#requested_date_time").text());
var date_time = requested_time.getFullYear()+'-'+(requested_time.getMonth() > 10? requested_time.getMonth() : '0'+ (requested_time.getMonth() + 1))+'-'+(requested_time.getDate()> 10? requested_time.getDate() : '0' + requested_time.getDate());
var waiting_time = new Date(date_time+' '+$("#waiting_time").val());
// requested_time.setHours(requested_time.getHours() - 1);
// var requested_time = new Date($("#requested_date_time").text());
// if(type == 'after'){
// requested_time.setMinutes(requested_time.getMinutes() + minutes);
// }else{
// requested_time.setMinutes(requested_time.getMinutes() - minutes);
// }
// console.log(requested_time);
// console.log(date_time);
if(waiting_time.getTime() < requested_time.getTime()){
var time_diff = (requested_time.getTime() - waiting_time.getTime());
var expected_time = (Math.floor(time_diff) / 1000) / 60;
callback_url(callback,ref_no,order_id,status,type,minutes);
});
$(document).on('click','.access_number', function(event){
if(event.handled !== true) {
var original_value = $('#access_code').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value){
$('#access_code').val(original_value + input_value);
}else{
var time_diff = (waiting_time.getTime() - requested_time.getTime());
var expected_time = (Math.floor(time_diff) / 1000) / 60;
// $("#waiting_time").val("");
// $("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
$('#access_code').val(original_value + input_value);
}
break;
case 'ok':
var type = $(this).attr("data-action");
code = $('#access_code').val();
check_emp_access_code(code,type)
break;
case 'clr':
$('#access_code').val("");
break;
}
event.handled = true;
} else {
return false;
}
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
});
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
// createAccessCode(code);
$("#approved_code").text(code);
$('#AccessCodeModal').modal('hide');
$("#rejected_reasonModal").modal({show: true, backdrop: false, keyboard: false});
}else{
swal("Opps",result.message,"warning")
}
}
});
}
function customTableClick(){
$(".custom-table .custom-tr").on("click", function(){
$(".custom-tr").removeClass("tr-active");
@@ -96,6 +185,7 @@ function refreshDetailData(){
$("#sr_number").text("");
$("#delivery_info").text("");
$("#contact_info").text("");
$("#invoice_no").text("");
$('.summary-items').html("");
$('#sub_total').text("0.00");
$('#delivery_fee').text("0.00");
@@ -116,20 +206,31 @@ function show_order_detail(url,sr_no){
dataType: "json",
success: function(data) {
// console.log(data);
$(".tbl_customer").show();
if(data.status != "delivered"){
$('#accepted').show();
if(data.status != "ready_to_delivery" && data.status != "send_to_kitchen"){
$('#cancel').show();
}
}else{
$('#accepted').hide();
$('#cancel').hide();
}
var delivery = data["delivery"];
var items = data["order_items"];
var item_list = $('.summary-items');
var newDate = new Date(data.requested_time);
var time = timeFormat(newDate);
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
// var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
var expDate = new Date(data.expected_waiting_time);
var exptime = timeFormat(expDate);
var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() > 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() > 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
// var expDate = new Date(data.expected_waiting_time);
// var exptime = timeFormat(expDate);
// var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() >= 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() >= 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
$('.expected_time').show();
$('#expected_time').text(expected_time? expected_time : '');
$('#expected_time').text(data.expected_waiting_time? data.expected_waiting_time : '');
}else{
$('.expected_time').hide();
$('#expected_time').text('');
@@ -160,7 +261,8 @@ function show_order_detail(url,sr_no){
$("#discount").show();
}
$('#requested_date_time').text(requested_date);
//customer info detail
// $('#requested_date_time').text(requested_date);
$('#sub_total').text(data.total_amount);
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
@@ -184,6 +286,7 @@ function show_order_detail(url,sr_no){
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
$("#trans_ref").text(data.transaction_ref);
if(delivery.delivery_type == "service"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "pick_up"){
@@ -197,11 +300,22 @@ function show_order_detail(url,sr_no){
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
$("#order_remark").text(data.reservation_remark);
}
$("#sr_number").text("NO."+sr_no);
if (data["receipt_no"]) {
$("#contact_info").text(data["receipt_no"]);
if(data.remark!=null && data.remark!=""){
var doemal_remark = data.remark.split("||");
var remark = doemal_remark[0] +", "+ doemal_remark[1];
$("#remark").text(remark);
}else{
$("#contact_info").text(data["order_reservation_id"]);
$("#remark").text("");
}
//no and order id info
$("#sr_number").text("NO."+sr_no);
$("#order_status").text(data.status);
if (data["receipt_no"]) {
$("#invoice_no").text(data["receipt_no"]);
}else{
$("#invoice_no").text(data["order_reservation_id"]);
}
}
@@ -211,40 +325,42 @@ function show_order_detail(url,sr_no){
//end Ajax
}
function showTimePicker(requested_time){
// var date = new Date(requested_time);
// var time = timeFormat(date);
// console.log(time);
$('.timepicker').bootstrapMaterialDatePicker({
format: 'HH:mm',
useSeconds: false,
clearButton: true,
date: false
});
}
function callback_url(callback,ref_no,order_id,status,time,exptime){
function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){
var url = 'order_reservation/update';
var post_url = "order_reservation/send_status";
var waiting_time = "";
var expected_time = "";
var type = "";
var reject_reason = "";
var access_code = "";
if(time!=undefined && time!=""){
waiting_time = time;
}
var expected_time = "";
if(exptime!=undefined && exptime!=""){
expected_time = exptime;
}
if(min_type!=undefined && min_type!=""){
type = min_type;
}
if(reason!=undefined && reason!=""){
reject_reason = reason;
}
if(approved_code!=undefined && approved_code!=""){
access_code = approved_code;
}
$.ajax({
type: "POST",
url: post_url,
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason},
dataType: "json",
success: function(data) {
if(data.status){
$.ajax({
type: "POST",
url: url,
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
data: {order_id: order_id, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
dataType: "json",
success: function(data) {
if (data.status) {
@@ -293,7 +409,14 @@ function showNewOrder(order_reservation){
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
var date = new Date(order_reservation.requested_time);
var time = timeFormat(date);
var requested_date = date.getFullYear() + '-' + (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() > 10? date.getDate() : '0' + date.getDate()) +' '+time;
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
//audio play
var audio = new Audio('/beep.wav'); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
swal({
html: true,
title: 'Information',
@@ -305,3 +428,13 @@ function showNewOrder(order_reservation){
});
}
}
function getOrderMonth(month){
var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"];
return MONTHS[month];
}
function getOrderDay(day){
var DAYS = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
return DAYS[day];
}

View File

@@ -6,14 +6,18 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
def check_customer
customer_id = 0
status = false
if !params[:name]
render :json => { :status => false, :message => "name is required!" }
elsif !params[:email]
render :json => { :status => false, :message => "email is required!" }
elsif !params[:membership_id]
render :json => { :status => false, :message => "membership_id is required!" }
else
status = true
end
if status
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
if !check_customer.nil?
customer_id = check_customer.customer_id
@@ -21,9 +25,9 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
customer = Customer.addCustomer(params)
customer_id = customer.id
end
render :json => { :status => true, :data => { :customer_id => customer_id} }
end
end
def create
status = false
@@ -71,4 +75,42 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
end
end
end
def update_status
order_reservation_id = params[:id]
status = params[:status]
remark = params[:remark]
if params[:status] && params[:remark]
reason = status +"||"+remark
order_reservation = OrderReservation.find(order_reservation_id)
if status == 'REMOVE'
if order_reservation.status == "new" || order_reservation.status == "accepted"
OrderReservation.update_order_reservation(order_reservation_id, nil, "rejected",nil,remark)
result = {:status=> true, :message => "rejected" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't remove!" }
end
elsif status == 'FOC'
if order_reservation.status == "new" || order_reservation.status == "accepted" || order_reservation.status == "send_to_kitchen"
OrderReservation.update_order_reservation(order_reservation_id, nil, nil,nil,reason)
result = {:status=> true, :message => "FOC successfully" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't get FOC!" }
end
elsif status == 'VOID'
if order_reservation.status == "ready_to_delivery"
OrderReservation.update_order_reservation(order_reservation_id, nil, nil,nil,reason)
result = {:status=> true, :message => "VOID successfully" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't VOID!" }
end
end
else
result = { :status => false, :order_reservation_id => order_reservation_id, :message => "status and remark is required!" }
end
render :json => result
end
end

View File

@@ -220,8 +220,12 @@ class Api::OrdersController < Api::ApiController
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
if !assigned_items.nil?
assigned_items.each do |assign_item|
# order queue stations
oqs = assigned_item.order_queue_station
oqs = assign_item.order_queue_station
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
@@ -248,6 +252,8 @@ class Api::OrdersController < Api::ApiController
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end
end
end
return return_json_status_with_code(200, "updated successfully!")
else

View File

@@ -18,14 +18,17 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
end
# if params[:menus].present?
# @menus = JSON.parse(params[:menus], object_class: OpenStruct)
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# else
puts params[:menu]
puts "sssssssssssssssssssssssssss"
if params[:menus].present?
@menus = JSON.parse(params[:menus], object_class: OpenStruct)
@menu = JSON.parse(params[:category], object_class: OpenStruct)
puts @menus.to_json
puts @menu.to_json
else
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
end
@table_id = params[:id]
@table = DiningFacility.find(@table_id)

View File

@@ -1,19 +1,25 @@
class Origami::OrderReservationController < BaseOrigamiController
def index
puts Time.now.utc
@order = OrderReservation.latest_order #.active
@count_on_order = OrderReservation.get_count_on_order
@count_on_completed = OrderReservation.get_count_on_completed
end
def update
@id = params[:order_id]
@status = params[:status]
min_type = params[:min_type]
if min_type != ""
expected_waiting_time = params[:expected_time]
else
expected_waiting_time = min_type + " " +params[:expected_time]
end
remark = params[:remark]
access_code = params[:access_code]
@order_reservation = OrderReservation.find(@id)
status = true
if status
if @status == "processed"
result = OrderReservation.create_doemal_order(@order_reservation,current_user)
elsif @status == "delivery"
@@ -23,8 +29,8 @@ class Origami::OrderReservationController < BaseOrigamiController
elsif @status == "completed"
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
else
if @status == "cancel"
OrderReservation.update_order_reservation(@id, nil, "cancelled")
if @status == "rejected"
OrderReservation.update_order_reservation(@id, nil, "rejected",nil,remark,access_code,current_user)
result = {:status=> true, :message => "rejected" }
else
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
@@ -32,10 +38,6 @@ class Origami::OrderReservationController < BaseOrigamiController
end
end
render :json => result.to_json
else
result = {:status=> false, :message => "Order not accepted !" }
render :json => result.to_json
end
end
def get_order
@@ -46,13 +48,7 @@ class Origami::OrderReservationController < BaseOrigamiController
end
def send_status
if params[:status] == "cancel"
status = "rejected"
else
status = params[:status]
end
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
render :json => response
end

View File

@@ -50,10 +50,13 @@ class Origami::SaleEditController < BaseOrigamiController
end
end
end
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
# FOr Sale Audit
action_by = current_user.name
if access_code.present?
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"SALEITEMVOID" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMVOID" )
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
@@ -84,10 +87,12 @@ class Origami::SaleEditController < BaseOrigamiController
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id)
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
action_by = current_user.name
if access_code.present?
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"SALEITEMFOC" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
@@ -126,10 +131,12 @@ class Origami::SaleEditController < BaseOrigamiController
saleitemObj.unit_price = update_price
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
action_by = current_user.name
if access_code.present?
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Update Qty #{update_qty} Price [#{saleitemObj.price}]| Receipt No #{sale.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, approved_by.name,remark,"SALEITEMEDIT" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, action_by,remark,"SALEITEMEDIT" )
# saleitemObj.remark = 'edit'
unless saleitemObj.product_name.include? 'updated'
@@ -177,10 +184,12 @@ class Origami::SaleEditController < BaseOrigamiController
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id)
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
action_by = current_user.name
if access_code.present?
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"ITEMCANCELVOID" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source)
ProductCommission.remove_product_commission(saleitemObj)

View File

@@ -72,9 +72,12 @@ class Origami::VoidController < BaseOrigamiController
# FOr Sale Audit
action_by = current_user.name
approved_by = Employee.find_by_emp_id(access_code)
if access_code.present?
action_by = Employee.find_by_emp_id(access_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,"SALEVOID" )
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
# For Print

View File

@@ -1,7 +1,7 @@
class Reports::OrderReservationController < BaseReportController
# authorize_resource :class => false
def index
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
@providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
from, to = get_date_range_from_params
@@ -17,8 +17,9 @@ class Reports::OrderReservationController < BaseReportController
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
payment_type = params[:payment_type]
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
provider = params[:provider]
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider)
@from = from
@to = to
# get printer info
@@ -40,7 +41,7 @@ class Reports::OrderReservationController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -195,7 +195,9 @@ class Settings::MenusController < ApplicationController
# end
end
file_path = "public/menus/" + menu.name + ".xlsx"
directory_name = "public/menus"
Dir.mkdir(directory_name) unless File.exists?(directory_name)
file_path = directory_name +"/" + menu.name + ".xlsx"
p.serialize(file_path)
render :json => { status: true, path: file_path }
end

View File

@@ -30,7 +30,7 @@ class OrderReservation < ApplicationRecord
order_reservation.payment_type = order_reserve[:payment_info][:payment_type]
order_reservation.payment_status = order_reserve[:payment_info][:payment_status]
order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref]
order_reservation.taxes = order_reserve[:payment_info][:taxes]
order_reservation.taxes = order_reserve[:payment_info][:taxes].to_json
order_reservation.total_amount = order_reserve[:payment_info][:sub_total]
order_reservation.total_tax = order_reserve[:payment_info][:total_tax]
order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount]
@@ -40,7 +40,7 @@ class OrderReservation < ApplicationRecord
end
if order_reserve[:reservation_info]
order_reservation.total_customer = order_reserve[:reservation_info][:total_user]
order_reservation.reservation_remark = order_reserve[:reservation_info][:reservation_note]
order_reservation.order_remark = order_reserve[:reservation_info][:reservation_note]
end
order_reservation.save!
if order_reserve[:order_info][:items]
@@ -102,7 +102,7 @@ class OrderReservation < ApplicationRecord
#order reservation status updated
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "created" }
result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
return result
end
end
@@ -138,7 +138,7 @@ class OrderReservation < ApplicationRecord
end
end
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil)
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil,min_type=nil,reason=nil)
base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation")
@@ -158,7 +158,9 @@ class OrderReservation < ApplicationRecord
post_url = base_url + url
if !waiting_time.nil?
send_params = {id: ref_no, waiting_time: waiting_time, status: status}
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
elsif !reason.nil?
send_params = {id: ref_no, status: status, reason: reason}
else
send_params = {id: ref_no, status: status}
end
@@ -185,20 +187,77 @@ class OrderReservation < ApplicationRecord
return response
end
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil)
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil, remark=nil, access_code=nil, current_user=nil)
order_reservation = OrderReservation.find(id)
if sale_id.present?
order_reservation.sale_id = sale_id
end
if !expected_waiting_time.nil?
order_reservation.expected_waiting_time = DateTime.parse(expected_waiting_time).utc
order_reservation.expected_waiting_time = expected_waiting_time
end
if !status.nil?
order_reservation.status = status
end
if !remark.nil?
order_reservation.order_remark = remark
end
if status == "delivered"
order_reservation.payment_status = "paid"
end
order_reservation.save
# if !order_reservation.sale_id.nil? && status == "rejected"
# void_doemal_payment(order_reservation.sale_id, remark, access_code, current_user)
# end
end
def self.void_doemal_payment(sale_id, remark, access_code, current_user)
if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id)
# update count for shift sale
if(sale.sale_status == "completed")
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.calculate(sale_id, "void")
end
else
# void before sale payment complete
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.total_void = shift.total_void + sale.grand_total
shift.save
end
end
sale.payment_status = 'void'
sale.sale_status = 'void'
sale.save
# FOr Sale Audit
action_by = current_user.name
approved_by = Employee.find_by_emp_id(access_code)
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,"SALEVOID" )
# update complete order items in oqs
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
aoi.delivery_status = 1
aoi.save
end
end
end
end
def self.get_count_on_order
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status").group("status")
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status")
.where("status != 'delivered'")
.group("status")
end
def self.get_count_on_completed
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count")
.where("created_at BETWEEN '#{DateTime.now.beginning_of_day}' AND '#{DateTime.now.end_of_day}' AND status = 'delivered'").first()
end
def self.get_pending_orders
@@ -218,8 +277,7 @@ class OrderReservation < ApplicationRecord
end
def self.check_order_send_to_kitchen
today = Time.now.utc
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}' and expected_waiting_time < '#{today}'")
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
@@ -228,8 +286,7 @@ class OrderReservation < ApplicationRecord
end
def self.check_order_ready_to_delivery
today = Time.now.utc
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}' and expected_waiting_time < '#{today}'")
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
@@ -237,6 +294,36 @@ class OrderReservation < ApplicationRecord
end
end
def self.get_order_reservation_by_shift(shift_sale_range,shift,from,to,provider)
## => left join -> show all sales although no orders
if provider.blank?
provider = ''
else
if provider.present?
provider = " and deliveries.provider = '#{provider}'"
end
end
query = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee, customers.name, customers.email")
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
.joins(" JOIN customers on customers.customer_id = order_reservations.customer_id")
.joins(" JOIN sales on sales.sale_id = order_reservations.sale_id")
if shift.present?
query = query.where("sales.shift_sale_id in (?) #{provider} and sales.sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
elsif shift_sale_range.present?
query = query.where("sales.sale_status='completed' #{provider} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
else
query = query.where("sales.sale_status='completed' and sales.receipt_date between ? and ? #{provider} and sale_payments.payment_amount != 0",from,to)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
end
return query
end
private
def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")

View File

@@ -430,6 +430,8 @@ class Sale < ApplicationRecord
# customer.tax_profiles.each do |cus_tax|
# if cus_tax.to_i == tax.id
if tax.group_type.to_s == order_source.to_s
if customer.customer_type.downcase == 'takeaway'
if tax.name.downcase == 'commercial tax'
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
@@ -453,6 +455,31 @@ class Sale < ApplicationRecord
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
else
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
# substract , to give after discount
total_tax = total_taxable - total_discount
#include or execulive
if tax.inclusive
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
#new taxable amount is standard rule for step by step
if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount
end
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
end
# end
# end
end
@@ -484,6 +511,8 @@ class Sale < ApplicationRecord
# customer.tax_profiles.each do |cus_tax|
# if cus_tax.to_i == tax.id
if tax.group_type.to_s == order_source.to_s
if customer.customer_type.downcase == 'takeaway'
if tax.name.downcase == 'commercial tax'
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
@@ -508,6 +537,32 @@ class Sale < ApplicationRecord
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
else
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
# substract , to give after discount
total_tax = total_taxable - self.total_discount
#include or execulive
if tax.inclusive
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
#new taxable amount is standard rule for step by step
if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount
end
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
end
# end
# end
end

View File

@@ -132,6 +132,9 @@
<li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li>
<li>
<a href="<%= reports_order_reservation_index_path %>">Order Reservation</a>
</li>
<li>
<a href="<%= reports_receipt_no_index_path %>">Receipt</a>
</li>

View File

@@ -5,29 +5,16 @@
<% type = request.path_info.include?('quick_service')%>
<% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid " style="padding:">
<div class="container-fluid ">
<div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div>
</div>
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;">
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
</a>
<ul class="dropdown-menu menu_list" style="width:90%">
<% @menus.each do |menu| %>
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>">
<a class="nav-link" data-toggle="tab" href="" role="tab"><%=menu.name%></a>
</li>
<%end%>
</ul> -->
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
<li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
<!-- <i class="material-icons material-icons m-l-50 p-r-30">arrow_drop_down</i> -->
</a>
<ul class="ml-menu menu_list aria-hidden " style="border-top: 1px solid #fff">
<% @menus.each do |menu| %>
@@ -51,9 +38,9 @@
<li class="nav-item">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a>
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
@@ -63,18 +50,18 @@
<li class="nav-item ">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<% else %>
<li class="nav-item ">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- end quick_service or cashier for table -->
@@ -85,6 +72,26 @@
</ul>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_cache">
<li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
</a>
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
</ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
</ul>
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
<div class="card">
<div class="card-block" style="">
@@ -175,10 +182,12 @@
<div class="col-md-5 col-lg-5 col-sm-5">Table : </div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"></p>
<p class="hidden" id="table_get_current"></p>
<% else%>
<div class="col-md-5 col-lg-5 col-sm-5">Table : <%=@table.name%></div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
<% end%>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
@@ -199,8 +208,6 @@
</button>
</div>
<% end%>
</div>
<% else %>
<div class="row ">
@@ -212,6 +219,7 @@
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear
@@ -527,12 +535,74 @@
-webkit-animation-duration: 350ms !important;
}
</style>
<script>
jQuery(function(){
id = "<%=@menu[0].id%>";
jQuery('.first_'+id).click();
});
$(document).ready(function () {
var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
$("#menu_cache").removeClass("hidden");
$(".menu_cache_name").text(menus[0]["name"])
for(var i in menus) {
menu_list_template(menus[i]);
}
var category = menus[0]["categories"];
for(var ii in category) {
// <li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
// <a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
// </li>
if (category[ii]["valid_time"]== true){
if (category[ii]["parent_id"] == null ){
if(type){
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}
}else{
if ($("#table_get_current").text()) {
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}else {
category_list_template(category[ii]);
}
}
}
}
}
}
}else{
$("#menu_data").removeClass("hidden");
}
function category_list_template(menu) {
row = '<li class="nav-item">'
+'<p class="hidden menu-id">'+menu.id+'</p> '
+'<a class="nav-link menu_category sub_click first_'+menu.id+'" '
+'data-toggle="tab" href="" role="tab" data-id="'+menu.id+'" '
+'data-sub-id="'+menu.sub_category+'">'+menu.name+''
+'</a>'
+'<ul class="sub_category_list hidden fadeInTop animated" '
+'id="sub_category_list">'
+'</ul>'
+' </li>';
$(".category_cache_list").append(row);
}
function menu_list_template(menu) {
row = '<li class="nav-item menu_click" data-name="'+menu.name+'" '
+' data-id="'+menu.id+'" style="">'
+' <a class="nav-link" data-toggle="tab" href="" role="tab"'
+' style="text-transform: lowercase;">'+menu.name+'</a>'
+'</li>';
$(".menu_cache_list").append(row);
}
$(".tables").on('click', function () {
$('.tables').css('background-color','');
$('.tables').removeClass('purple')
@@ -545,6 +615,7 @@
$('.confirm_table').attr("data-name",name)
$('.confirm_table').attr("data-type",type)
});
$(".confirm_table").on('click', function () {
var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
@@ -641,7 +712,6 @@
$('#modal-qty').attr('data-value',input_value);
// update_total_amount();
}else{
console.log("aaaaaaaaaa")
$('#modal-qty').val(original_qty + input_value);
$('#modal-qty').attr('data-value',original_qty + input_value);
// update_total_amount();

View File

@@ -6,6 +6,16 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories)
json.categories menu.menu_categories do |category|
menu_category = MenuCategory.find_by_menu_category_id(category.id)
if !menu_category.nil?
json.sub_category "true"
else
json.sub_category "false"
end
valid_time = category.valid_time
json.valid_time valid_time
json.id category.id
json.code category.code
json.order_by category.order_by
@@ -15,6 +25,8 @@ if (menu.menu_categories)
json.parent_id category.menu_category_id
json.is_available category.is_available
if category.menu_items
json.items category.menu_items do |item|
json.partial! 'origami/addorders/menu_item', item: item

View File

@@ -208,7 +208,6 @@
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script>
$(function() {
localStorage.removeItem("menus");
$.ajax({
type: "GET",
url: 'get_all_menu',

View File

@@ -142,7 +142,6 @@ $(document).ready(function(){
var webview = <%= @webview %>;
showHideNavbar(webview,"index");
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;

View File

@@ -1010,26 +1010,6 @@
$('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>";
// var menus = JSON.parse(localStorage.getItem("menus"));
// var menu_arr = [];
// if (menus != null) {
// for(var i in menus) {
// var arr = {};
// arr.id = menus[i]["id"];
// arr.name = menus[i]["name"];
// menu_arr.push(arr);
// }
// }
// menu_arr = JSON.stringify(menu_arr);
// console.log(menu_arr)
// $.ajax({
// type: 'POST',
// data: {menus: menu_arr},
// url: '/origami/addorders/' + dining_id,
// success: function(data) {
// }
// });
window.location.href = '/origami/addorders/' + dining_id;
});

View File

@@ -4,7 +4,7 @@ if @order
:requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
:discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
:reservation_remark,:sale_id)
:remark,:sale_id)
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
if @delivery
json.delivery do |json|

View File

@@ -1,48 +1,65 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid">
<!-- start count function -->
<%
pending_count = 0
accepted_count = 0
delivered_count = 0
completed_count = 0
processed_count = 0
%>
<% if !@count_on_order.nil?
@count_on_order.each do |count_order|
if count_order.status == "new"
pending_count = count_order.count
elsif count_order.status == "accepted"
accepted_count = count_order.count
elsif count_order.status == "send_to_kitchen"
delivered_count = count_order.count
elsif count_order.status == "ready_to_delivery"
completed_count = count_order.count
end
end
end
if !@count_on_completed.nil?
processed_count = @count_on_completed.count
end
%>
<!-- end count function -->
<div class="row m-t--10">
<div class="col-lg-4 col-md-4 col-sm-4 div_order_margin">
<div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item red m-b-10" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "new" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :pending %></a>
<a class="nav-link" data-toggle="tab" href="#pending" role="tab">
<p class="num p-t-10">
<%= pending_count %>
</p> <%= t :pending %></a>
</li>
<li class="nav-item purple m-b-10" data-color="#673AB7" data-type="processing">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "accepted" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :processing %></a>
<a class="nav-link" data-toggle="tab" href="#processing" role="tab">
<p class="num p-t-10">
<%= accepted_count %>
</p> <%= t :processing %></a>
</li>
<li class="nav-item m-b-10" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "send_to_kitchen" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :delivering %></a>
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab">
<p class="num p-t-10">
<%= delivered_count %>
</p> <%= t :delivering %></a>
</li>
<li class="nav-item m-b-10" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "ready_to_delivery" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :completed %></a>
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">
<p class="num p-t-10">
<%= completed_count %>
</p> <%= t :completed %></a>
</li>
<li class="nav-item m-b-10" data-color="#5bc0de" data-type="processed" style="background-color: #5bc0de;">
<a class="nav-link" data-toggle="tab" href="#processed" role="tab">
<p class="num p-t-10">
<%= processed_count %>
</p> <%= t :processed %></a>
</li>
</ul>
@@ -215,6 +232,48 @@
</div>
</div>
</div>
<!--- Panel 5 - processed -->
<div class="tab-pane dining" id="processed" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<% i=1
@order.each do |order| %>
<% if order.status == 'delivered' && (order.created_at.utc.getlocal.strftime("%Y-%m-%d") == DateTime.now.strftime("%Y-%m-%d")) %>
<tr class="custom-tr fifth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %>
PICK-UP
<% else %>
DIRECT DELIVERY
<% end %>
</span>
</td>
</tr>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -230,7 +289,11 @@
<td width="40%" class="header-td align-left">
<b><span class="font-15" id="requested_date_time"></span></b>
</td>
<td width ="50%" class="header-td font- align-right"><b><span id="contact_info"></span></b></td>
<td width ="50%" class="header-td align-right">
<b><span id="invoice_no"></span></b>
<span id="order_status" class="hidden"></span>
<span id="approved_code" class="hidden"></span>
</td>
</tr>
</table>
</div>
@@ -296,8 +359,8 @@
</tr>
<tr>
<td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
<strong>DECLINE</strong>
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="rejected">
<strong>REJECT</strong>
</button>
</td>
<td width ="50%" class="footer-td align-right col-blue">
@@ -321,7 +384,7 @@
</div>
</div>
<div class="'col-lg-4 col-md-4 col-sm-4'" style="margin:0px -5px 0px -2px !important ">
<div class="'col-lg-3 col-md-3 col-sm-3'" style="margin:0px -5px 0px -2px !important ">
<div class="card" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
@@ -331,13 +394,13 @@
</tr>
</table>
</div>
<div class="card-block">
<table class="table">
<div class="card-block" style="height: 520px">
<table class="table tbl_customer">
<tbody>
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
<span class="font-13">REF.</span><br>
<b id="trans_ref"></b>
</td>
<td class="body-td align-right">
<span class="font-13">REQUESTED TIME</span><br>
@@ -346,12 +409,18 @@
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b id="phone"></b>
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
</td>
<td class="body-td align-right expected_time">
<span class="font-13">EXPECTED TIME</span><br>
<b id="expected_time"></b>
<span class="font-13">COOKING TIME</span><br>
<b><span id="expected_time"></span> MINS</b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b id="phone"></b>
</td>
</tr>
<tr>
@@ -372,11 +441,20 @@
<b id="order_remark"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<b><i><span id="remark"></span></i></b>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div>
</div>
<p id="ref_no" class="hidden"></p>
@@ -391,26 +469,171 @@
<h4 class="modal-title" id="waiting_timeModalLabel">Expected Waiting Time for <span id="requested_order_time"></span></h4>
</div>
<div class="modal-body">
<input type="text" id="waiting_time" name="waiting_time" value="" class="timepicker form-control" placeholder="Expected Waiting Time">
<span id="waiting_timeErr" style="color:red;"></span>
<div class="row text-center m-t-20">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info timer_type" data-value="after">After</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="15">15 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="30">30 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="45">45 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="60">60 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="75">75 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="90">90 Mins.</button>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="save" active="true">SAVE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="rejected_reasonModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="rejected_reasonLabel">Reason</h4>
</div>
<div class="modal-body">
<div class="form-group">
<textarea id="reject_reason" name="reject_reason" class="form-control" rows="3" cols="30"></textarea>
<span id="reject_reasonErr" style="color:red"></span>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect send_status">SEND</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="modal fade " id="notify_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_new_orderLabel">You have new orders</h4>
</div>
<div class="modal-body notify_new_orderBody">
<div class="form-group text-center">
Are you accept or reject for these orders <b><span id="notify_new_order_lists"></span></b>?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div>
<div class="modal fade " id="notify_order_send_to_kitchen" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="notify_order_send_to_kitchenLabel">You have to send order to kitchen</h4>
</div>
<div class="modal-body notify_order_send_to_kitchenBody">
<div class="form-group text-center">
Could you send these orders <b><span id="notify_order_send_to_kitchen_lists"></span></b> to kitchen?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade " id="notify_order_ready_to_delivery" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="notify_order_ready_to_deliveryLabel">You have orders that are ready to deliver</h4>
</div>
<div class="modal-body notify_order_ready_to_deliveryBody">
<div class="form-group text-center">
Could you ready these orders <b><span id="notify_order_ready_to_delivery_lists"></span></b> to deliver?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div> -->
</div>

View File

@@ -281,6 +281,7 @@ var access_code = localStorage.getItem("access_code");
})*/
$('#action').on('click', function () {
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type');
var remark = $("#remark").val();

View File

@@ -18,10 +18,10 @@
<option value="9">Last year</option>
</select>
</div>
<% if defined? payments %>
<% if defined? providers %>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
<label class="font-14"><%= t("views.right_panel.detail.select_providers") %></label>
<%= select_tag "provider", options_for_select(@providers, :selected => params[:provider]), :class => "form-control" %>
</div>
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2">
@@ -49,37 +49,6 @@
</div>
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
<% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> '
@@ -91,38 +60,4 @@
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
// shift = $(".shift-id").text()
// if (shift.length>0) {
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
// }
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.order_reservation_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
@@ -12,14 +12,14 @@
<!-- <div class="container"> -->
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
:locals=>{ :period_type => true, :shift_name => true,:providers => true, :report_path =>reports_order_reservation_index_path} %>
<hr />
<!-- </div> -->
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
<a href="javascript:export_to('<%=reports_order_reservation_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div>
<!-- </div> -->
<!-- </div> -->
@@ -28,33 +28,34 @@
<div class="card">
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</th>
</tr>
</thead>
<tbody>
@@ -68,76 +69,92 @@
delimiter = ","
else
delimiter = ""
end %>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
total_discount_amount = 0
total_delivery_fee = 0
total_convenience_charge = 0
total_delivery_tax = 0
total_convenience_tax = 0
total_commercial_tax = 0
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
puts precision
puts "predelidm"
puts delimiter %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
end
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
else
provider = order_reservation.provider
end
%>
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= number_with_precision(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
</tr>
<% end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<%end%>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td colspan="6"></td>
<td><b><%= number_with_precision(total_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
</tr>
<%end%>
</tbody>
</table>
</div>
@@ -151,9 +168,7 @@
var check_arr = [];
search_by_period();
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
@@ -216,7 +231,7 @@
from = $("#from").val();
to = $("#to").val();
}
url = '<%= reports_get_shift_by_date_path %>';
url = '<%= reports_get_shift_by_order_reservation_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){

View File

@@ -6,98 +6,124 @@
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</th>
</tr>
</thead>
<tbody>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<%
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
total_discount_amount = 0
total_delivery_fee = 0
total_convenience_charge = 0
total_delivery_tax = 0
total_convenience_tax = 0
total_commercial_tax = 0
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
else
provider = order_reservation.provider
end
%>
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= order_reservation.total_amount rescue '0.0'%></td>
<td><%= discount_amount rescue '0.0'%></td>
<td><%= delivery_fee rescue '0.0'%></td>
<td><%= convenience_charge rescue '0.0'%></td>
<td><%= delivery_tax rescue '0.0'%></td>
<td><%= convenience_tax rescue '0.0'%></td>
<td><%= commercial_tax rescue '0.0'%></td>
<td><%= order_reservation.total_tax rescue '0.0'%></td>
<td><%= order_reservation.grand_total rescue '0.0' %></td>
</tr>
<% end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= result.total_amount rescue '-' %></td>
<td><%= result.total_discount rescue '-' %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td>0.0</td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= tax.tax_payable_amount rescue '-' %></td>
<%end%>
<td><%= result.grand_total %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
<td colspan="6"></td>
<td><b><%= total_amount rescue '0.0'%></b></td>
<td><b><%= total_discount_amount rescue '0.0'%></b></td>
<td><b><%= total_delivery_fee rescue '0.0'%></b></td>
<td><b><%= total_convenience_charge rescue '0.0'%></b></td>
<td><b><%= total_delivery_tax rescue '0.0'%></b></td>
<td><b><%= total_convenience_tax rescue '0.0'%></b></td>
<td><b><%= total_commercial_tax rescue '0.0'%></b></td>
<td><b><%= total_tax rescue '0.0'%></b></td>
<td><b><%= grand_total rescue '0.0'%></b></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= total_sum rescue '-'%></b></td>
<td><b><%= discount_amt rescue '-'%></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= tax.st_amount.round(2) %></b></td>
<% end %>
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
<td><b><%= rounding_adj rescue '-'%></b></td>
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
</tr>
<%end%>
</tbody>
</table>
</div>

View File

@@ -5,42 +5,65 @@
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% @sale_data.each do |sale| %>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% @sale_data.each do |sale| %>
<% if !receipt_arr.include?(sale.receipt_no) %>
<thead>
<td>&nbsp;</td>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% receipt_arr.push(sale.receipt_no) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% end %>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tbody>
<% if !sale.item_instance_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
<% if !menu_cat_arr.include?(sale.name) %>
<td><%= sale.name %></td>
<% menu_cat_arr.push(sale.name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.product_name %></td>
<td><%= sale.product_code %></td>
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
</tr>
<% end %>
<% end %>
<% count = count + 1 %>
<% if sale.sale_items.count == count %>
<tr>
<td></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
@@ -49,6 +72,8 @@
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
</tbody>
<% end %>
</table>

View File

@@ -79,6 +79,7 @@ en:
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
processed: "Processed"
views:
btn:
@@ -435,7 +436,7 @@ en:
item: "Item"
revenue: "Revenue"
total_price_by: "Total Price By"
sub_total: "Sub Total"
sub_totalိိ: "Sub Total"
cash_received: "Cash Received"
card_sales: "Card Sales"
select_payments: "Select Payments"
@@ -470,6 +471,15 @@ en:
adult: "Adult"
foreigner: "Foreigner"
local: "Local"
order_reservation_report: "Order Reservation"
requested_time: "Requested Time"
provider: "Provider"
delivery_fee: "Delivery Fee"
delivery_tax: "Delivery Tax"
convenience_charge: "Convenience Charge"
convenience_tax: "Convenience Tax"
commercial_tax: "Commercial Tax"
select_providers: "Select Providers"
code_txt: "code "
charge_txt: "charge"

View File

@@ -74,6 +74,7 @@ mm:
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
processed: "Processed"
views:
btn:
@@ -464,6 +465,15 @@ mm:
adult: "လူကြီး"
foreigner: "နိုင်ငံခြားသား"
local: "နိုင်ငံသား"
order_reservation_report: "ၾကိဳတင္ order မွာယူျခင္း"
requested_time: "Requested Time"
provider: "Provider"
delivery_fee: "Delivery Fee"
delivery_tax: "Delivery Tax"
convenience_charge: "Convenience Charge"
convenience_tax: "Convenience Tax"
commercial_tax: "Commercial Tax"
select_providers: "Select Providers"
code_txt: "ကုတ်ဒ် "
charge_txt: "ကောက်ခံသည်"

View File

@@ -88,6 +88,7 @@ scope "(:locale)", locale: /en|mm/ do
namespace :order_reserve do
post "customer" => "order_reservation#check_customer"
post "order" => "order_reservation#create"
post "callback/:id" => "order_reservation#update_status"
end
end
@@ -238,7 +239,7 @@ scope "(:locale)", locale: /en|mm/ do
get '/addorders/get_menu_sub_category/:id' => "addorders#get_menu_sub_category",:as => "get_menu_sub_category", :defaults => { :format => 'json' }
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
get '/:addorders/:id' => "addorders#detail"
# match '/:addorders/:id' => "addorders#detail", via: [:post, :get]
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
@@ -446,6 +447,7 @@ scope "(:locale)", locale: /en|mm/ do
resources :order_reservation, :only => [:index, :show]
get "saleitem/get_shift_by_date", to: "saleitem#show", as: "get_shift_by_sale_item"
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
get "order_reservation/get_shift_by_date", to: "order_reservation#show", as: "get_shift_by_order_reservation"
end

View File

@@ -865,6 +865,12 @@ value ('All', 'All', 'smtp.transport', 'smtps', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.user', 'postmaster@smartsales.asia', now(), 'admin', now());
insert into sym_notification (notification_id, node_group_id, external_id, severity_level, type, expression, enabled, create_time, last_update_by, last_update_time)
value ('notify_info', 'ALL', 'ALL', 100, 'email', 'info@connect.smartsales.asia', 1, now(), 'admin', now());
insert into sym_notification (notification_id, node_group_id, external_id, severity_level, type, expression, enabled, create_time, last_update_by, last_update_time)
value ('notify_severe', 'ALL', 'ALL', 300, 'email', 'info@connect.smartsales.asia', 1, now(), 'admin', now());
### End of Batch Monitoring ####

BIN
public/beep.wav Normal file

Binary file not shown.