Multiple Invoices Phase 1
This commit is contained in:
40
app/controllers/origami/room_invoices_controller.rb
Normal file
40
app/controllers/origami/room_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
class Origami::RoomInvoicesController < BaseOrigamiController
|
||||||
|
def index
|
||||||
|
@room = DiningFacility.find(params[:room_id])
|
||||||
|
puts "room bookig lenght"
|
||||||
|
@sale_array = Array.new
|
||||||
|
@room.bookings.each do |booking|
|
||||||
|
puts booking.sale_id
|
||||||
|
|
||||||
|
if booking.sale_id.nil?
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
|
||||||
|
if sale.sale_status != "completed"
|
||||||
|
@sale_array.push(sale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@room = DiningFacility.find(params[:room_id])
|
||||||
|
@sale_array = Array.new
|
||||||
|
@room.bookings.each do |booking|
|
||||||
|
if booking.sale_id.nil?
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
|
||||||
|
if sale.sale_status != "completed"
|
||||||
|
@sale_array.push(sale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@sale = Sale.find(params[:invoice_id])
|
||||||
|
@date = @sale.created_at
|
||||||
|
@status_sale = 'sale'
|
||||||
|
@customer = @sale.customer
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
40
app/controllers/origami/table_invoices_controller.rb
Normal file
40
app/controllers/origami/table_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
class Origami::TableInvoicesController < BaseOrigamiController
|
||||||
|
def index
|
||||||
|
@table = DiningFacility.find(params[:table_id])
|
||||||
|
puts "table bookig lenght"
|
||||||
|
@sale_array = Array.new
|
||||||
|
@table.bookings.each do |booking|
|
||||||
|
puts booking.sale_id
|
||||||
|
|
||||||
|
if booking.sale_id.nil?
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
|
||||||
|
if sale.sale_status != "completed"
|
||||||
|
@sale_array.push(sale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@table = DiningFacility.find(params[:table_id])
|
||||||
|
@sale_array = Array.new
|
||||||
|
@table.bookings.each do |booking|
|
||||||
|
if booking.sale_id.nil?
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
|
||||||
|
if sale.sale_status != "completed"
|
||||||
|
@sale_array.push(sale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@sale = Sale.find(params[:invoice_id])
|
||||||
|
@date = @sale.created_at
|
||||||
|
@status_sale = 'sale'
|
||||||
|
@customer = @sale.customer
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -241,18 +241,18 @@
|
|||||||
%>
|
%>
|
||||||
</table>
|
</table>
|
||||||
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
|
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
|
||||||
<%
|
<% end %>
|
||||||
end
|
<br><br>
|
||||||
@sale_array.each do |sale|
|
Pending Payment
|
||||||
|
<% @sale_array.each do |sale|
|
||||||
if @sale_array.size > 1
|
if @sale_array.size > 1
|
||||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||||
%>
|
%>
|
||||||
<br><br>
|
|
||||||
Pending Payment
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Receipt No - <%= sale.receipt_no %></td>
|
<td>Receipt No - <%= sale.receipt_no %></td>
|
||||||
<td><button class='btn btn-sm btn-primary '>Show Detail </button></td>
|
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<%
|
<%
|
||||||
@@ -298,6 +298,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
$('.invoicedetails').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
var sale_id = this.id;
|
||||||
|
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
|
||||||
|
})
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
@@ -455,4 +460,5 @@ $('#edit').on('click',function(){
|
|||||||
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
82
app/views/origami/room_invoices/index.html.erb
Normal file
82
app/views/origami/room_invoices/index.html.erb
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||||
|
<% @sale_array.each do |sale| %>
|
||||||
|
<div class="card tables" data-id="<%= sale.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">INVOICE 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">
|
||||||
|
<%= @sale.receipt_no rescue '' %>
|
||||||
|
</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail hide">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<p>Customer : <span id="customer_name"></span></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||||
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".tables").on('click', function(){
|
||||||
|
var dining_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/table/<%= @room.id %>/table_invoice/' + dining_id;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pay').on('click',function() {
|
||||||
|
// var sale_id = $('#sale_id').val();
|
||||||
|
// window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||||
|
});
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami/table/<%= @room.id %>';
|
||||||
|
})
|
||||||
|
</script>
|
||||||
147
app/views/origami/room_invoices/show.html.erb
Normal file
147
app/views/origami/room_invoices/show.html.erb
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||||
|
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
||||||
|
<% @sale_array.each do |sale| %>
|
||||||
|
<div class="card tables" data-id="<%= sale.id %>">
|
||||||
|
<% if sale.id == @sale.id %>
|
||||||
|
<div class="card-bl ock" style="background-color:#6080f0;">
|
||||||
|
<%= sale.receipt_no %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">INVOICE 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">
|
||||||
|
<%= @sale.receipt_no rescue '' %>
|
||||||
|
</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail hide">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<!-- <% if !@customer.nil? %> -->
|
||||||
|
<p class="hidden customer-id"><%= @customer.customer_id %></p>
|
||||||
|
<p>Customer : <%= @customer.name %></p>
|
||||||
|
<!-- <% end %> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="card-text">
|
||||||
|
<table class="table table-striped" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</td>
|
||||||
|
<th class="item-attr">Price</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
count = 0
|
||||||
|
sub_total = 0
|
||||||
|
if @status_sale == "sale"
|
||||||
|
@sale.sale_items.each do |sale_item|
|
||||||
|
count += 1
|
||||||
|
sub_total = sub_total + sale_item.price
|
||||||
|
%>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||||
|
<%
|
||||||
|
# Can't check for discount
|
||||||
|
unless sale_item.price == 0
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if @status_order == 'order' && @status_sale != 'sale'
|
||||||
|
unless @order_items.nil?
|
||||||
|
count = 0
|
||||||
|
@order_items.each do |order_item |
|
||||||
|
count += 1
|
||||||
|
sub_total = sub_total + order_item.price
|
||||||
|
|
||||||
|
unless order_item.price == 0 %>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||||
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".tables").on('click', function(){
|
||||||
|
var dining_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/table/<%= @room.id %>/table_invoice/' + dining_id;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pay').on('click',function() {
|
||||||
|
window.location.href = '/origami/sale/<%= @sale.id %>/payment';
|
||||||
|
});
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami/table/<%= @room.id %>';
|
||||||
|
})
|
||||||
|
</script>
|
||||||
82
app/views/origami/table_invoices/index.html.erb
Normal file
82
app/views/origami/table_invoices/index.html.erb
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||||
|
<% @sale_array.each do |sale| %>
|
||||||
|
<div class="card tables" data-id="<%= sale.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">INVOICE 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">
|
||||||
|
<%= @sale.receipt_no rescue '' %>
|
||||||
|
</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail hide">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<p>Customer : <span id="customer_name"></span></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||||
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".tables").on('click', function(){
|
||||||
|
var dining_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/table/<%= @table.id %>/table_invoice/' + dining_id;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pay').on('click',function() {
|
||||||
|
// var sale_id = $('#sale_id').val();
|
||||||
|
// window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||||
|
});
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami/table/<%= @table.id %>';
|
||||||
|
})
|
||||||
|
</script>
|
||||||
147
app/views/origami/table_invoices/show.html.erb
Normal file
147
app/views/origami/table_invoices/show.html.erb
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||||
|
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
||||||
|
<% @sale_array.each do |sale| %>
|
||||||
|
<div class="card tables" data-id="<%= sale.id %>">
|
||||||
|
<% if sale.id == @sale.id %>
|
||||||
|
<div class="card-block" style="background-color:#6080f0;">
|
||||||
|
<%= sale.receipt_no %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">INVOICE 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">
|
||||||
|
<%= @sale.receipt_no rescue '' %>
|
||||||
|
</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail hide">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<!-- <% if !@customer.nil? %> -->
|
||||||
|
<p class="hidden customer-id"><%= @customer.customer_id %></p>
|
||||||
|
<p>Customer : <%= @customer.name %></p>
|
||||||
|
<!-- <% end %> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="card-text">
|
||||||
|
<table class="table table-striped" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</td>
|
||||||
|
<th class="item-attr">Price</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
count = 0
|
||||||
|
sub_total = 0
|
||||||
|
if @status_sale == "sale"
|
||||||
|
@sale.sale_items.each do |sale_item|
|
||||||
|
count += 1
|
||||||
|
sub_total = sub_total + sale_item.price
|
||||||
|
%>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||||
|
<%
|
||||||
|
# Can't check for discount
|
||||||
|
unless sale_item.price == 0
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if @status_order == 'order' && @status_sale != 'sale'
|
||||||
|
unless @order_items.nil?
|
||||||
|
count = 0
|
||||||
|
@order_items.each do |order_item |
|
||||||
|
count += 1
|
||||||
|
sub_total = sub_total + order_item.price
|
||||||
|
|
||||||
|
unless order_item.price == 0 %>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||||
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".tables").on('click', function(){
|
||||||
|
var dining_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/table/<%= @table.id %>/table_invoice/' + dining_id;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pay').on('click',function() {
|
||||||
|
window.location.href = '/origami/sale/<%= @sale.id %>/payment';
|
||||||
|
});
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami/table/<%= @table.id %>';
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -109,6 +109,12 @@ Rails.application.routes.draw do
|
|||||||
get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#index"
|
get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#index"
|
||||||
get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index"
|
get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index"
|
||||||
|
|
||||||
|
#---------Multiple Invoices --------------#
|
||||||
|
get 'table/:table_id/table_invoices' => "table_invoices#index" , :as => "table_invoice_index"
|
||||||
|
get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show" , :as => "table_invoice_show"
|
||||||
|
get 'room/:room_id/room_invoices' => "room_invoices#index" , :as => "room_invoice_index"
|
||||||
|
get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show" , :as => "room_invoice_show"
|
||||||
|
|
||||||
#---------Add Customer --------------#
|
#---------Add Customer --------------#
|
||||||
#resources :customers
|
#resources :customers
|
||||||
get '/:sale_id/customers', to: "customers#add_customer"
|
get '/:sale_id/customers', to: "customers#add_customer"
|
||||||
|
|||||||
Reference in New Issue
Block a user