changed in server master

This commit is contained in:
superuser
2017-06-22 11:38:42 +06:30
82 changed files with 2217 additions and 513 deletions

View File

@@ -18,3 +18,5 @@
//= require cable
//= require jquery-ui
//= require bootstrap-datepicker
//= require bootstrap/modal

View File

@@ -18,46 +18,71 @@
//= require cable
$(document).ready(function(){
// auto refresh every 10 seconds
// setTimeout(function(){
// window.location.reload(1);
// }, 10000);
$('.queue_station').on('click',function(){
var orderZone=$(this).children().children().children('.order-zone').text();
var orderItem=$(this).children().children().children('.order-item').text();
var orderQty=$(this).children().children().children('.order-qty').text();
var orderBy=$(this).children().children().children().children('.order-by').text();
var orderAt=$(this).children().children().children().children('.order-at').text();
var orderCustomer=$(this).children().children('.order-customer').text();
var orderZone=$(this).children().children().children('.order-zone').text().trim();
// var orderItem=$(this).children().children().children('.order-item').text();
//var assigned_item_id = $(this).children().find(".assigned-order-item").text();
var orderQty = $(this).children().children().children('.order-qty').text();
var orderBy = $(this).children().children().children().children('.order-by').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-by').text(orderBy);
$('#order-at').text(orderAt);
$('#order-customer').text(orderCustomer);
$('#order-from').text(orderZone);
// clear order items
$("#oqs-order-details-table").children("tbody").empty();
$('#order-items').text(orderItem);
$('#order-qty').text(orderQty);
// Call get_order_items() for Order Items by dining
$.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');
$(this).addClass('selected-item');
});
// complete for queue item
$('.order-complete').on('click',function(e){
$('.order-complete').on('click',function(e){
//e.preventDefault();
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var params = { 'id':assigned_item_id };
// Call update_delivery_status() for changed delivery and move to delivery
$.ajax({
type: 'POST',
url: '/oqs/update_delivery',
data: params,
dataType: 'json',
success: function(data){
for (i = 0; i < data.length; i++) {
success: function(data){
for (i = 0; i < data.length; i++) {
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
var station = queue_station.parent().parent().attr('id');
@@ -66,7 +91,7 @@ $(document).ready(function(){
// Remove a queue card from current station
queue_station.children('.card-footer').remove();
// Add removed queue card from station to completed
$("#completed").children('.card-columns').append(queue_station);
@@ -74,33 +99,37 @@ $(document).ready(function(){
var station_count=parseInt($("#"+station+"_count").text()) - 1;
$("#"+station+"_count").text(station_count);
}
// update queue item count in completed station
// update queue item count in completed station
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
alert("updated!");
// Page reload
location.reload();
}
});
});
});
// Print Order Item
$('#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 };
$.ajax({
type: 'GET',
url: '/oqs/print/print/'+assigned_item_id,
url: '/oqs/print/print/'+assigned_item_id,
success: function(data){ }
});
});
// Print Order Summary
$('#print_order_summary').on('click',function(){
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
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 params = { 'table_name':table_name };
$.ajax({
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){ }
});
});

View File

@@ -55,7 +55,7 @@ $(document).ready(function(){
var cashier="";
var receipt_date="";
var sub_total=0;
var sub_total=0.0;
var discount_amount=0;
var tax_amount=0;
var grand_total_amount=0;
@@ -69,11 +69,11 @@ $(document).ready(function(){
type: "POST",
url: "/origami/" + unique_id,
data: { 'booking_id' : unique_id },
success:function(result){
success:function(result){
for (i = 0; i < result.length; i++) {
var data = JSON.stringify(result[i]);
var parse_data = JSON.parse(data);
var show_date = "";
var show_date = "";
// Receipt Header
receipt_no = result[i].receipt_no;
@@ -81,36 +81,37 @@ $(document).ready(function(){
if(result[i].receipt_date != null){
receipt_date = new Date(result[i].receipt_date);
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
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;
tax_amount = parse_data.tax_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);
grand_total_amount = parse_data.grand_total_amount;
// Ordered Items
var order_items_rows = "<tr>" +
"<td class='item-name'>" + parse_data.item_name + "</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>";
$("#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
@@ -121,7 +122,7 @@ $(document).ready(function(){
// Bill Request
$('#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!=""){
window.location.href = '/origami/' + order_id + '/request_bills'
}
@@ -133,7 +134,8 @@ $(document).ready(function(){
// Discount for Payment
$('#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!=""){
window.location.href = '/origami/' + order_id + '/discount'
}
@@ -148,7 +150,7 @@ $(document).ready(function(){
$("#pay-discount").on('click', function(e){
e.preventDefault();
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 grand_total = $('#order-grand-total').text();
var discount_type = $('#discount-type').val();
@@ -178,7 +180,7 @@ $(document).ready(function(){
// Payment for Bill
$('#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!=""){
window.location.href = '/origami/sale/'+ sale_id + "/payment"
}
@@ -190,7 +192,7 @@ $(document).ready(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") {
var sale_id = sale
}else{
@@ -202,7 +204,7 @@ $(document).ready(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"

View File

@@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() {
items.push($(value).attr("data-id"));
});
$("#order_queue_station_processing_items").val(items);
$("#order_queue_station_processing_items").val(JSON.stringify(items));
//$(this).submit();
})
})

View File

@@ -3,6 +3,7 @@
@import "theme";
@import "jquery-ui";
@import "bootstrap-datepicker3";
@import "bootstrap/modal";
/* Show it is fixed to the top */
// body {
@@ -10,4 +11,15 @@
// 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;
}

View File

@@ -15,14 +15,29 @@ class Api::BillController < Api::ApiController
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
else
@status = true
@sale_id = booking.sale_id
end
end
elsif (params[:order_id])
@sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
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

View File

@@ -23,55 +23,117 @@ class BaseReportController < ActionController::Base
period = params[:period]
from = params[:from]
to = params[:to]
day_ref = Time.now
if period_type.to_i == 1
if params[:from] && params[:to]
if params[:from] != "" && params[:to] !=""
from = DateTime.strptime(params[:from], "%m/%d/%Y")
to = DateTime.strptime(params[:to], "%m/%d/%Y")
else
day_ref = Time.now.utc.getlocal
if params[:report_type] == "daily_sale"
if from != "" && to != ""
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
to = day_ref.end_of_day.utc
end
end
else
case period.to_i
when PERIOD["today"]
from = day_ref.beginning_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["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
else # end daily sale report
if period_type.to_i == 1
if params[:from] && params[:to]
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
if params[:from] != "" && params[:to] !=""
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
from = day_ref.beginning_of_day.utc
to = day_ref.end_of_day.utc
end
end
else
case period.to_i
when PERIOD["today"]
from = day_ref.beginning_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
return from, to
end
end

View File

@@ -117,7 +117,7 @@ class Crm::CustomersController < BaseCrmController
# format.json { render :index, status: :created, location: @crm_customers }
else
@crm_customers.destroy
# @crm_customers.destroy
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
else

View File

@@ -4,7 +4,8 @@ class Crm::DiningQueuesController < BaseCrmController
# GET /crm/dining_queues
# GET /crm/dining_queues.json
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
# GET /crm/dining_queues/1
@@ -38,7 +39,7 @@ class Crm::DiningQueuesController < BaseCrmController
printer = Printer::ReceiptPrinter.new(print_settings)
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 }
else
format.html { render :new }
@@ -52,7 +53,7 @@ class Crm::DiningQueuesController < BaseCrmController
def update
respond_to do |format|
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 }
else
format.html { render :edit }
@@ -71,6 +72,27 @@ class Crm::DiningQueuesController < BaseCrmController
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
# Use callbacks to share common setup or constraints between actions.
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.
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

View File

@@ -1,27 +1,65 @@
class Oqs::HomeController < BaseOqsController
def index
queue_stations=OrderQueueStation.all
@queue_items_details = queue_items_query(0)
@queue_completed_item = queue_items_query(1)
@queue_items_details = queue_items_query(false)
@queue_completed_item = queue_items_query(true)
@queue_stations_items=Array.new
# Calculate Count for each station tab
queue_stations.each do |que|
queue_stations.each do |que|
i=0
@queue_items_details.each do |qid|
if qid.station_name == que.station_name
i=i+1
end
end
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
@queue_items_details.each do |qid|
if qid.station_name == que.station_name
i=i+1
end
end
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
end
@queue_stations_items
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
end
@@ -35,24 +73,33 @@ class Oqs::HomeController < BaseOqsController
# update delivery status for completed same order items
assigned_items.each do |ai|
ai.delivery_status=true
ai.save
ai.save
removed_item.push(ai.assigned_order_item_id)
end
render :json => removed_item.to_json
end
render :json => removed_item.to_json
end
# Query for OQS with 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")
.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
.joins(" 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")
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}")
.group("assigned_order_items.assigned_order_item_id")
.order("odt.item_name DESC")
end
end

View File

@@ -9,10 +9,13 @@ class Oqs::PrintController < ApplicationController
# order queue stations
oqs = assigned_item.order_queue_station
# Check Printed
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
# 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,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
assigned_items.each do |ai|
@@ -21,20 +24,28 @@ class Oqs::PrintController < ApplicationController
end
end
# Print Order Details
# Print Order Details with booking id
def print_order_summary
unique_code="OrderSummaryPdf"
assigned_item_id=params[:id]
table_name=params[:table_name]
assigned_item=AssignedOrderItem.find(assigned_item_id)
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
# order queue stations
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_settings=PrintSetting.find_by_unique_code(unique_code)
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
assigned_items.each do |ai|

View File

@@ -1,8 +1,8 @@
class Origami::HomeController < BaseOrigamiController
def index
if params[:booking_id] != nil
type=params[:booking_id].split('-')[0];
# Sale
type=params[:booking_id].split('-')[0];
# Sale
if type == "SAL"
@selected_item = Sale.find(params[:booking_id])
@selected_item_type="Sale"
@@ -10,23 +10,23 @@ class Origami::HomeController < BaseOrigamiController
else
@selected_item = Order.find(params[:booking_id])
@selected_item_type="Order"
end
end
end
end
@completed_orders = Order.get_completed_order()
@booking_orders = Order.get_booking_order_table()
@booking_rooms = Order.get_booking_order_rooms()
@booking_rooms = Order.get_booking_order_rooms()
@orders = Order.get_orders()
end
end
def item_show
selection(params[:booking_id],1)
end
end
def selection(selected_id, is_ajax)
str = []
type=selected_id.split('-')[0];
# Sale
type=selected_id.split('-')[0];
# Sale
if type == "SAL"
@order_details = SaleItem.get_order_items_details(params[:booking_id])
@order_details.each do |ord_detail|
@@ -39,6 +39,7 @@ class Origami::HomeController < BaseOrigamiController
str.push(ord_detail)
end
end
if is_ajax == 1
render :json => str.to_json
else
@@ -54,21 +55,21 @@ class Origami::HomeController < BaseOrigamiController
else
sale = Order.find(params[:sale_id])
end
status = sale.update_attributes(customer_id: params[:customer_id])
if status == true
render json: JSON.generate({:status => true})
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end
end
end
def get_customer
@customer = Customer.find(params[:customer_id])
response = Customer.get_member_account(@customer)
respond_to do |format|

View File

@@ -12,7 +12,7 @@ class Origami::PaymentsController < BaseOrigamiController
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "cash")
unique_code = "ReceiptBillPdf"
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
# get member information
@@ -20,11 +20,10 @@ class Origami::PaymentsController < BaseOrigamiController
# 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(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
end
end
@@ -41,14 +40,14 @@ class Origami::PaymentsController < BaseOrigamiController
@sale_data = Sale.find_by_sale_id(sale_id)
#get customer amount
@customer = Customer.find(@sale_data.customer_id)
@customer = Customer.find(@sale_data.customer_id)
# get member information
response = Customer.get_member_account(@customer)
@balance = 0.00
@accountable_type = ''
if response["data"]==true
if response["status"]==true
response["data"].each do |res|
if res["accountable_type"] == "RebateAccount"
@balance = res["balance"]
@@ -84,19 +83,19 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj = Sale.find(sale_id)
unique_code = "ReceiptBillPdf"
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
# get member information
member_info = Customer.get_member_account(customer)
# 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(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
end

View File

@@ -6,7 +6,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id)
# 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
others = 0
sale_data.sale_payments.each do |sale_payment|
@@ -16,11 +17,11 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
others = others + sale_payment.payment_amount
end
end
is_bervage_exceed = others - (beverage_prices + sale_data.total_tax)
if is_bervage_exceed < 0
@food_prices = food_prices - @payparcount
non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
if non_rebate_exceed < 0
@redeem_prices = rebate_prices - @payparcount
else
@food_prices = food_prices - @payparcount -is_bervage_exceed
@redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
end
if sale_data

View File

@@ -1,9 +1,25 @@
class Reports::DailySaleController < BaseReportController
def index
from, to = get_date_range_from_params
@sale_data = Sale.get_receipt_no_list(from,to)
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
from, to = get_date_range_from_params
@sale_data = Sale.daily_sales_list(from,to)
@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

View File

@@ -68,6 +68,6 @@ class Settings::AccountsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def account_params
params.require(:account).permit(:title, :account_type)
params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
end
end

View File

@@ -41,7 +41,7 @@ class Settings::OrderQueueStationsController < ApplicationController
# PATCH/PUT /settings/order_queue_stations/1
# PATCH/PUT /settings/order_queue_stations/1.json
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|
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.' }
@@ -71,6 +71,11 @@ class Settings::OrderQueueStationsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
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)
# =======
# 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

View 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

View 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

View File

@@ -10,6 +10,8 @@ class Settings::ZonesController < ApplicationController
# GET /settings/zones/1
# GET /settings/zones/1.json
def show
@settings_tables = @settings_zone.tables
@settings_rooms = @settings_zone.rooms
end
# GET /settings/zones/new
@@ -25,10 +27,10 @@ class Settings::ZonesController < ApplicationController
# POST /settings/zones.json
def create
@settings_zone = Zone.new(settings_zone_params)
@settings_zone.created_by = current_login_employee.name
respond_to do |format|
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 }
else
format.html { render :new }
@@ -41,8 +43,9 @@ class Settings::ZonesController < ApplicationController
# PATCH/PUT /settings/zones/1.json
def update
respond_to do |format|
@settings_zone.created_by = current_login_employee.name
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 }
else
format.html { render :edit }
@@ -54,9 +57,11 @@ class Settings::ZonesController < ApplicationController
# DELETE /settings/zones/1
# DELETE /settings/zones/1.json
def destroy
@settings_zone.rooms.destroy
@settings_zone.tables.destroy
@settings_zone.destroy
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 }
end
end
@@ -69,6 +74,6 @@ class Settings::ZonesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
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

View File

@@ -9,28 +9,8 @@ class Customer < ApplicationRecord
validates_presence_of :name, :contact_no, :email
validates :contact_no, uniqueness: true
validates :email, uniqueness: true
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
paginates_per 50
def self.get_member_account(customer)
membership = MembershipSetting.find_by_membership_type("paypar_url")
@@ -38,13 +18,19 @@ class Customer < ApplicationRecord
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.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,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
},
:timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
end
return response;
@@ -59,6 +45,35 @@ class Customer < ApplicationRecord
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)
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
# end

View File

@@ -9,8 +9,24 @@ class DiningFacility < ApplicationRecord
scope :active, -> {where(is_active: true)}
def get_current_booking
puts "enter booking"
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
puts "enter booking"
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
if booking.count > 0 then
return booking[0].booking_id
else
return nil
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

View File

@@ -1,7 +1,9 @@
class DiningQueue < ApplicationRecord
belongs_to :dining_facility, :optional => true
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
end
end
end

View File

@@ -6,6 +6,9 @@ class Employee < ApplicationRecord
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
def self.collection
Employee.select("id, name").map { |e| [e.name, e.id] }
end
def self.login(emp_id, password)
user = Employee.find_by_emp_id(emp_id)

View File

@@ -246,7 +246,7 @@ class Order < ApplicationRecord
.joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id")
.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
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
end

View File

@@ -5,6 +5,8 @@
class OrderQueueStation < ApplicationRecord
has_many :assigned_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)}
@@ -14,37 +16,67 @@ class OrderQueueStation < ApplicationRecord
oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
order_items = order.order_items
# get dining
booking = Booking.find_by_dining_facility_id(dining.id)
#Assign OQS id to order Items
oqs_stations.each do |oqs|
#Get List of items -
pq_items = JSON.parse(oqs.processing_items)
if oqs.id == oqpbz.order_queue_station_id
#Loop through the processing items
pq_items.each do |pq_item|
#Processing through the looping items
order_items.each do |order_item|
if (pq_item == order_item.item_code)
#Same Order_items can appear in two location.
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
pq_items.each do |pq_item|
#Processing through the looping items
order_items.each do |order_item|
if (pq_item == order_item.item_code)
# 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)
# end
if oqs.auto_print
print_slip(oqs, order, order_items)
end
end
end
end
end
end
#Print OQS where printing is require
end
private
#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
#Print order_items in 1 slip per item
def print_slip_item
#Print order_item in 1 slip per 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

View File

@@ -1,66 +1,128 @@
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
#Generate PDF
#Print
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"
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf"
pdf = OrderItemPdf.new(order_item[0], print_status)
pdf.render_file filename
if oqs.print_copy
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print("tmp/receipt.pdf", oqs.printer_name)
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("tmp/receipt.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
end
end
def print_order_summary(oqs,order_id)
# Query for per order
def print_order_summary(oqs, order_id, print_status)
#Use CUPS service
#Generate PDF
#Print
order=print_query('order_summary',order_id)
#Print
order=print_query('order_summary', order_id)
# For Print Per Item
if oqs.cut_per_item
order.each do|odi|
pdf = OrderItemPdf.new(odi)
pdf.render_file "tmp/receipt.pdf"
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
pdf = OrderItemPdf.new(odi, print_status)
# pdf.render_file "tmp/order_item.pdf"
pdf.render_file filename
if oqs.print_copy
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
end
end
# For Print Order Summary
else
filename = "tmp/order_summary_#{order_id}" + ".pdf"
pdf = OrderSummaryPdf.new(order)
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
pdf = OrderSummaryPdf.new(order, print_status)
pdf.render_file filename
self.print(filename, oqs.printer_name)
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, code)
if type == 'order_item'
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")
.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("order_items.item_code='" + code + "'")
.where("order_items.item_code = '#{ id }'")
.group("order_items.item_code")
else
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='" + code + "'")
.group("order_items.item_code")
.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

View File

@@ -52,7 +52,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
self.print(filename)
end
def print_receipt_payment_by_foc(sale_id)
#Use CUPS service
#Generate PDF
@@ -70,6 +70,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Generate PDF
#Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info)
pdf.render_file "tmp/receipt_bill.pdf"
self.print("tmp/receipt_bill.pdf")
end

View File

@@ -23,6 +23,7 @@ class Sale < ApplicationRecord
if (booking)
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
booking.booking_orders.each do |order|
if booking.sale_id
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
@@ -88,6 +89,8 @@ class Sale < ApplicationRecord
order.save
booking.sale_id = self.id
booking.checkout_at = Time.now.utc
booking.checkout_by = requested_by.name
booking.save
return true, self.id
@@ -188,9 +191,14 @@ class Sale < ApplicationRecord
# Tax Calculate
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
self.sale_taxes.each do |existing_tax|
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
#delete existing and create new
existing_tax.delete
end
@@ -199,7 +207,7 @@ class Sale < ApplicationRecord
#tax_profile - list by order_by
tax_profiles = TaxProfile.all.order("order_by asc")
#Creat new tax records
# #Creat new tax records
tax_profiles.each do |tax|
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
@@ -273,6 +281,59 @@ class Sale < ApplicationRecord
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
def generate_custom_id

View File

@@ -30,35 +30,51 @@ class SaleItem < ApplicationRecord
# end
end
# Calculate food total and beverage total
def self.calculate_food_beverage(sale_items)
food_prices=0
beverage_prices=0
sale_items.each do |si|
food_price, beverage_price = self.get_price(si.sale_item_id)
food_prices = food_prices + food_price
beverage_prices = beverage_prices + beverage_price
rebateacc = Account.where("rebate=?",true)
puts "Account that can rebate"
rebateacc.each do |i|
puts i.title
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
def self.get_price(sale_item_id)
food_price=0
beverage_price=0
# get food price or beverage price for item
def self.get_price(sale_item_id,rebateacc)
price=0
item=SaleItem.select("sale_items.price , menu_items.account_id")
.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)
if item[0].account_id == 1
food_price = item[0].price
else
beverage_price = item[0].price
rebateacc.each do |i|
if item[0].account_id == i.id
price = item[0].price
end
end
return food_price, beverage_price
return price
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
def generate_custom_id
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")

View File

@@ -66,16 +66,20 @@ class SalePayment < ApplicationRecord
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,
: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 => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
)
return response;
: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 => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, :timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
end
return response;
end
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"]
sale_data = Sale.find_by_sale_id(sale_id)
if sale_data
response = HTTParty.post(url,
: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,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
)
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
: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,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
},
:timeout => 10
)
rescue Net::OpenTimeout
response = false
end
else
response = false;
end
@@ -119,7 +129,6 @@ class SalePayment < ApplicationRecord
end
def creditnote_payment(customer_id)
payment_status = false
self.payment_method = "creditnote"
@@ -187,17 +196,16 @@ class SalePayment < ApplicationRecord
payment_status = false
#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)
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)
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')
sale_update_payment_status(self.received_amount.to_f)
@@ -241,7 +249,9 @@ class SalePayment < ApplicationRecord
end
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
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
paypar = sObj.sale_payments
@@ -251,7 +261,10 @@ class SalePayment < ApplicationRecord
payparcost = payparcost + pp.payment_amount
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
receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url")
@@ -260,14 +273,20 @@ class SalePayment < ApplicationRecord
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
auth_token = memberaction.auth_token.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,
:headers => {
'Content-Type' => '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

View File

@@ -5,6 +5,10 @@ class SaleTax < ApplicationRecord
before_create :generate_custom_id
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
def generate_custom_id
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")

View File

@@ -2,7 +2,12 @@ class Zone < ApplicationRecord
# model association
has_many :tables, dependent: :destroy
has_many :rooms, dependent: :destroy
has_many :order_queue_stations
# validations
validates_presence_of :name, :created_by
def self.collection
Zone.select("id, name").map { |e| [e.name, e.id] }
end
end

View File

@@ -1,16 +1,16 @@
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
def initialize(order_item)
self.page_width = 254
self.page_height = 1450
self.margin = 10
def initialize(order_item, print_status)
self.page_width = 210
self.page_height = 2500
self.margin = 5
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.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_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 => [10, 5, 30, 5], :page_size => [200,400])
@@ -19,9 +19,9 @@ class OrderItemPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
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
move_down 5
@@ -71,7 +71,7 @@ class OrderItemPdf < Prawn::Document
add_order_items(order_item)
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
end

View File

@@ -1,13 +1,13 @@
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
def initialize(order)
self.page_width = 254
self.page_height = 1450
self.margin = 10
def initialize(order, print_status)
self.page_width = 210
self.page_height = 2500
self.margin = 5
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.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_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=100
@@ -20,7 +20,7 @@ class OrderSummaryPdf < Prawn::Document
self.header_font_size = 12
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
move_down 5
@@ -59,7 +59,7 @@ class OrderSummaryPdf < Prawn::Document
text "Item", :size => self.item_font_size,:align => :left
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
end
@@ -77,16 +77,22 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
order_item.each do|odi|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
y_position = cursor
# 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
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left
bounding_box([self.item_width,y_position], :width => self.qty_width) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left, :height => self.item_height
end
end
move_down 5
move_down 5
end
end
end

View File

@@ -4,14 +4,13 @@ class ReceiptBillPdf < Prawn::Document
self.page_width = 210
self.page_height = 2500
self.margin = 5
self.price_width = 35
self.price_width = 40
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_height = 15
self.item_description_width = (self.page_width-20) / 2
self.label_width = 100
# @item_width = self.page_width.to_i / 2
# @qty_width = @item_width.to_i / 3
# @double = @qty_width * 1.3
@@ -36,7 +35,6 @@ class ReceiptBillPdf < Prawn::Document
if member_info != nil
member_info(member_info)
end
footer
end
@@ -55,29 +53,36 @@ class ReceiptBillPdf < Prawn::Document
# move_down 2
y_position = cursor
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
bounding_box([self.label_width, y_position], :width =>self.item_width) do
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
text "#{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
end
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Customer:", :size => self.item_font_size,:align => :left
bounding_box([0, y_position], :width =>self.item_width) do
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
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do
text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left
end
move_down 5
# 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 "Date:", :size => self.item_font_size,:align => :left
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.item_width) do
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.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
move_down 5
@@ -120,10 +125,10 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor
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 "#{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 "#{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 "#{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 "#{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}", :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}", :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}", :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
end
@@ -165,7 +170,7 @@ class ReceiptBillPdf < Prawn::Document
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
end
if sale_data.sale_taxes.length > 1
if sale_data.sale_taxes.length > 0
sale_data.sale_taxes.each do |st|
move_down 5
y_position = cursor
@@ -174,7 +179,7 @@ class ReceiptBillPdf < Prawn::Document
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
end
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
else
@@ -206,10 +211,10 @@ class ReceiptBillPdf < Prawn::Document
# show member information
def member_info(member_info)
move_down 7
if member_info["status"] == true
member_info["data"].each do |res|
if member_info["status"] == true
member_info["data"].each do |res|
move_down 5
y_position = cursor
@@ -219,9 +224,9 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
end
end
end
end
end
end
def footer

View File

@@ -10,7 +10,7 @@
</div>
<br>
<div class="form-actions">
<%= f.button :submit %>
<%= f.button :submit,"Create Queue" %>
</div>
<% end %>

View 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>

View File

@@ -1,38 +1,69 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Queue</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Queue</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th style="width:25%">Name</th>
<th style="width:25%">Contact No</th>
<th style="width:25%">Queue No</th>
<th style="width:25%">Action</th>
</tr>
</thead>
<div class="row">
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
<div class="row">
<% @i = 0 %> .
<% @dining_queues.each do |queue| %>
<div class="col-md-3 ">
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
<div class="card-block">
<p class="hidden queue-id"><%= queue.id %></p>
<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>
<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>

View File

@@ -14,6 +14,7 @@
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
<hr>
<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>
<li><%= link_to "Cashier Terminals ", settings_cashier_terminals_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 "Tax Profile", settings_tax_profiles_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>
</li>
@@ -35,7 +38,7 @@
<li class="navbar-nav mr-auto dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;Reports</a>
<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 "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
</ul>

View File

@@ -49,7 +49,10 @@
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<!--
Item Options
<p class="card-text">Medium, Fries, Salad</p>
-->
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
@@ -60,6 +63,7 @@
</span>
</small>
</p>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
@@ -96,7 +100,10 @@
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<!--
Item Options
<p class="card-text">Medium, Fries, Salad</p>
-->
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
@@ -133,7 +140,7 @@
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" >
<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 class="card-block">
<div class="card-title">
@@ -159,7 +166,7 @@
</table>
</div>
<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>
<tr>
<th style="width:80%; text-align:left">Items</th>
@@ -167,17 +174,7 @@
</tr>
</thead>
<tbody>
<tr>
<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>
<!-- Bind With JS -->
</tbody>
</table>
</div>

View File

@@ -82,10 +82,10 @@
<!--- Panel 1 - Table Orders -->
<div class="tab-pane active" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_orders.each do |bko|
# No Show completed
# No Show completed
if bko.sale_status == 'completed'
next
end
@@ -146,7 +146,7 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_rooms.each do |rmo|
# No Show completed
# No Show completed
if rmo.sale_status == 'completed'
next
end
@@ -207,8 +207,8 @@
<div class="tab-pane" id="orders" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@orders.each do |odr|
# No Show completed
@orders.each do |odr|
# No Show completed
if odr.sale_status == 'completed'
next
end
@@ -289,7 +289,7 @@
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
@@ -300,18 +300,18 @@
<th class="item-attr">Price</td>
</tr>
</thead>
<tbody>
<tbody>
<%
# For Sale Items
sub_total = 0
if @selected_item_type == "Sale"
@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>
<td class='item-name'><%= sale_item.product_name %></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>
<%
end
@@ -319,10 +319,10 @@
%>
<%
# For Order Items
# For Order Items
if @selected_item_type == "Order"
@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>
<td class='item-name'><%= order_item.item_name %></td>
@@ -354,17 +354,17 @@
<td class="charges-name"><strong>Discount:</strong></td>
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<!-- <tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
</tr>
<tr>
<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>
</tr>
<tr class="rebate_amount">
</tr>
</tr> -->
<tr class="rebate_amount"></tr>
</table>
</div>
</div>

View File

@@ -11,7 +11,7 @@
<div class="rebate-form">
<div class="row">
<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="">
</div>
<hr>
@@ -68,7 +68,7 @@
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div>
<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 green left" data-type="clr">Clr</div>
</div>
@@ -91,11 +91,17 @@
</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>
<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>
<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
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
@@ -128,6 +134,9 @@ $(document).on('click', '.cashier_number', function(event){
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
case 'nett':
var remain_amount = $('#validamount').val();
$('#amount').text(remain_amount);
break;
}
@@ -141,7 +150,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#jcb_pay').on('click',function(){
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= "<%= @can_jcb %>"){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
$.ajax({type: "POST",
url: "<%= origami_payment_jcb_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,

View File

@@ -11,7 +11,7 @@
<div class="rebate-form">
<div class="row">
<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="">
</div>
<hr>
@@ -96,6 +96,12 @@
</div>
<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){
event.stopPropagation();
event.preventDefault();
@@ -138,7 +144,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#master_pay').on('click',function(){
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= "<%= @can_master %>"){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
$.ajax({type: "POST",
url: "<%= origami_payment_master_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,

View File

@@ -11,7 +11,7 @@
<div class="rebate-form">
<div class="row">
<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="">
</div>
<hr>
@@ -68,7 +68,7 @@
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div>
<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 green left" data-type="clr">Clr</div>
</div>
@@ -96,6 +96,12 @@
</div>
<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){
event.stopPropagation();
event.preventDefault();
@@ -127,6 +133,9 @@ $(document).on('click', '.cashier_number', function(event){
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
case 'nett':
var remain_amount = $('#validamount').val();
$('#amount').text(remain_amount);
break;
}
@@ -138,7 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#mpu_pay').on('click',function(){
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= "<%= @can_mpu %>"){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
$.ajax({type: "POST",
url: "<%= origami_payment_mpu_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,

View File

@@ -235,9 +235,10 @@
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-lg btn-block"> Foc </button>
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </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" 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-block"> FOC </button>
<button type="button" class="btn btn-primary btn-block"> Void </button>
</div>
</div>

View File

@@ -6,7 +6,7 @@
<div class="row">
<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>
<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>
<hr>
</div>
@@ -21,7 +21,7 @@
<% end %>
<div class="row">
<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 %>">
</div>
<hr>
@@ -38,10 +38,10 @@
<!-- <% if @payparcount > 0 %>
<p class="">Last time rebate amount is <%= @payparcount %></p>
<% 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 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="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>
<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 green left" data-type="clr">Clr</div>
</div>
@@ -84,9 +84,15 @@
<div class="pay purple" id="redeem">Pay</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 class="row">
@@ -123,6 +129,9 @@ $(document).on('click', '.cashier_number', function(event){
case 'del' :
var cash=$('#used_amount').text();
$('#used_amount').text(cash.substr(0,cash.length-1));
case 'nett':
alert($('#valid_amount').text())
$('#used_amount').text($('#valid_amount').text());
break;
}
@@ -142,7 +151,7 @@ $("#redeem").click(function(){
}else if(valid_amount< redeem_amount){
alert(" Insufficient Amount!")
}else{
if(redeem_amount <= "<%= @food_prices %>"){
if(redeem_amount <= "<%= @redeem_prices %>"){
$.ajax({
type: "POST",
url: "<%=origami_payment_paypar_path%>",

View File

@@ -11,7 +11,7 @@
<div class="rebate-form">
<div class="row">
<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="">
</div>
<hr>
@@ -68,7 +68,7 @@
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div>
<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 green left" data-type="clr">Clr</div>
</div>
@@ -91,11 +91,17 @@
</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>
<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>
<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){
event.stopPropagation();
event.preventDefault();
@@ -127,6 +133,9 @@ $(document).on('click', '.cashier_number', function(event){
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
case 'nett':
var remain_amount = $('#validamount').val();
$('#amount').text(remain_amount);
break;
}
@@ -138,7 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#visa_pay').on('click',function(){
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= "<%= @can_visa %>"){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value"))){
$.ajax({type: "POST",
url: "<%= origami_payment_visa_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,

View 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>

View 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">&nbsp;</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">&nbsp;</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>

View 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">&nbsp;</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">&nbsp;</td>
</tr>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>

View File

@@ -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>

View File

@@ -44,7 +44,7 @@
<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_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_discount.to_f), :delimiter => ',') %></td>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>

View File

@@ -4,11 +4,14 @@
<div class="form-inputs">
<%= f.input :title %>
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
<%= f.input :discount %>
<%= f.input :point %>
<%= f.input :bonus %>
<%= f.input :rebate %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
<% end %>

View File

@@ -14,9 +14,14 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width:40%">Title</th>
<th style="width:40%">Account Type</th>
<th style="width:20%">Action</th>
<th>Title</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 style="">Action</th>
</tr>
</thead>
@@ -25,10 +30,14 @@
<tr>
<td><%= account.title %></td>
<td><%= account.account_type %></td>
<td><%= account.discount %></td>
<td><%= account.point %></td>
<td><%= account.bonus %></td>
<td><%= account.rebate %></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?' } %>
</td>
</tr>
<% end %>

View File

@@ -17,6 +17,10 @@
<tr>
<th>Title</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>
</tr>
</thead>
@@ -25,10 +29,14 @@
<tr>
<td><%= @settings_account.title %></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>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -9,7 +9,6 @@
<%= f.input :auth_token %>
<%= f.input :merchant_account_id %>
<%= f.input :created_by %>
<%= f.input :additional_parameter %>
</div>
<div class="form-actions">

View File

@@ -1,41 +1,47 @@
<p id="notice"><%= notice %></p>
<h1>Settings Membership Actions</h1>
<table>
<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>
<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 class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Settings Membership Actions</li>
<span style="float: right">
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<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>

View File

@@ -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| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :station_name %>
<%= f.input :is_active %>
<%= f.input :auto_print %>
<%= f.input :printer_name %>
<%= f.input :font_size %>
<%= 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 :use_alternate_name %>
<%= f.input :processing_items, as: :hidden %>
<%= f.input :auto_print %>
</div>
<div class="form-actions">

View 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 %>

View 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)

View 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>

View 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>

View 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>

View 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>

View 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 %>

View 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)

View 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>

View 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>

View 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>

View 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>

View File

@@ -1,10 +1,10 @@
<%= simple_form_for(@settings_zone) do |f| %>
<%= simple_form_for([:settings,@settings_zone]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :is_active %>
<%= f.input :created_by %>
<!-- <%= f.input :created_by, :collection => Employee.collection %> -->
</div>
<div class="form-actions">

View File

@@ -1,6 +1,10 @@
<h1>Editing Settings Zone</h1>
<%= render 'form', settings_zone: @settings_zone %>
<%= link_to 'Show', @settings_zone %> |
<%= link_to 'Back', settings_zones_path %>
<div class="span12">
<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>Edit</li>
</ul>
</div>
<%= render 'form', settings_zone: @settings_zone %>
</div>

View File

@@ -1,31 +1,41 @@
<p id="notice"><%= notice %></p>
<h1>Settings Zones</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Is active</th>
<th>Created by</th>
<th colspan="3"></th>
</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>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Zones</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_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>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>

View File

@@ -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>
<strong>Name:</strong>
<%= @settings_zone.name %>
</p>
<br/>
<div class="card">
<div class="card-block">
<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>
<strong>Is active:</strong>
<%= @settings_zone.is_active %>
</p>
<tbody>
<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 '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>
<strong>Created by:</strong>
<%= @settings_zone.created_by %>
</p>
<%= link_to 'Edit', edit_settings_zone_path(@settings_zone) %> |
<%= link_to 'Back', settings_zones_path %>
<tbody>
<% @settings_tables.each do |settings_table|%>
<tr>
<td><%= link_to settings_table.name, settings_zone_table_path(@settings_zone,settings_table) %></td>
<td>Table</td>
<td><%= settings_table.seater %></td>
<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>

View File

@@ -124,11 +124,15 @@ Rails.application.routes.draw do
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 "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign"
post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table"
end
#--------- Order Queue Station ------------#
namespace :oqs do
root "home#index"
get "/:table_id", to: "home#get_order_items"
post 'update_delivery', to: "home#update_delivery_status"
@@ -207,6 +211,7 @@ Rails.application.routes.draw do
#--------- Reports Controller Sections ------------#
namespace :reports do
resources :receipt_no, :only => [:index, :show]
resources :daily_sale, :only => [:index, :show]
# resources :sales, :only => [:index, :show]
# resources :orders, :only => [:index, :show]
# resources :customers, :only => [:index, :show]

View File

@@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1]
create_table :accounts do |t|
t.string :title
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
end

View File

@@ -4,7 +4,7 @@ class CreateDiningFacilities < ActiveRecord::Migration[5.1]
t.references :zone, foreign_key: true
t.string :name, :null => false
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 :order_by

View File

@@ -5,6 +5,7 @@ class CreateDiningQueues < ActiveRecord::Migration[5.1]
t.string :contact_no
t.string :queue_no
t.string :status
t.references :dining_facility, foreign_key: true
t.timestamps
end

BIN
dump.rdb

Binary file not shown.

View File

@@ -11,7 +11,7 @@ namespace :clear do
Sale.delete_all
SaleAudit.delete_all
SalePayment.delete_all
DiningFacility.update_all(status:'available')
puts "Clear Data Done."
end
end

0
sxrestaurant-lock Normal file
View File