confict clear
This commit is contained in:
@@ -48,9 +48,9 @@ GEM
|
|||||||
sass (>= 3.4.19)
|
sass (>= 3.4.19)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
byebug (9.0.6)
|
byebug (9.0.6)
|
||||||
coffee-rails (4.2.1)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0, < 5.2.x)
|
railties (>= 4.0.0)
|
||||||
coffee-script (2.4.1)
|
coffee-script (2.4.1)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
@@ -97,7 +97,7 @@ GEM
|
|||||||
minitest (5.10.2)
|
minitest (5.10.2)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
mysql2 (0.4.6)
|
mysql2 (0.4.6)
|
||||||
nio4r (2.0.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.7.2)
|
nokogiri (1.7.2)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
|
|||||||
3
app/assets/javascripts/origami/request_bills.coffee
Normal file
3
app/assets/javascripts/origami/request_bills.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
3
app/assets/stylesheets/origami/request_bills.scss
Normal file
3
app/assets/stylesheets/origami/request_bills.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the origami/RequestBills controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -40,6 +40,7 @@ class Api::OrdersController < Api::ApiController
|
|||||||
#Create Table Booking or Room Booking
|
#Create Table Booking or Room Booking
|
||||||
if !params["booking_id"].nil? && params[:booking_id].to_i > 0
|
if !params["booking_id"].nil? && params[:booking_id].to_i > 0
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
|
# @order.new_booking = true
|
||||||
@order.booking_id = params[:booking_id]
|
@order.booking_id = params[:booking_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
class Origami::HomeController < BaseOrigamiController
|
class Origami::HomeController < BaseOrigamiController
|
||||||
def index
|
def index
|
||||||
|
@order_table = Order.get_order_table()
|
||||||
|
@order_rooms = Order.get_order_rooms()
|
||||||
|
@orders = Order.get_orders()
|
||||||
end
|
end
|
||||||
def show
|
def show
|
||||||
|
str = []
|
||||||
|
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
||||||
|
@order_details.each do |ord_detail|
|
||||||
|
str.push(ord_detail)
|
||||||
|
end
|
||||||
|
render :json => str.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
13
app/controllers/origami/request_bills_controller.rb
Normal file
13
app/controllers/origami/request_bills_controller.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class Origami::RequestBillsController < BaseOrigamiController
|
||||||
|
def show
|
||||||
|
@sale = Sale.new
|
||||||
|
check_order = Order.find_by_id(params[:id])
|
||||||
|
if check_order
|
||||||
|
@order_details = OrderItem.get_order_items_details(check_order.id)
|
||||||
|
@order_details = OrderItem.get_order_items_details(check_order.id)
|
||||||
|
@status, @sale_id = @sale.generate_invoice_from_order(check_order.id, nil,current_login_employee.name)
|
||||||
|
@sale_data = Sale.find_by_id(@sale_id)
|
||||||
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
2
app/helpers/origami/request_bills_helper.rb
Normal file
2
app/helpers/origami/request_bills_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Origami::RequestBillsHelper
|
||||||
|
end
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
class DiningFacility < ApplicationRecord
|
class DiningFacility < ApplicationRecord
|
||||||
belongs_to :zone
|
belongs_to :zone
|
||||||
|
|
||||||
|
TABLE_TYPE = "Table"
|
||||||
|
ROOM_TYPE = "Room"
|
||||||
|
|
||||||
default_scope { order('order_by asc') }
|
default_scope { order('order_by asc') }
|
||||||
|
|
||||||
scope :active, -> {where(is_active: true)}
|
scope :active, -> {where(is_active: true)}
|
||||||
|
|||||||
@@ -201,4 +201,40 @@ class Order < ApplicationRecord
|
|||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
OrderQueueProcessorJob.perform_later(self.id)
|
OrderQueueProcessorJob.perform_later(self.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Origami: Cashier : to view order type 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
|
||||||
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_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)
|
||||||
|
.group("orders.id")
|
||||||
|
end
|
||||||
|
#Origami: Cashier : to view order type Room
|
||||||
|
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_items.id as order_items_id,dining_facilities.name as room_name")
|
||||||
|
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
||||||
|
left join bookings on bookings.id = booking_orders.id
|
||||||
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_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::ROOM_TYPE,"dine_in",true)
|
||||||
|
.group("orders.id")
|
||||||
|
end
|
||||||
|
#Origami: Cashier : to view orders
|
||||||
|
def self.get_orders
|
||||||
|
from = Time.now.beginning_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,
|
||||||
|
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.id
|
||||||
|
left join bookings on bookings.id = booking_orders.id
|
||||||
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||||
|
left join order_items on order_items.order_id = orders.id")
|
||||||
|
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||||
|
.group("orders.id")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,4 +33,10 @@ class OrderItem < ApplicationRecord
|
|||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
#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)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -188,7 +188,8 @@ class Sale < ApplicationRecord
|
|||||||
sale_tax.tax_name = tax.name
|
sale_tax.tax_name = tax.name
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
#include or execulive
|
#include or execulive
|
||||||
sale_tax.tax_payable_amount = total_taxable * tax.rate
|
# sale_tax.tax_payable_amount = total_taxable * tax.rate
|
||||||
|
sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
|
||||||
#new taxable amount
|
#new taxable amount
|
||||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
<div class="col-lg-6 col-md-6 col-sm-8">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
|
|
||||||
@@ -18,67 +18,20 @@
|
|||||||
|
|
||||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||||
<!-- Panel 1 - Tables -->
|
<!-- Panel 1 - Tables -->
|
||||||
|
|
||||||
<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">
|
||||||
<div class="card">
|
<% if @order_table %>
|
||||||
<div class="card-block">
|
<% @order_table.each do |order_table| %>
|
||||||
<h4 class="card-title">Card title that wraps to a new line</h4>
|
<div class="card" id="table-order-<%=order_table.order_id%>" onclick="callOrderDetails('<%=order_table.order_id%>')">
|
||||||
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
|
<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>
|
</div>
|
||||||
</div>
|
<%end %>
|
||||||
<div class="card p-3">
|
<%end %>
|
||||||
<blockquote class="card-block card-blockquote">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
|
|
||||||
<footer>
|
|
||||||
<small class="text-muted">
|
|
||||||
Someone famous in <cite title="Source Title">Source Title</cite>
|
|
||||||
</small>
|
|
||||||
</footer>
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card card-inverse card-primary p-3 text-center">
|
|
||||||
<blockquote class="card-blockquote">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
|
|
||||||
<footer>
|
|
||||||
<small>
|
|
||||||
Someone famous in <cite title="Source Title">Source Title</cite>
|
|
||||||
</small>
|
|
||||||
</footer>
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
<div class="card text-center">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card p-3 text-right">
|
|
||||||
<blockquote class="card-blockquote">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
|
|
||||||
<footer>
|
|
||||||
<small class="text-muted">
|
|
||||||
Someone famous in <cite title="Source Title">Source Title</cite>
|
|
||||||
</small>
|
|
||||||
</footer>
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -87,46 +40,16 @@
|
|||||||
<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">
|
||||||
<div class="card">
|
<% @order_rooms.each do |order_room| %>
|
||||||
|
<div class="card" id="table-order-<%=order_room.order_id%>" onclick="callOrderDetails('<%=order_room.order_id%>')">
|
||||||
|
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title">Card title that wraps to a new line</h4>
|
<% tablename = order_room.room_name%>
|
||||||
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
|
<h4 class="card-title"><span id="table-name-<%=order_room.order_id%>" class="table-name"><%=order_room.room_name%></span></h4>
|
||||||
</div>
|
<p class="card-text"><%=order_room.total_price%></p>
|
||||||
</div>
|
|
||||||
<div class="card p-3">
|
|
||||||
<blockquote class="card-block card-blockquote">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
|
|
||||||
<footer>
|
|
||||||
<small class="text-muted">
|
|
||||||
Someone famous in <cite title="Source Title">Source Title</cite>
|
|
||||||
</small>
|
|
||||||
</footer>
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card card-inverse card-primary p-3 text-center">
|
|
||||||
<blockquote class="card-blockquote">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
|
|
||||||
<footer>
|
|
||||||
<small>
|
|
||||||
Someone famous in <cite title="Source Title">Source Title</cite>
|
|
||||||
</small>
|
|
||||||
</footer>
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
<div class="card text-center">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<%end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -137,27 +60,15 @@
|
|||||||
|
|
||||||
<!--- Booking Items -->
|
<!--- Booking Items -->
|
||||||
<div class="card-columns" style="padding-top:10px">
|
<div class="card-columns" style="padding-top:10px">
|
||||||
<div class="card">
|
<% @orders.each do |order| %>
|
||||||
|
<div class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('<%=order.order_id%>')">
|
||||||
|
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title">Card title that wraps to a new line</h4>
|
<h4 class="card-title"><span id="table-name-<%=order.order_id%>" class="table-name"><%=order.table_or_room_name%></span></h4>
|
||||||
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
|
<p class="card-text"><%=order.total_price%></p>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card text-center">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">Card title</h4>
|
|
||||||
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
|
|
||||||
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<%end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -172,7 +83,7 @@
|
|||||||
<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> - Table 4</div>
|
<div id="order-title"><strong>ORDER DETAILS</strong> <span id="order-detail-header"></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
@@ -186,120 +97,21 @@
|
|||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
||||||
<table class="table">
|
<table class="table" id="append-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
Menu Items Name @ 50.00
|
<span id="item-name-price"></span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%; text-align:right">
|
<td style="width:20%; text-align:right">
|
||||||
5
|
<span id="item-qty"></span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%; text-align:right">
|
<td style="width:20%; text-align:right">
|
||||||
250.00
|
<span id="item-total-price"></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
Menu Items Name @ 50.00
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
5
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
250.00
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -307,24 +119,8 @@
|
|||||||
<table class="table" style="margin-bottom:0px">
|
<table class="table" style="margin-bottom:0px">
|
||||||
<tfooter>
|
<tfooter>
|
||||||
<tr>
|
<tr>
|
||||||
<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>750.00</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">Discounts</td>
|
|
||||||
<td style="width:20%; text-align:right">(-250.00)</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left">Service Tax</td>
|
|
||||||
<td style="width:20%; text-align:right">50.00</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left">Commercial Tax</td>
|
|
||||||
<td style="width:20%; text-align:right">39.50</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left"><strong>Grand Total</strong></td>
|
|
||||||
<td style="width:20%; text-align:right"><strong>589.50</strong></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tfooter>
|
</tfooter>
|
||||||
</table>
|
</table>
|
||||||
@@ -340,12 +136,74 @@
|
|||||||
<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>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>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">
|
||||||
|
Req.Bill
|
||||||
|
</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" 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>
|
||||||
|
<script>
|
||||||
|
var old_order_id = 0
|
||||||
|
var old_table_name = ""
|
||||||
|
var table_or_order_id = 0
|
||||||
|
|
||||||
|
function callOrderDetails(order_id){
|
||||||
|
table_or_order_id = order_id
|
||||||
|
$("#test").html(order_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(document.getElementById("table-name-"+order_id).innerHTML)
|
||||||
|
$("#sub-total").html("")
|
||||||
|
url = "origami/"+order_id
|
||||||
|
$.ajax({type: "GET",
|
||||||
|
url: url,
|
||||||
|
data: { order_id: order_id},
|
||||||
|
success:function(result){
|
||||||
|
var sub_total = 0
|
||||||
|
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 = '<tbody><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>'
|
||||||
|
tbody += row
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#append-table").append(tbody)
|
||||||
|
$("#sub-total").append((sub_total)+"<br/>")
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
error:function(result){
|
||||||
|
// alert('error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$( document ).ready(function() {
|
||||||
|
$('#request_bills').click(function() {
|
||||||
|
window.location.href = '/origami/request_bills/'+table_or_order_id;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.selected_color{
|
||||||
|
color:white;
|
||||||
|
background-color: blue;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
69
app/views/origami/request_bills/show.html.erb
Normal file
69
app/views/origami/request_bills/show.html.erb
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div id="order-title">
|
||||||
|
<span><strong>Receipt 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>
|
||||||
|
</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>
|
||||||
|
<% sub_total = 0 %>
|
||||||
|
<% if @sale_items %>
|
||||||
|
<% @sale_items.each do |sale_item| %>
|
||||||
|
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||||
|
<tr>
|
||||||
|
<td style="width:60%; text-align:left">
|
||||||
|
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-qty"><%=sale_item.qty%></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<%end %>
|
||||||
|
<%end %>
|
||||||
|
</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"><%=sub_total%></span></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<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>
|
||||||
|
</tr>
|
||||||
|
<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>
|
||||||
|
</tr>
|
||||||
|
<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>
|
||||||
|
</tr>
|
||||||
|
</tfooter>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -2,9 +2,10 @@ require 'sidekiq/web'
|
|||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
namespace :settings do
|
namespace :origami do
|
||||||
resources :accounts
|
get 'request_bills/show'
|
||||||
end
|
end
|
||||||
|
|
||||||
root 'home#index'
|
root 'home#index'
|
||||||
mount Sidekiq::Web => '/kiq'
|
mount Sidekiq::Web => '/kiq'
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ 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]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
5
spec/views/origami/request_bills/show.html.erb_spec.rb
Normal file
5
spec/views/origami/request_bills/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "request_bills/show.html.erb", type: :view do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user