merge with settings_backend

This commit is contained in:
Yan
2017-06-26 14:46:31 +06:30
16 changed files with 647 additions and 63 deletions

View File

@@ -160,6 +160,10 @@
background-color: #FF8C00
}
.blue{
background-color: blue
}
.left{
margin-left:1px;
}

View 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

View 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

View File

@@ -54,7 +54,7 @@ class SalePayment < ApplicationRecord
#record an payment in sale-audit
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
return true, self.save
else
#record an payment in sale-audit
@@ -94,10 +94,15 @@ class SalePayment < ApplicationRecord
sale_data = Sale.find_by_sale_id(sale_id)
if sale_data
others = 0
sale_data.sale_payments.each do |sale_payment|
others = others + sale_payment.payment_amount
end
redeem_prices = sale_data.grand_total -others
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:body => { generic_customer_id:membership_id,total_amount: redeem_prices,total_sale_transaction_amount: sale_data.grand_total,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
@@ -292,7 +297,7 @@ class SalePayment < ApplicationRecord
# Control for Paypar Cloud
begin
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_sale_transaction_amount: sObj.grand_total,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
receipt_no: receipt_no,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',

View File

@@ -38,12 +38,21 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block">
@@ -121,7 +130,7 @@ $(function() {
var timer;
function start() {
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 30000); //10000
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 10000); //10000
};
function stop() {

View File

@@ -38,16 +38,22 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
<% end %>
</div>
</div>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block">
@@ -108,9 +114,9 @@
<div class="card" >
<div class="card-header">
<% if @status_order == 'order' && @status_sale != 'sale' %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong></div>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
<% end %>
</div>
<div class="card-block">
@@ -126,15 +132,14 @@
<p>Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p>
<%end%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<%end%>
</div>
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
@@ -243,18 +248,18 @@
%>
</table>
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
<%
end
@sale_array.each do |sale|
<% end %>
<br><br>
Pending Payment
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<br><br>
Pending Payment
<table class="table table-striped">
<tr>
<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>
</table>
<%
@@ -300,6 +305,11 @@
</div>
<script>
$(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(){
var customer_id=$(".customer-id").text();
@@ -464,4 +474,5 @@ $('#edit').on('click',function(){
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
})
</script>

View File

@@ -5,7 +5,7 @@
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem upto </label>
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem up to </label>
<input type="text" name="" id="redeemamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
@@ -21,7 +21,7 @@
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4"> Rebat Balance </label>
<label class="col-lg-4 col-md-4 col-sm-4"> Rebate Balance </label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
@@ -98,6 +98,12 @@
</div>
<script type="text/javascript">
$(document).ready(function() {
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#redeemamt').attr("value",parseFloat("<%= @redeem_prices %>") - parseFloat(localStorage.getItem("cash")));
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
@@ -131,7 +137,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#used_amount').text(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#redeemamt').val();
var remain_amount = $('#valid_amount').val();
$('#used_amount').text(remain_amount);
break;

View 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>

View 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 rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></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>

View File

@@ -38,16 +38,21 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
<% end %>
</div>
</div>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block">
@@ -108,9 +113,9 @@
<div class="card" >
<div class="card-header">
<% if @status == 'order' %>
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong></div>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% end %>
</div>
@@ -260,28 +265,28 @@ $(document).ready(function(){
$(".tables").on('click', function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;
})
$(".sales").on('click',function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/sale/' + sale_id;
})
$(".rooms").on('click', function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/room/' + dining_id;
})
$(".orders").on('click',function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var order_id = $(this).attr("data-id");
window.location.href = '/origami/order/' + order_id;
})

View 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>

View 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 rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></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>

View File

@@ -16,9 +16,9 @@
<tr>
<th>Title</th>
<th>Account Type</th>
<th>Can get Discount</th>
<!-- <th>Can get Discount</th> -->
<th>Can get Points</th>
<th>Can get Bonus</th>
<!-- <th>Can get Bonus</th> -->
<th>Can rebate</th>
<th style="">Action</th>
@@ -30,9 +30,9 @@
<tr>
<td><%= account.title %></td>
<td><%= account.account_type %></td>
<td><%= account.discount %></td>
<!-- <td><%= account.discount %></td> -->
<td><%= account.point %></td>
<td><%= account.bonus %></td>
<!-- <td><%= account.bonus %></td> -->
<td><%= account.rebate %></td>
<td>
<%= link_to 'Edit', edit_settings_account_path(account) %> |

View File

@@ -1,4 +1,4 @@
<!-- -->
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
@@ -17,9 +17,9 @@
<tr>
<th>Title</th>
<th>Account type</th>
<th>Can get Discount</th>
<!-- <th>Can get Discount</th> -->
<th>Can get Points</th>
<th>Can get Bonus</th>
<!-- <th>Can get Bonus</th> -->
<th>Can rebate</th>
<th>Action</th>
</tr>
@@ -29,9 +29,9 @@
<tr>
<td><%= @settings_account.title %></td>
<td><%= @settings_account.account_type %></td>
<td><%= @settings_account.discount %></td>
<!-- <td><%= @settings_account.discount %></td> -->
<td><%= @settings_account.point %></td>
<td><%= @settings_account.bonus %></td>
<!-- <td><%= @settings_account.bonus %></td> -->
<td><%= @settings_account.rebate %></td>
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>

View File

@@ -110,6 +110,12 @@ Rails.application.routes.draw do
get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#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 --------------#
#resources :customers
get '/:sale_id/customers', to: "customers#add_customer"

View File

@@ -73,8 +73,8 @@ booking_status = Lookup.create([{lookup_type:'booking_status', name: 'Available'
{lookup_type:'booking_status', name: 'Moved', value: 'moved'}])
#booking_status
account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value: 'income'},
{lookup_type:'account_type', name: 'Expense', value: 'expense'}])
account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value: '0'},
{lookup_type:'account_type', name: 'Expense', value: '1'}])
# sale void reason
void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manager', value: 'Approve By Manager'},