Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Phyo
2017-06-14 17:14:03 +06:30
11 changed files with 393 additions and 143 deletions

View File

@@ -218,7 +218,7 @@ $(document).ready(function(){
'<td class="charges-name">' + data["response_data"]["data"][i]["accountable_type"] +'</td>' '<td class="charges-name">' + data["response_data"]["data"][i]["accountable_type"] +'</td>'
+'<td class="item-attr">' + balance + '</td>'; +'<td class="item-attr">' + balance + '</td>';
$(".rebate_amount").append(row); $(".rebate_amount").html(row);
} }
} }

View File

@@ -1,6 +1,6 @@
class Api::InvoicesController < ActionController::API class Api::InvoicesController < ActionController::API
before :authenticate_token # before :authenticate_token
before :set_sale_params, only:[:show, :update, :destroy] # before :set_sale_params, only:[:show, :update, :destroy]
#List open invoices for today. #List open invoices for today.
def index def index

View File

@@ -1,7 +1,7 @@
class Api::MembershipsController < ActionController::API class Api::MembershipsController < ActionController::API
before :authenticate_token #before :authenticate_token
#Add Membership to invoice #Add Membership to invoice
def create def create

View File

@@ -29,56 +29,56 @@ class Api::PaymentsController < ActionController::API
#:received_amount, :card_payment_reference, :vochure_no, :giftcard_no, #:received_amount, :card_payment_reference, :vochure_no, :giftcard_no,
#:customer_id, :external_payment_status #:customer_id, :external_payment_status
switch (payment_method) case payment_method
case "cash" when "cash"
sale_payment.payment_method = "cash" sale_payment.payment_method = "cash"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "creditnote" when "creditnote"
sale_payment.payment_method = "creditnote" sale_payment.payment_method = "creditnote"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.customer_id = params[:customer_id] sale_payment.customer_id = params[:customer_id]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "visa" when "visa"
sale_payment.payment_method = "visa" sale_payment.payment_method = "visa"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.payment_reference = params[:payment_reference] sale_payment.payment_reference = params[:payment_reference]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "master" when "master"
sale_payment.payment_method = "master" sale_payment.payment_method = "master"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.payment_reference = params[:payment_reference] sale_payment.payment_reference = params[:payment_reference]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "jcb" when "jcb"
sale_payment.payment_method = "jcb" sale_payment.payment_method = "jcb"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.payment_reference = params[:payment_reference] sale_payment.payment_reference = params[:payment_reference]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "mpu" when "mpu"
sale_payment.payment_method = "mpu" sale_payment.payment_method = "mpu"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.payment_reference = params[:payment_reference] sale_payment.payment_reference = params[:payment_reference]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "unionpay" when "unionpay"
sale_payment.payment_method = "unionpay" sale_payment.payment_method = "unionpay"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.payment_reference = params[:payment_reference] sale_payment.payment_reference = params[:payment_reference]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "vochure" when "vochure"
sale_payment.payment_method = "vochure" sale_payment.payment_method = "vochure"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.customer_id = params[:customer_id] sale_payment.customer_id = params[:customer_id]
sale_payment.payment_reference = params[:vochure_no] sale_payment.payment_reference = params[:vochure_no]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "giftcard" when "giftcard"
sale_payment.payment_method = "giftcard" sale_payment.payment_method = "giftcard"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.customer_id = params[:customer_id] sale_payment.customer_id = params[:customer_id]
sale_payment.payment_reference = params[:giftcard_no] sale_payment.payment_reference = params[:giftcard_no]
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
case "paypar" when "paypar"
sale_payment.payment_method = "paypar" sale_payment.payment_method = "paypar"
sale_payment.received_amount = params[:amount] sale_payment.received_amount = params[:amount]
sale_payment.payment_reference = params[:payment_reference] sale_payment.payment_reference = params[:payment_reference]

View File

@@ -17,9 +17,9 @@ class Crm::CustomersController < BaseCrmController
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new @crm_customer = Customer.new
if flash["errors"] # if flash["errors"]
@crm_customer.valid? # @crm_customer.valid?
end # end
# @membership = Customer.get_member_group # @membership = Customer.get_member_group
# if @membership["status"] == true # if @membership["status"] == true
# @member_group = @membership["data"] # @member_group = @membership["data"]
@@ -65,15 +65,19 @@ class Crm::CustomersController < BaseCrmController
'Accept' => 'application/json' 'Accept' => 'application/json'
} }
) )
if(response["status"] == true)
@type = "-" @membership = response["data"]
@balance = 0.00 else
response["data"].each do |res| @membership = 0
if res["accountable_type"] == "RebateAccount"
@balance = res["balance"]
@type = "RebateAccount"
end
end end
# @type = "-"
# @balance = 0.00
# response["data"].each do |res|
# if res["accountable_type"] == "RebateAccount"
# @balance = res["balance"]
# @type = "RebateAccount"
# end
# end
#end customer amount #end customer amount

