Pull from master

This commit is contained in:
San Wai Lwin
2018-08-06 17:52:03 +06:30
parent 35ac07b0a6
commit e99e907bc4
33 changed files with 455 additions and 126 deletions

View File

@@ -11,10 +11,10 @@
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="main-box-body clearfix p-l-5 p-r-5">
<div class="table-responsive">
<table class="table table-">
<table class="table">
<tbody>
<tr>
<td colspan="8">
<td colspan="14">
<%= form_tag transactions_order_reservations_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
@@ -65,7 +65,7 @@
</div>
<div class="card">
<div class="table-responsive">
<table class="table table-striped">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
@@ -81,11 +81,12 @@
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<!-- <th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th> -->
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.transaction_fee") %></th>
</tr>
</thead>
@@ -116,13 +117,15 @@
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
if !JSON.parse(order_reservation.taxes).empty?
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
end
%>
@@ -150,16 +153,17 @@
<td><%= number_with_precision(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<!-- <td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td> -->
<td><%= number_with_precision(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
<td><%= number_with_precision(order_reservation.transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
</td>
</tr>
<% end %>
<% else %>
<tr><td colspan="16"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
<tr><td colspan="14"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
<% end %>
</tbody>
</table>

View File

@@ -99,18 +99,21 @@
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
total_transaction_fee = 0.0
%>
<%
discount_amount = @order_reservation.discount_amount
delivery_fee = @order_reservation.delivery_fee ? @order_reservation.delivery_fee : 0.0
convenience_charge = @order_reservation.convenience_charge
JSON.parse(@order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
if !JSON.parse(@order_reservation.taxes).empty?
JSON.parse(@order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
end
total_discount_amount += discount_amount.to_f
@@ -122,6 +125,7 @@
total_tax += @order_reservation.total_tax.to_f
total_amount += @order_reservation.total_amount.to_f
grand_total += @order_reservation.grand_total.to_f
total_transaction_fee += @order_reservation.transaction_fee.to_f
%>
<tr style="border-top:2px solid #000">
@@ -185,6 +189,13 @@
<td colspan="4"><%= number_with_precision(grand_total, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
<% if total_transaction_fee > 0 %>
<tr style="border-top:2px solid #000">
<td colspan="2" style="text-align:center"></td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.transaction_fee") %></td>
<td colspan="4"><%= number_with_precision(total_transaction_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
</tbody>
</table>
</div>