add transaction fee for order reservation

This commit is contained in:
phyusin
2018-07-30 17:20:04 +06:30
parent ca14b1e399
commit 01783c2707
5 changed files with 17 additions and 0 deletions

View File

@@ -57,6 +57,7 @@
<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>
<tbody>
@@ -88,6 +89,7 @@
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
transaction_fee = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
@@ -117,6 +119,9 @@
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<% if order_reservation.transaction_fee && order_reservation.transaction_fee > 0
transaction_fee += order_reservation.transaction_fee.to_f
end %>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
@@ -149,6 +154,7 @@
<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>
</tr>
<% end
end %>
@@ -164,6 +170,7 @@
<td><b><%= number_with_precision(total_commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
</tr>
</tbody>
</table>

View File

@@ -40,6 +40,7 @@
<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>
<tbody>
@@ -61,6 +62,7 @@
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
transaction_fee = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
@@ -91,6 +93,9 @@
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<% if order_reservation.transaction_fee && order_reservation.transaction_fee > 0
transaction_fee += order_reservation.transaction_fee.to_f
end %>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
@@ -123,6 +128,7 @@
<td><%= commercial_tax rescue '0.0'%></td>
<td><%= order_reservation.total_tax rescue '0.0'%></td>
<td><%= order_reservation.grand_total rescue '0.0' %></td>
<td><%= order_reservation.transaction_fee rescue '0.0' %></td>
</tr>
<% end
end %>
@@ -138,6 +144,7 @@
<td><b><%= total_commercial_tax rescue '0.0'%></b></td>
<td><b><%= total_tax rescue '0.0'%></b></td>
<td><b><%= grand_total rescue '0.0'%></b></td>
<td><b><%= transaction_fee rescue '0.0'%></b></td>
</tr>
</tbody>
</table>

View File

@@ -491,6 +491,7 @@ en:
induty_report: "Induty Report"
in_time: "In Time"
out_time: "Out Time"
transaction_fee: "Transaction Fee"
code_txt: "code "
charge_txt: "charge"

View File

@@ -485,6 +485,7 @@ mm:
induty_report: "Induty Report"
in_time: "In Time"
out_time: "Out Time"
transaction_fee: "Transaction Fee"
code_txt: "ကုတ်ဒ် "
charge_txt: "ကောက်ခံသည်"

View File

@@ -19,6 +19,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.decimal :discount_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :convenience_charge, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :transaction_fee, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :status, :null => false, :default => "new"
t.string :order_remark
t.string :remark