changed in server master
This commit is contained in:
@@ -18,3 +18,5 @@
|
|||||||
//= require cable
|
//= require cable
|
||||||
//= require jquery-ui
|
//= require jquery-ui
|
||||||
//= require bootstrap-datepicker
|
//= require bootstrap-datepicker
|
||||||
|
//= require bootstrap/modal
|
||||||
|
|
||||||
|
|||||||
@@ -18,27 +18,51 @@
|
|||||||
//= require cable
|
//= require cable
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
// auto refresh every 10 seconds
|
// auto refresh every 10 seconds
|
||||||
// setTimeout(function(){
|
// setTimeout(function(){
|
||||||
// window.location.reload(1);
|
// window.location.reload(1);
|
||||||
// }, 10000);
|
// }, 10000);
|
||||||
|
|
||||||
$('.queue_station').on('click',function(){
|
$('.queue_station').on('click',function(){
|
||||||
var orderZone=$(this).children().children().children('.order-zone').text();
|
var orderZone=$(this).children().children().children('.order-zone').text().trim();
|
||||||
var orderItem=$(this).children().children().children('.order-item').text();
|
// var orderItem=$(this).children().children().children('.order-item').text();
|
||||||
var orderQty=$(this).children().children().children('.order-qty').text();
|
//var assigned_item_id = $(this).children().find(".assigned-order-item").text();
|
||||||
var orderBy=$(this).children().children().children().children('.order-by').text();
|
var orderQty = $(this).children().children().children('.order-qty').text();
|
||||||
var orderAt=$(this).children().children().children().children('.order-at').text();
|
var orderBy = $(this).children().children().children().children('.order-by').text();
|
||||||
var orderCustomer=$(this).children().children('.order-customer').text();
|
var orderAt = $(this).children().children().children().children('.order-at').text();
|
||||||
|
var orderCustomer = $(this).children().children('.order-customer').text();
|
||||||
|
var order_status = $(this).children().children('.order-status').text();
|
||||||
|
|
||||||
$('#order-title').text("ORDER DETAILS - " + orderZone);
|
$('#order-title').text("ORDER DETAILS - " + orderZone);
|
||||||
$('#order-by').text(orderBy);
|
$('#order-by').text(orderBy);
|
||||||
$('#order-at').text(orderAt);
|
$('#order-at').text(orderAt);
|
||||||
$('#order-customer').text(orderCustomer);
|
$('#order-customer').text(orderCustomer);
|
||||||
$('#order-from').text(orderZone);
|
$('#order-from').text(orderZone);
|
||||||
|
// clear order items
|
||||||
|
$("#oqs-order-details-table").children("tbody").empty();
|
||||||
|
|
||||||
$('#order-items').text(orderItem);
|
// Call get_order_items() for Order Items by dining
|
||||||
$('#order-qty').text(orderQty);
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: '/oqs/' + orderZone,
|
||||||
|
data: { 'status' : order_status },
|
||||||
|
success: function(res){
|
||||||
|
for (i = 0; i < res.length; i++) {
|
||||||
|
var data = JSON.stringify(res[i]);
|
||||||
|
var parse_data = JSON.parse(data);
|
||||||
|
|
||||||
|
var order_item_row = "<tr>" +
|
||||||
|
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + "</td>" +
|
||||||
|
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
$("#oqs-order-details-table").children("tbody").append(order_item_row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// $('#order-items').text(orderItem);
|
||||||
|
// $('#order-qty').text(orderQty);
|
||||||
|
|
||||||
$('.queue_station').removeClass('selected-item');
|
$('.queue_station').removeClass('selected-item');
|
||||||
$(this).addClass('selected-item');
|
$(this).addClass('selected-item');
|
||||||
@@ -51,6 +75,7 @@ $(document).ready(function(){
|
|||||||
var assigned_item_id=$(this).attr('id').substr(15);
|
var assigned_item_id=$(this).attr('id').substr(15);
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
|
|
||||||
|
// Call update_delivery_status() for changed delivery and move to delivery
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/oqs/update_delivery',
|
url: '/oqs/update_delivery',
|
||||||
@@ -85,6 +110,7 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Print Order Item
|
||||||
$('#print_order_item').on('click',function(){
|
$('#print_order_item').on('click',function(){
|
||||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
@@ -95,12 +121,15 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Print Order Summary
|
||||||
$('#print_order_summary').on('click',function(){
|
$('#print_order_summary').on('click',function(){
|
||||||
|
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
|
||||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'table_name':table_name };
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
||||||
|
data: params,
|
||||||
success: function(data){ }
|
success: function(data){ }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
var cashier="";
|
var cashier="";
|
||||||
var receipt_date="";
|
var receipt_date="";
|
||||||
var sub_total=0;
|
var sub_total=0.0;
|
||||||
var discount_amount=0;
|
var discount_amount=0;
|
||||||
var tax_amount=0;
|
var tax_amount=0;
|
||||||
var grand_total_amount=0;
|
var grand_total_amount=0;
|
||||||
@@ -83,34 +83,35 @@ $(document).ready(function(){
|
|||||||
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#receipt_no").text(receipt_no);
|
|
||||||
$("#cashier").text(cashier == null ? "" : cashier);
|
|
||||||
$("#receipt_date").text(show_date);
|
|
||||||
|
|
||||||
|
|
||||||
//Receipt Charges
|
//Receipt Charges
|
||||||
sub_total += (parse_data.qty*parse_data.price);
|
sub_total += parseFloat(parse_data.price);
|
||||||
|
|
||||||
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
||||||
tax_amount = parse_data.tax_amount;
|
tax_amount = parse_data.tax_amount;
|
||||||
grand_total_amount = parse_data.grand_total_amount;
|
grand_total_amount = parse_data.grand_total_amount;
|
||||||
|
|
||||||
$("#order-sub-total").text(sub_total);
|
|
||||||
// $("#order-food").text('');
|
|
||||||
// $("#order-beverage").text('');
|
|
||||||
$("#order-discount").text(discount_amount);
|
|
||||||
$("#order-Tax").text(tax_amount);
|
|
||||||
$("#order-grand-total").text(grand_total_amount);
|
|
||||||
|
|
||||||
// Ordered Items
|
// Ordered Items
|
||||||
var order_items_rows = "<tr>" +
|
var order_items_rows = "<tr>" +
|
||||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||||
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
|
"<td class='item-attr'>" + parse_data.price + "</td>" +
|
||||||
"</tr>";
|
"</tr>";
|
||||||
|
|
||||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cashier Info
|
||||||
|
$("#receipt_no").text(receipt_no);
|
||||||
|
$("#cashier").text(cashier == null ? "" : cashier);
|
||||||
|
$("#receipt_date").text(show_date);
|
||||||
|
|
||||||
|
// Payment Info
|
||||||
|
$("#order-sub-total").text(sub_total);
|
||||||
|
// $("#order-food").text('');
|
||||||
|
// $("#order-beverage").text('');
|
||||||
|
$("#order-discount").text(discount_amount);
|
||||||
|
$("#order-Tax").text(tax_amount);
|
||||||
|
$("#order-grand-total").text(grand_total_amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// End AJAX Call
|
// End AJAX Call
|
||||||
@@ -121,7 +122,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function() {
|
$('#request_bills').click(function() {
|
||||||
var order_id=$(".selected-item").find(".orders-id").text();
|
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||||
if(order_id!=""){
|
if(order_id!=""){
|
||||||
window.location.href = '/origami/' + order_id + '/request_bills'
|
window.location.href = '/origami/' + order_id + '/request_bills'
|
||||||
}
|
}
|
||||||
@@ -133,7 +134,8 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// Discount for Payment
|
// Discount for Payment
|
||||||
$('#discount').click(function() {
|
$('#discount').click(function() {
|
||||||
var order_id=$(".selected-item").find(".orders-id").text();
|
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||||
|
|
||||||
if(order_id!=""){
|
if(order_id!=""){
|
||||||
window.location.href = '/origami/' + order_id + '/discount'
|
window.location.href = '/origami/' + order_id + '/discount'
|
||||||
}
|
}
|
||||||
@@ -148,7 +150,7 @@ $(document).ready(function(){
|
|||||||
$("#pay-discount").on('click', function(e){
|
$("#pay-discount").on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
var sale_item_id = $('.selected-item').attr('id');
|
var sale_item_id = $('.selected-item').attr('id').substr(0,16);
|
||||||
var sub_total = $('#order-sub-total').text();
|
var sub_total = $('#order-sub-total').text();
|
||||||
var grand_total = $('#order-grand-total').text();
|
var grand_total = $('#order-grand-total').text();
|
||||||
var discount_type = $('#discount-type').val();
|
var discount_type = $('#discount-type').val();
|
||||||
@@ -178,7 +180,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// Payment for Bill
|
// Payment for Bill
|
||||||
$('#pay-bill').click(function() {
|
$('#pay-bill').click(function() {
|
||||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||||
if(sale_id!=""){
|
if(sale_id!=""){
|
||||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||||
}
|
}
|
||||||
@@ -190,7 +192,7 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#customer').click(function() {
|
$('#customer').click(function() {
|
||||||
var sale = $(".selected-item").find(".orders-id").text();
|
var sale = $(".selected-item").find(".orders-id").text().substr(0,16);
|
||||||
if (sale.substring(0, 3)=="SAL") {
|
if (sale.substring(0, 3)=="SAL") {
|
||||||
var sale_id = sale
|
var sale_id = sale
|
||||||
}else{
|
}else{
|
||||||
@@ -202,7 +204,7 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#re-print').click(function() {
|
$('#re-print').click(function() {
|
||||||
var sale_id = $(".selected-item").find(".orders-id").text();
|
var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16);
|
||||||
|
|
||||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() {
|
|||||||
items.push($(value).attr("data-id"));
|
items.push($(value).attr("data-id"));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#order_queue_station_processing_items").val(items);
|
$("#order_queue_station_processing_items").val(JSON.stringify(items));
|
||||||
//$(this).submit();
|
//$(this).submit();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
@import "theme";
|
@import "theme";
|
||||||
@import "jquery-ui";
|
@import "jquery-ui";
|
||||||
@import "bootstrap-datepicker3";
|
@import "bootstrap-datepicker3";
|
||||||
|
@import "bootstrap/modal";
|
||||||
|
|
||||||
/* Show it is fixed to the top */
|
/* Show it is fixed to the top */
|
||||||
// body {
|
// body {
|
||||||
@@ -10,4 +11,15 @@
|
|||||||
// padding-top: 4.5rem;
|
// padding-top: 4.5rem;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
.selected-item {
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: #ccc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.assign {
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
.assign .text-muted{
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,14 +15,29 @@ class Api::BillController < Api::ApiController
|
|||||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
||||||
else
|
else
|
||||||
@status = true
|
@status = true
|
||||||
|
@sale_id = booking.sale_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif (params[:order_id])
|
elsif (params[:order_id])
|
||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
customer= Customer.where('customer_id=' + @sale_data.customer_id)
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# Calculate Food and Beverage Total
|
||||||
|
|
||||||
|
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,55 +23,117 @@ class BaseReportController < ActionController::Base
|
|||||||
period = params[:period]
|
period = params[:period]
|
||||||
from = params[:from]
|
from = params[:from]
|
||||||
to = params[:to]
|
to = params[:to]
|
||||||
day_ref = Time.now
|
day_ref = Time.now.utc.getlocal
|
||||||
if period_type.to_i == 1
|
|
||||||
if params[:from] && params[:to]
|
if params[:report_type] == "daily_sale"
|
||||||
if params[:from] != "" && params[:to] !=""
|
|
||||||
from = DateTime.strptime(params[:from], "%m/%d/%Y")
|
if from != "" && to != ""
|
||||||
to = DateTime.strptime(params[:to], "%m/%d/%Y")
|
|
||||||
else
|
f_date = DateTime.parse(params[:from])
|
||||||
|
t_date = DateTime.parse(params[:to])
|
||||||
|
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||||
|
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||||
|
from = f_time.beginning_of_day.utc.getlocal
|
||||||
|
to = t_time.end_of_day.utc.getlocal
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
case period.to_i
|
||||||
|
when PERIOD["today"]
|
||||||
|
|
||||||
from = day_ref.beginning_of_day.utc
|
from = day_ref.beginning_of_day.utc
|
||||||
to = day_ref.end_of_day.utc
|
to = day_ref.end_of_day.utc
|
||||||
|
|
||||||
|
when PERIOD["yesterday"]
|
||||||
|
from = (day_ref - 1.day).beginning_of_day.utc
|
||||||
|
to = (day_ref - 1.day).end_of_day.utc
|
||||||
|
|
||||||
|
when PERIOD["this_week"]
|
||||||
|
from = Time.now.beginning_of_week.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_week"]
|
||||||
|
from = (day_ref - 7.day).beginning_of_week.utc
|
||||||
|
to = (day_ref - 7.day).end_of_week.utc
|
||||||
|
when PERIOD["last_7"]
|
||||||
|
from = (day_ref - 7.day).utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["this_month"]
|
||||||
|
from = Time.now.beginning_of_month.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_month"]
|
||||||
|
from = (day_ref - 1.month).beginning_of_month.utc
|
||||||
|
to = (day_ref - 1.month).end_of_month.utc
|
||||||
|
when PERIOD["last_30"]
|
||||||
|
from = (day_ref - 30.day).utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["this_year"]
|
||||||
|
from = Time.now.beginning_of_year.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_year"]
|
||||||
|
from = (day_ref - 1.year).beginning_of_year.utc
|
||||||
|
to = (day_ref - 1.year).end_of_year.utc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else # end daily sale report
|
||||||
case period.to_i
|
if period_type.to_i == 1
|
||||||
when PERIOD["today"]
|
|
||||||
|
|
||||||
from = day_ref.beginning_of_day.utc
|
if params[:from] && params[:to]
|
||||||
to = day_ref.end_of_day.utc
|
|
||||||
|
|
||||||
when PERIOD["yesterday"]
|
if params[:from] != "" && params[:to] !=""
|
||||||
from = (day_ref - 1.day).beginning_of_day.utc
|
|
||||||
to = (day_ref - 1.day).end_of_day.utc
|
|
||||||
|
|
||||||
when PERIOD["this_week"]
|
f_date = DateTime.parse(params[:from])
|
||||||
from = Time.now.beginning_of_week.utc
|
t_date = DateTime.parse(params[:to])
|
||||||
to = Time.now.utc
|
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||||
when PERIOD["last_week"]
|
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||||
from = (day_ref - 7.day).beginning_of_week.utc
|
from = f_time.beginning_of_day.utc.getlocal
|
||||||
to = (day_ref - 7.day).end_of_week.utc
|
to = t_time.end_of_day.utc.getlocal
|
||||||
when PERIOD["last_7"]
|
else
|
||||||
from = (day_ref - 7.day).utc
|
from = day_ref.beginning_of_day.utc
|
||||||
to = Time.now.utc
|
to = day_ref.end_of_day.utc
|
||||||
when PERIOD["this_month"]
|
end
|
||||||
from = Time.now.beginning_of_month.utc
|
end
|
||||||
to = Time.now.utc
|
else
|
||||||
when PERIOD["last_month"]
|
case period.to_i
|
||||||
from = (day_ref - 1.month).beginning_of_month.utc
|
when PERIOD["today"]
|
||||||
to = (day_ref - 1.month).end_of_month.utc
|
|
||||||
when PERIOD["last_30"]
|
from = day_ref.beginning_of_day.utc
|
||||||
from = (day_ref - 30.day).utc
|
to = day_ref.end_of_day.utc
|
||||||
to = Time.now.utc
|
|
||||||
when PERIOD["this_year"]
|
when PERIOD["yesterday"]
|
||||||
from = Time.now.beginning_of_year.utc
|
from = (day_ref - 1.day).beginning_of_day.utc
|
||||||
to = Time.now.utc
|
to = (day_ref - 1.day).end_of_day.utc
|
||||||
when PERIOD["last_year"]
|
|
||||||
from = (day_ref - 1.year).beginning_of_year.utc
|
when PERIOD["this_week"]
|
||||||
to = (day_ref - 1.year).end_of_year.utc
|
from = Time.now.beginning_of_week.utc
|
||||||
end
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_week"]
|
||||||
|
from = (day_ref - 7.day).beginning_of_week.utc
|
||||||
|
to = (day_ref - 7.day).end_of_week.utc
|
||||||
|
when PERIOD["last_7"]
|
||||||
|
from = (day_ref - 7.day).utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["this_month"]
|
||||||
|
from = Time.now.beginning_of_month.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_month"]
|
||||||
|
from = (day_ref - 1.month).beginning_of_month.utc
|
||||||
|
to = (day_ref - 1.month).end_of_month.utc
|
||||||
|
when PERIOD["last_30"]
|
||||||
|
from = (day_ref - 30.day).utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["this_year"]
|
||||||
|
from = Time.now.beginning_of_year.utc
|
||||||
|
to = Time.now.utc
|
||||||
|
when PERIOD["last_year"]
|
||||||
|
from = (day_ref - 1.year).beginning_of_year.utc
|
||||||
|
to = (day_ref - 1.year).end_of_year.utc
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return from, to
|
return from, to
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
# format.json { render :index, status: :created, location: @crm_customers }
|
# format.json { render :index, status: :created, location: @crm_customers }
|
||||||
else
|
else
|
||||||
|
|
||||||
@crm_customers.destroy
|
# @crm_customers.destroy
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
# GET /crm/dining_queues
|
# GET /crm/dining_queues
|
||||||
# GET /crm/dining_queues.json
|
# GET /crm/dining_queues.json
|
||||||
def index
|
def index
|
||||||
@dining_queues = DiningQueue.all
|
today = DateTime.now.strftime('%Y-%m-%d')
|
||||||
|
@dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? ", today).order("queue_no asc")
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/dining_queues/1
|
# GET /crm/dining_queues/1
|
||||||
@@ -38,7 +39,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_queue_no(print_settings,@dining_queue)
|
printer.print_queue_no(print_settings,@dining_queue)
|
||||||
|
|
||||||
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully created.' }
|
format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @dining_queue }
|
format.json { render :show, status: :created, location: @dining_queue }
|
||||||
else
|
else
|
||||||
format.html { render :new }
|
format.html { render :new }
|
||||||
@@ -52,7 +53,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @dining_queue.update(dining_queue_params)
|
if @dining_queue.update(dining_queue_params)
|
||||||
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully updated.' }
|
format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @dining_queue }
|
format.json { render :show, status: :ok, location: @dining_queue }
|
||||||
else
|
else
|
||||||
format.html { render :edit }
|
format.html { render :edit }
|
||||||
@@ -71,6 +72,27 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def assign
|
||||||
|
@queue = DiningQueue.find(params[:id])
|
||||||
|
@tables = DiningFacility.where("status = 'available' ")
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_table
|
||||||
|
queue = DiningQueue.find(params[:id])
|
||||||
|
table_id = params[:table_id]
|
||||||
|
|
||||||
|
queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||||
|
DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to crm_dining_queues_path, notice: 'Table was successfully assigned.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_dining_queue
|
def set_dining_queue
|
||||||
@@ -79,6 +101,6 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def dining_queue_params
|
def dining_queue_params
|
||||||
params.require(:dining_queue).permit(:name, :contact_no, :queue_no)
|
params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
def index
|
def index
|
||||||
queue_stations=OrderQueueStation.all
|
queue_stations=OrderQueueStation.all
|
||||||
|
|
||||||
@queue_items_details = queue_items_query(0)
|
@queue_items_details = queue_items_query(false)
|
||||||
|
|
||||||
@queue_completed_item = queue_items_query(1)
|
@queue_completed_item = queue_items_query(true)
|
||||||
|
|
||||||
@queue_stations_items=Array.new
|
@queue_stations_items=Array.new
|
||||||
|
|
||||||
@@ -22,6 +22,44 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
@queue_stations_items
|
@queue_stations_items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get Order items
|
||||||
|
def get_order_items
|
||||||
|
items = []
|
||||||
|
table_name = params[:table_id]
|
||||||
|
status = params[:status]
|
||||||
|
dining = DiningFacility.find_by_name(table_name);
|
||||||
|
# oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||||
|
# if status == ""
|
||||||
|
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
|
||||||
|
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# else
|
||||||
|
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
|
||||||
|
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||||
|
BookingOrder.where("booking_id='#{ booking.booking_id }'").find_each do |bo|
|
||||||
|
order=Order.find(bo.order_id)
|
||||||
|
order.order_items.each do |oi|
|
||||||
|
items.push(oi)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# booking_id = dining.get_new_booking
|
||||||
|
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
|
||||||
|
# order=Order.find(bo.order_id);
|
||||||
|
# order.order_items.each do |oi|
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
render :json => items.to_json
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,16 +81,25 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
|
|
||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def queue_items_query(status)
|
def queue_items_query(status)
|
||||||
|
# AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||||
|
# .joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
||||||
|
# left join dining_facilities as df on df.zone_id = oqpz.zone_id
|
||||||
|
# left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
|
||||||
|
# left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
|
# left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
||||||
|
# left join customers as cus ON cus.customer_id = od.customer_id")
|
||||||
|
# .where("assigned_order_items.delivery_status = #{status}")
|
||||||
|
# .group("assigned_order_items.assigned_order_item_id")
|
||||||
|
# .order("odt.item_name DESC")
|
||||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||||
.joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||||
left join dining_facilities as df on df.zone_id = oqpz.zone_id
|
|
||||||
left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
|
|
||||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
||||||
left join customers as cus ON cus.customer_id = od.customer_id")
|
left join customers as cus ON cus.customer_id = od.customer_id
|
||||||
|
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||||
|
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||||
|
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||||
.where("assigned_order_items.delivery_status = #{status}")
|
.where("assigned_order_items.delivery_status = #{status}")
|
||||||
.group("assigned_order_items.assigned_order_item_id")
|
.group("assigned_order_items.assigned_order_item_id")
|
||||||
.order("odt.item_name DESC")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,13 @@ class Oqs::PrintController < ApplicationController
|
|||||||
# order queue stations
|
# order queue stations
|
||||||
oqs = assigned_item.order_queue_station
|
oqs = assigned_item.order_queue_station
|
||||||
|
|
||||||
|
# Check Printed
|
||||||
|
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||||
|
|
||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_item(oqs,assigned_item.order_id, assigned_item.item_code )
|
order_queue_printer.print_order_item(oqs, assigned_item.order_id, assigned_item.item_code, print_status )
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
@@ -21,20 +24,28 @@ class Oqs::PrintController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print Order Details
|
# Print Order Details with booking id
|
||||||
def print_order_summary
|
def print_order_summary
|
||||||
unique_code="OrderSummaryPdf"
|
unique_code="OrderSummaryPdf"
|
||||||
assigned_item_id=params[:id]
|
assigned_item_id=params[:id]
|
||||||
|
table_name=params[:table_name]
|
||||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||||
|
|
||||||
# order queue stations
|
# order queue stations
|
||||||
oqs = assigned_item.order_queue_station
|
oqs = assigned_item.order_queue_station
|
||||||
|
|
||||||
|
# Check Printed
|
||||||
|
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||||
|
|
||||||
|
# get dining
|
||||||
|
dining = DiningFacility.find_by_name(table_name);
|
||||||
|
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||||
|
|
||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_summary(oqs,assigned_item.order_id)
|
order_queue_printer.print_booking_summary(oqs, booking.booking_id, print_status)
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
str.push(ord_detail)
|
str.push(ord_detail)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_ajax == 1
|
if is_ajax == 1
|
||||||
render :json => str.to_json
|
render :json => str.to_json
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
# Calculate Food and Beverage Total
|
# Calculate Food and Beverage Total
|
||||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
@balance = 0.00
|
@balance = 0.00
|
||||||
@accountable_type = ''
|
@accountable_type = ''
|
||||||
if response["data"]==true
|
if response["status"]==true
|
||||||
response["data"].each do |res|
|
response["data"].each do |res|
|
||||||
if res["accountable_type"] == "RebateAccount"
|
if res["accountable_type"] == "RebateAccount"
|
||||||
@balance = res["balance"]
|
@balance = res["balance"]
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
|
||||||
# limit redeem_amount
|
# limit redeem_amount
|
||||||
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
||||||
|
nonrebate_prices = sale_data.total_amount - rebate_prices
|
||||||
@payparcount = 0
|
@payparcount = 0
|
||||||
others = 0
|
others = 0
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
@@ -16,11 +17,11 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
others = others + sale_payment.payment_amount
|
others = others + sale_payment.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
is_bervage_exceed = others - (beverage_prices + sale_data.total_tax)
|
non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
|
||||||
if is_bervage_exceed < 0
|
if non_rebate_exceed < 0
|
||||||
@food_prices = food_prices - @payparcount
|
@redeem_prices = rebate_prices - @payparcount
|
||||||
else
|
else
|
||||||
@food_prices = food_prices - @payparcount -is_bervage_exceed
|
@redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
|
||||||
end
|
end
|
||||||
|
|
||||||
if sale_data
|
if sale_data
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
class Reports::DailySaleController < BaseReportController
|
class Reports::DailySaleController < BaseReportController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
@sale_data = Sale.daily_sales_list(from,to)
|
||||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
@tax = SaleTax.get_tax(from,to)
|
||||||
|
end
|
||||||
|
|
||||||
|
# @locations = Location.all
|
||||||
|
|
||||||
|
# branch,from, to, report_type = get_date_range_from_params
|
||||||
|
|
||||||
|
# @location = Location.find_by_id(current_location)
|
||||||
|
# @sale_data = Sale.daily_sales_report(current_location,from,to)
|
||||||
|
# @tax = SaleT.get_tax(current_location,from,to)
|
||||||
|
|
||||||
|
# if @sale_data.blank? && @tax.blank? && request.post?
|
||||||
|
# flash.now[:notice] = "No data available for selected filters"
|
||||||
|
# end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -68,6 +68,6 @@ class Settings::AccountsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def account_params
|
def account_params
|
||||||
params.require(:account).permit(:title, :account_type)
|
params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
|||||||
# PATCH/PUT /settings/order_queue_stations/1
|
# PATCH/PUT /settings/order_queue_stations/1
|
||||||
# PATCH/PUT /settings/order_queue_stations/1.json
|
# PATCH/PUT /settings/order_queue_stations/1.json
|
||||||
def update
|
def update
|
||||||
params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
|
# params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_order_queue_station.update(settings_order_queue_station_params)
|
if @settings_order_queue_station.update(settings_order_queue_station_params)
|
||||||
format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }
|
format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }
|
||||||
@@ -71,6 +71,11 @@ class Settings::OrderQueueStationsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_order_queue_station_params
|
def settings_order_queue_station_params
|
||||||
|
# <<<<<<< HEAD
|
||||||
params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
|
params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
|
||||||
|
# =======
|
||||||
|
# Don't Know { zone_ids: [] }
|
||||||
|
# params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by,{ zone_ids: [] })
|
||||||
|
# >>>>>>> b093a993ba002c92659bbb34338c55c031c11d87
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
83
app/controllers/settings/rooms_controller.rb
Normal file
83
app/controllers/settings/rooms_controller.rb
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
class Settings::RoomsController < ApplicationController
|
||||||
|
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy]
|
||||||
|
# GET /settings/rooms
|
||||||
|
# GET /settings/rooms.json
|
||||||
|
def index
|
||||||
|
@settings_rooms = @zone.rooms
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/rooms/1
|
||||||
|
# GET /settings/rooms/1.json
|
||||||
|
def show
|
||||||
|
@room = Room.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/rooms/new
|
||||||
|
def new
|
||||||
|
@settings_room = Room.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/rooms/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /settings/rooms
|
||||||
|
# POST /settings/rooms.json
|
||||||
|
def create
|
||||||
|
@settings_room = Room.new(settings_room_params)
|
||||||
|
@settings_room.type = DiningFacility::ROOM_TYPE
|
||||||
|
@settings_room.zone_id = params[:zone_id]
|
||||||
|
@settings_room.created_by = current_login_employee.name
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_room.save
|
||||||
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @settings_room }
|
||||||
|
else
|
||||||
|
puts "abc"
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @settings_room.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /settings/rooms/1
|
||||||
|
# PATCH/PUT /settings/rooms/1.json
|
||||||
|
def update
|
||||||
|
@settings_room.created_by = current_login_employee.name
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_room.update(settings_room_params)
|
||||||
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @settings_room }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @settings_room.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /settings/rooms/1
|
||||||
|
# DELETE /settings/rooms/1.json
|
||||||
|
def destroy
|
||||||
|
@settings_room.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_settings_room
|
||||||
|
@settings_room = Room.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_settings_zone
|
||||||
|
@zone = Zone.find(params[:zone_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
def settings_room_params
|
||||||
|
params.require(:room).permit(:name, :status, :seater, :order_by,:is_active ,:id, :zone_id, :created_by)
|
||||||
|
end
|
||||||
|
end
|
||||||
82
app/controllers/settings/tables_controller.rb
Normal file
82
app/controllers/settings/tables_controller.rb
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
class Settings::TablesController < ApplicationController
|
||||||
|
before_action :set_settings_table, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
|
||||||
|
# GET /settings/tables
|
||||||
|
# GET /settings/tables.json
|
||||||
|
def index
|
||||||
|
@settings_tables = @zone.tables
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/tables/1
|
||||||
|
# GET /settings/tables/1.json
|
||||||
|
def show
|
||||||
|
@table = Table.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/tables/new
|
||||||
|
def new
|
||||||
|
@settings_table = Table.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/tables/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /settings/tables
|
||||||
|
# POST /settings/tables.json
|
||||||
|
def create
|
||||||
|
@settings_table = Table.new(settings_table_params)
|
||||||
|
@settings_table.type = DiningFacility::TABLE_TYPE
|
||||||
|
@settings_table.zone_id = params[:zone_id]
|
||||||
|
@settings_table.created_by = current_login_employee.name
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_table.save
|
||||||
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @settings_table }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /settings/tables/1
|
||||||
|
# PATCH/PUT /settings/tables/1.json
|
||||||
|
def update
|
||||||
|
@settings_table.created_by = current_login_employee.name
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_table.update(settings_table_params)
|
||||||
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @settings_table }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /settings/tables/1
|
||||||
|
# DELETE /settings/tables/1.json
|
||||||
|
def destroy
|
||||||
|
@settings_table.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_settings_table
|
||||||
|
@settings_table = Table.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_settings_zone
|
||||||
|
@zone = Zone.find(params[:zone_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
def settings_table_params
|
||||||
|
params.require(:table).permit(:name, :status, :seater, :order_by,:is_active ,:id, :zone_id, :created_by)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,6 +10,8 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# GET /settings/zones/1
|
# GET /settings/zones/1
|
||||||
# GET /settings/zones/1.json
|
# GET /settings/zones/1.json
|
||||||
def show
|
def show
|
||||||
|
@settings_tables = @settings_zone.tables
|
||||||
|
@settings_rooms = @settings_zone.rooms
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/zones/new
|
# GET /settings/zones/new
|
||||||
@@ -25,10 +27,10 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# POST /settings/zones.json
|
# POST /settings/zones.json
|
||||||
def create
|
def create
|
||||||
@settings_zone = Zone.new(settings_zone_params)
|
@settings_zone = Zone.new(settings_zone_params)
|
||||||
|
@settings_zone.created_by = current_login_employee.name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_zone.save
|
if @settings_zone.save
|
||||||
format.html { redirect_to @settings_zone, notice: 'Zone was successfully created.' }
|
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_zone }
|
format.json { render :show, status: :created, location: @settings_zone }
|
||||||
else
|
else
|
||||||
format.html { render :new }
|
format.html { render :new }
|
||||||
@@ -41,8 +43,9 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# PATCH/PUT /settings/zones/1.json
|
# PATCH/PUT /settings/zones/1.json
|
||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@settings_zone.created_by = current_login_employee.name
|
||||||
if @settings_zone.update(settings_zone_params)
|
if @settings_zone.update(settings_zone_params)
|
||||||
format.html { redirect_to @settings_zone, notice: 'Zone was successfully updated.' }
|
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @settings_zone }
|
format.json { render :show, status: :ok, location: @settings_zone }
|
||||||
else
|
else
|
||||||
format.html { render :edit }
|
format.html { render :edit }
|
||||||
@@ -54,9 +57,11 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# DELETE /settings/zones/1
|
# DELETE /settings/zones/1
|
||||||
# DELETE /settings/zones/1.json
|
# DELETE /settings/zones/1.json
|
||||||
def destroy
|
def destroy
|
||||||
|
@settings_zone.rooms.destroy
|
||||||
|
@settings_zone.tables.destroy
|
||||||
@settings_zone.destroy
|
@settings_zone.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to settings_zones_url, notice: 'Zone was successfully destroyed.' }
|
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -69,6 +74,6 @@ class Settings::ZonesController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_zone_params
|
def settings_zone_params
|
||||||
params.require(:settings_zone).permit(:name, :is_active, :created_by)
|
params.require(:zone).permit(:name, :is_active, :created_by)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,27 +10,7 @@ class Customer < ApplicationRecord
|
|||||||
validates :contact_no, uniqueness: true
|
validates :contact_no, uniqueness: true
|
||||||
validates :email, uniqueness: true
|
validates :email, uniqueness: true
|
||||||
|
|
||||||
paginates_per 50
|
paginates_per 50
|
||||||
|
|
||||||
# def self.get_member_group
|
|
||||||
|
|
||||||
# membership = MembershipSetting.find_by_membership_type("paypar_url")
|
|
||||||
# memberaction = MembershipAction.find_by_membership_type("get_all_member_group")
|
|
||||||
# app_token = membership.auth_token.to_s
|
|
||||||
|
|
||||||
# url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
|
||||||
# response = HTTParty.get(url,
|
|
||||||
# :body => { app_token: app_token}.to_json,
|
|
||||||
# :headers => {
|
|
||||||
# 'Content-Type' => 'application/json',
|
|
||||||
# 'Accept' => 'application/json'
|
|
||||||
# }
|
|
||||||
# )
|
|
||||||
# puts response.body, response.code, response.message, response.headers.inspect
|
|
||||||
|
|
||||||
# return response;
|
|
||||||
|
|
||||||
# end
|
|
||||||
|
|
||||||
def self.get_member_account(customer)
|
def self.get_member_account(customer)
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
@@ -38,13 +18,19 @@ class Customer < ApplicationRecord
|
|||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
# urltest =self.url_exist?(url)
|
||||||
|
|
||||||
|
begin
|
||||||
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json'
|
'Accept' => 'application/json'
|
||||||
}
|
},
|
||||||
|
:timeout => 10
|
||||||
)
|
)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { status: false }
|
||||||
|
end
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
@@ -59,6 +45,35 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# require "net/http"
|
||||||
|
# def self.url_exist?(url_string)
|
||||||
|
# url = URI.parse(url_string)
|
||||||
|
|
||||||
|
|
||||||
|
# req = Net::HTTP.new(url.host, url.port)
|
||||||
|
# puts "hhhhhhhhhhhh"
|
||||||
|
# puts req.to_json
|
||||||
|
# req.use_ssl = (url.scheme == 'https')
|
||||||
|
# puts "aaaaaaaaaaaa"
|
||||||
|
# puts req.use_ssl?
|
||||||
|
# path = url.path if url.path.present?
|
||||||
|
# puts "bbbbbbbbbbbbb"
|
||||||
|
# puts path
|
||||||
|
# res = req.request_head(path || '/')
|
||||||
|
# puts "cccccccccccccc"
|
||||||
|
# puts res.to_json
|
||||||
|
# puts "ddddddddd"
|
||||||
|
# puts res.kind_of?(Net::HTTPRedirection)
|
||||||
|
# if res.kind_of?(Net::HTTPRedirection)
|
||||||
|
# url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL
|
||||||
|
# else
|
||||||
|
# ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families
|
||||||
|
# end
|
||||||
|
# rescue Errno::ENOENT
|
||||||
|
# false #false if can't find the server
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
# def self.search(search)
|
# def self.search(search)
|
||||||
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
||||||
# end
|
# end
|
||||||
|
|||||||
@@ -18,4 +18,20 @@ class DiningFacility < ApplicationRecord
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_new_booking
|
||||||
|
# query for new
|
||||||
|
# if status
|
||||||
|
# to ask when req bill booking_status?
|
||||||
|
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is null").limit(1)
|
||||||
|
# else
|
||||||
|
# booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id not null").limit(1)
|
||||||
|
# end
|
||||||
|
|
||||||
|
if booking.count > 0 then
|
||||||
|
return booking[0].booking_id
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
class DiningQueue < ApplicationRecord
|
class DiningQueue < ApplicationRecord
|
||||||
|
belongs_to :dining_facility, :optional => true
|
||||||
def self.generate_queue_no
|
def self.generate_queue_no
|
||||||
queue_no = DiningQueue.all.count + 1
|
today = DateTime.now.strftime('%Y-%m-%d')
|
||||||
|
dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? ", today).order("queue_no desc")
|
||||||
|
queue_no = dining_queues.count + 1
|
||||||
return queue_no
|
return queue_no
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -6,6 +6,9 @@ class Employee < ApplicationRecord
|
|||||||
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||||
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
||||||
|
|
||||||
|
def self.collection
|
||||||
|
Employee.select("id, name").map { |e| [e.name, e.id] }
|
||||||
|
end
|
||||||
|
|
||||||
def self.login(emp_id, password)
|
def self.login(emp_id, password)
|
||||||
user = Employee.find_by_emp_id(emp_id)
|
user = Employee.find_by_emp_id(emp_id)
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("sales.sale_status='completed'")
|
.where("sales.sale_status='completed'")
|
||||||
.group("sales.sale_id,bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
.group("sales.sale_id")
|
||||||
# For PG
|
# For PG
|
||||||
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
class OrderQueueStation < ApplicationRecord
|
class OrderQueueStation < ApplicationRecord
|
||||||
has_many :assigned_order_items
|
has_many :assigned_order_items
|
||||||
has_many :order_items
|
has_many :order_items
|
||||||
|
has_many :order_queue_process_by_zones
|
||||||
|
has_many :zones, through: :order_queue_process_by_zones
|
||||||
|
|
||||||
scope :active, -> {where(is_active: true)}
|
scope :active, -> {where(is_active: true)}
|
||||||
|
|
||||||
@@ -14,37 +16,67 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||||
|
|
||||||
order_items = order.order_items
|
order_items = order.order_items
|
||||||
|
|
||||||
|
# get dining
|
||||||
|
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||||
|
|
||||||
#Assign OQS id to order Items
|
#Assign OQS id to order Items
|
||||||
oqs_stations.each do |oqs|
|
oqs_stations.each do |oqs|
|
||||||
#Get List of items -
|
#Get List of items -
|
||||||
pq_items = JSON.parse(oqs.processing_items)
|
pq_items = JSON.parse(oqs.processing_items)
|
||||||
|
|
||||||
if oqs.id == oqpbz.order_queue_station_id
|
|
||||||
#Loop through the processing items
|
#Loop through the processing items
|
||||||
pq_items.each do |pq_item|
|
pq_items.each do |pq_item|
|
||||||
#Processing through the looping items
|
#Processing through the looping items
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
if (pq_item == order_item.item_code)
|
if (pq_item == order_item.item_code)
|
||||||
#Same Order_items can appear in two location.
|
# if oqs.id == oqpbz.order_queue_station_id
|
||||||
|
# #Same Order_items can appear in two location.
|
||||||
|
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
|
# else
|
||||||
|
|
||||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
|
# end
|
||||||
|
|
||||||
|
if oqs.auto_print
|
||||||
|
print_slip(oqs, order, order_items)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Print OQS where printing is require
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
#Print order_items in 1 slip
|
#Print order_items in 1 slip
|
||||||
def print_slip
|
def print_slip(oqs, order, order_items)
|
||||||
|
unique_code="OrderSummaryPdf"
|
||||||
|
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
|
order_queue_printer.print_order_summary(oqs,order.order_id, print_status="")
|
||||||
|
|
||||||
|
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||||
|
# update print status for order items
|
||||||
|
ai.print_status=true
|
||||||
|
ai.save
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Print order_items in 1 slip per item
|
#Print order_item in 1 slip per item
|
||||||
def print_slip_item
|
def print_slip_item(oqs, assigned_order_item)
|
||||||
|
unique_code="OrderItemPdf"
|
||||||
|
|
||||||
|
# print when complete click
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
|
order_queue_printer.print_order_item(oqs,item.order_id, item.item_code, print_status="" )
|
||||||
|
|
||||||
|
# update print status for completed same order items
|
||||||
|
assigned_order_item.each do |ai|
|
||||||
|
ai.print_status=true
|
||||||
|
ai.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,66 +1,128 @@
|
|||||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||||
|
|
||||||
def print_order_item(oqs,order_id, item_code)
|
def print_order_item(oqs,order_id, item_code, print_status)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
order_item= print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||||
pdf = OrderItemPdf.new(order_item[0])
|
|
||||||
pdf.render_file "tmp/receipt.pdf"
|
|
||||||
if oqs.print_copy
|
|
||||||
self.print("tmp/receipt.pdf", oqs.printer_name)
|
|
||||||
self.print("tmp/receipt.pdf", oqs.printer_name)
|
|
||||||
else
|
|
||||||
self.print("tmp/receipt.pdf", oqs.printer_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def print_order_summary(oqs,order_id)
|
filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf"
|
||||||
#Use CUPS service
|
pdf = OrderItemPdf.new(order_item[0], print_status)
|
||||||
#Generate PDF
|
pdf.render_file filename
|
||||||
#Print
|
|
||||||
order=print_query('order_summary',order_id)
|
if oqs.print_copy
|
||||||
# For Print Per Item
|
self.print(filename, oqs.printer_name)
|
||||||
if oqs.cut_per_item
|
|
||||||
order.each do|odi|
|
#For print copy
|
||||||
pdf = OrderItemPdf.new(odi)
|
pdf.render_file filename.gsub(".","-copy.")
|
||||||
pdf.render_file "tmp/receipt.pdf"
|
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||||
if oqs.print_copy
|
|
||||||
self.print("tmp/receipt.pdf", oqs.printer_name)
|
|
||||||
self.print("tmp/receipt.pdf", oqs.printer_name)
|
|
||||||
else
|
|
||||||
self.print("tmp/receipt.pdf", oqs.printer_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# For Print Order Summary
|
|
||||||
else
|
else
|
||||||
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
|
||||||
pdf = OrderSummaryPdf.new(order)
|
|
||||||
pdf.render_file filename
|
|
||||||
self.print(filename, oqs.printer_name)
|
self.print(filename, oqs.printer_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Query for OQS with status
|
# Query for per order
|
||||||
def print_query(type, code)
|
def print_order_summary(oqs, order_id, print_status)
|
||||||
if type == 'order_item'
|
#Use CUPS service
|
||||||
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
#Generate PDF
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
#Print
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
order=print_query('order_summary', order_id)
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
# For Print Per Item
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
if oqs.cut_per_item
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
order.each do|odi|
|
||||||
.where("order_items.item_code='" + code + "'")
|
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||||
.group("order_items.item_code")
|
pdf = OrderItemPdf.new(odi, print_status)
|
||||||
|
# pdf.render_file "tmp/order_item.pdf"
|
||||||
|
pdf.render_file filename
|
||||||
|
if oqs.print_copy
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||||
|
else
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
|
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
|
||||||
|
pdf = OrderSummaryPdf.new(order, print_status)
|
||||||
|
pdf.render_file filename
|
||||||
|
if oqs.print_copy
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
|
||||||
|
#For print copy
|
||||||
|
pdf.render_file filename.gsub(".","-copy.")
|
||||||
|
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||||
|
else
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Print for orders in booking
|
||||||
|
def print_booking_summary(oqs, booking_id, print_status)
|
||||||
|
order=print_query('booking_summary', booking_id)
|
||||||
|
# For Print Per Item
|
||||||
|
if oqs.cut_per_item
|
||||||
|
order.each do|odi|
|
||||||
|
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||||
|
pdf = OrderItemPdf.new(odi, print_status)
|
||||||
|
pdf.render_file filename
|
||||||
|
|
||||||
|
if oqs.print_copy
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
|
||||||
|
#For print copy
|
||||||
|
pdf.render_file filename.gsub(".","-copy.")
|
||||||
|
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||||
|
else
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# For Print Order Summary
|
||||||
|
else
|
||||||
|
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
|
||||||
|
pdf = OrderSummaryPdf.new(order, print_status)
|
||||||
|
pdf.render_file filename
|
||||||
|
if oqs.print_copy
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
|
||||||
|
#For print copy
|
||||||
|
pdf.render_file filename.gsub(".","-copy.")
|
||||||
|
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||||
|
else
|
||||||
|
self.print(filename, oqs.printer_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Query for OQS with status
|
||||||
|
def print_query(type, id)
|
||||||
|
if type == "order_item"
|
||||||
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
.where("orders.order_id='" + code + "'")
|
.where("order_items.item_code = '#{ id }'")
|
||||||
.group("order_items.item_code")
|
.group("order_items.item_code")
|
||||||
|
elsif type == "order_summary"
|
||||||
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
|
.where("orders.order_id = '#{ id }'")
|
||||||
|
else
|
||||||
|
# order summary for booking
|
||||||
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
|
.where("b.booking_id = '#{ id }'")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info)
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info)
|
||||||
|
|
||||||
pdf.render_file "tmp/receipt_bill.pdf"
|
pdf.render_file "tmp/receipt_bill.pdf"
|
||||||
self.print("tmp/receipt_bill.pdf")
|
self.print("tmp/receipt_bill.pdf")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Sale < ApplicationRecord
|
|||||||
if (booking)
|
if (booking)
|
||||||
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
||||||
#get all order attached to this booking and combine into 1 invoice
|
#get all order attached to this booking and combine into 1 invoice
|
||||||
|
|
||||||
booking.booking_orders.each do |order|
|
booking.booking_orders.each do |order|
|
||||||
if booking.sale_id
|
if booking.sale_id
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
||||||
@@ -88,6 +89,8 @@ class Sale < ApplicationRecord
|
|||||||
order.save
|
order.save
|
||||||
|
|
||||||
booking.sale_id = self.id
|
booking.sale_id = self.id
|
||||||
|
booking.checkout_at = Time.now.utc
|
||||||
|
booking.checkout_by = requested_by.name
|
||||||
booking.save
|
booking.save
|
||||||
|
|
||||||
return true, self.id
|
return true, self.id
|
||||||
@@ -188,9 +191,14 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
# Tax Calculate
|
# Tax Calculate
|
||||||
def apply_tax(total_taxable)
|
def apply_tax(total_taxable)
|
||||||
|
#if tax is not apply create new record
|
||||||
|
# self.sale_taxes.each do |existing_tax|
|
||||||
|
# #delete existing and create new
|
||||||
|
# existing_tax.delete
|
||||||
|
# end
|
||||||
|
|
||||||
#if tax is not apply create new record
|
#if tax is not apply create new record
|
||||||
self.sale_taxes.each do |existing_tax|
|
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
||||||
#delete existing and create new
|
#delete existing and create new
|
||||||
existing_tax.delete
|
existing_tax.delete
|
||||||
end
|
end
|
||||||
@@ -199,7 +207,7 @@ class Sale < ApplicationRecord
|
|||||||
#tax_profile - list by order_by
|
#tax_profile - list by order_by
|
||||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||||
|
|
||||||
#Creat new tax records
|
# #Creat new tax records
|
||||||
tax_profiles.each do |tax|
|
tax_profiles.each do |tax|
|
||||||
sale_tax = SaleTax.new(:sale => self)
|
sale_tax = SaleTax.new(:sale => self)
|
||||||
sale_tax.tax_name = tax.name
|
sale_tax.tax_name = tax.name
|
||||||
@@ -273,6 +281,59 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.daily_sales_list(from,to)
|
||||||
|
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||||
|
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='credit') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
|
||||||
|
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to)
|
||||||
|
.group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')")
|
||||||
|
|
||||||
|
daily_total = Array.new
|
||||||
|
|
||||||
|
payments_total.each do |pay|
|
||||||
|
sale_date = pay.sale_date
|
||||||
|
diff_time = payments_total.first.sale_date.beginning_of_day.utc - from
|
||||||
|
diff = diff_time % 86400
|
||||||
|
from_date = sale_date.beginning_of_day.utc - diff
|
||||||
|
to_date = sale_date.end_of_day.utc - diff
|
||||||
|
|
||||||
|
total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
|
||||||
|
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
|
||||||
|
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
|
||||||
|
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj")
|
||||||
|
.where("(sale_status = ? OR sale_status = ?) AND receipt_date between ? and ? AND total_amount != 0", 'completed', 'void', from_date, to_date)
|
||||||
|
|
||||||
|
total_sale.each do |sale|
|
||||||
|
grand_total = sale.grand_total
|
||||||
|
total_discount = sale.total_discount
|
||||||
|
void_amount = sale.void_amount
|
||||||
|
total = {:sale_date => pay.sale_date,
|
||||||
|
:mpu_amount => pay.mpu_amount,
|
||||||
|
:master_amount => pay.master_amount,
|
||||||
|
:visa_amount => pay.visa_amount,
|
||||||
|
:jcb_amount => pay.jcb_amount,
|
||||||
|
:paypar_amount => pay.paypar_amount,
|
||||||
|
:cash_amount => pay.cash_amount,
|
||||||
|
:credit_amount => pay.credit_amount,
|
||||||
|
:foc_amount => pay.foc_amount,
|
||||||
|
:total_discount => total_discount,
|
||||||
|
:grand_total => grand_total,
|
||||||
|
:void_amount => void_amount,
|
||||||
|
:rounding_adj => sale.rounding_adj}
|
||||||
|
daily_total.push(total)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
return daily_total
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
|
|||||||
@@ -30,35 +30,51 @@ class SaleItem < ApplicationRecord
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Calculate food total and beverage total
|
||||||
def self.calculate_food_beverage(sale_items)
|
def self.calculate_food_beverage(sale_items)
|
||||||
food_prices=0
|
|
||||||
beverage_prices=0
|
|
||||||
|
|
||||||
sale_items.each do |si|
|
rebateacc = Account.where("rebate=?",true)
|
||||||
food_price, beverage_price = self.get_price(si.sale_item_id)
|
puts "Account that can rebate"
|
||||||
|
rebateacc.each do |i|
|
||||||
food_prices = food_prices + food_price
|
puts i.title
|
||||||
beverage_prices = beverage_prices + beverage_price
|
|
||||||
end
|
end
|
||||||
return food_prices, beverage_prices
|
prices=0
|
||||||
|
sale_items.each do |si|
|
||||||
|
price = self.get_price(si.sale_item_id,rebateacc)
|
||||||
|
|
||||||
|
prices = prices + price
|
||||||
|
end
|
||||||
|
return prices
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_price(sale_item_id)
|
# get food price or beverage price for item
|
||||||
food_price=0
|
def self.get_price(sale_item_id,rebateacc)
|
||||||
beverage_price=0
|
price=0
|
||||||
|
|
||||||
item=SaleItem.select("sale_items.price , menu_items.account_id")
|
item=SaleItem.select("sale_items.price , menu_items.account_id")
|
||||||
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
|
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
|
||||||
.where("sale_items.sale_item_id=?", sale_item_id.to_s)
|
.where("sale_items.sale_item_id=?", sale_item_id.to_s)
|
||||||
if item[0].account_id == 1
|
|
||||||
food_price = item[0].price
|
rebateacc.each do |i|
|
||||||
else
|
if item[0].account_id == i.id
|
||||||
beverage_price = item[0].price
|
price = item[0].price
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return food_price, beverage_price
|
return price
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def self.get_overall_discount(sale_id)
|
||||||
|
# price = 0.0
|
||||||
|
# item=SaleItem.where("product_code=?", sale_id)
|
||||||
|
#
|
||||||
|
# item.each do|i|
|
||||||
|
# price += i.price
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# return price
|
||||||
|
# end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||||
|
|||||||
@@ -66,16 +66,20 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
||||||
|
# Control for Paypar Cloud
|
||||||
|
begin
|
||||||
response = HTTParty.get(url,
|
response = HTTParty.get(url,
|
||||||
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json'
|
'Accept' => 'application/json'
|
||||||
}
|
}, :timeout => 10
|
||||||
)
|
)
|
||||||
return response;
|
rescue Net::OpenTimeout
|
||||||
|
response = { status: false }
|
||||||
|
end
|
||||||
|
return response;
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||||
@@ -87,13 +91,19 @@ class SalePayment < ApplicationRecord
|
|||||||
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
if sale_data
|
if sale_data
|
||||||
response = HTTParty.post(url,
|
# Control for Paypar Cloud
|
||||||
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
begin
|
||||||
:headers => {
|
response = HTTParty.post(url,
|
||||||
'Content-Type' => 'application/json',
|
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
'Accept' => 'application/json'
|
:headers => {
|
||||||
}
|
'Content-Type' => 'application/json',
|
||||||
)
|
'Accept' => 'application/json'
|
||||||
|
},
|
||||||
|
:timeout => 10
|
||||||
|
)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
response = false;
|
response = false;
|
||||||
end
|
end
|
||||||
@@ -119,7 +129,6 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def creditnote_payment(customer_id)
|
def creditnote_payment(customer_id)
|
||||||
|
|
||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
self.payment_method = "creditnote"
|
self.payment_method = "creditnote"
|
||||||
@@ -187,17 +196,16 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
#Next time - validate if the vochure number is valid - within
|
#Next time - validate if the vochure number is valid - within
|
||||||
self.payment_method = "paypar"
|
|
||||||
self.payment_amount = self.received_amount
|
|
||||||
self.payment_reference = self.voucher_no
|
|
||||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
|
||||||
self.payment_status = "pending"
|
|
||||||
payment_method = self.save!
|
|
||||||
|
|
||||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||||
if membership_data["status"]==true
|
if membership_data["status"]==true
|
||||||
|
self.payment_method = "paypar"
|
||||||
|
self.payment_amount = self.received_amount
|
||||||
|
self.payment_reference = self.voucher_no
|
||||||
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
|
self.payment_status = "pending"
|
||||||
|
payment_method = self.save!
|
||||||
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
|
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
|
||||||
sale_update_payment_status(self.received_amount.to_f)
|
sale_update_payment_status(self.received_amount.to_f)
|
||||||
|
|
||||||
@@ -241,7 +249,9 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def rebat(sObj)
|
def rebat(sObj)
|
||||||
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
rebate_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||||
|
puts "rebate_prices"
|
||||||
|
puts rebate_prices
|
||||||
generic_customer_id = sObj.customer.membership_id
|
generic_customer_id = sObj.customer.membership_id
|
||||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||||
paypar = sObj.sale_payments
|
paypar = sObj.sale_payments
|
||||||
@@ -251,7 +261,10 @@ class SalePayment < ApplicationRecord
|
|||||||
payparcost = payparcost + pp.payment_amount
|
payparcost = payparcost + pp.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
total_amount = food_prices - payparcost
|
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||||
|
overall_dis = sObj.total_discount
|
||||||
|
|
||||||
|
total_amount = rebate_prices - payparcost + overall_dis
|
||||||
if total_amount > 0
|
if total_amount > 0
|
||||||
receipt_no = sObj.receipt_no
|
receipt_no = sObj.receipt_no
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
@@ -260,14 +273,20 @@ class SalePayment < ApplicationRecord
|
|||||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
|
||||||
|
# Control for Paypar Cloud
|
||||||
|
begin
|
||||||
|
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||||
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json'
|
'Accept' => 'application/json'
|
||||||
})
|
}, :timeout => 10)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { status: false }
|
||||||
|
end
|
||||||
|
|
||||||
puts response.to_json
|
# puts response.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ class SaleTax < ApplicationRecord
|
|||||||
before_create :generate_custom_id
|
before_create :generate_custom_id
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
|
|
||||||
|
def self.get_tax(from,to)
|
||||||
|
query = SaleTax.select("sale_taxes.tax_name,SUM(sale_taxes.tax_payable_amount) as tax_amount").joins("join sales on sales.sale_id = sale_taxes.sale_id").where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to).group("sale_taxes.tax_name")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")
|
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")
|
||||||
|
|||||||
@@ -2,7 +2,12 @@ class Zone < ApplicationRecord
|
|||||||
# model association
|
# model association
|
||||||
has_many :tables, dependent: :destroy
|
has_many :tables, dependent: :destroy
|
||||||
has_many :rooms, dependent: :destroy
|
has_many :rooms, dependent: :destroy
|
||||||
|
has_many :order_queue_stations
|
||||||
|
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :name, :created_by
|
validates_presence_of :name, :created_by
|
||||||
|
|
||||||
|
def self.collection
|
||||||
|
Zone.select("id, name").map { |e| [e.name, e.id] }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
class OrderItemPdf < Prawn::Document
|
class OrderItemPdf < Prawn::Document
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||||
def initialize(order_item)
|
def initialize(order_item, print_status)
|
||||||
self.page_width = 254
|
self.page_width = 210
|
||||||
self.page_height = 1450
|
self.page_height = 2500
|
||||||
self.margin = 10
|
self.margin = 5
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 34
|
self.qty_width = 30
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width + (self.margin*4))
|
self.item_width = self.page_width - self.qty_width
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=80
|
self.label_width=100
|
||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
@@ -21,7 +21,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
self.header_font_size = 14
|
self.header_font_size = 14
|
||||||
self.item_font_size = 12
|
self.item_font_size = 12
|
||||||
|
|
||||||
text "#{order_item.dining}", :size => self.header_font_size,:align => :center, :left_margin => -20
|
text "#{ order_item.dining+print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
add_order_items(order_item)
|
add_order_items(order_item)
|
||||||
|
|
||||||
dash(1, :space => 1, :phase => 1)
|
dash(1, :space => 1, :phase => 1)
|
||||||
stroke_horizontal_line 0, self.page_width
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
class OrderSummaryPdf < Prawn::Document
|
class OrderSummaryPdf < Prawn::Document
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||||
def initialize(order)
|
def initialize(order, print_status)
|
||||||
self.page_width = 254
|
self.page_width = 210
|
||||||
self.page_height = 1450
|
self.page_height = 2500
|
||||||
self.margin = 10
|
self.margin = 5
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 34
|
self.qty_width = 30
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width + (self.margin*4))
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=100
|
self.label_width=100
|
||||||
@@ -20,7 +20,7 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
text "#{order[0].dining}", :size => self.header_font_size,:align => :center, :left_margin => -20
|
text "#{ order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
text "Item", :size => self.item_font_size,:align => :left
|
text "Item", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
bounding_box([self.item_width-2,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||||
text "Qty", :size => self.item_font_size,:align => :left
|
text "Qty", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -77,16 +77,22 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
order_item.each do|odi|
|
order_item.each do|odi|
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
y_position = cursor
|
||||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
|
||||||
|
# pad_top(15) {
|
||||||
|
# text_box "#{odi.item_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
|
# text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
|
# }
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left, :height => self.item_height
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
text "#{odi.qty}", :size => self.item_font_size,:align => :left, :height => self.item_height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 2500
|
self.page_height = 2500
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
self.price_width = 35
|
self.price_width = 40
|
||||||
self.qty_width = 20
|
self.qty_width = 20
|
||||||
self.total_width = 35
|
self.total_width = 40
|
||||||
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
self.item_description_width = (self.page_width-20) / 2
|
self.item_description_width = (self.page_width-20) / 2
|
||||||
self.label_width = 100
|
self.label_width = 100
|
||||||
|
|
||||||
# @item_width = self.page_width.to_i / 2
|
# @item_width = self.page_width.to_i / 2
|
||||||
# @qty_width = @item_width.to_i / 3
|
# @qty_width = @item_width.to_i / 3
|
||||||
# @double = @qty_width * 1.3
|
# @double = @qty_width * 1.3
|
||||||
@@ -36,7 +35,6 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
if member_info != nil
|
if member_info != nil
|
||||||
member_info(member_info)
|
member_info(member_info)
|
||||||
end
|
end
|
||||||
|
|
||||||
footer
|
footer
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,29 +53,36 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# move_down 2
|
# move_down 2
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
text "Receipt No:", :size => self.item_font_size,:align => :left
|
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
bounding_box([self.label_width, y_position], :width =>self.item_width) do
|
text "#{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||||
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
|
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0, y_position], :width =>self.item_width) do
|
||||||
text "Customer:", :size => self.item_font_size,:align => :left
|
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||||
end
|
|
||||||
bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
|
||||||
text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do
|
||||||
text "Date:", :size => self.item_font_size,:align => :left
|
text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.label_width,y_position], :width => self.item_width) do
|
move_down 5
|
||||||
text "#{sale_data.receipt_date.strftime('%Y-%m-%d %I:%M %p')}" , :size => self.item_font_size,:align => :left
|
|
||||||
|
# bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
||||||
|
# text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
# move_down 5
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
|
text "Time In: #{ sale_data.bookings[0].checkin_at.strftime('%I:%M %p') }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
|
text "Time Out: #{ sale_data.bookings[0].checkout_at.strftime('%I:%M %p') }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -120,10 +125,10 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :overflow => :shrink_to_fix, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
text_box "#{price.to_i}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "#{qty.to_i}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "#{total_price.to_i}", :at =>[(item_name_width),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{total_price}", :at =>[(item_name_width),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down 3
|
move_down 3
|
||||||
end
|
end
|
||||||
@@ -165,7 +170,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
if sale_data.sale_taxes.length > 1
|
if sale_data.sale_taxes.length > 0
|
||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -174,7 +179,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
|
text "#{ st.tax_name }", :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_description_width,y_position], :width =>self.label_width) do
|
||||||
text "( " +"#{ st.tax_payable_amount }" +" )" , :size => self.item_font_size,:align => :right
|
text "#{ st.tax_payable_amount }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.button :submit %>
|
<%= f.button :submit,"Create Queue" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
44
app/views/crm/dining_queues/assign.html.erb
Normal file
44
app/views/crm/dining_queues/assign.html.erb
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= crm_dining_queues_path %>">Queue</a></li>
|
||||||
|
<li>New</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<%= form_tag crm_assign_table_path, :method => :post do %>
|
||||||
|
<input type="hidden" name="id" value="<%=@queue.id%>">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Queue No</label>
|
||||||
|
<input type="text" name="queue" class="form-control" readonly="true" value="<%=@queue.queue_no%>">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-inputs">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Select Table</label>
|
||||||
|
<select class="selectpicker form-control col-md-12" name="table_id" style="height: 40px" >
|
||||||
|
<% @tables.each do |table| %>
|
||||||
|
<option value="<%= table.id %>">
|
||||||
|
<%= table.name %></option>
|
||||||
|
<%end %>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="submit" class="btn btn-default">Assign Table</button>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -1,38 +1,69 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="<%= %>">Home</a></li>
|
<li><a href="<%= %>">Home</a></li>
|
||||||
<li>Queue</li>
|
<li>Queue</li>
|
||||||
<span style="float: right">
|
<span style="float: right">
|
||||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
|
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
|
||||||
</span>
|
</span>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<div class="row">
|
||||||
<div class="card">
|
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
<div class="row">
|
||||||
<tr>
|
<% @i = 0 %> .
|
||||||
<th style="width:25%">Name</th>
|
<% @dining_queues.each do |queue| %>
|
||||||
<th style="width:25%">Contact No</th>
|
<div class="col-md-3 ">
|
||||||
<th style="width:25%">Queue No</th>
|
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||||
<th style="width:25%">Action</th>
|
<div class="card-block">
|
||||||
</tr>
|
<p class="hidden queue-id"><%= queue.id %></p>
|
||||||
</thead>
|
<p class="hidden queue-status"><%= queue.status %></p>
|
||||||
|
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||||
|
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||||
|
<p class="card-text">
|
||||||
|
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||||
|
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||||
|
<br>
|
||||||
|
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @dining_queues.each do |dining_queue| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= dining_queue.name %></td>
|
|
||||||
<td><%= dining_queue.contact_no %></td>
|
|
||||||
<td><%= dining_queue.queue_no %></td>
|
|
||||||
<td>
|
|
||||||
<%= link_to 'Edit', edit_crm_dining_queue_path(dining_queue) %> | <%= link_to 'Destroy', crm_dining_queue_path(dining_queue), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
|
||||||
|
$(".select-queue").on("click", function(){
|
||||||
|
$('.select-queue').removeClass('selected-item');
|
||||||
|
$(this).addClass('selected-item');
|
||||||
|
var status = $(this).find(".queue-status").text();
|
||||||
|
if(status != "Assign"){
|
||||||
|
$("#assign").removeAttr("disabled");
|
||||||
|
}else{
|
||||||
|
$("#assign").addAttr("disabled");
|
||||||
|
}
|
||||||
|
$("#assign").val($(this).find(".queue-id").text());
|
||||||
|
}); //End Click
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
$('#assign').click(function() {
|
||||||
|
var id = $(this).val();
|
||||||
|
window.location.href = "dining_queues/"+id + "/assign"
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
|
||||||
<hr>
|
<hr>
|
||||||
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
|
||||||
|
<li><%= link_to "Zones", settings_zones_path, :tabindex =>"-1" %></li>
|
||||||
<hr>
|
<hr>
|
||||||
<li><%= link_to "Cashier Terminals ", settings_cashier_terminals_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Cashier Terminals ", settings_cashier_terminals_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
|
||||||
@@ -22,6 +23,8 @@
|
|||||||
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
||||||
|
<hr>
|
||||||
|
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -35,7 +38,7 @@
|
|||||||
<li class="navbar-nav mr-auto dropdown">
|
<li class="navbar-nav mr-auto dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Daily Sale Report", origami_root_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Daily Sale Report", reports_daily_sale_index_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -49,7 +49,10 @@
|
|||||||
<%= qid.qty %>
|
<%= qid.qty %>
|
||||||
</span> ]
|
</span> ]
|
||||||
</h4>
|
</h4>
|
||||||
|
<!--
|
||||||
|
Item Options
|
||||||
<p class="card-text">Medium, Fries, Salad</p>
|
<p class="card-text">Medium, Fries, Salad</p>
|
||||||
|
-->
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<small class="text-muted">Order at
|
<small class="text-muted">Order at
|
||||||
<span class="order-at">
|
<span class="order-at">
|
||||||
@@ -60,6 +63,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
|
<p class="hidden order-status">completed</p>
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,7 +100,10 @@
|
|||||||
<%= qid.qty %>
|
<%= qid.qty %>
|
||||||
</span> ]
|
</span> ]
|
||||||
</h4>
|
</h4>
|
||||||
<p class="card-text">Medium, Fries, Salad</p>
|
<!--
|
||||||
|
Item Options
|
||||||
|
<p class="card-text">Medium, Fries, Salad</p>
|
||||||
|
-->
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<small class="text-muted">Order at
|
<small class="text-muted">Order at
|
||||||
<span class="order-at">
|
<span class="order-at">
|
||||||
@@ -133,7 +140,7 @@
|
|||||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title">ORDER DETAILS -</strong></div>
|
<div><strong id="order-title">ORDER DETAILS - Table</strong></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
@@ -159,7 +166,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-text" style="min-height:400px; max-height:400px; overflow:auto">
|
<div class="card-text" style="min-height:400px; max-height:400px; overflow:auto">
|
||||||
<table class="table">
|
<table class="table" id="oqs-order-details-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:80%; text-align:left">Items</th>
|
<th style="width:80%; text-align:left">Items</th>
|
||||||
@@ -167,17 +174,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<!-- Bind With JS -->
|
||||||
<td id="order-items" style="width:80%; text-align:left">
|
|
||||||
<!-- Menu Items Name <br/>
|
|
||||||
Less Sweet, No MSG -->
|
|
||||||
</td>
|
|
||||||
<td id="order-qty" style="width:20%; text-align:right">
|
|
||||||
<!-- 5 -->
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -306,12 +306,12 @@
|
|||||||
sub_total = 0
|
sub_total = 0
|
||||||
if @selected_item_type == "Sale"
|
if @selected_item_type == "Sale"
|
||||||
@selected_item.sale_items.each do |sale_item|
|
@selected_item.sale_items.each do |sale_item|
|
||||||
sub_total += (sale_item.qty*sale_item.unit_price)
|
sub_total = sub_total + sale_item.price
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty*sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
end
|
end
|
||||||
@@ -322,7 +322,7 @@
|
|||||||
# For Order Items
|
# For Order Items
|
||||||
if @selected_item_type == "Order"
|
if @selected_item_type == "Order"
|
||||||
@selected_item.order_items.each do |order_item|
|
@selected_item.order_items.each do |order_item|
|
||||||
sub_total += (order_item.qty*order_item.unit_price)
|
sub_total = sub_total + (order_item.qty*order_item.price)
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
@@ -354,17 +354,17 @@
|
|||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
|
<!-- <tr>
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%=@selected_item.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%=@selected_item.grand_total rescue 0%></strong></td>
|
||||||
</tr>
|
</tr> -->
|
||||||
<tr class="rebate_amount">
|
|
||||||
|
|
||||||
</tr>
|
<tr class="rebate_amount"></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="rebate-form">
|
<div class="rebate-form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay upto </label>
|
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_jcb %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_jcb %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class=" cashier_number del_cashier_number" data-type="nett" disable>Nett</div>
|
<div class=" cashier_number " data-type="nett" >Nett</div>
|
||||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,11 +91,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"><i class="fa fa-arrow-left fa-lg"></i> Back </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_jcb %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
// number key pad
|
// number key pad
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -128,6 +134,9 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
case 'del' :
|
case 'del' :
|
||||||
var cash=$('#amount').text();
|
var cash=$('#amount').text();
|
||||||
$('#amount').text(cash.substr(0,cash.length-1));
|
$('#amount').text(cash.substr(0,cash.length-1));
|
||||||
|
case 'nett':
|
||||||
|
var remain_amount = $('#validamount').val();
|
||||||
|
$('#amount').text(remain_amount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -141,7 +150,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#jcb_pay').on('click',function(){
|
$('#jcb_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_jcb %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_jcb_path %>",
|
url: "<%= origami_payment_jcb_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="rebate-form">
|
<div class="rebate-form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay upto </label>
|
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_master %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_master %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -96,6 +96,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_master %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -138,7 +144,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#master_pay').on('click',function(){
|
$('#master_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_master %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_master_path %>",
|
url: "<%= origami_payment_master_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="rebate-form">
|
<div class="rebate-form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay upto </label>
|
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_mpu %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_mpu %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class=" cashier_number del_cashier_number" data-type="nett" disable>Nett</div>
|
<div class=" cashier_number " data-type="nett" >Nett</div>
|
||||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,6 +96,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_mpu %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -127,6 +133,9 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
case 'del' :
|
case 'del' :
|
||||||
var cash=$('#amount').text();
|
var cash=$('#amount').text();
|
||||||
$('#amount').text(cash.substr(0,cash.length-1));
|
$('#amount').text(cash.substr(0,cash.length-1));
|
||||||
|
case 'nett':
|
||||||
|
var remain_amount = $('#validamount').val();
|
||||||
|
$('#amount').text(remain_amount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -138,7 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#mpu_pay').on('click',function(){
|
$('#mpu_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_mpu %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_mpu_path %>",
|
url: "<%= origami_payment_mpu_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
@@ -235,9 +235,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Foc </button>
|
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> <i class="fa fa-arrow-left fa-lg"></i> Back </button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </button>
|
<button type="button" class="btn btn-primary btn-block"> FOC </button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
<button type="button" class="btn btn-primary btn-block"> Void </button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem upto </label>
|
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem upto </label>
|
||||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @food_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">Available Redeem Amount</label>
|
<label class="col-lg-4 col-md-4 col-sm-4"> Rebat Balance </label>
|
||||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -38,10 +38,10 @@
|
|||||||
<!-- <% if @payparcount > 0 %>
|
<!-- <% if @payparcount > 0 %>
|
||||||
<p class="">Last time rebate amount is <%= @payparcount %></p>
|
<p class="">Last time rebate amount is <%= @payparcount %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p> -->
|
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @redeem_prices %></span></p> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
<div class="col-lg-6 col-md-7 col-sm-7">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class=" cashier_number del_cashier_number" data-type="nett" disable>Nett</div>
|
<div class=" cashier_number " data-type="nett">Nett</div>
|
||||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -84,9 +84,15 @@
|
|||||||
<div class="pay purple" id="redeem">Pay</div>
|
<div class="pay purple" id="redeem">Pay</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
@@ -123,6 +129,9 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
case 'del' :
|
case 'del' :
|
||||||
var cash=$('#used_amount').text();
|
var cash=$('#used_amount').text();
|
||||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||||
|
case 'nett':
|
||||||
|
alert($('#valid_amount').text())
|
||||||
|
$('#used_amount').text($('#valid_amount').text());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -142,7 +151,7 @@ $("#redeem").click(function(){
|
|||||||
}else if(valid_amount< redeem_amount){
|
}else if(valid_amount< redeem_amount){
|
||||||
alert(" Insufficient Amount!")
|
alert(" Insufficient Amount!")
|
||||||
}else{
|
}else{
|
||||||
if(redeem_amount <= "<%= @food_prices %>"){
|
if(redeem_amount <= "<%= @redeem_prices %>"){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<%=origami_payment_paypar_path%>",
|
url: "<%=origami_payment_paypar_path%>",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="rebate-form">
|
<div class="rebate-form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay upto </label>
|
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_visa %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_visa %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class=" cashier_number del_cashier_number" data-type="nett" disable>Nett</div>
|
<div class=" cashier_number" data-type="nett" >Nett</div>
|
||||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,11 +91,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"><i class="fa fa-arrow-left fa-lg"></i> Back </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#validamount').attr("value",parseFloat("<%= @can_visa %>") - parseFloat(localStorage.getItem("cash")));
|
||||||
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -127,6 +133,9 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
case 'del' :
|
case 'del' :
|
||||||
var cash=$('#amount').text();
|
var cash=$('#amount').text();
|
||||||
$('#amount').text(cash.substr(0,cash.length-1));
|
$('#amount').text(cash.substr(0,cash.length-1));
|
||||||
|
case 'nett':
|
||||||
|
var remain_amount = $('#validamount').val();
|
||||||
|
$('#amount').text(remain_amount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -138,7 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#visa_pay').on('click',function(){
|
$('#visa_pay').on('click',function(){
|
||||||
var amount = $('#amount').text();
|
var amount = $('#amount').text();
|
||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
if(parseFloat(amount) <= "<%= @can_visa %>"){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value"))){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_visa_path %>",
|
url: "<%= origami_payment_visa_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
|
|||||||
212
app/views/reports/daily_sale/_shift_sale_report_filter.html.erb
Normal file
212
app/views/reports/daily_sale/_shift_sale_report_filter.html.erb
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
|
<% if period_type != false %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label>Select Period</label>
|
||||||
|
<select name="period" id="sel_period" class="form-control">
|
||||||
|
<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>
|
||||||
|
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
||||||
|
<!-- <div class="form-group col-md-2">
|
||||||
|
<label>Select Type</label>
|
||||||
|
<select name="sale_type" id="sel_sale_type" class="form-control">
|
||||||
|
<option value="0">All Sale Type</option>
|
||||||
|
<option value="1">Revenue Only</option>
|
||||||
|
<option value="2">Discount Only</option>
|
||||||
|
<option value="3">Void Only</option>
|
||||||
|
<option value="4">Taxes Only</option>
|
||||||
|
<option value="5">Other Amount Only</option>
|
||||||
|
</select>
|
||||||
|
</div> -->
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
|
<label class="">From</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="">To</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- <div class="row">
|
||||||
|
<% if defined? show_monthly %>
|
||||||
|
<div class="span3" style="margin-bottom:10px;">
|
||||||
|
<input type="hidden" id="report_type" name="report_type" value="0">
|
||||||
|
<div class="btn-group" data-toggle="buttons-radio">
|
||||||
|
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
||||||
|
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<% if defined? promotions %>
|
||||||
|
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? menu_types %>
|
||||||
|
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? payments %>
|
||||||
|
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? shift_name %>
|
||||||
|
<!-- Temporary no needs
|
||||||
|
<select name="shift_name" id="shift_name"></select>
|
||||||
|
-->
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? cashiers %>
|
||||||
|
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? singer %>
|
||||||
|
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? bsm %>
|
||||||
|
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? guest_role %>
|
||||||
|
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
||||||
|
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? products %>
|
||||||
|
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? items %>
|
||||||
|
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<div class = "row">
|
||||||
|
|
||||||
|
<div class = "span3">
|
||||||
|
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
||||||
|
</div>
|
||||||
|
<div class = "span3">
|
||||||
|
<select name="shift" id="shift">
|
||||||
|
<option value="">All Shift</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class = "span3">
|
||||||
|
</div>
|
||||||
|
</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');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Reset the form to pervious values
|
||||||
|
$("#branch").val(<%=params[:branch]%>);
|
||||||
|
$("#waiter").val("<%=params[:waiter]%>");
|
||||||
|
$("#cashier").val(<%=params[:cashier]%>);
|
||||||
|
$("#product").val(<%=params[:product]%>);
|
||||||
|
$("#singer").val(<%=params[:singer]%>);
|
||||||
|
$("#item").val('<%=params[:item]%>');
|
||||||
|
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||||
|
|
||||||
|
|
||||||
|
$("#from").val("<%=params[:from]%>");
|
||||||
|
$("#to").val("<%=params[:to]%>");
|
||||||
|
$("#sel_period").val(<%=params[:period]%>);
|
||||||
|
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||||
|
|
||||||
|
<% 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>
|
||||||
190
app/views/reports/daily_sale/index.html.erb
Normal file
190
app/views/reports/daily_sale/index.html.erb
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= %>">Home</a></li>
|
||||||
|
<li>Daily Sale Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sale_index_path} %>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<a href="javascript:export_to('<%=reports_daily_sale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container margin-top-20">
|
||||||
|
<div class="card row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<% if params[:from]%>
|
||||||
|
<tr>
|
||||||
|
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th style='text-align:center;'>Sr.no</th>
|
||||||
|
<th style='text-align:center;'>Date</th>
|
||||||
|
<th style='text-align:center;'>Daily Void Amount</th>
|
||||||
|
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily master Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily visa Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||||
|
<th style='text-align:center;'>(Daily Discount)</th>
|
||||||
|
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Grand Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% unless @sale_data.empty? %>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% void = 0 %>
|
||||||
|
<% mpu = 0 %>
|
||||||
|
<% master = 0 %>
|
||||||
|
<% visa = 0 %>
|
||||||
|
<% jcb = 0 %>
|
||||||
|
<% paypar = 0 %>
|
||||||
|
<% cash = 0 %>
|
||||||
|
<% credit = 0 %>
|
||||||
|
<% foc = 0 %>
|
||||||
|
<% discount = 0 %>
|
||||||
|
<% total = 0 %>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% count = 1 %> <% rounding_adj = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% void += sale[:void_amount] %>
|
||||||
|
<% mpu += sale[:mpu_amount] %>
|
||||||
|
<% master += sale[:master_amount] %>
|
||||||
|
<% visa += sale[:visa_amount] %>
|
||||||
|
<% jcb += sale[:jcb_amount] %>
|
||||||
|
<% paypar += sale[:paypar_amount] %>
|
||||||
|
<% cash += sale[:cash_amount] %>
|
||||||
|
<% credit += sale[:credit_amount] %>
|
||||||
|
<% foc += sale[:foc_amount] %>
|
||||||
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:right;'><%= count %></td>
|
||||||
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
<% count = count + 1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% unless @tax.empty? %>
|
||||||
|
<% @tax.each do |tax| %>
|
||||||
|
<% total_tax += tax.tax_amount.to_f %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% net = total - total_tax %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
var check_arr = [];
|
||||||
|
var search = '<%= params[:period_type] %>';
|
||||||
|
if(search){
|
||||||
|
if(parseInt(search) == 0){
|
||||||
|
search_by_period();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
search_by_date();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
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 = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#from').change(function(){
|
||||||
|
search_by_date();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#to').change(function(){
|
||||||
|
search_by_date();
|
||||||
|
});
|
||||||
|
function search_by_date(){
|
||||||
|
var from = $('#from').val();
|
||||||
|
var to = $('#to').val();
|
||||||
|
var period = 0;
|
||||||
|
var period_type = 1;
|
||||||
|
if(to != '' && from != ''){
|
||||||
|
shift_name = from + ',' + to;
|
||||||
|
check_arr.push(to);
|
||||||
|
// console.log(check_arr.length)
|
||||||
|
if(check_arr.length == 1){
|
||||||
|
}
|
||||||
|
if(check_arr.length == 3){
|
||||||
|
check_arr = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
116
app/views/reports/daily_sale/index.xls.erb
Normal file
116
app/views/reports/daily_sale/index.xls.erb
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<div class="card row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<% if params[:from]%>
|
||||||
|
<tr>
|
||||||
|
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th style='text-align:center;'>Sr.no</th>
|
||||||
|
<th style='text-align:center;'>Date</th>
|
||||||
|
<th style='text-align:center;'>Daily Void Amount</th>
|
||||||
|
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily master Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily visa Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||||
|
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||||
|
<th style='text-align:center;'>(Daily Discount)</th>
|
||||||
|
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Grand Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% unless @sale_data.empty? %>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% void = 0 %>
|
||||||
|
<% mpu = 0 %>
|
||||||
|
<% master = 0 %>
|
||||||
|
<% visa = 0 %>
|
||||||
|
<% jcb = 0 %>
|
||||||
|
<% paypar = 0 %>
|
||||||
|
<% cash = 0 %>
|
||||||
|
<% credit = 0 %>
|
||||||
|
<% foc = 0 %>
|
||||||
|
<% discount = 0 %>
|
||||||
|
<% total = 0 %>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% count = 1 %> <% rounding_adj = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% void += sale[:void_amount] %>
|
||||||
|
<% mpu += sale[:mpu_amount] %>
|
||||||
|
<% master += sale[:master_amount] %>
|
||||||
|
<% visa += sale[:visa_amount] %>
|
||||||
|
<% jcb += sale[:jcb_amount] %>
|
||||||
|
<% paypar += sale[:paypar_amount] %>
|
||||||
|
<% cash += sale[:cash_amount] %>
|
||||||
|
<% credit += sale[:credit_amount] %>
|
||||||
|
<% foc += sale[:foc_amount] %>
|
||||||
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:right;'><%= count %></td>
|
||||||
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
<% count = count + 1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% unless @tax.empty? %>
|
||||||
|
<% @tax.each do |tax| %>
|
||||||
|
<% total_tax += tax.tax_amount.to_f %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% net = total - total_tax %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= %>">Home</a></li>
|
||||||
|
<li>Receipt List Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||||
<td style='text-align:center;'><%=sale.cashier_id rescue ''%></td>
|
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :title %>
|
<%= f.input :title %>
|
||||||
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
|
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
|
||||||
|
<%= f.input :discount %>
|
||||||
|
<%= f.input :point %>
|
||||||
|
<%= f.input :bonus %>
|
||||||
|
<%= f.input :rebate %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
@@ -11,4 +15,3 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,14 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:40%">Title</th>
|
<th>Title</th>
|
||||||
<th style="width:40%">Account Type</th>
|
<th>Account Type</th>
|
||||||
<th style="width:20%">Action</th>
|
<th>Can get Discount</th>
|
||||||
|
<th>Can get Points</th>
|
||||||
|
<th>Can get Bonus</th>
|
||||||
|
<th>Can rebate</th>
|
||||||
|
|
||||||
|
<th style="">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -25,6 +30,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= account.title %></td>
|
<td><%= account.title %></td>
|
||||||
<td><%= account.account_type %></td>
|
<td><%= account.account_type %></td>
|
||||||
|
<td><%= account.discount %></td>
|
||||||
|
<td><%= account.point %></td>
|
||||||
|
<td><%= account.bonus %></td>
|
||||||
|
<td><%= account.rebate %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to 'Edit', edit_settings_account_path(account) %> |
|
<%= link_to 'Edit', edit_settings_account_path(account) %> |
|
||||||
<%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %>
|
<%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Account type</th>
|
<th>Account type</th>
|
||||||
|
<th>Can get Discount</th>
|
||||||
|
<th>Can get Points</th>
|
||||||
|
<th>Can get Bonus</th>
|
||||||
|
<th>Can rebate</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -25,6 +29,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= @settings_account.title %></td>
|
<td><%= @settings_account.title %></td>
|
||||||
<td><%= @settings_account.account_type %></td>
|
<td><%= @settings_account.account_type %></td>
|
||||||
|
<td><%= @settings_account.discount %></td>
|
||||||
|
<td><%= @settings_account.point %></td>
|
||||||
|
<td><%= @settings_account.bonus %></td>
|
||||||
|
<td><%= @settings_account.rebate %></td>
|
||||||
|
|
||||||
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>
|
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
<%= f.input :auth_token %>
|
<%= f.input :auth_token %>
|
||||||
<%= f.input :merchant_account_id %>
|
<%= f.input :merchant_account_id %>
|
||||||
<%= f.input :created_by %>
|
<%= f.input :created_by %>
|
||||||
<%= f.input :additional_parameter %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -1,41 +1,47 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
<h1>Settings Membership Actions</h1>
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
<table>
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
<thead>
|
<li>Settings Membership Actions</li>
|
||||||
<tr>
|
<span style="float: right">
|
||||||
<th>Membership type</th>
|
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path,:class => 'btn btn-primary btn-sm' %>
|
||||||
<th>Is active</th>
|
</span>
|
||||||
<th>Gateway communication type</th>
|
</ul>
|
||||||
<th>Gateway url</th>
|
</div>
|
||||||
<th>Auth token</th>
|
|
||||||
<th>Merchant account</th>
|
|
||||||
<th>Created by</th>
|
|
||||||
<th>Additional parameter</th>
|
|
||||||
<th colspan="3"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @settings_membership_actions.each do |settings_membership_action| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= settings_membership_action.membership_type %></td>
|
|
||||||
<td><%= settings_membership_action.is_active %></td>
|
|
||||||
<td><%= settings_membership_action.gateway_communication_type %></td>
|
|
||||||
<td><%= settings_membership_action.gateway_url %></td>
|
|
||||||
<td><%= settings_membership_action.auth_token %></td>
|
|
||||||
<td><%= settings_membership_action.merchant_account_id %></td>
|
|
||||||
<td><%= settings_membership_action.created_by %></td>
|
|
||||||
<td><%= settings_membership_action.additional_parameter %></td>
|
|
||||||
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
|
|
||||||
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
|
|
||||||
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
<div class="card">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Membership type</th>
|
||||||
|
<th>Is active</th>
|
||||||
|
<th>Gateway communication type</th>
|
||||||
|
<th>Gateway url</th>
|
||||||
|
<th>Auth token</th>
|
||||||
|
<th>Merchant account</th>
|
||||||
|
<th>Created by</th>
|
||||||
|
<th>Additional parameter</th>
|
||||||
|
<th colspan="3"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path %>
|
<tbody>
|
||||||
|
<% @settings_membership_actions.each do |settings_membership_action| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= settings_membership_action.membership_type %></td>
|
||||||
|
<td><%= settings_membership_action.is_active %></td>
|
||||||
|
<td><%= settings_membership_action.gateway_communication_type %></td>
|
||||||
|
<td><%= settings_membership_action.gateway_url %></td>
|
||||||
|
<td><%= settings_membership_action.auth_token %></td>
|
||||||
|
<td><%= settings_membership_action.merchant_account_id %></td>
|
||||||
|
<td><%= settings_membership_action.created_by %></td>
|
||||||
|
<td><%= settings_membership_action.additional_parameter %></td>
|
||||||
|
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
|
<style type="text/css">
|
||||||
|
div.form-inputs span{
|
||||||
|
padding: 1%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<%= simple_form_for([:settings,@settings_order_queue_station]) do |f| %>
|
<%= simple_form_for([:settings,@settings_order_queue_station]) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :station_name %>
|
<%= f.input :station_name %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<%= f.input :auto_print %>
|
|
||||||
<%= f.input :printer_name %>
|
<%= f.input :printer_name %>
|
||||||
<%= f.input :font_size %>
|
<%= f.input :font_size %>
|
||||||
<%= f.input :print_copy %>
|
<%= f.input :print_copy %>
|
||||||
|
<%= f.hidden_field :processing_items %>
|
||||||
|
<%= f.label "Select Zones", :class => 'control-label' %>
|
||||||
|
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'ta'%>
|
||||||
<%= f.input :cut_per_item %>
|
<%= f.input :cut_per_item %>
|
||||||
<%= f.input :use_alternate_name %>
|
<%= f.input :use_alternate_name %>
|
||||||
<%= f.input :processing_items, as: :hidden %>
|
<%= f.input :processing_items, as: :hidden %>
|
||||||
|
<%= f.input :auto_print %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
15
app/views/settings/rooms/_form.html.erb
Normal file
15
app/views/settings/rooms/_form.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<%= simple_form_for([:settings,@zone,@settings_room]) do |f| %>
|
||||||
|
<%= f.error_notification %>
|
||||||
|
|
||||||
|
<div class="form-inputs">
|
||||||
|
<%= f.input :name %>
|
||||||
|
<%= f.input :status %>
|
||||||
|
<%= f.input :seater %>
|
||||||
|
<%= f.input :order_by %>
|
||||||
|
<%= f.input :is_active %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.button :submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
2
app/views/settings/rooms/_settings_room.json.jbuilder
Normal file
2
app/views/settings/rooms/_settings_room.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
json.extract! settings_table, :id, :name, :status, :seater, :order_by, :is_active, :created_by, :created_at, :updated_at
|
||||||
|
json.url settings_table_url(settings_room, format: :json)
|
||||||
10
app/views/settings/rooms/edit.html.erb
Normal file
10
app/views/settings/rooms/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<div class="span12">
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zone_rooms_path %>">Rooms</a></li>
|
||||||
|
<li>Edit</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render 'form', settings_table: @settings_room %>
|
||||||
|
</div>
|
||||||
51
app/views/settings/rooms/index.html.erb
Normal file
51
app/views/settings/rooms/index.html.erb
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li>Rooms</li>
|
||||||
|
<span style="float: right">
|
||||||
|
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_room_path,:class => 'btn btn-primary btn-sm' %>
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="card">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Seater</th>
|
||||||
|
<th>Order by</th>
|
||||||
|
<th>is Active</th>
|
||||||
|
<th>Created By</th>
|
||||||
|
<th>Created At</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @settings_rooms.each do |room| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to room.name, settings_menu_path(room) %></td>
|
||||||
|
<td><%= room.status %></td>
|
||||||
|
<td>Room</td>
|
||||||
|
<td><%= room.seater rescue "-" %></td>
|
||||||
|
<td><%= room.order_by rescue "-" %></td>
|
||||||
|
<td><%= room.is_active %></td>
|
||||||
|
<% if Employee.exists?(room.created_by) %>
|
||||||
|
<td><%= Employee.find(room.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= room.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= room.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_room_path(@zone,room) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_zone_room_path(@zone,room), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
11
app/views/settings/rooms/new.html.erb
Normal file
11
app/views/settings/rooms/new.html.erb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zone_path(@zone) %>">Zone</a></li>
|
||||||
|
<li>New</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render 'form', settings_table: @settings_room %>
|
||||||
|
</div>
|
||||||
49
app/views/settings/rooms/show.html.erb
Normal file
49
app/views/settings/rooms/show.html.erb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zone_rooms_path %>">Rooms</a></li>
|
||||||
|
<li>Details</li>
|
||||||
|
<span style="float: right">
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title">Room</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Room</th>
|
||||||
|
<th>Seater</th>
|
||||||
|
<th>Order by</th>
|
||||||
|
<th>is Active</th>
|
||||||
|
<th>Created By</th>
|
||||||
|
<th>Created At</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to @room.name, settings_menu_path(@room) %></td>
|
||||||
|
<td><%= @room.status %></td>
|
||||||
|
<td>Room</td>
|
||||||
|
<td><%= @room.seater rescue "-" %></td>
|
||||||
|
<td><%= @room.order_by rescue "-" %></td>
|
||||||
|
<td><%= @room.is_active rescue "-" %></td>
|
||||||
|
<% if Employee.exists?(@room.created_by) %>
|
||||||
|
<td><%= Employee.find(@room.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= @room.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= @room.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_room_path(@zone,@room) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_zone_room_path(@zone,@room), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
15
app/views/settings/tables/_form.html.erb
Normal file
15
app/views/settings/tables/_form.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<%= simple_form_for([:settings,@zone,@settings_table]) do |f| %>
|
||||||
|
<%= f.error_notification %>
|
||||||
|
|
||||||
|
<div class="form-inputs">
|
||||||
|
<%= f.input :name %>
|
||||||
|
<%= f.input :status %>
|
||||||
|
<%= f.input :seater %>
|
||||||
|
<%= f.input :order_by %>
|
||||||
|
<%= f.input :is_active %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.button :submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
2
app/views/settings/tables/_settings_table.json.jbuilder
Normal file
2
app/views/settings/tables/_settings_table.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
json.extract! settings_table, :id, :name, :status, :seater, :order_by, :is_active, :created_by, :created_at, :updated_at
|
||||||
|
json.url settings_table_url(settings_table, format: :json)
|
||||||
10
app/views/settings/tables/edit.html.erb
Normal file
10
app/views/settings/tables/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<div class="span12">
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zone_tables_path %>">Tables</a></li>
|
||||||
|
<li>Edit</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render 'form', settings_table: @settings_table %>
|
||||||
|
</div>
|
||||||
49
app/views/settings/tables/index.html.erb
Normal file
49
app/views/settings/tables/index.html.erb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li>Tables</li>
|
||||||
|
<span style="float: right">
|
||||||
|
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_table_path,:class => 'btn btn-primary btn-sm' %>
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="card">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Seater</th>
|
||||||
|
<th>Order by</th>
|
||||||
|
<th>is Active</th>
|
||||||
|
<th>Created By</th>
|
||||||
|
<th>Created At</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @settings_tables.each do |table| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to table.name, settings_menu_path(table) %></td>
|
||||||
|
<td><%= table.status %></td>
|
||||||
|
<td><%= table.seater rescue "-" %></td>
|
||||||
|
<td><%= table.order_by rescue "-" %></td>
|
||||||
|
<td><%= table.is_active %></td>
|
||||||
|
<% if Employee.exists?(table.created_by) %>
|
||||||
|
<td><%= Employee.find(table.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= table.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= table.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_table_path(@zone,table) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_zone_table_path(@zone,table), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
11
app/views/settings/tables/new.html.erb
Normal file
11
app/views/settings/tables/new.html.erb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zone_path(@zone) %>">Zone</a></li>
|
||||||
|
<li>New</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render 'form', settings_table: @settings_table %>
|
||||||
|
</div>
|
||||||
47
app/views/settings/tables/show.html.erb
Normal file
47
app/views/settings/tables/show.html.erb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zone_tables_path %>">Tables</a></li>
|
||||||
|
<li>Details</li>
|
||||||
|
<span style="float: right">
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title">Table</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Seater</th>
|
||||||
|
<th>Order by</th>
|
||||||
|
<th>is Active</th>
|
||||||
|
<th>Created By</th>
|
||||||
|
<th>Created At</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to @table.name, settings_menu_path(@table) %></td>
|
||||||
|
<td><%= @table.status %></td>
|
||||||
|
<td><%= @table.seater rescue "-" %></td>
|
||||||
|
<td><%= @table.order_by rescue "-" %></td>
|
||||||
|
<td><%= @table.is_active rescue "-" %></td>
|
||||||
|
<% if Employee.exists?(@table.created_by) %>
|
||||||
|
<td><%= Employee.find(@table.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= @table.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= @table.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_table_path(@zone,@table) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_zone_table_path(@zone,@table), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<%= simple_form_for(@settings_zone) do |f| %>
|
<%= simple_form_for([:settings,@settings_zone]) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<%= f.input :created_by %>
|
<!-- <%= f.input :created_by, :collection => Employee.collection %> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<h1>Editing Settings Zone</h1>
|
<div class="span12">
|
||||||
|
<div class="page-header">
|
||||||
<%= render 'form', settings_zone: @settings_zone %>
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
<%= link_to 'Show', @settings_zone %> |
|
<li><a href="<%= settings_zones_path %>">Zones</a></li>
|
||||||
<%= link_to 'Back', settings_zones_path %>
|
<li>Edit</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render 'form', settings_zone: @settings_zone %>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,31 +1,41 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
<h1>Settings Zones</h1>
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
<table>
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
<thead>
|
<li>Zones</li>
|
||||||
<tr>
|
<span style="float: right">
|
||||||
<th>Name</th>
|
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_path,:class => 'btn btn-primary btn-sm' %>
|
||||||
<th>Is active</th>
|
</span>
|
||||||
<th>Created by</th>
|
</ul>
|
||||||
<th colspan="3"></th>
|
</div>
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @settings_zones.each do |settings_zone| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= settings_zone.name %></td>
|
|
||||||
<td><%= settings_zone.is_active %></td>
|
|
||||||
<td><%= settings_zone.created_by %></td>
|
|
||||||
<td><%= link_to 'Show', settings_zone %></td>
|
|
||||||
<td><%= link_to 'Edit', edit_settings_zone_path(settings_zone) %></td>
|
|
||||||
<td><%= link_to 'Destroy', settings_zone, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
<div class="card">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Is active</th>
|
||||||
|
<th>Created by</th>
|
||||||
|
<th colspan="3"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<%= link_to 'New Settings Zone', new_settings_zone_path %>
|
<tbody>
|
||||||
|
<% @settings_zones.each do |settings_zone| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= settings_zone.name %></td>
|
||||||
|
<td><%= settings_zone.is_active %></td>
|
||||||
|
<% if Employee.exists?(settings_zone.created_by) %>
|
||||||
|
<td><%= Employee.find(settings_zone.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= settings_zone.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= link_to 'Show', settings_zone_path(settings_zone) %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_path(settings_zone) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_zone_path(settings_zone), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,19 +1,97 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_zones_path %>">Zones</a></li>
|
||||||
|
<li>Details</li>
|
||||||
|
<span style="float: right">
|
||||||
|
<%= link_to 'Back', settings_zones_path %>
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<br/>
|
||||||
<strong>Name:</strong>
|
<div class="card">
|
||||||
<%= @settings_zone.name %>
|
<div class="card-block">
|
||||||
</p>
|
<h4 class="card-title">Zone</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Is active</th>
|
||||||
|
<th>Created by</th>
|
||||||
|
<th colspan="2"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<p>
|
<tbody>
|
||||||
<strong>Is active:</strong>
|
<tr>
|
||||||
<%= @settings_zone.is_active %>
|
<td><%= @settings_zone.name %></td>
|
||||||
</p>
|
<td><%= @settings_zone.is_active %></td>
|
||||||
|
<% if Employee.exists?(@settings_zone.created_by) %>
|
||||||
|
<td><%= Employee.find(@settings_zone.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= @settings_zone.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_path(@settings_zone) %></td>
|
||||||
|
<td><%= link_to 'Destroy', settings_zone_path(@settings_zone), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title">Dining Facilities
|
||||||
|
<span style="float: right">
|
||||||
|
<%= link_to "New Table",new_settings_zone_table_path(@settings_zone),:class => 'btn btn-primary btn-sm' %>
|
||||||
|
<%= link_to "New Room",new_settings_zone_room_path(@settings_zone),:class => 'btn btn-primary btn-sm' %>
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Seater</th>
|
||||||
|
<th>Is active</th>
|
||||||
|
<th>Created by</th>
|
||||||
|
<th colspan="2"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<p>
|
<tbody>
|
||||||
<strong>Created by:</strong>
|
<% @settings_tables.each do |settings_table|%>
|
||||||
<%= @settings_zone.created_by %>
|
<tr>
|
||||||
</p>
|
<td><%= link_to settings_table.name, settings_zone_table_path(@settings_zone,settings_table) %></td>
|
||||||
|
<td>Table</td>
|
||||||
<%= link_to 'Edit', edit_settings_zone_path(@settings_zone) %> |
|
<td><%= settings_table.seater %></td>
|
||||||
<%= link_to 'Back', settings_zones_path %>
|
<td><%= settings_table.is_active %></td>
|
||||||
|
<% if Employee.exists?(settings_table.created_by) %>
|
||||||
|
<td><%= Employee.find(settings_table.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= settings_table.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= settings_table.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_table_path(@settings_zone, settings_table) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% @settings_rooms.each do |room|%>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to room.name, settings_zone_room_path(@settings_zone,room) %></td>
|
||||||
|
<td>Room</td>
|
||||||
|
<td><%= room.seater %></td>
|
||||||
|
<td><%= room.is_active %></td>
|
||||||
|
<% if Employee.exists?(room.created_by) %>
|
||||||
|
<td><%= Employee.find(room.created_by).name %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><%= room.created_by %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= room.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_zone_room_path(@settings_zone, room) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -124,11 +124,15 @@ Rails.application.routes.draw do
|
|||||||
post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel
|
post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel
|
||||||
get '/print/:id', to: "home#print_order"#print order for crm
|
get '/print/:id', to: "home#print_order"#print order for crm
|
||||||
|
|
||||||
|
get "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign"
|
||||||
|
post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Order Queue Station ------------#
|
#--------- Order Queue Station ------------#
|
||||||
namespace :oqs do
|
namespace :oqs do
|
||||||
root "home#index"
|
root "home#index"
|
||||||
|
get "/:table_id", to: "home#get_order_items"
|
||||||
|
|
||||||
post 'update_delivery', to: "home#update_delivery_status"
|
post 'update_delivery', to: "home#update_delivery_status"
|
||||||
|
|
||||||
@@ -207,6 +211,7 @@ Rails.application.routes.draw do
|
|||||||
#--------- Reports Controller Sections ------------#
|
#--------- Reports Controller Sections ------------#
|
||||||
namespace :reports do
|
namespace :reports do
|
||||||
resources :receipt_no, :only => [:index, :show]
|
resources :receipt_no, :only => [:index, :show]
|
||||||
|
resources :daily_sale, :only => [:index, :show]
|
||||||
# resources :sales, :only => [:index, :show]
|
# resources :sales, :only => [:index, :show]
|
||||||
# resources :orders, :only => [:index, :show]
|
# resources :orders, :only => [:index, :show]
|
||||||
# resources :customers, :only => [:index, :show]
|
# resources :customers, :only => [:index, :show]
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1]
|
|||||||
create_table :accounts do |t|
|
create_table :accounts do |t|
|
||||||
t.string :title
|
t.string :title
|
||||||
t.string :account_type
|
t.string :account_type
|
||||||
|
t.boolean :discount, :null => false, :default => false
|
||||||
|
t.boolean :point, :null => false, :default => false
|
||||||
|
t.boolean :bonus, :null => false, :default => false
|
||||||
|
t.boolean :rebate, :null => false, :default => false
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class CreateDiningFacilities < ActiveRecord::Migration[5.1]
|
|||||||
t.references :zone, foreign_key: true
|
t.references :zone, foreign_key: true
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :status, :null => false, :default => "available"
|
t.string :status, :null => false, :default => "available"
|
||||||
t.string :type, :null => false, :default => "table"
|
t.string :type, :null => false, :default => "Table"
|
||||||
t.integer :seater, :null => false, :default => 2
|
t.integer :seater, :null => false, :default => 2
|
||||||
t.integer :order_by
|
t.integer :order_by
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class CreateDiningQueues < ActiveRecord::Migration[5.1]
|
|||||||
t.string :contact_no
|
t.string :contact_no
|
||||||
t.string :queue_no
|
t.string :queue_no
|
||||||
t.string :status
|
t.string :status
|
||||||
|
t.references :dining_facility, foreign_key: true
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
@@ -11,7 +11,7 @@ namespace :clear do
|
|||||||
Sale.delete_all
|
Sale.delete_all
|
||||||
SaleAudit.delete_all
|
SaleAudit.delete_all
|
||||||
SalePayment.delete_all
|
SalePayment.delete_all
|
||||||
|
DiningFacility.update_all(status:'available')
|
||||||
puts "Clear Data Done."
|
puts "Clear Data Done."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
0
sxrestaurant-lock
Normal file
0
sxrestaurant-lock
Normal file
Reference in New Issue
Block a user