merge with master
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -12,6 +12,7 @@ gem 'rails', '~> 5.1.0'
|
|||||||
|
|
||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
|
#Use PosgreSQL
|
||||||
gem 'pg'
|
gem 'pg'
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
@@ -90,3 +91,5 @@ end
|
|||||||
|
|
||||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||||
|
|
||||||
|
gem 'httparty', '~> 0.15.5'
|
||||||
10
Gemfile.lock
10
Gemfile.lock
@@ -1,6 +1,6 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: git://github.com/amatsuda/kaminari.git
|
remote: git://github.com/amatsuda/kaminari.git
|
||||||
revision: c3c853a944cd2bff072ae05e48c563b2c9a29597
|
revision: bc52ae73d41386d344b5d1b18e689e5a988f1a03
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
kaminari (1.0.1)
|
kaminari (1.0.1)
|
||||||
@@ -92,7 +92,9 @@ GEM
|
|||||||
railties (>= 3.2, < 5.2)
|
railties (>= 3.2, < 5.2)
|
||||||
globalid (0.4.0)
|
globalid (0.4.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
i18n (0.8.1)
|
httparty (0.15.5)
|
||||||
|
multi_xml (>= 0.5.2)
|
||||||
|
i18n (0.8.4)
|
||||||
jbuilder (2.6.4)
|
jbuilder (2.6.4)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
multi_json (>= 1.2)
|
multi_json (>= 1.2)
|
||||||
@@ -114,6 +116,7 @@ GEM
|
|||||||
mini_portile2 (2.1.0)
|
mini_portile2 (2.1.0)
|
||||||
minitest (5.10.2)
|
minitest (5.10.2)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
|
multi_xml (0.6.0)
|
||||||
mysql2 (0.4.6)
|
mysql2 (0.4.6)
|
||||||
nio4r (2.1.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.7.2)
|
nokogiri (1.7.2)
|
||||||
@@ -125,7 +128,7 @@ GEM
|
|||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
prawn-table (0.2.2)
|
prawn-table (0.2.2)
|
||||||
prawn (>= 1.3.0, < 3.0.0)
|
prawn (>= 1.3.0, < 3.0.0)
|
||||||
puma (3.8.2)
|
puma (3.9.1)
|
||||||
rack (2.0.3)
|
rack (2.0.3)
|
||||||
rack-cors (0.4.1)
|
rack-cors (0.4.1)
|
||||||
rack-protection (2.0.0)
|
rack-protection (2.0.0)
|
||||||
@@ -248,6 +251,7 @@ DEPENDENCIES
|
|||||||
factory_girl_rails (~> 4.0)
|
factory_girl_rails (~> 4.0)
|
||||||
faker
|
faker
|
||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
|
httparty (~> 0.15.5)
|
||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
kaminari!
|
kaminari!
|
||||||
|
|||||||
@@ -80,4 +80,14 @@ $(document).ready(function(){
|
|||||||
success: function(data){ }
|
success: function(data){ }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#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 };
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
||||||
|
success: function(data){ }
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
113
app/assets/javascripts/origami/payment.js
Normal file
113
app/assets/javascripts/origami/payment.js
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
// $(document).on('touchstart click', '.keypad', function(event){
|
||||||
|
// event.stopPropagation();
|
||||||
|
// event.preventDefault();
|
||||||
|
// if(event.handled !== true) {
|
||||||
|
//
|
||||||
|
// // Do your magic here.
|
||||||
|
// var input_value = $(this).attr("data-value");
|
||||||
|
// switch (input_value) {
|
||||||
|
//
|
||||||
|
// case 'delete':
|
||||||
|
// process_delete_payment();
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case 'foc':
|
||||||
|
// remove_input_action();
|
||||||
|
// $(".foc").attr("data-action","true");
|
||||||
|
// if(customerName.toString() != " "){ //if already chosen customer
|
||||||
|
// if($("#foc_reason_lists").attr("foc_reason") == ' '){
|
||||||
|
// alert("Please! Choose or Add FOC reason");
|
||||||
|
// foc_additional_form();
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// process_foc_payment();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// alert("Please! Choose or Save Customer");
|
||||||
|
// foc_additional_form();
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case 'nett':
|
||||||
|
// remove_input_action();
|
||||||
|
// $(".nett").attr("data-action","true");
|
||||||
|
// if($(".credit_note_payment").hasClass("payment_selected")){
|
||||||
|
// if(customerName == " "){
|
||||||
|
// alert("Please! Choose or Save Customer");
|
||||||
|
// showCustomer();
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// $("#accept_payment_btn").attr("data-payment","credit");
|
||||||
|
// process_nett_payment();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// process_nett_payment();
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case 'edit':
|
||||||
|
// process_edit_invoice();
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case 'cancel':
|
||||||
|
// remove_input_action();
|
||||||
|
// var status = $("#label_amountdue").attr("data-status");
|
||||||
|
// if (status != 'completed' && status != 'void'){
|
||||||
|
// $(".cancel").attr("data-action","true");
|
||||||
|
// var message = confirm("Are you sure to void? Please, add reason!");
|
||||||
|
// if (message == true) {
|
||||||
|
// $(".additional_form").hide();
|
||||||
|
// $("#void_sale_additional_form").show();
|
||||||
|
// process_cancel_payment();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// $(".cancel").addClass("dim");
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case 'ent':
|
||||||
|
// amount_due = parseFloat($("#label_amountdue").attr("data-original"));
|
||||||
|
// other_amt = parseFloat($("#label_cash_amount").attr("data-value"));
|
||||||
|
// credit_amount = parseFloat($("#label_credit_note").text());
|
||||||
|
// if ($(".credit_note_payment").hasClass("payment_selected") && credit_amount > 0){
|
||||||
|
// if(customerName.toString() != " "){
|
||||||
|
// if(credit_amount > (amount_due - other_amt)){
|
||||||
|
// alert("You shouldn't exceed the amount due.");
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// $("#accept_payment_btn").attr("data-payment","credit");
|
||||||
|
// update_balance_due();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// alert("Please! Choose or Save Customer");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// update_balance_due();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// case 'clear':
|
||||||
|
// process_clear_payment();
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// default:
|
||||||
|
//
|
||||||
|
// var existing_value = $(".payment_selected span").text();
|
||||||
|
//
|
||||||
|
// if (existing_value == "0" || existing_value == "0.00") { existing_value = ""; }
|
||||||
|
// existing_value = existing_value + input_value;
|
||||||
|
// $(".payment_selected span").text(existing_value);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// event.handled = true;
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
@@ -7,3 +7,33 @@
|
|||||||
// min-height: 75rem;
|
// min-height: 75rem;
|
||||||
// padding-top: 4.5rem;
|
// padding-top: 4.5rem;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
.cashier_number{
|
||||||
|
height:76px;
|
||||||
|
line-height:80px;
|
||||||
|
text-align:center;
|
||||||
|
background:#54A5AF;
|
||||||
|
float:left;
|
||||||
|
margin:2px;
|
||||||
|
font-size:20px;
|
||||||
|
color:white;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.cashier_number:hover{
|
||||||
|
background:#A9F5F2;
|
||||||
|
}
|
||||||
|
.long{
|
||||||
|
width:100%
|
||||||
|
}
|
||||||
|
|
||||||
|
.purple {
|
||||||
|
background-color:#7a62d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background-color:#ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green{
|
||||||
|
background-color: #009900
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Api::OrdersController < Api::ApiController
|
|||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
@order.order_type = params[:order_type]
|
||||||
@order.customer_id = params[:customer_id]
|
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
@order.items = params[:order_items]
|
@order.items = params[:order_items]
|
||||||
@order.guest = params[:guest_info]
|
@order.guest = params[:guest_info]
|
||||||
@order.table_id = params[:table_id]
|
@order.table_id = params[:table_id]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# GET /crm/customers
|
# GET /crm/customers
|
||||||
# GET /crm/customers.json
|
# GET /crm/customers.json
|
||||||
def index
|
def index
|
||||||
@crm_customers = Crm::Customer.all
|
@crm_customers = Customer.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/customers/1
|
# GET /crm/customers/1
|
||||||
@@ -14,7 +14,8 @@ class Crm::CustomersController < ApplicationController
|
|||||||
|
|
||||||
# GET /crm/customers/new
|
# GET /crm/customers/new
|
||||||
def new
|
def new
|
||||||
@crm_customer = Crm::Customer.new
|
@crm_customer = Customer.new
|
||||||
|
@membership = Customer.get_member_group
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/customers/1/edit
|
# GET /crm/customers/1/edit
|
||||||
@@ -24,7 +25,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# POST /crm/customers
|
# POST /crm/customers
|
||||||
# POST /crm/customers.json
|
# POST /crm/customers.json
|
||||||
def create
|
def create
|
||||||
@crm_customer = Crm::Customer.new(crm_customer_params)
|
@crm_customer = Customer.new(crm_customer_params)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customer.save
|
if @crm_customer.save
|
||||||
@@ -64,7 +65,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_crm_customer
|
def set_crm_customer
|
||||||
@crm_customer = Crm::Customer.find(params[:id])
|
@crm_customer = Customer.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
|
|
||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def queue_items_query(status)
|
def queue_items_query(status)
|
||||||
AssignedOrderItem.select("assigned_order_items.id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||||
.joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
.joins(" left join order_queue_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 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 order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
|
||||||
left join orders as od ON od.id = assigned_order_items.order_id
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
||||||
left join customers as cus ON cus.id = od.customer_id")
|
left join customers as cus ON cus.customer_id = od.customer_id")
|
||||||
.where("assigned_order_items.delivery_status = #{status}")
|
.where("assigned_order_items.delivery_status = #{status}")
|
||||||
.group("assigned_order_items.id")
|
.group("assigned_order_items.assigned_order_item_id")
|
||||||
.order("odt.item_name DESC")
|
.order("odt.item_name DESC")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
def print
|
def print
|
||||||
unique_code="OrderItemPdf"
|
unique_code="OrderItemPdf"
|
||||||
assigned_item_id=params[:id]
|
assigned_item_id=params[:id]
|
||||||
assigned_order_item=AssignedOrderItem.select("order_id, item_code").where('id='+assigned_item_id)
|
assigned_order_item=AssignedOrderItem.select("order_id, item_code").where("assigned_order_item_id='" + assigned_item_id + "'")
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
@@ -13,4 +13,19 @@ class Oqs::PrintController < ApplicationController
|
|||||||
assigned_item.print_status=true
|
assigned_item.print_status=true
|
||||||
assigned_item.save
|
assigned_item.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_order_summary
|
||||||
|
unique_code="OrderSummaryPdf"
|
||||||
|
assigned_item_id=params[:id]
|
||||||
|
assigned_order_item=AssignedOrderItem.select("order_id").where('assigned_order_item_id='+assigned_item_id)
|
||||||
|
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
|
order_queue_printer.print_order_summary(print_settings,assigned_order_item[0].order_id)
|
||||||
|
|
||||||
|
# update print status when complete click
|
||||||
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
|
assigned_item.print_status=true
|
||||||
|
assigned_item.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
10
app/controllers/origami/card_payments_controller.rb
Normal file
10
app/controllers/origami/card_payments_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class Origami::CardPaymentsController < BaseOrigamiController
|
||||||
|
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
10
app/controllers/origami/credit_payments_controller.rb
Normal file
10
app/controllers/origami/credit_payments_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class Origami::CreditPaymentsController < BaseOrigamiController
|
||||||
|
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,11 +1,21 @@
|
|||||||
class Origami::HomeController < BaseOrigamiController
|
class Origami::HomeController < BaseOrigamiController
|
||||||
def index
|
def index
|
||||||
@order_table = Order.get_order_table()
|
@booking_orders = Order.get_booking_order_table()
|
||||||
@order_rooms = Order.get_order_rooms()
|
@booking_rooms = Order.get_booking_order_rooms()
|
||||||
@orders = Order.get_orders()
|
@orders = Order.get_orders()
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
str = []
|
str = []
|
||||||
|
|
||||||
|
|
||||||
|
if !params[:sale_id].nil?
|
||||||
|
@order_details = SaleItem.get_order_items_details(params[:sale_id])
|
||||||
|
@order_details.each do |ord_detail|
|
||||||
|
str.push(ord_detail)
|
||||||
|
end
|
||||||
|
render :json => str.to_json
|
||||||
|
else
|
||||||
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
||||||
@order_details.each do |ord_detail|
|
@order_details.each do |ord_detail|
|
||||||
str.push(ord_detail)
|
str.push(ord_detail)
|
||||||
@@ -13,3 +23,4 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
render :json => str.to_json
|
render :json => str.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
class Origami::PaymentsController < BaseOrigamiController
|
class Origami::PaymentsController < BaseOrigamiController
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
#payment type
|
||||||
|
#sale status
|
||||||
|
#point - get [ food amount ]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,22 +1,37 @@
|
|||||||
class Origami::RequestBillsController < BaseOrigamiController
|
class Origami::RequestBillsController < BaseOrigamiController
|
||||||
def show
|
|
||||||
|
def create
|
||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
|
|
||||||
check_order = Order.find_by_id(params[:id])
|
|
||||||
if check_order
|
booking_id = params[:id]
|
||||||
@order_details = OrderItem.get_order_items_details(check_order.id)
|
check_booking = Booking.find_by_booking_id(booking_id)
|
||||||
@order_details = OrderItem.get_order_items_details(check_order.id)
|
if check_booking.sale_id.nil?
|
||||||
@status, @sale_id = @sale.generate_invoice_from_order(check_order.id, nil,current_login_employee.name)
|
#check if it doesn't exist
|
||||||
@sale_data = Sale.find_by_id(@sale_id)
|
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||||
|
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||||
|
else
|
||||||
|
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||||
|
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
unique_code="ReceiptBillPdf"
|
unique_code="ReceiptBillPdf"
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale)
|
printer.print_receipt_bill(print_settings,@sale_items,@sale,@sale_data)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def show
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class OrderQueueProcessorJob < ApplicationJob
|
class OrderQueueProcessorJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :oqs
|
||||||
|
|
||||||
def perform(order_id)
|
def perform(order_id)
|
||||||
# Do something later
|
# Do something later
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
class AssignedOrderItem < ApplicationRecord
|
class AssignedOrderItem < ApplicationRecord
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
|
#primary key - need to be unique
|
||||||
|
self.primary_key = "assigned_order_item_id"
|
||||||
|
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
belongs_to :order_queue_station
|
belongs_to :order_queue_station
|
||||||
|
|
||||||
@@ -11,4 +16,9 @@ class AssignedOrderItem < ApplicationRecord
|
|||||||
assigned_order_item.delivery_status = false
|
assigned_order_item.delivery_status = false
|
||||||
assigned_order_item.save
|
assigned_order_item.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.assigned_order_item_id = SeedGenerator.generate_id(self.class.name, "AOI")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
|
|
||||||
class Booking < ApplicationRecord
|
class Booking < ApplicationRecord
|
||||||
|
self.primary_key = "booking_id"
|
||||||
|
|
||||||
#primary key - need to be unique
|
#primary key - need to be unique
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
belongs_to :dining_facility, :optional => true
|
belongs_to :dining_facility, :optional => true
|
||||||
belongs_to :sale, :optional => true
|
belongs_to :sale, :optional => true
|
||||||
has_many :booking_orders
|
has_many :booking_orders
|
||||||
|
has_many :orders, :through => :booking_orders
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
class CashierLoginLog < ApplicationRecord
|
class CashierLoginLog < ApplicationRecord
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
belongs_to :cashier_station
|
belongs_to :cashier_station
|
||||||
belongs_to :employee
|
belongs_to :employee
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.cashier_login_log_id = SeedGenerator.generate_id(self.class.name, "CLO")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
module Crm
|
|
||||||
def self.table_name_prefix
|
|
||||||
'crm_'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
class Customer < ApplicationRecord
|
class Customer < ApplicationRecord
|
||||||
|
self.primary_key = "customer_id"
|
||||||
|
|
||||||
|
before_create :generate_custom_id
|
||||||
has_many :orders
|
has_many :orders
|
||||||
has_many :sales
|
has_many :sales
|
||||||
|
|
||||||
@@ -8,4 +11,9 @@ class Customer < ApplicationRecord
|
|||||||
def lastest_invoices
|
def lastest_invoices
|
||||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
class Order < ApplicationRecord
|
class Order < ApplicationRecord
|
||||||
#primary key - need to be unique
|
self.primary_key = "order_id"
|
||||||
|
|
||||||
|
#primary key - need to be unique
|
||||||
|
before_create :generate_custom_id
|
||||||
before_create :set_order_date
|
before_create :set_order_date
|
||||||
|
|
||||||
belongs_to :customer
|
belongs_to :customer
|
||||||
@@ -40,7 +42,7 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
self.adding_line_items
|
self.adding_line_items
|
||||||
#Add Order Table and Room relation afrer order creation
|
#Add Order Table and Room relation afrer order creation
|
||||||
BookingOrder.create({:booking_id => booking.id, :order => self})
|
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||||
|
|
||||||
#Send order to queue one it done!
|
#Send order to queue one it done!
|
||||||
process_order_queue
|
process_order_queue
|
||||||
@@ -182,14 +184,6 @@ class Order < ApplicationRecord
|
|||||||
return new_items_list
|
return new_items_list
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def validate_api_inputs
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_order_date
|
|
||||||
self.date = Time.now.utc
|
|
||||||
end
|
|
||||||
|
|
||||||
#Update Items Count and Quantity changes whenever there is changes
|
#Update Items Count and Quantity changes whenever there is changes
|
||||||
def update_products_and_quantity_count
|
def update_products_and_quantity_count
|
||||||
@@ -198,7 +192,7 @@ class Order < ApplicationRecord
|
|||||||
# Count number of different items
|
# Count number of different items
|
||||||
self.item_count = self.order_items.item_count
|
self.item_count = self.order_items.item_count
|
||||||
self.quantity_count = quantity_count
|
self.quantity_count = quantity_count
|
||||||
# Counter number of quantity
|
# Counter number of quantityf
|
||||||
end
|
end
|
||||||
|
|
||||||
#Process order items and send to order queue
|
#Process order items and send to order queue
|
||||||
@@ -215,6 +209,7 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Table
|
#Origami: Cashier : to view order type Table
|
||||||
|
|
||||||
def self.get_order_table
|
def self.get_order_table
|
||||||
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||||
order_items.id as order_items_id,dining_facilities.name as table_name")
|
order_items.id as order_items_id,dining_facilities.name as table_name")
|
||||||
@@ -223,33 +218,70 @@ class Order < ApplicationRecord
|
|||||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||||
left join order_items on order_items.order_id = orders.id")
|
left join order_items on order_items.order_id = orders.id")
|
||||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||||
|
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
||||||
|
end
|
||||||
|
|
||||||
.group("orders.id")
|
def self.get_booking_order_table
|
||||||
|
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||||
|
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
|
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
|
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
|
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
|
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
||||||
|
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Origami: Cashier : to view order type Room
|
||||||
|
def self.get_booking_order_rooms
|
||||||
|
booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as room_name")
|
||||||
|
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
|
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
|
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
|
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||||
|
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name")
|
||||||
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
def self.get_order_rooms
|
def self.get_order_rooms
|
||||||
order_rooms = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
order_rooms = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||||
order_items.id as order_items_id,dining_facilities.name as room_name")
|
order_items.id as order_items_id,dining_facilities.name as room_name")
|
||||||
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||||
left join bookings on bookings.id = booking_orders.id
|
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||||
left join order_items on order_items.order_id = orders.id")
|
left join order_items on order_items.order_id = orders.order_id")
|
||||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
|
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
|
||||||
.group("orders.id,order_items.id,dining_facilities.name")
|
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view orders
|
#Origami: Cashier : to view orders
|
||||||
def self.get_orders
|
def self.get_orders
|
||||||
from = Time.now.beginning_of_day.utc
|
from = Time.now.beginning_of_day.utc
|
||||||
to = Time.now.end_of_day.utc
|
to = Time.now.end_of_day.utc
|
||||||
orders = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
order_items.id as order_items_id,dining_facilities.name as table_or_room_name")
|
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||||
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||||
left join bookings on bookings.id = booking_orders.id
|
|
||||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||||
left join order_items on order_items.order_id = orders.id")
|
left join order_items on order_items.order_id = orders.order_id
|
||||||
|
left join sale_orders on sale_orders.order_id = orders.order_id
|
||||||
|
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||||
.group("orders.id")
|
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def generate_custom_id
|
||||||
|
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR")
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_order_date
|
||||||
|
self.date = Time.now.utc
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
class OrderItem < ApplicationRecord
|
class OrderItem < ApplicationRecord
|
||||||
|
self.primary_key = "order_items_id"
|
||||||
|
|
||||||
#primary key - need to be unique
|
#primary key - need to be unique
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
#Associations
|
#Associations
|
||||||
belongs_to :order, autosave: true
|
belongs_to :order, autosave: true
|
||||||
@@ -36,10 +39,23 @@ class OrderItem < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
#Origami : Cashier : to show order items details
|
#Origami : Cashier : to show order items details
|
||||||
def self.get_order_items_details(order_id)
|
|
||||||
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
|
||||||
.joins("left join orders on orders.id = order_items.order_id")
|
|
||||||
.where("order_items.order_id=?",order_id)
|
|
||||||
|
|
||||||
|
def self.get_order_items_details(booking_id)
|
||||||
|
booking_orders = BookingOrder.where("booking_id=?",booking_id)
|
||||||
|
if booking_orders
|
||||||
|
booking_orders.each do |book_order|
|
||||||
|
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
||||||
|
.joins("left join orders on orders.order_id = order_items.order_id")
|
||||||
|
.where("order_items.order_id=?",book_order.order)
|
||||||
|
return order_details
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.order_items_id = SeedGenerator.generate_id(self.class.name, "ODI")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
self.print("tmp/receipt.pdf")
|
self.print("tmp/receipt.pdf")
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_order_summary(printer_settings,booking_id)
|
def print_order_summary(printer_settings,order_id)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
order=print_query('booking',booking_id)
|
order=print_query('order_summary',order_id)
|
||||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(order,printer_settings)
|
pdf = OrderSummaryPdf.new(order,printer_settings)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
|
|
||||||
@@ -25,21 +25,23 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def print_query(type, code)
|
def print_query(type, code)
|
||||||
if type == 'order_item'
|
if type == 'order_item'
|
||||||
OrderItem.select("order_items.item_code, order_items.item_name,order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
.joins("left join orders ON orders.id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
.where("order_items.item_code=" + code)
|
.where("order_items.item_code='" + code + "'")
|
||||||
.group("order_items.item_code")
|
.group("order_items.item_code")
|
||||||
else
|
else
|
||||||
OrderItem.select("order_items.item_code, order_items.item_name, df.name as dining")
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
.joins("left join orders ON orders.id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id")
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
.where("booking.id=" + code)
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
|
.where("orders.order_id='" + code.to_s + "'")
|
||||||
|
.group("order_items.item_code")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -64,12 +64,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
self.print(filename)
|
self.print(filename)
|
||||||
end
|
end
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_receipt_bill(printer_settings,sale_items,sale)
|
def print_receipt_bill(printer_settings,sale_items,sale,sale_data)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings,sale_items,sale)
|
pdf = ReceiptBillPdf.new(printer_settings,sale_items,sale,sale_data)
|
||||||
pdf.render_file "tmp/receipt_bill_#{sale.id}.pdf"
|
pdf.render_file "tmp/receipt_bill.pdf"
|
||||||
self.print("tmp/receipt_bill_#{sale.id}.pdf")
|
self.print("tmp/receipt_bill.pdf")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
class RoomBooking < Booking
|
class RoomBooking < Booking
|
||||||
|
has_many :orders
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#primary key - need to be unique generated for multiple shops
|
|
||||||
|
|
||||||
class Sale < ApplicationRecord
|
class Sale < ApplicationRecord
|
||||||
|
self.primary_key = "sale_id"
|
||||||
|
|
||||||
|
#primary key - need to be unique generated for multiple shops
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
#before_create :generate_receipt_no
|
#before_create :generate_receipt_no
|
||||||
belongs_to :cashier, :optional => true
|
belongs_to :cashier, :optional => true
|
||||||
belongs_to :customer, :optional => true
|
belongs_to :customer, :optional => true
|
||||||
@@ -14,6 +17,7 @@ class Sale < ApplicationRecord
|
|||||||
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||||
|
|
||||||
def generate_invoice_from_booking(booking_id, requested_by)
|
def generate_invoice_from_booking(booking_id, requested_by)
|
||||||
|
puts "get invoice from booking"
|
||||||
booking = Booking.find(booking_id)
|
booking = Booking.find(booking_id)
|
||||||
status = false
|
status = false
|
||||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||||
@@ -22,18 +26,20 @@ class Sale < ApplicationRecord
|
|||||||
#get all order attached to this booking and combine into 1 invoice
|
#get all order attached to this booking and combine into 1 invoice
|
||||||
booking.booking_orders.each do |order|
|
booking.booking_orders.each do |order|
|
||||||
if booking.sale_id
|
if booking.sale_id
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, requested_by)
|
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
||||||
else
|
else
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, requested_by)
|
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by)
|
||||||
end
|
end
|
||||||
booking.sale_id = sale_id
|
booking.sale_id = sale_id
|
||||||
end
|
end
|
||||||
|
order = booking.booking_orders.take.order
|
||||||
|
puts "add sale order"
|
||||||
|
link_order_sale(order.id)
|
||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_invoice_from_order (order_id, sale_id, requested_by)
|
def generate_invoice_from_order (order_id, sale_id, booking, requested_by)
|
||||||
taxable = true
|
taxable = true
|
||||||
#if sale_id is exsit and validate
|
#if sale_id is exsit and validate
|
||||||
#add order to that invoice
|
#add order to that invoice
|
||||||
@@ -75,6 +81,11 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
#Update the order items that is billed
|
#Update the order items that is billed
|
||||||
order.update_items_status_to_billed(nil)
|
order.update_items_status_to_billed(nil)
|
||||||
|
order.status = "billed"
|
||||||
|
order.save
|
||||||
|
|
||||||
|
booking.sale_id = self.id
|
||||||
|
booking.save
|
||||||
|
|
||||||
return true, self.id
|
return true, self.id
|
||||||
end
|
end
|
||||||
@@ -217,9 +228,14 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
def link_order_sale(order_id)
|
def link_order_sale(order_id)
|
||||||
#create if it doesn't exist
|
#create if it doesn't exist
|
||||||
if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?)
|
saleOrder = SaleOrder.where("sale_id=? and order_id=?", self.id, order_id).take
|
||||||
|
|
||||||
|
if saleOrder.nil?
|
||||||
SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
||||||
end
|
end
|
||||||
|
# if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?)
|
||||||
|
# SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
||||||
|
# end
|
||||||
#dosomrting here
|
#dosomrting here
|
||||||
#puts Time.now.format(":short")
|
#puts Time.now.format(":short")
|
||||||
end
|
end
|
||||||
@@ -242,4 +258,8 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
class SaleAudit < ApplicationRecord
|
class SaleAudit < ApplicationRecord
|
||||||
#primary key - need to be unique generated for multiple shops
|
self.primary_key = "sale_audit_id"
|
||||||
|
|
||||||
|
#primary key - need to be unique generated for SaleAudit
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
|
|
||||||
@@ -50,4 +53,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.sale_audit_id = SeedGenerator.generate_id(self.class.name, "SAI")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,33 @@
|
|||||||
class SaleItem < ApplicationRecord
|
class SaleItem < ApplicationRecord
|
||||||
|
self.primary_key = "sale_item_id"
|
||||||
|
|
||||||
#primary key - need to be unique generated for multiple shops
|
#primary key - need to be unique generated for multiple shops
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
|
|
||||||
#compute items - discount, tax, price_change
|
#compute items - discount, tax, price_change
|
||||||
def compute_item
|
def compute_item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.get_order_items_details(sale_id)
|
||||||
|
sale_orders = SaleOrder.where("sale_id=?",sale_id)
|
||||||
|
if sale_orders
|
||||||
|
sale_orders.each do |sale_order|
|
||||||
|
order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
|
||||||
|
.joins("left join sales on sales.id = sale_items.sale_id")
|
||||||
|
.where("sale_items.sale_id=?",sale_order.sale_id)
|
||||||
|
return order_details
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
class SaleOrder < ApplicationRecord
|
class SaleOrder < ApplicationRecord
|
||||||
|
self.primary_key = "sale_order_id"
|
||||||
|
|
||||||
#primary key - need to be unique generated for multiple shops
|
#primary key - need to be unique generated for multiple shops
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.sale_order_id = SeedGenerator.generate_id(self.class.name, "SOI")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
class SalePayment < ApplicationRecord
|
class SalePayment < ApplicationRecord
|
||||||
|
self.primary_key = "sale_payment_id"
|
||||||
|
|
||||||
#primary key - need to be unique generated for multiple shops
|
#primary key - need to be unique generated for multiple shops
|
||||||
|
before_create :generate_custom_id
|
||||||
|
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
|
|
||||||
@@ -156,4 +159,8 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
class SaleTax < ApplicationRecord
|
class SaleTax < ApplicationRecord
|
||||||
#primary key - need to be unique generated for multiple shops
|
self.primary_key = "sale_tax_id"
|
||||||
|
|
||||||
|
#primary key - need to be unique generated for multiple shops
|
||||||
|
before_create :generate_custom_id
|
||||||
belongs_to :sale
|
belongs_to :sale
|
||||||
|
|
||||||
|
private
|
||||||
|
def generate_custom_id
|
||||||
|
self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ class SeedGenerator < ApplicationRecord
|
|||||||
seed.save
|
seed.save
|
||||||
end
|
end
|
||||||
|
|
||||||
return prefix + "-" + seed.current.to_s
|
padding_len = 15 - prefix.length
|
||||||
|
|
||||||
|
return prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new_receipt_no
|
def self.new_receipt_no
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
class Test < ApplicationRecord
|
|
||||||
end
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
module Transactions
|
|
||||||
def self.table_name_prefix
|
|
||||||
'transactions_'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -11,21 +11,61 @@ class OrderItemPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
cashier_info(order_item.order_by,order_item.order_at, order_item.customer)
|
#order_info
|
||||||
|
order_info(order_item.order_by,order_item.order_at, order_item.customer)
|
||||||
|
|
||||||
|
# order items
|
||||||
|
order_items(order_item)
|
||||||
end
|
end
|
||||||
|
|
||||||
def cashier_info(order_by, order_at, customer)
|
# Write Order Information to PDF
|
||||||
move_down 5
|
def order_info(order_by, order_at, customer)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>200, :height => 20) do
|
bounding_box([0,y_position], :width => 200, :height => 15) do
|
||||||
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y %m %d")}", :size => 7,:align => :left
|
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 20
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order items to PDF
|
||||||
|
def order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 15) do
|
||||||
|
text "Item", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 15) do
|
||||||
|
text "Qty", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
|
#Add Order Item
|
||||||
|
add_order_items(order_item)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add order items under order info
|
||||||
|
def add_order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 20) do
|
||||||
|
text "#{order_item.item_name}", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 20) do
|
||||||
|
text "#{order_item.qty}", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,11 +7,68 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
|
|
||||||
|
|
||||||
font_size 9
|
font_size 9
|
||||||
text "#{"table_name"}", :size => 15
|
text "#{order[0].dining}", :size => 15
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
|
#order_info
|
||||||
|
order_info(order[0].order_by,order[0].order_at, order[0].customer)
|
||||||
|
|
||||||
|
# order items
|
||||||
|
order_items(order)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order Information to PDF
|
||||||
|
def order_info(order_by, order_at, customer)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 200, :height => 15) do
|
||||||
|
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 20
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order items to PDF
|
||||||
|
def order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 15) do
|
||||||
|
text "Item", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 15) do
|
||||||
|
text "Qty", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
#Add Order Item
|
||||||
|
add_order_items(order_item)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add order items under order info
|
||||||
|
def add_order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
order_item.each do|odi|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 20) do
|
||||||
|
text "#{odi.item_name}", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 20) do
|
||||||
|
text "#{odi.qty}", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
class ReceiptBillPdf < Prawn::Document
|
||||||
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
|
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
|
||||||
def initialize(printer_settings, sale_items,sale)
|
def initialize(printer_settings, sale_items,sale, sale_data)
|
||||||
self.p_width = 200
|
self.p_width = 200
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 10
|
self.margin = 10
|
||||||
# self.price_width = self.p_width / 2
|
# self.price_width = self.p_width / 2
|
||||||
self.price_width=90
|
self.price_width=80
|
||||||
self.item_width = self.p_width - self.price_width
|
self.item_width = self.p_width - self.price_width
|
||||||
self.item_height = self.item_height
|
self.item_height = self.item_height
|
||||||
self.qty_column_width = self.p_width / 2
|
self.qty_column_width = self.p_width / 2
|
||||||
@@ -14,7 +14,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
@item_width = self.p_width.to_i / 2
|
@item_width = self.p_width.to_i / 2
|
||||||
@qty_width = @item_width.to_i / 3
|
@qty_width = @item_width.to_i / 3
|
||||||
@double = @qty_width * 2
|
@double = @qty_width * 1.3
|
||||||
@half_qty = @qty_width / 2
|
@half_qty = @qty_width / 2
|
||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||||
@@ -23,8 +23,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
header( printer_settings.printer_name, printer_settings.name)
|
header( printer_settings.printer_name, printer_settings.name)
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
cashier_info(sale.receipt_no,sale.customer.name, sale.receipt_date)
|
cashier_info(sale.receipt_no,sale.customer, sale.receipt_date)
|
||||||
line_items(sale_items)
|
line_items(sale_items)
|
||||||
|
all_total(sale_data)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -89,7 +90,6 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text_box "Items", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
text_box "Items", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
||||||
text_box "Price", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "Price", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||||
text_box "Qty", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "Qty", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||||
text_box "Discount", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
|
||||||
text_box "Total", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "Total", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -98,13 +98,80 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
add_line_item_row(sale_items)
|
add_line_item_row(sale_items)
|
||||||
stroke_horizontal_rule
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items)
|
def add_line_item_row(sale_items)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
|
sub_total = 0.0
|
||||||
|
sale_items.each do |item|
|
||||||
|
|
||||||
|
sub_total += item.qty*item.unit_price
|
||||||
|
qty = item.qty
|
||||||
|
total_price = item.qty*item.unit_price
|
||||||
|
price = item.unit_price
|
||||||
|
product_name = item.product_name
|
||||||
|
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
pad_top(15) {
|
||||||
|
# @item_width.to_i + @half_qty.to_i
|
||||||
|
text_box "#{product_name}", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
||||||
|
text_box "#{price}", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||||
|
text_box "#{qty.to_i}", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||||
|
text_box "#{total_price}", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
|
}
|
||||||
|
move_down 3
|
||||||
|
end
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
||||||
|
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
||||||
|
text "#{sub_total}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def all_total(sale_data)
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
y_position =cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
||||||
|
text "Discount", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
||||||
|
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
y_position =cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
||||||
|
text "Total Tax", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
||||||
|
text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
move_down 5
|
||||||
|
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
||||||
|
text "Grand Total", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
||||||
|
text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 5
|
||||||
|
# stroke_horizontal_rule
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if (@booking)
|
if (@booking)
|
||||||
json.id @booking.id
|
json.id @booking.booking_id
|
||||||
json.status @booking.booking_status
|
json.status @booking.booking_status
|
||||||
json.checkin_at @booking.checkin_at
|
json.checkin_at @booking.checkin_at
|
||||||
json.checkin_by @booking.checkin_by
|
json.checkin_by @booking.checkin_by
|
||||||
@@ -13,6 +13,7 @@ if (@booking)
|
|||||||
@total_amount = 0.00
|
@total_amount = 0.00
|
||||||
@total_tax = 0.00
|
@total_tax = 0.00
|
||||||
|
|
||||||
|
@booking_orders = BookingOrder.where("booking_id = #{@booking.booking_id}").all;
|
||||||
if @booking.booking_orders
|
if @booking.booking_orders
|
||||||
order_items = []
|
order_items = []
|
||||||
@booking.booking_orders.each do |bo|
|
@booking.booking_orders.each do |bo|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<%= simple_form_for(@crm_customer) do |f| %>
|
|
||||||
|
<%= simple_form_for([:crm,@crm_customer]) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
@@ -7,7 +8,7 @@
|
|||||||
<%= f.input :contact_no %>
|
<%= f.input :contact_no %>
|
||||||
<%= f.input :email %>
|
<%= f.input :email %>
|
||||||
<%= f.input :date_of_birth %>
|
<%= f.input :date_of_birth %>
|
||||||
<%= f.association :membership %>
|
|
||||||
<%= f.input :membership_type %>
|
<%= f.input :membership_type %>
|
||||||
<%= f.input :membership_authentication_code %>
|
<%= f.input :membership_authentication_code %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
<%= render 'form', crm_customer: @crm_customer %>
|
<%= render 'form', crm_customer: @crm_customer %>
|
||||||
|
|
||||||
<%= link_to 'Show', @crm_customer %> |
|
<%= link_to 'Show', @crm_customers_path %> |
|
||||||
<%= link_to 'Back', crm_customers_path %>
|
<%= link_to 'Back', crm_customers_path %>
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
<td><%= crm_customer.contact_no %></td>
|
<td><%= crm_customer.contact_no %></td>
|
||||||
<td><%= crm_customer.email %></td>
|
<td><%= crm_customer.email %></td>
|
||||||
<td><%= crm_customer.date_of_birth %></td>
|
<td><%= crm_customer.date_of_birth %></td>
|
||||||
<td><%= crm_customer.membership %></td>
|
<td><%= crm_customer.membership_id %></td>
|
||||||
<td><%= crm_customer.membership_type %></td>
|
<td><%= crm_customer.membership_type %></td>
|
||||||
<td><%= crm_customer.membership_authentication_code %></td>
|
<td><%= crm_customer.membership_authentication_code %></td>
|
||||||
<td><%= link_to 'Show', crm_customer %></td>
|
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
|
||||||
<td><%= link_to 'Edit', edit_crm_customer_path(crm_customer) %></td>
|
<td><%= link_to 'Edit', edit_crm_customer_path(crm_customer) %></td>
|
||||||
<td><%= link_to 'Destroy', crm_customer, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<% @i = 0 %>
|
<% @i = 0 %>
|
||||||
<% @booking.each do |booking| %>
|
<% @booking.each do |booking| %>
|
||||||
<% if booking.booking_status == "new" %>
|
<% if booking.booking_status == "assign" %>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-block booking_click" data-ref="<%= api_booking_path booking.id%>" id="card-block booking_block" style="width:100%;">
|
<div class="card-block booking_click" data-ref="<%= api_booking_path booking.id%>" id="card-block booking_block" style="width:100%;">
|
||||||
<h4 class="card-title">
|
<h4 class="card-title">
|
||||||
@@ -40,7 +40,7 @@ $(function(){
|
|||||||
$(".summary-items tbody tr").remove();
|
$(".summary-items tbody tr").remove();
|
||||||
$("#cancel").removeAttr("disabled");
|
$("#cancel").removeAttr("disabled");
|
||||||
$("#assign").removeAttr("disabled");
|
$("#assign").removeAttr("disabled");
|
||||||
var url = $(this).attr('data-ref');
|
var url = $(this).attr('data-ref');alert(url);
|
||||||
show_details(url);
|
show_details(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
<p class="hidden assigned-order-item"><%= qid.id %></p>
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="card-footer">
|
<!-- <div class="card-footer">
|
||||||
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
||||||
@@ -112,10 +112,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<!-- Hidden Fields for Items -->
|
<!-- Hidden Fields for Items -->
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
<p class="hidden assigned-order-item"><%= qid.id %></p>
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%
|
<%
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- OQS Buttons -->
|
<!-- OQS Buttons -->
|
||||||
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
|
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_item" disabled>Print <br/>Order<br/>Summary</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_summary">Print <br/>Order<br/>Summary</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
1
app/views/origami/card_payments/index.html.erb
Normal file
1
app/views/origami/card_payments/index.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello Card Payment
|
||||||
1
app/views/origami/credit_payments/index.html.erb
Normal file
1
app/views/origami/credit_payments/index.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
hello Credit
|
||||||
@@ -22,34 +22,58 @@
|
|||||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||||
<!--- Booking Items -->
|
<!--- Booking Items -->
|
||||||
<div class="card-columns" style="padding-top:10px">
|
<div class="card-columns" style="padding-top:10px">
|
||||||
<% if @order_table %>
|
|
||||||
<% @order_table.each do |order_table| %>
|
|
||||||
<div class="card" id="table-order-<%=order_table.order_id%>" onclick="callOrderDetails('<%=order_table.order_id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title"><span id="table-name-<%=order_table.order_id%>" class="table-name"><%=order_table.table_name%></span></h4>
|
|
||||||
<p class="card-text"><%=order_table.total_price%></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<%end %>
|
|
||||||
<%end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<% if @booking_orders %>
|
||||||
|
<% @booking_orders.each do |booking_order| %>
|
||||||
|
<% if booking_order.order_status != "new" %>
|
||||||
|
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_order.sale_id%>" onclick="callOrderDetails('sale_<%=booking_order.sale_id%>')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title">
|
||||||
|
<span id="table-name-<%=booking_order.sale_id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
||||||
|
<span>Receipt No : <%=booking_order.receipt_no%></span><br/>
|
||||||
|
<span>Order Status : <%=booking_order.order_status %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="card" id="table-order-<%=booking_order.id%>" onclick="callOrderDetails('order_<%=booking_order.id%>')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title"><span id="table-name-<%=booking_order.id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
||||||
|
<span>Order Status : <%=booking_order.order_status %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%end %>
|
||||||
|
<%end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Panel 1 - Tables - End -->
|
<!-- Panel 1 - Tables - End -->
|
||||||
<!-- Panel 2 - Rooms -->
|
<!-- Panel 2 - Rooms -->
|
||||||
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||||
<!--- Booking Items -->
|
<!--- Booking Items -->
|
||||||
<div class="card-columns" style="padding-top:10px">
|
<div class="card-columns" style="padding-top:10px">
|
||||||
<% @order_rooms.each do |order_room| %>
|
|
||||||
<div class="card" id="table-order-<%=order_room.order_id%>" onclick="callOrderDetails('<%=order_room.order_id%>')">
|
|
||||||
|
|
||||||
|
<% if @booking_rooms %>
|
||||||
|
<% @booking_rooms.each do |booking_room| %>
|
||||||
|
<% if !booking_room.order_status = 'new'%>
|
||||||
|
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('sale_<%=booking_room.id%>')">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<% tablename = order_room.room_name%>
|
<h4 class="card-title">
|
||||||
<h4 class="card-title"><span id="table-name-<%=order_room.order_id%>" class="table-name"><%=order_room.room_name%></span></h4>
|
<span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
||||||
<p class="card-text"><%=order_room.total_price%></p>
|
<span>Receipt No : <%=booking_room.receipt_no%></span><br/>
|
||||||
|
<span>Order Status : <%=booking_room.order_status %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('order_<%=booking_room.id%>')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title"><span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%>ddd</span></h4> \
|
||||||
|
<span>Order Status : <%=booking_room.order_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%end %>
|
||||||
|
<%end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -60,15 +84,30 @@
|
|||||||
|
|
||||||
<!--- Booking Items -->
|
<!--- Booking Items -->
|
||||||
<div class="card-columns" style="padding-top:10px">
|
<div class="card-columns" style="padding-top:10px">
|
||||||
<% @orders.each do |order| %>
|
|
||||||
<div class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('<%=order.order_id%>')">
|
|
||||||
|
|
||||||
|
<% if @orders %>
|
||||||
|
<% @orders.each do |order| %>
|
||||||
|
<% if !order.order_status = 'new'%>
|
||||||
|
<div style="background-color: green;color: white;" class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('sale_<%=order.order_id%>')">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title"><span id="table-name-<%=order.order_id%>" class="table-name"><%=order.table_or_room_name%></span></h4>
|
<h4 class="card-title">
|
||||||
<p class="card-text"><%=order.total_price%></p>
|
<span id="table-name-<%=order.order_id%>" class="table-name">Order No:<%=order.order_id%></span></h4>
|
||||||
|
<span>Receipt No : <%=order.receipt_no%></span><br/>
|
||||||
|
<span>Order Status : <%=order.order_status %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('order_<%=order.order_id%>')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title"><span id="table-name-<%=order.order_id%>" class="table-name">Order No:<%=order.order_id%></span></h4>
|
||||||
|
<span>Order Status : <%=order.order_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%end %>
|
||||||
|
<%end %>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +122,9 @@
|
|||||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div id="order-title"><strong>ORDER DETAILS</strong> <span id="order-detail-header"></span></div>
|
<div id="order-title"><strong><span id="receipt-no">ORDER DETAILS</span></strong>
|
||||||
|
<strong><span id ="receipt-date" style="margin-left: 20%"></span></strong></div><br/>
|
||||||
|
<div ><strong><span id="cashier-name"></span></strong><strong><span style="margin-left: 36%" id="order-detail-header"></span></strong></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
@@ -122,6 +163,18 @@
|
|||||||
<td style="width:80%; text-align:left; border-top:none"><strong>Sub Total</strong></td>
|
<td style="width:80%; text-align:left; border-top:none"><strong>Sub Total</strong></td>
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="sub-total"></span></strong></td>
|
<td style="width:20%; text-align:right; border-top:none"><strong><span id="sub-total"></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width:80%; text-align:left; border-top:none"><strong><span id="discount-header"></strong></td>
|
||||||
|
<td style="width:20%; text-align:right; border-top:none"><strong><span id="discount_amount"></span></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width:80%; text-align:left; border-top:none"><strong><span id="tax-header"></strong></td>
|
||||||
|
<td style="width:20%; text-align:right; border-top:none"><strong><span id="tax_amount"></span></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width:80%; text-align:left; border-top:none"><strong><span id="grand-total-header"></strong></td>
|
||||||
|
<td style="width:20%; text-align:right; border-top:none"><strong><span id="grand_total_amount"></span></strong></td>
|
||||||
|
</tr>
|
||||||
</tfooter>
|
</tfooter>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,13 +190,13 @@
|
|||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
|
||||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button> -->
|
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button> -->
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">
|
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>
|
||||||
Req.Bill
|
Req.Bill
|
||||||
</button>
|
</button>
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Pay</button>
|
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" disabled >Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -151,10 +204,30 @@
|
|||||||
var old_order_id = 0
|
var old_order_id = 0
|
||||||
var old_table_name = ""
|
var old_table_name = ""
|
||||||
var table_or_order_id = 0
|
var table_or_order_id = 0
|
||||||
|
var pay_sale_id = 0
|
||||||
|
|
||||||
function callOrderDetails(order_id){
|
function callOrderDetails(sale_order_id){
|
||||||
|
|
||||||
|
var order_id = 0
|
||||||
|
var sale_id = 0
|
||||||
|
var data_val = ""
|
||||||
|
sale_order = sale_order_id.split("_")[0]
|
||||||
|
|
||||||
|
if (sale_order == 'sale') {
|
||||||
|
sale_id = sale_order_id.split("_")[1]
|
||||||
|
url = "origami/"+sale_order_id.split("_")[1]
|
||||||
|
data_val = { sale_id: sale_order_id.split("_")[1]}
|
||||||
|
$("#pay").prop('disabled',false);
|
||||||
|
$("#request_bills").prop('disabled',true);
|
||||||
|
}else{
|
||||||
|
order_id = sale_order_id.split("_")[1]
|
||||||
|
url = "origami/"+order_id
|
||||||
|
data_val = { order_id: sale_order_id.split("_")[1]}
|
||||||
|
$("#request_bills").prop('disabled',false);
|
||||||
|
$("#pay").prop('disabled',true);
|
||||||
|
}
|
||||||
table_or_order_id = order_id
|
table_or_order_id = order_id
|
||||||
$("#test").html(order_id)
|
pay_sale_id = sale_id
|
||||||
var tbody = ""
|
var tbody = ""
|
||||||
$("#append-table").html("")
|
$("#append-table").html("")
|
||||||
if (old_order_id != order_id){
|
if (old_order_id != order_id){
|
||||||
@@ -162,31 +235,73 @@ function callOrderDetails(order_id){
|
|||||||
$("#table-order-"+order_id).addClass("selected_color")
|
$("#table-order-"+order_id).addClass("selected_color")
|
||||||
old_order_id = order_id
|
old_order_id = order_id
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#order-detail-header").html("")
|
$("#order-detail-header").html("")
|
||||||
$("#order-detail-header").append(document.getElementById("table-name-"+order_id).innerHTML)
|
$("#order-detail-header").append("Table Name : "+document.getElementById("table-name-"+order_id).innerHTML)
|
||||||
$("#sub-total").html("")
|
$("#sub-total").html("")
|
||||||
url = "origami/"+order_id
|
|
||||||
$.ajax({type: "GET",
|
$.ajax({type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
data: { order_id: order_id},
|
data: data_val,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
var sub_total = 0
|
var sub_total = 0
|
||||||
|
var discount_amount = 0
|
||||||
|
var receipt_no = ""
|
||||||
|
var cashier_name = ""
|
||||||
|
var receipt_date = ""
|
||||||
|
var tax_amount = 0
|
||||||
|
var grand_total_amount = 0
|
||||||
|
row = "<tbody>"
|
||||||
for (i = 0; i < result.length; i++) {
|
for (i = 0; i < result.length; i++) {
|
||||||
var data = JSON.stringify(result[i]);
|
var data = JSON.stringify(result[i]);
|
||||||
var parse_data = JSON.parse(data)
|
var parse_data = JSON.parse(data)
|
||||||
sub_total += (parse_data.qty*parse_data.price)
|
sub_total += (parse_data.qty*parse_data.price)
|
||||||
row = '<tbody><tr><td style="width:60%; text-align:left"><span id="item-name-price">'+parse_data.item_name+"@"+(parse_data.price*1)+'</span></td>'
|
row = '<tr><td style="width:60%; text-align:left"><span id="item-name-price">'+parse_data.item_name+"@"+(parse_data.price*1)+'</span></td>'
|
||||||
+'<td style="width:20%; text-align:right"><span id="item-qty">'+(parse_data.qty*1)+'</span></td>s'
|
+'<td style="width:20%; text-align:right"><span id="item-qty">'+(parse_data.qty*1)+'</span></td>s'
|
||||||
+'<td style="width:20%; text-align:right"><span id="item-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
+'<td style="width:20%; text-align:right"><span id="item-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
||||||
+'</tr></tbody>'
|
+'</tr>>'
|
||||||
tbody += row
|
tbody += row
|
||||||
|
|
||||||
}
|
discount_amount = result[i].discount_amount;
|
||||||
|
|
||||||
|
tax_amount = result[i].tax_amount;
|
||||||
|
grand_total_amount = result[i].grand_total_amount;
|
||||||
|
|
||||||
|
receipt_no = result[i].receipt_no;
|
||||||
|
cashier_name = result[i].cashier_name;
|
||||||
|
receipt_date = result[i].receipt_date;
|
||||||
|
}
|
||||||
|
row = "</tbody>"
|
||||||
$("#append-table").append(tbody)
|
$("#append-table").append(tbody)
|
||||||
|
|
||||||
$("#sub-total").append((sub_total)+"<br/>")
|
$("#sub-total").append((sub_total)+"<br/>")
|
||||||
|
|
||||||
|
if (discount_amount > 0 ) {
|
||||||
|
$("#discount-header").html("(Discount)")
|
||||||
|
$("#discount_amount").html("("+discount_amount+")")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tax_amount > 0 ) {
|
||||||
|
$("#tax-header").html("Tax")
|
||||||
|
$("#tax_amount").html(tax_amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grand_total_amount > 0 ) {
|
||||||
|
$("#grand-total-header").html("Grand Total")
|
||||||
|
$("#grand_total_amount").html(grand_total_amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cashier_name == null){
|
||||||
|
cashier_name = ""
|
||||||
|
}
|
||||||
|
if(receipt_no != null){
|
||||||
|
$("#receipt-no").html("Receipt No : "+receipt_no)
|
||||||
|
}
|
||||||
|
if (receipt_date != null) {
|
||||||
|
$("#receipt-date").html("Receipt Date : "+receipt_date);
|
||||||
|
}
|
||||||
|
if (cashier_name != null) {
|
||||||
|
$("#cashier-name").html("Cashier Name : "+cashier_name);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error:function(result){
|
error:function(result){
|
||||||
// alert('error');
|
// alert('error');
|
||||||
@@ -196,10 +311,19 @@ function callOrderDetails(order_id){
|
|||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
$('#request_bills').click(function() {
|
$('#request_bills').click(function() {
|
||||||
window.location.href = '/origami/request_bills/'+table_or_order_id;
|
window.location.href = '/origami/request_bills/'+ table_or_order_id
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#pay').click(function() {
|
||||||
|
window.location.href = '/origami/sale/'+ pay_sale_id + "/payment"
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.selected_color{
|
.selected_color{
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div id="order-title">
|
<div id="order-title">
|
||||||
<span><strong>Receipt No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></span>
|
<span><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></span>
|
||||||
|
<span style="margin-left: 24%"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></span>
|
||||||
<span><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></span>
|
<span><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></span>
|
||||||
|
<span style="margin-left: 27%"><strong>Sale Id</strong> </span><span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
@@ -23,8 +26,7 @@
|
|||||||
<table class="table" id="append-table">
|
<table class="table" id="append-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% if @sale_items %>
|
<% @sale_data.sale_items.each do |sale_item| %>
|
||||||
<% @sale_items.each do |sale_item| %>
|
|
||||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
@@ -38,7 +40,6 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<%end %>
|
<%end %>
|
||||||
<%end %>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,19 +52,183 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
|
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount%>)</span></strong></td>
|
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong>Tax</strong></td>
|
<td style="width:80%; text-align:left; border-top:none"><strong>Tax</strong></td>
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.total_tax%></span></strong></td>
|
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.total_tax rescue 0%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong>Grand Total</strong></td>
|
<td style="width:80%; text-align:left; border-top:none"><strong>Grand Total</strong></td>
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.grand_total%></span></strong></td>
|
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfooter>
|
</tfooter>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div style='text-align:center;margin-top:20px'>
|
||||||
|
<!-- <INPUT TYPE="Button" class='btn btn-primary' VALUE="Reprint" onClick="" style='width:120px'/>
|
||||||
|
<INPUT TYPE="Submit" class='btn btn-primary' VALUE="CANCEL" action="origami/index" style='width:120px'/> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8"><strong>AMOUNT DUE</strong></div>
|
||||||
|
<div class="col-md-4"><strong><span id="amount_due"><%= @sale_data.grand_total %></span></strong></div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">CASH</div>
|
||||||
|
<div class="col-md-4" id="cash" >0.0</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row" id="credit_payment">
|
||||||
|
<div class="col-md-8">CREDIT</div>
|
||||||
|
<div class="col-md-4">0.0</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row" id="card_payment">
|
||||||
|
<div class="col-md-8">CARD</div>
|
||||||
|
<div class="col-md-4">0.0</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">BALANCE</div>
|
||||||
|
<div class="col-md-4"><span id='balance'><%= @sale_data.grand_total %></span></div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="col-md-12 cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="col-md-12 cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="col-md-12 cashier_number long" data-value="10000" data-type="add">10000</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
|
||||||
|
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="col-md-12 cashier_number long" data-value="50000" data-type="add">50000</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number"></div>
|
||||||
|
<div class="col-md-3 cashier_number red">DEL</div>
|
||||||
|
<div class="col-md-3 cashier_number green">CLR</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="col-md-12 cashier_number long purple " id="pay">PAY</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
<script>
|
||||||
</div>
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
</div>
|
event.stopPropagation();
|
||||||
</div>
|
event.preventDefault();
|
||||||
|
if(event.handled !== true) {
|
||||||
|
var original_value;
|
||||||
|
original_value = $('#cash').text();
|
||||||
|
|
||||||
|
var input_type = $(this).attr("data-type");
|
||||||
|
switch (input_type) {
|
||||||
|
case 'num':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
if (original_value == "0.0"){
|
||||||
|
$('#cash').text(input_value);
|
||||||
|
update_balance();
|
||||||
|
}else{
|
||||||
|
$('#cash').append(input_value);
|
||||||
|
update_balance();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'add':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
amount = parseInt(input_value) + parseInt(original_value);
|
||||||
|
$('#cash').text(amount);
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
event.handled = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$( document ).ready(function() {
|
||||||
|
$('#credit_payment').click(function() {
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
window.location.href = '/origami/sale/'+ sale_id + "/payment/credit_payment"
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#card_payment').click(function() {
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
window.location.href = '/origami/sale/'+ sale_id + "/payment/card_payment"
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pay').click(function() {
|
||||||
|
console.log("pay")
|
||||||
|
if($('#amount_due').text() > 0){
|
||||||
|
console.log("greater")
|
||||||
|
}else{
|
||||||
|
console.log("less")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function update_balance(){
|
||||||
|
var cash = $('#cash').text();
|
||||||
|
var credit = $('#credit').text();
|
||||||
|
var card = $('#card').text();
|
||||||
|
var amount_due = $('#amount_due').text();
|
||||||
|
var total = cash + credit + card
|
||||||
|
var result = amount_due - total
|
||||||
|
$('#balance').text(result);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -14,8 +14,5 @@ module SXRestaurants
|
|||||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
|
|
||||||
# config.generators do |g|
|
|
||||||
# g.orm :active_record, primary_key_type: :uuid
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ Rails.application.routes.draw do
|
|||||||
resources :discounts, only: [:index,:new, :create ] #add discount type
|
resources :discounts, only: [:index,:new, :create ] #add discount type
|
||||||
resources :customers, only: [:index,:new, :create ] #add customer type
|
resources :customers, only: [:index,:new, :create ] #add customer type
|
||||||
end
|
end
|
||||||
resources :request_bills, only: [:show]
|
# resources :request_bills, only: [:show]
|
||||||
|
get 'sale/:sale_id/payment' => 'request_bills#show'
|
||||||
|
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
||||||
|
get 'sale/:sale_id/payment/card_payment' => "card_payments#index"
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Waiter/Ordering Station ------------#
|
#--------- Waiter/Ordering Station ------------#
|
||||||
@@ -99,7 +102,9 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
post 'update_delivery', to: "home#update_delivery_status"
|
post 'update_delivery', to: "home#update_delivery_status"
|
||||||
|
|
||||||
|
# Pass assigned_order_item_id
|
||||||
get 'print/print/:id', to: "print#print"
|
get 'print/print/:id', to: "print#print"
|
||||||
|
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
||||||
#dashboard
|
#dashboard
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class CreateCustomers < ActiveRecord::Migration[5.0]
|
class CreateCustomers < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :customers do |t|
|
create_table :customers, :id => false do |t|
|
||||||
|
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :company
|
t.string :company
|
||||||
t.string :contact_no
|
t.string :contact_no
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
class CreateOrders < ActiveRecord::Migration[5.0]
|
class CreateOrders < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :orders do |t|
|
create_table :orders, :id => false do |t|
|
||||||
|
t.string :order_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
t.datetime :date, :null => false
|
t.datetime :date, :null => false
|
||||||
t.string :source, :null => false, :default => "emenu"
|
t.string :source, :null => false, :default => "emenu"
|
||||||
t.string :order_type, :null => false, :default => "dine-in"
|
t.string :order_type, :null => false, :default => "dine-in"
|
||||||
t.references :customer, foreign_key: true
|
t.string :customer_id, foreign_key: true, :limit => 16
|
||||||
t.integer :item_count, :null => false, :default => 0
|
t.integer :item_count, :null => false, :default => 0
|
||||||
t.integer :quantity_count, :null => false, :default => 0
|
t.integer :quantity_count, :null => false, :default => 0
|
||||||
t.string :status, :null => false, :default => "new"
|
t.string :status, :null => false, :default => "new"
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
class CreateOrderItems < ActiveRecord::Migration[5.0]
|
class CreateOrderItems < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :order_items do |t|
|
create_table :order_items, :id => false do |t|
|
||||||
t.references :order, foreign_key: true, :null => false
|
t.string :order_items_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
t.string :order_id, foreign_key: true, :null => false, :limit => 16
|
||||||
t.string :order_item_status, :null => false, :default => "new"
|
t.string :order_item_status, :null => false, :default => "new"
|
||||||
t.string :item_order_by #person who order this
|
t.string :item_order_by #person who order this
|
||||||
t.string :item_code, :null => false
|
t.string :item_code, :null => false
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
class CreateCashierLoginLogs < ActiveRecord::Migration[5.0]
|
class CreateCashierLoginLogs < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :cashier_login_logs do |t|
|
create_table :cashier_login_logs, :id => false, :primary_key => :cashier_login_log_id do |t|
|
||||||
|
t.string :cashier_login_log_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
t.references :cashier_terminal, foreign_key: true
|
t.references :cashier_terminal, foreign_key: true
|
||||||
t.references :employee, foreign_key: true
|
t.references :employee, foreign_key: true
|
||||||
t.datetime :login_at, :null => false
|
t.datetime :login_at, :null => false
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
class CreateSales < ActiveRecord::Migration[5.0]
|
class CreateSales < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sales do |t|
|
create_table :sales, :id => false do |t|
|
||||||
|
t.string :sale_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
t.integer :cashier_id, :index => true
|
t.integer :cashier_id, :index => true
|
||||||
t.string :cashier_name
|
t.string :cashier_name
|
||||||
t.string :requested_by, :null => false
|
t.string :requested_by, :null => false
|
||||||
t.datetime :requested_at, :null => false
|
t.datetime :requested_at, :null => false
|
||||||
t.string :receipt_no, :null => false
|
t.string :receipt_no, :null => false
|
||||||
t.datetime :receipt_date, :null => false
|
t.datetime :receipt_date, :null => false
|
||||||
t.references :customer, foreign_key: true
|
t.string :customer_id, foreign_key: true, :limit => 16
|
||||||
t.string :payment_status, :null => false, :default => "outstanding"
|
t.string :payment_status, :null => false, :default => "outstanding"
|
||||||
t.string :sale_status, :null => false, :default => "new"
|
t.string :sale_status, :null => false, :default => "new"
|
||||||
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_items do |t|
|
create_table :sale_items, :id => false do |t|
|
||||||
t.references :sale, foreign_key: true
|
t.string :sale_item_id, :limit => 16, :primary_key => true#custom primary key - to ensure consistence for cloud syncing
|
||||||
|
t.string :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :product_code, :null => false
|
t.string :product_code, :null => false
|
||||||
t.string :product_name, :null => false
|
t.string :product_name, :null => false
|
||||||
t.string :remark
|
t.string :remark
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_taxes do |t|
|
create_table :sale_taxes, :id => false do |t|
|
||||||
t.references :sale, foreign_key: true
|
t.string :sale_tax_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
|
t.string :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :tax_name, :null => false
|
t.string :tax_name, :null => false
|
||||||
t.decimal :tax_rate, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :tax_rate, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :tax_payable_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :tax_payable_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_payments do |t|
|
create_table :sale_payments, :id => false do |t|
|
||||||
t.references :sale, foreign_key: true
|
t.string :sale_payment_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
|
t.string :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :payment_method, :null => false, :default => "cash"
|
t.string :payment_method, :null => false, :default => "cash"
|
||||||
t.decimal :payment_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :payment_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :outstanding_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :outstanding_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
class CreateSaleOrders < ActiveRecord::Migration[5.0]
|
class CreateSaleOrders < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_orders do |t|
|
create_table :sale_orders, :id => false do |t|
|
||||||
t.references :sale, foreign_key: true
|
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
|
||||||
t.references :order, foreign_key: true
|
|
||||||
|
t.string :sale_id, foreign_key: true,:limit => 16
|
||||||
|
t.string :order_id, foreign_key: true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_audits do |t|
|
create_table :sale_audits, :id => false do |t|
|
||||||
t.references :sale, foreign_key: true
|
t.string :sale_audit_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
|
t.string :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :action, :null => false
|
t.string :action, :null => false
|
||||||
t.datetime :action_at, :null => false
|
t.datetime :action_at, :null => false
|
||||||
t.string :action_by, :null => false
|
t.string :action_by, :null => false
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
class CreateBookings < ActiveRecord::Migration[5.0]
|
class CreateBookings < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :bookings do |t|
|
create_table :bookings, :id => false do |t|
|
||||||
|
t.string :booking_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
t.references :dining_facility, foreign_key: true
|
t.references :dining_facility, foreign_key: true
|
||||||
t.string :type, :null => false, :default => "Table"
|
t.string :type, :null => false, :default => "Table"
|
||||||
t.datetime :checkin_at, :null => false
|
t.datetime :checkin_at, :null => false
|
||||||
@@ -10,7 +12,8 @@ class CreateBookings < ActiveRecord::Migration[5.0]
|
|||||||
t.datetime :reserved_at
|
t.datetime :reserved_at
|
||||||
t.string :reserved_by
|
t.string :reserved_by
|
||||||
t.string :booking_status, :null => false, :default => "new"
|
t.string :booking_status, :null => false, :default => "new"
|
||||||
t.references :sale, foreign_key: true
|
t.string :sale_id, foreign_key: true, :limit => 16
|
||||||
|
t.string :customer_id, foreign_key: true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
class CreateAssignedOrderItems < ActiveRecord::Migration[5.0]
|
class CreateAssignedOrderItems < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :assigned_order_items do |t|
|
create_table :assigned_order_items, :id => false do |t|
|
||||||
|
t.string :assigned_order_item_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
t.string :item_code, :null => false, :index => true
|
t.string :item_code, :null => false, :index => true
|
||||||
t.references :order_queue_station, foreign_key: true
|
t.references :order_queue_station, foreign_key: true
|
||||||
t.references :order, foreign_key: true
|
t.string :order_id, foreign_key: true, :limit => 16
|
||||||
t.boolean :print_status
|
t.boolean :print_status
|
||||||
t.boolean :delivery_status
|
t.boolean :delivery_status
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
class CreateBookingOrders < ActiveRecord::Migration[5.0]
|
class CreateBookingOrders < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :booking_orders do |t|
|
create_table :booking_orders, :id => false do |t|
|
||||||
t.references :booking, foreign_key: true
|
#t.string :booking_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
t.references :order, foreign_key: true
|
t.primary_key :booking_order_id
|
||||||
|
t.string :booking_id, foreign_key: true, :limit => 16
|
||||||
|
t.string :order_id, foreign_key: true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,3 +137,7 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o
|
|||||||
|
|
||||||
#Create Adminstrator employee
|
#Create Adminstrator employee
|
||||||
admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
|
admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
|
||||||
|
|
||||||
|
#Account for Menu Item Type (eg: Food, Beverage)
|
||||||
|
food = Account.create({title: "Food", account_type: "0"})
|
||||||
|
beverage = Account.create({title: "Beverage", account_type: "1"})
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Test, type: :model do
|
RSpec.describe PrintSetting, type: :model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
5
spec/models/print_setting_spec.rb~crm
Normal file
5
spec/models/print_setting_spec.rb~crm
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe PrintSetting, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user