fixed conflict
This commit is contained in:
8
Gemfile
8
Gemfile
@@ -10,10 +10,10 @@ end
|
||||
gem 'rails', '~> 5.1.0'
|
||||
# Use mysql as the database for Active Record
|
||||
|
||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||
#gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||
|
||||
#Use PosgreSQL
|
||||
gem 'pg'
|
||||
#gem 'pg'
|
||||
|
||||
# redis server for cable
|
||||
# gem 'redis', '~> 3.0'
|
||||
@@ -92,4 +92,6 @@ end
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
gem 'httparty', '~> 0.15.5'
|
||||
gem 'httparty', '~> 0.15.5'
|
||||
|
||||
gem 'bootstrap-datepicker-rails'
|
||||
@@ -64,6 +64,8 @@ GEM
|
||||
bootstrap (4.0.0.alpha6)
|
||||
autoprefixer-rails (>= 6.0.3)
|
||||
sass (>= 3.4.19)
|
||||
bootstrap-datepicker-rails (1.6.4.1)
|
||||
railties (>= 3.0)
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
coffee-rails (4.2.2)
|
||||
@@ -117,12 +119,10 @@ GEM
|
||||
minitest (5.10.2)
|
||||
multi_json (1.12.1)
|
||||
multi_xml (0.6.0)
|
||||
mysql2 (0.4.6)
|
||||
nio4r (2.1.0)
|
||||
nokogiri (1.7.2)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
pdf-core (0.7.0)
|
||||
pg (0.20.0)
|
||||
prawn (2.2.2)
|
||||
pdf-core (~> 0.7.0)
|
||||
ttfunk (~> 1.5)
|
||||
@@ -244,6 +244,7 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
bcrypt (~> 3.1.7)
|
||||
bootstrap (~> 4.0.0.alpha3)
|
||||
bootstrap-datepicker-rails
|
||||
byebug
|
||||
coffee-rails (~> 4.2)
|
||||
cups (~> 0.0.7)
|
||||
@@ -256,8 +257,8 @@ DEPENDENCIES
|
||||
jquery-rails
|
||||
kaminari!
|
||||
listen (~> 3.0.5)
|
||||
mysql2 (>= 0.3.18, < 0.5)
|
||||
pg
|
||||
mysql2 (>= 0.3.18, < 0.5)
|
||||
prawn
|
||||
prawn-table
|
||||
puma (~> 3.0)
|
||||
|
||||
@@ -17,3 +17,4 @@
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
@@ -15,3 +15,88 @@
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".orders").on('click', function(){
|
||||
var zone_name=$(this).find(".orders-table").text();
|
||||
var receipt_no=$(this).find(".orders-receipt-no").text();
|
||||
var unique_id=$(this).find(".orders-id").text();
|
||||
|
||||
var cashier="";
|
||||
var receipt_date="";
|
||||
var sub_total=0;
|
||||
var discount_amount=0;
|
||||
var tax_amount=0;
|
||||
var grand_total_amount=0;
|
||||
|
||||
$("#order-title").text("ORDER DETAILS - " + zone_name);
|
||||
// clear order items
|
||||
$("#order-items-table").children("tbody").empty();
|
||||
|
||||
// AJAX call for order
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "origami/" + unique_id,
|
||||
data: { 'id' : unique_id },
|
||||
success:function(result){
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
|
||||
// Receipt Header
|
||||
receipt_no = result[i].receipt_no;
|
||||
cashier = result[i].cashier_name;
|
||||
receipt_date = result[i].receipt_date;
|
||||
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier==null?"":cashier);
|
||||
$("#receipt_date").text(receipt_date);
|
||||
|
||||
|
||||
//Receipt Charges
|
||||
sub_total += (parse_data.qty*parse_data.price);
|
||||
discount_amount = parse_data.discount_amount;
|
||||
tax_amount = parse_data.tax_amount;
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
$("#order-food").text('');
|
||||
$("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
|
||||
// Ordered Items
|
||||
var order_items_rows = "<tr>" +
|
||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
|
||||
"</tr>";
|
||||
|
||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||
}
|
||||
}
|
||||
});
|
||||
// End AJAX Call
|
||||
|
||||
$('.orders').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text();
|
||||
window.location.href = '/origami/request_bills/'+ order_id
|
||||
return false;
|
||||
});
|
||||
|
||||
// Payment for Bill
|
||||
$('#pay').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
@import "bootstrap-datepicker3";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
|
||||
@@ -19,13 +19,45 @@
|
||||
color:white;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.cashier_number:hover{
|
||||
background:#A9F5F2;
|
||||
}
|
||||
|
||||
.long{
|
||||
width:100%
|
||||
}
|
||||
|
||||
.sold {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.selected-item {
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
/* Reciept Style */
|
||||
#order-charges-table td {
|
||||
border-top: none !important;
|
||||
}
|
||||
|
||||
.charges-name {
|
||||
width: 80%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
width: 60%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.item-attr {
|
||||
width: 20%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
/* Colors */
|
||||
.purple {
|
||||
background-color:#7a62d3;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,13 @@ class Crm::CustomersController < ApplicationController
|
||||
# GET /crm/customers.json
|
||||
def index
|
||||
@crm_customers = Customer.all
|
||||
@customers = Customer.new
|
||||
@membership = Customer.get_member_group
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @crm_customers }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /crm/customers/1
|
||||
@@ -15,7 +22,8 @@ class Crm::CustomersController < ApplicationController
|
||||
# GET /crm/customers/new
|
||||
def new
|
||||
@crm_customer = Customer.new
|
||||
@membership = Customer.get_member_group
|
||||
@membership = Customer.get_member_group()
|
||||
|
||||
end
|
||||
|
||||
# GET /crm/customers/1/edit
|
||||
@@ -25,7 +33,7 @@ class Crm::CustomersController < ApplicationController
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
@crm_customer = Customer.new(crm_customer_params)
|
||||
@crm_customer = Customer.new(customer_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customer.save
|
||||
@@ -42,7 +50,7 @@ class Crm::CustomersController < ApplicationController
|
||||
# PATCH/PUT /crm/customers/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @crm_customer.update(crm_customer_params)
|
||||
if @crm_customer.update(customer_params)
|
||||
format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
else
|
||||
@@ -69,7 +77,7 @@ class Crm::CustomersController < ApplicationController
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def crm_customer_params
|
||||
params.require(:crm_customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
||||
def customer_params
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,16 +7,18 @@ class Origami::HomeController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
str = []
|
||||
type=params[:id].split('-')[0];
|
||||
|
||||
|
||||
if !params[:sale_id].nil?
|
||||
@order_details = SaleItem.get_order_items_details(params[:sale_id])
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@order_details = SaleItem.get_order_items_details(params[:id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
render :json => str.to_json
|
||||
# Booking
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
||||
@order_details = OrderItem.get_order_items_details(params[:id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
def create
|
||||
def print
|
||||
@sale = Sale.new
|
||||
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
booking_id = params[:id]
|
||||
check_booking = Booking.find_by_booking_id(booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
#check if it doesn't exist
|
||||
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||
# Create Sale if it doesn't exist
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
end
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer_name = Customer.select("name").where('customer_id=' + @sale_data.customer_id)
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale,@sale_data)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name)
|
||||
redirect_to origami_root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,6 +4,6 @@ class Account < ApplicationRecord
|
||||
has_many :menu_items
|
||||
# belongs_to :lookup , :class_name => "Lookup"
|
||||
def self.collection
|
||||
Account.select("id, title").map { |e| [e.title, e.id] }
|
||||
end
|
||||
Account.select("id, title").map { |e| [e.title, e.id] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
class Customer < ApplicationRecord
|
||||
self.primary_key = "customer_id"
|
||||
|
||||
#self.primary_key = :customer_id
|
||||
|
||||
before_create :generate_custom_id
|
||||
has_many :orders
|
||||
has_many :sales
|
||||
|
||||
validates_presence_of :name, :contact_no
|
||||
validates_presence_of :name, :contact_no, :email
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
|
||||
def self.get_member_group
|
||||
|
||||
gateway_url = MembershipSetting.find_by_membership_type("smartpay_url")
|
||||
url = gateway_url.gateway_url.to_s + "/api/get_all_member_group".to_s
|
||||
response = HTTParty.get(url)
|
||||
puts response.body, response.code, response.message, response.headers.inspect
|
||||
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
# http://192.168.1.47:3006/api/create_membership_customer
|
||||
#get_all_member_group
|
||||
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
|
||||
@@ -208,27 +208,26 @@ class Order < ApplicationRecord
|
||||
OrderBroadcastJob.perform_later(self.id)
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order type Table
|
||||
|
||||
#Origami: Cashier : to view 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_items.id as order_items_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
||||
left join bookings on bookings.id = booking_orders.id
|
||||
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.booking_order_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::TABLE_TYPE,"dine_in",true)
|
||||
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view booking order Table
|
||||
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")
|
||||
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")
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.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")
|
||||
|
||||
@@ -236,7 +235,8 @@ class Order < ApplicationRecord
|
||||
|
||||
#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")
|
||||
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")
|
||||
@@ -249,7 +249,7 @@ class Order < ApplicationRecord
|
||||
#Origami: Cashier : to view order type Room
|
||||
def self.get_order_rooms
|
||||
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.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
@@ -263,7 +263,8 @@ class Order < ApplicationRecord
|
||||
def self.get_orders
|
||||
from = Time.now.beginning_of_day.utc
|
||||
to = Time.now.end_of_day.utc
|
||||
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")
|
||||
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")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
@@ -272,6 +273,7 @@ class Order < ApplicationRecord
|
||||
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id")
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -64,12 +64,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
self.print(filename)
|
||||
end
|
||||
#Bill Receipt Print
|
||||
def print_receipt_bill(printer_settings,sale_items,sale,sale_data)
|
||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = ReceiptBillPdf.new(printer_settings,sale_items,sale,sale_data)
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name)
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ class Sale < ApplicationRecord
|
||||
order = booking.booking_orders.take.order
|
||||
puts "add sale order"
|
||||
link_order_sale(order.id)
|
||||
return status
|
||||
return status, sale_id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -76,7 +76,8 @@ class Sale < ApplicationRecord
|
||||
|
||||
|
||||
self.save!
|
||||
#compute summary
|
||||
|
||||
#compute sales summary
|
||||
compute
|
||||
|
||||
#Update the order items that is billed
|
||||
@@ -218,6 +219,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
|
||||
private
|
||||
|
||||
def product_get_unit_price(item_code)
|
||||
menu_item_hash =MenuItem.search_by_item_code(item_code)
|
||||
if (menu_instance_code)
|
||||
|
||||
@@ -12,17 +12,22 @@ class SaleItem < ApplicationRecord
|
||||
|
||||
|
||||
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
|
||||
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.sale_id = sale_items.sale_id")
|
||||
.where("sale_items.sale_id=?",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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
def initialize(printer_settings, sale_items,sale, sale_data)
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name)
|
||||
self.p_width = 200
|
||||
self.page_height = 1450
|
||||
self.margin = 10
|
||||
@@ -19,11 +19,11 @@ class ReceiptBillPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||
self.header_font_size = 10
|
||||
self.item_font_size = 6
|
||||
self.item_font_size = 9
|
||||
|
||||
header( printer_settings.printer_name, printer_settings.name)
|
||||
stroke_horizontal_rule
|
||||
cashier_info(sale.receipt_no,sale.customer, sale.receipt_date)
|
||||
cashier_info(sale_data, customer_name)
|
||||
line_items(sale_items)
|
||||
all_total(sale_data)
|
||||
|
||||
@@ -41,7 +41,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
end
|
||||
|
||||
def cashier_info(receipt_no, customer, receipt_date)
|
||||
def cashier_info(sale_data, customer_name)
|
||||
move_down 5
|
||||
move_down 2
|
||||
y_position = cursor
|
||||
@@ -50,7 +50,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.price_width, y_position], :width =>self.receipt_width) do
|
||||
text "#{receipt_no}" , :size => self.item_font_size, :align => :left
|
||||
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
move_down 5
|
||||
|
||||
@@ -59,7 +59,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Customer:", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
||||
text "#{customer}" , :size => self.item_font_size,:align => :left
|
||||
text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
move_down 5
|
||||
|
||||
@@ -68,7 +68,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Date:", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
||||
text "#{receipt_date}" , :size => self.item_font_size,:align => :left
|
||||
text "#{sale_data.receipt_date.strftime('%Y %m %d %h:%m')}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# stroke_horizontal_rule
|
||||
move_down 5
|
||||
@@ -139,7 +139,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
def all_total(sale_data)
|
||||
|
||||
move_down 5
|
||||
y_position =cursor
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
if (@booking)
|
||||
json.id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
json.checkin_at @booking.checkin_at
|
||||
json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y")
|
||||
json.checkin_by @booking.checkin_by
|
||||
json.table_name @booking.dining_facility.name
|
||||
|
||||
@@ -13,14 +13,13 @@ if (@booking)
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
@booking_orders = BookingOrder.where("booking_id = #{@booking.booking_id}").all;
|
||||
if @booking.booking_orders
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
if (order.status == "new")
|
||||
#if (order.status == "new")
|
||||
order_items = order_items + order.order_items
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
json.order_items order_items do |item|
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<%= f.input :contact_no %>
|
||||
<%= f.input :email %>
|
||||
<%= f.input :date_of_birth %>
|
||||
|
||||
<%= f.input :membership_id, :collection => @membership %>
|
||||
<%= f.input :membership_type %>
|
||||
<%= f.input :membership_authentication_code %>
|
||||
</div>
|
||||
|
||||
@@ -1,41 +1,110 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li class="active">
|
||||
<a href="<%= crm_customers_path %>">Customer</a>
|
||||
</li>
|
||||
<a href="<%= new_crm_customer_path%>" class="btn btn-primary pull-right">
|
||||
<i class="fa fa-plus-circle fa-lg"></i> Add Customer
|
||||
</a>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<h1>Crm Customers</h1>
|
||||
<div class="row">
|
||||
<div class="col-lg-7">
|
||||
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<th>Date of birth</th>
|
||||
<th>Membership</th>
|
||||
<th>Membership type</th>
|
||||
<th>Membership authentication code</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<tr>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
<td><%= crm_customer.email %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tbody>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<tr>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
<td><%= crm_customer.email %></td>
|
||||
<td><%= crm_customer.date_of_birth %></td>
|
||||
<td><%= crm_customer.membership_id %></td>
|
||||
<td><%= crm_customer.membership_type %></td>
|
||||
<td><%= crm_customer.membership_authentication_code %></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 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="col-lg-5">
|
||||
<%= simple_form_for crm_customers_path, :html => { :class => 'form-horizontal' } do |f| %>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :name, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :email, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
|
||||
<%= link_to 'New Crm Customer', new_crm_customer_path %>
|
||||
<div class="form-group">
|
||||
<label for="date_of_birth" class="col-md-6 control-label">Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:class=>"form-control datepicker",:readonly =>true, :value => @date_of_birth%>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.select :membership_id, options_for_select(@membership.collect { |member|
|
||||
[member["id"].name.titleize, member["id"].id] }, 1), {}, { id: 'countries_select' } %>
|
||||
<select class="selectpicker form-control col-md-6" name="membership_id">
|
||||
<option>Select Member Group</option>
|
||||
<% @membership.each do |member| %>
|
||||
<option value="<%= member["id"] %>">
|
||||
<%= member["name"] %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :membership_type, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :membership_authentication_code, :class => "form-control col-md-6" %>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit", :class => 'btn btn-primary' , :id => 'submit_account' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
if (jQuery().datepicker) {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -40,7 +40,7 @@ $(function(){
|
||||
$(".summary-items tbody tr").remove();
|
||||
$("#cancel").removeAttr("disabled");
|
||||
$("#assign").removeAttr("disabled");
|
||||
var url = $(this).attr('data-ref');alert(url);
|
||||
var url = $(this).attr('data-ref');
|
||||
show_details(url);
|
||||
});
|
||||
|
||||
|
||||
@@ -61,11 +61,8 @@
|
||||
</small>
|
||||
</p>
|
||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
<!-- <div class="card-footer">
|
||||
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
||||
</div> -->
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
@@ -16,318 +16,210 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!-- Panel 1 - Tables -->
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow:auto">
|
||||
|
||||
<!--- Panel 0 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% 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 class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_orders.each do |bko|
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if bko.order_status == 'new'
|
||||
unique_id=bko.booking_id
|
||||
else
|
||||
unique_id=bko.sale_id
|
||||
sale_status="sold"
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= bko.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= bko.order_status %>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 1 - Tables - End -->
|
||||
<!-- Panel 2 - Rooms -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% 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">
|
||||
<h4 class="card-title">
|
||||
<span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
||||
<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>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
|
||||
<!--- Panel 1 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_rooms.each do |rmo|
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if rmo.order_status == 'new'
|
||||
unique_id=rmo.booking_id
|
||||
else
|
||||
unique_id=rmo.sale_id
|
||||
sale_status="sold"
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= rmo.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= rmo.order_status %>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- Panel 2 - Rooms - End -->
|
||||
<!-- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% 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">
|
||||
<h4 class="card-title">
|
||||
<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>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
|
||||
|
||||
<!--- Panel 2 - Orders -->
|
||||
<div class="tab-pane active" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@orders.each do |odr|
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if odr.order_status == 'new'
|
||||
unique_id=odr.booking_id
|
||||
else
|
||||
unique_id=odr.sale_id
|
||||
sale_status="sold"
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= odr.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= odr.order_status %>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- Panel 3 - Orders - End -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<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 class="card-block">
|
||||
<div class="card-title">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">ORDER DETAILS -</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Receipt No: <span id="receipt_no"></span></p>
|
||||
<p>Cashier: <span id="cashier"></span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Append Javascript Template -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<th style="width:60%; text-align:left">Items</th>
|
||||
<th style="width:20%; text-align:right">QTY</td>
|
||||
<th style="width:20%; text-align:right">Price</td>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
||||
<table class="table" id="append-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-name-price"></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-qty"></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" style="margin-bottom:0px">
|
||||
<tfooter>
|
||||
<tr>
|
||||
<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 class="charges-name"><strong>Food:</strong></td>
|
||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||
</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>
|
||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||
<td class="item-attr"><strong id="order-beverage"></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>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount"></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>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"></strong></td>
|
||||
</tr>
|
||||
</tfooter>
|
||||
</table>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three--->
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</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>Req.Bill</button> -->
|
||||
<button type="button" id="request_bills" 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">Req.Bill</button>
|
||||
<!-- 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>Tax</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">Discount</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block">Tax</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var old_order_id = 0
|
||||
var old_table_name = ""
|
||||
var table_or_order_id = 0
|
||||
var pay_sale_id = 0
|
||||
|
||||
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
|
||||
pay_sale_id = sale_id
|
||||
var tbody = ""
|
||||
$("#append-table").html("")
|
||||
if (old_order_id != order_id){
|
||||
$("#table-order-"+old_order_id).removeClass("selected_color")
|
||||
$("#table-order-"+order_id).addClass("selected_color")
|
||||
old_order_id = order_id
|
||||
}
|
||||
|
||||
$("#order-detail-header").html("")
|
||||
$("#order-detail-header").append("Table Name : "+document.getElementById("table-name-"+order_id).innerHTML)
|
||||
$("#sub-total").html("")
|
||||
$.ajax({type: "GET",
|
||||
url: url,
|
||||
data: data_val,
|
||||
success:function(result){
|
||||
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++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data)
|
||||
sub_total += (parse_data.qty*parse_data.price)
|
||||
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-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
||||
+'</tr>>'
|
||||
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)
|
||||
|
||||
$("#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){
|
||||
// alert('error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
$('#request_bills').click(function() {
|
||||
window.location.href = '/origami/request_bills/'+ table_or_order_id
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#pay').click(function() {
|
||||
window.location.href = '/origami/sale/'+ pay_sale_id + "/payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.selected_color{
|
||||
color:white;
|
||||
background-color: blue;
|
||||
}
|
||||
</style>
|
||||
|
||||
328
app/views/origami/home/index_old.html.erb
Normal file
328
app/views/origami/home/index_old.html.erb
Normal file
@@ -0,0 +1,328 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!-- Panel 1 - Tables -->
|
||||
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% 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>
|
||||
<!-- Panel 1 - Tables - End -->
|
||||
<!-- Panel 2 - Rooms -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% 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">
|
||||
<h4 class="card-title">
|
||||
<span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
||||
<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>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 2 - Rooms - End -->
|
||||
<!-- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% 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">
|
||||
<h4 class="card-title">
|
||||
<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>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 3 - Orders - End -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div id="order-title"><strong><span id="receipt-no">ORDER DETAILS</span></strong>
|
||||
<strong><span id ="receipt-date" style="margin-left: 30%"></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 class="card-block">
|
||||
<div class="card-title">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:60%; text-align:left">Items</th>
|
||||
<th style="width:20%; text-align:right">QTY</td>
|
||||
<th style="width:20%; text-align:right">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
||||
<table class="table" id="append-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-name-price"></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-qty"></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" style="margin-bottom:0px">
|
||||
<tfooter>
|
||||
<tr>
|
||||
<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>
|
||||
</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>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three--->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</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>Req.Bill</button> -->
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">
|
||||
Req.Bill
|
||||
</button>
|
||||
<!-- 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>Tax</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var old_order_id = 0
|
||||
var old_table_name = ""
|
||||
var table_or_order_id = 0
|
||||
var pay_sale_id = 0
|
||||
|
||||
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_id
|
||||
data_val = { sale_id: sale_id }
|
||||
sale_or_order_id=sale_id
|
||||
}else{
|
||||
order_id = sale_order_id.split("_")[1]
|
||||
url = "origami/"+order_id
|
||||
data_val = { order_id: sale_order_id.split("_")[1]}
|
||||
sale_or_order_id=order_id
|
||||
}
|
||||
|
||||
table_or_order_id = order_id
|
||||
pay_sale_id = sale_id
|
||||
var tbody = ""
|
||||
|
||||
// clear data in table
|
||||
$("#append-table").html("")
|
||||
|
||||
if (old_order_id != order_id){
|
||||
$("#table-order-"+old_order_id).removeClass("selected_color")
|
||||
$("#table-order-"+order_id).addClass("selected_color")
|
||||
old_order_id = order_id
|
||||
}
|
||||
|
||||
$("#order-detail-header").html("")
|
||||
$("#order-detail-header").append("Table Name : "+document.getElementById("table-name-" + sale_or_order_id).innerHTML)
|
||||
$("#sub-total").html("")
|
||||
$.ajax({type: "GET",
|
||||
url: url,
|
||||
data: data_val,
|
||||
success:function(result){
|
||||
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++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data)
|
||||
|
||||
sub_total += (parse_data.qty*parse_data.price)
|
||||
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-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
||||
+'</tr>>'
|
||||
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);
|
||||
|
||||
$("#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){
|
||||
// alert('error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
$('#request_bills').click(function() {
|
||||
console.log(table_or_order_id);
|
||||
window.location.href = '/origami/request_bills/'+ table_or_order_id
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#pay').click(function() {
|
||||
window.location.href = '/origami/sale/'+ pay_sale_id + "/payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.selected_color{
|
||||
color:white;
|
||||
background-color: blue;
|
||||
}
|
||||
</style>
|
||||
@@ -72,6 +72,9 @@ Rails.application.routes.draw do
|
||||
resources :customers, only: [:index,:new, :create ] #add customer type
|
||||
end
|
||||
|
||||
|
||||
get "/request_bills/:id" => "request_bills#print"
|
||||
|
||||
get 'sale/:sale_id/payment' => 'payments#show'
|
||||
post 'payment_process' => 'payments#create'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateZones < ActiveRecord::Migration[5.0]
|
||||
class CreateZones < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :zones do |t|
|
||||
t.string :name, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMenus < ActiveRecord::Migration[5.0]
|
||||
class CreateMenus < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menus do |t|
|
||||
t.string :name
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMenuCategories < ActiveRecord::Migration[5.0]
|
||||
class CreateMenuCategories < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_categories do |t|
|
||||
t.references :menu, foreign_key: true
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class CreateMenuItems < ActiveRecord::Migration[5.0]
|
||||
|
||||
class CreateMenuItems < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_items do |t|
|
||||
t.string :item_code, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMenuItemAttributes < ActiveRecord::Migration[5.0]
|
||||
class CreateMenuItemAttributes < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_item_attributes do |t|
|
||||
t.string :attribute_type, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMenuItemOptions < ActiveRecord::Migration[5.0]
|
||||
class CreateMenuItemOptions < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_item_options do |t|
|
||||
t.string :name, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMenuItemInstances < ActiveRecord::Migration[5.0]
|
||||
class CreateMenuItemInstances < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_item_instances do |t|
|
||||
t.references :menu_item, :foreign_key => true, :null => false
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class CreateCustomers < ActiveRecord::Migration[5.0]
|
||||
class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
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 :company
|
||||
t.string :contact_no
|
||||
t.string :contact_no, :unique => true
|
||||
t.string :email
|
||||
t.date :date_of_birth
|
||||
t.string :membership_id
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateOrders < ActiveRecord::Migration[5.0]
|
||||
class CreateOrders < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :orders, :id => false do |t|
|
||||
t.string :order_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateOrderItems < ActiveRecord::Migration[5.0]
|
||||
class CreateOrderItems < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :order_items, :id => false do |t|
|
||||
t.string :order_items_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateDiningFacilities < ActiveRecord::Migration[5.0]
|
||||
class CreateDiningFacilities < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :dining_facilities do |t|
|
||||
t.references :zone, foreign_key: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateOrderQueueStations < ActiveRecord::Migration[5.0]
|
||||
class CreateOrderQueueStations < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :order_queue_stations do |t|
|
||||
t.string :station_name, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateOrderQueueProcessByZones < ActiveRecord::Migration[5.0]
|
||||
class CreateOrderQueueProcessByZones < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :order_queue_process_by_zones do |t|
|
||||
t.references :order_queue_station, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreatePaymentMethodSettings < ActiveRecord::Migration[5.0]
|
||||
class CreatePaymentMethodSettings < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :payment_method_settings do |t|
|
||||
t.string :payment_method, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateEmployees < ActiveRecord::Migration[5.0]
|
||||
class CreateEmployees < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :employees do |t|
|
||||
t.string :name, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateCashierTerminals < ActiveRecord::Migration[5.0]
|
||||
class CreateCashierTerminals < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :cashier_terminals do |t|
|
||||
t.string :name, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateCashierLoginLogs < ActiveRecord::Migration[5.0]
|
||||
class CreateCashierLoginLogs < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSales < ActiveRecord::Migration[5.0]
|
||||
class CreateSales < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
||||
class CreateSaleItems < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :sale_items, :id => false do |t|
|
||||
t.string :sale_item_id, :limit => 16, :primary_key => true#custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
||||
class CreateSaleTaxes < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :sale_taxes, :id => false do |t|
|
||||
t.string :sale_tax_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
||||
class CreateSalePayments < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :sale_payments, :id => false do |t|
|
||||
t.string :sale_payment_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSaleOrders < ActiveRecord::Migration[5.0]
|
||||
class CreateSaleOrders < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :sale_orders, :id => false do |t|
|
||||
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
||||
class CreateSaleAudits < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :sale_audits, :id => false do |t|
|
||||
t.string :sale_audit_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateLookups < ActiveRecord::Migration[5.0]
|
||||
class CreateLookups < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :lookups do |t|
|
||||
t.string :lookup_type, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateTaxProfiles < ActiveRecord::Migration[5.0]
|
||||
class CreateTaxProfiles < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :tax_profiles do |t|
|
||||
t.string :name, :null => false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateBookings < ActiveRecord::Migration[5.0]
|
||||
class CreateBookings < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateSeedGenerators < ActiveRecord::Migration[5.0]
|
||||
class CreateSeedGenerators < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :seed_generators do |t|
|
||||
t.string :model, :null => false, :default => "sale"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMembershipSettings < ActiveRecord::Migration[5.0]
|
||||
class CreateMembershipSettings < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :membership_settings do |t|
|
||||
t.string :membership_type, :null => false, :default => "internal"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateAssignedOrderItems < ActiveRecord::Migration[5.0]
|
||||
class CreateAssignedOrderItems < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateBookingOrders < ActiveRecord::Migration[5.0]
|
||||
class CreateBookingOrders < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :booking_orders, :id => false do |t|
|
||||
#t.string :booking_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class AddCompanyAddressEmail < ActiveRecord::Migration[5.0]
|
||||
class AddCompanyAddressEmail < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class OrderItemsCompletedBy < ActiveRecord::Migration[5.0]
|
||||
class OrderItemsCompletedBy < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :order_items, :completed_by, :string
|
||||
add_column :order_items, :completed_at, :datetime
|
||||
|
||||
@@ -9,7 +9,7 @@ class CreateShops < ActiveRecord::Migration[5.1]
|
||||
t.string :state, :null => false
|
||||
t.string :country, :null => false
|
||||
t.string :phone_no, :null => false
|
||||
t.string :reserviation_no, :null => false
|
||||
t.string :reservation_no, :null => false
|
||||
t.string :license, :null => false
|
||||
t.datetime :activated_at, :null => false
|
||||
t.text :license_data, :null => false
|
||||
|
||||
18
db/seeds.rb
18
db/seeds.rb
@@ -75,9 +75,8 @@ account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value
|
||||
{lookup_type:'account_type', name: 'Expense', value: 'expense'}])
|
||||
|
||||
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
||||
customer = Customer.create({id:1, name:"WALK-IN", contact_no:"000000000"})
|
||||
customer = Customer.create({id:2, name:"TAKEAWAY", contact_no:"000000000"})
|
||||
|
||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000"})
|
||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111"})
|
||||
|
||||
#Default ZOne
|
||||
zone = Zone.create({id:1, name: "Default Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
||||
@@ -108,7 +107,7 @@ menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Sample Men
|
||||
|
||||
#Default Menu items
|
||||
menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"01001-1", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"II0101", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"full portion",item_instance_code:"01001-2", menu_item: menu_category1_menu_item0, price:18.00, is_on_promotion:false}])
|
||||
|
||||
menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food})
|
||||
@@ -136,3 +135,14 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o
|
||||
|
||||
#Create Adminstrator employee
|
||||
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"})
|
||||
|
||||
shop = Shop.create(
|
||||
{name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
|
||||
country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
|
||||
activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user