confict clear
This commit is contained in:
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
|
||||
if !params["booking_id"].nil? && params[:booking_id].to_i > 0
|
||||
@order.new_booking = false
|
||||
# @order.new_booking = true
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
def index
|
||||
@order_table = Order.get_order_table()
|
||||
@order_rooms = Order.get_order_rooms()
|
||||
@orders = Order.get_orders()
|
||||
end
|
||||
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
|
||||
|
||||
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
|
||||
belongs_to :zone
|
||||
|
||||
TABLE_TYPE = "Table"
|
||||
ROOM_TYPE = "Room"
|
||||
|
||||
default_scope { order('order_by asc') }
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
|
||||
@@ -201,4 +201,40 @@ class Order < ApplicationRecord
|
||||
#Send to background job for processing
|
||||
OrderQueueProcessorJob.perform_later(self.id)
|
||||
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
|
||||
|
||||
@@ -33,4 +33,10 @@ class OrderItem < ApplicationRecord
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -188,7 +188,8 @@ class Sale < ApplicationRecord
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
#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
|
||||
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">
|
||||
<!-- Column One -->
|
||||
|
||||
@@ -18,67 +18,20 @@
|
||||
|
||||
<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">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Card title that wraps to a new line</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>
|
||||
<% if @order_table %>
|
||||
<% @order_table.each do |order_table| %>
|
||||
<div class="card" id="table-order-<%=order_table.order_id%>" onclick="callOrderDetails('<%=order_table.order_id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><span id="table-name-<%=order_table.order_id%>" class="table-name"><%=order_table.table_name%></span></h4>
|
||||
<p class="card-text"><%=order_table.total_price%></p>
|
||||
</div>
|
||||
</div>
|
||||
</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 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>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -87,46 +40,16 @@
|
||||
<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">
|
||||
<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">
|
||||
<h4 class="card-title">Card title that wraps to a new line</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>
|
||||
</div>
|
||||
</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>
|
||||
<% tablename = order_room.room_name%>
|
||||
<h4 class="card-title"><span id="table-name-<%=order_room.order_id%>" class="table-name"><%=order_room.room_name%></span></h4>
|
||||
<p class="card-text"><%=order_room.total_price%></p>
|
||||
</div>
|
||||
</div>
|
||||
<%end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -137,27 +60,15 @@
|
||||
|
||||
<!--- Booking Items -->
|
||||
<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">
|
||||
<h4 class="card-title">Card title that wraps to a new line</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>
|
||||
</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>
|
||||
<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"><%=order.total_price%></p>
|
||||
</div>
|
||||
</div>
|
||||
<%end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -172,7 +83,7 @@
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card" >
|
||||
<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 class="card-block">
|
||||
<div class="card-title">
|
||||
@@ -186,120 +97,21 @@
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
||||
<table class="table">
|
||||
<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">
|
||||
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>
|
||||
<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">
|
||||
<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>
|
||||
@@ -307,24 +119,8 @@
|
||||
<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>750.00</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>
|
||||
<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>
|
||||
</tfooter>
|
||||
</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>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" 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" 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>
|
||||
|
||||
</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>
|
||||
Reference in New Issue
Block a user