View File

@@ -10,7 +10,7 @@ class Transactions::SalesController < ApplicationController
today = Date.today today = Date.today
if receipt_no.nil? if receipt_no.nil?
@sales = Sale.order("sale_id").page(params[:page]) @sales = Sale.order("sale_id")
#@products = Product.order("name").page(params[:page]).per(5) #@products = Product.order("name").page(params[:page]).per(5)
else else
@sales = Sale.search(receipt_no) @sales = Sale.search(receipt_no)
@@ -27,7 +27,16 @@ class Transactions::SalesController < ApplicationController
def show def show
@sale = Sale.find(params[:id]) @sale = Sale.find(params[:id])
# @sale_receivables = SaleReceivable.where('sale_id = ?', @sale.id)
@order_items = []
@sale.sale_orders.each do |sale_order|
order = Order.find(sale_order.order_id)
#if (order.status == "new")
@order_items = @order_items + order.order_items
#end
end
@sale_receivables = SalePayment.where('sale_id = ?', @sale.id)
respond_to do |format| respond_to do |format|
format.html # show.html.erb format.html # show.html.erb
format.json { render json: @sale } format.json { render json: @sale }

View File

@@ -74,22 +74,29 @@
<span class="patch_method"></span> <span class="patch_method"></span>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group"> <div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :name, :class => "form-control col-md-6 name" %> <%= f.input :name, :class => "form-control col-md-6 name" %>
<% flash.each do |name, msg| %>
<span class="help-block"><%= msg['name'] %></span>
<% end -%>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.input :company, :class => "form-control col-md-6 company" %> <%= f.input :company, :class => "form-control col-md-6 company" %>
</div> </div>
<div class="form-group"> <div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %> <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
<% flash.each do |name, msg| %>
<span class="help-block"><%= msg['contact_no'] %></span>
<% end -%>
</div> </div>
<div class="form-group"> <div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :email, :class => "form-control col-md-6 email" %> <%= f.input :email, :class => "form-control col-md-6 email" %>
<% flash.each do |name, msg| %>
<span class="help-block"><%= msg['email'] %></span>
<% end -%>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@@ -19,31 +19,64 @@
<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">
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:"> <div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<div class="table-responsive"> <div class="row">
<table class="table table-striped"> <div class="col-md-3"></div>
<tbody> <div class="col-md-6">
<tr> <br>
<th>Name</th> <h4>Customer Profile</h4>
<td><%= @crm_customer.name %></td> <div class="table-responsive">
</tr> <table class="table table-striped">
<tr> <tbody>
<th>Email</th> <tr>
<td><%= @crm_customer.email %></td> <th>Name</th>
</tr> <td><%= @crm_customer.name %></td>
<tr> </tr>
<th>Contact no</th> <tr>
<td><%= @crm_customer.contact_no %></td> <th>Email</th>
</tr> <td><%= @crm_customer.email %></td>
<tr> </tr>
<th>Company</th> <tr>
<td><%= @crm_customer.company %></td> <th>Contact no</th>
</tr> <td><%= @crm_customer.contact_no %></td>
<tr> </tr>
<th>Date Of Birth</th> <tr>
<td><%= @crm_customer.date_of_birth %> </td> <th>Company</th>
</tr> <td><%= @crm_customer.company %></td>
</tbody> </tr>
</table> <tr>
<th>Date Of Birth</th>
<td><%= @crm_customer.date_of_birth %> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<h4>Membership Detail</h4>
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<% if @membership == 0 %>
<tr>
<td colspan="2">"There is no membership data"</td>
</tr>
<% else %>
<% @membership.each do |member| %>
<tr>
<th><%= member["accountable_type"] %></th>
<td><%= member["balance"] %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div> </div>
</div> </div>

View File

@@ -3,10 +3,10 @@
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li> <li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active"> <li class="active">
<a href="<%= settings_orders_path %>">Order</a> <a href="<%= transactions_orders_path %>">Order</a>
</li> </li>
<li class="active"> <li class="active">
<a href="<%= settings_orders_path %>"><%= @order.order_id %></a> <a href="<%= transactions_orders_path %>"><%= @order.order_id %></a>
</li> </li>
</ol> </ol>
</div> </div>
@@ -70,7 +70,7 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<a href="<%= settings_orders_path%>" class="btn btn-primary pull-left"> <a href="<%= transactions_orders_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back <i class="fa fa-arrow-left fa-xs"></i> Back
</a> </a>
</div> </div>

View File

