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