@@ -3,101 +3,186 @@
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li> <li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active"> <li class="active">
<a href="<%= settings_sales_path %>">Sale</a> <a href="<%= transactions_sales_path %>">Sale</a>
</li> </li>
<li class="active"> <li class="active">
<a href="<%= settings_sales_path %>"><%= @sale.sale_id %></a> <a href="<%= transactions_sales_path %>"><%= @sale.sale_id %></a>
</li> </li>
</ol> </ol>
</div> </div>
</div> </div>
<hr>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-10 col-md-10 col-sm-10">
<div class="main-box-body clearfix"> <!-- Column One -->
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Receipt Date </th>
<th>Receipt no</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt generated at</th>
</tr>
</thead>
<tbody> <!-- Nav tabs -->
<tr> <ul class="nav nav-tabs" role="tablist">
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td> <li class="nav-item">
<td><%= @sale.receipt_no %></td> <a class="nav-link active" data-toggle="tab" href="#queue" role="tab">Sale Details </a>
<td><%= @sale.cashier rescue '-' %></td> </li>
<td> <%= @sale.sale_status %> </td> <li class="nav-item">
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td> <a class="nav-link " data-toggle="tab" href="#booking" role="tab">Orders </a>
</tr> </li>
<tr style="border-top:2px solid #000"> <!-- <li class="nav-item">
<th>Sale item name</th> <a class="nav-link" data-toggle="tab" href="#customer" role="tab">Sales</a>
<th> Qty</th> </li> -->
<th>Unit price</th> </ul>
<th>Total pirce </th> <!-- Nav tabs - End -->
<th>Created at</th>
</tr>
<% @sale.sale_items.each do |s| %>
<tr> <div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td> <div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td> <div class="table-responsive">
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td> <table class="table table-striped">
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td> <thead>
</tr> <tr>
<% end %> <td colspan="6">&nbsp;</td>
<tr style="border-top:2px solid #000"> </tr>
<td colspan=2 style="text-align:center"></td> <tr>
<td>Total</td> <th>Receipt Date </th>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td> <th>Receipt no</th>
</tr> <th>Cashier</th>
<tr> <th>Sales status</th>
<td colspan=2 style="text-align:center"></td> <th>Receipt generated at</th>
<td>Tax</td> </tr>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td> </thead>
</tr>
<tr> <tbody>
<td colspan=2 style="text-align:center"></td> <tr>
<td>Discount</td> <td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td> <td><%= @sale.receipt_no %></td>
</tr> <td><%= @sale.cashier rescue '-' %></td>
<tr> <td> <%= @sale.sale_status %> </td>
<td colspan=2 style="text-align:center"></td> <td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
<td>Grand Total</td> </tr>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td> <tr style="border-top:2px solid #000">
</tr> <th>Sale item name</th>
<tr><td>&nbsp;<td></tr> <th> Qty</th>
<tr> <th>Unit price</th>
<td colspan=2 style="text-align:center"></td> <th>Total pirce </th>
<td>Pay Amount</td> <th>Created at</th>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td> </tr>
</tr> <% @sale.sale_items.each do |s| %>
<tr>
<td colspan=2 style="text-align:center"></td> <tr>
<td>Change</td> <td><%=s.product_name rescue ' '%></td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td> <td><%=s.qty rescue ' '%></td>
</tr> <td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
</tr>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td>Total</td>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Discount</td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Tax</td>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Grand Total</td>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td>&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Change</td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<% @sale_receivables.each do |r|%>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Payment <%= r.payment_method rescue ' '%></td>
<td><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="booking" role="tabpanel">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order ID</th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
<th>Created at </th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.order_id %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
<td><%= order_item.created_at.strftime("%d-%m-%y") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<h3>Sale Details</h3>
<div class="table-responsive">
</div>
</div>
</tbody>
</table>
<a href="<%= settings_sales_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div> </div>
</div>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2">
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-trash fa-lg"></i> Void Sale
</a>
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-invoice fa-lg"></i> Complete Sale
</a>
</div>
</div> </div>

View File

@@ -0,0 +1,112 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= transactions_sales_path %>">Sale</a>
</li>
<li class="active">
<a href="<%= transactions_sales_path %>"><%= @sale.sale_id %></a>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="4">
</td>
<td>
</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
</tr>
<tr>
<th>Receipt Date </th>
<th>Receipt no</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt generated at</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
</tr>
<tr style="border-top:2px solid #000">
<th>Sale item name</th>
<th> Qty</th>
<th>Unit price</th>
<th>Total pirce </th>
<th>Created at</th>
</tr>
<% @sale.sale_items.each do |s| %>
<tr>
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
</tr>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td>Total</td>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Discount</td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Tax</td>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Grand Total</td>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td>&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Change</td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>