change order reservation data

This commit is contained in:
phyusin
2018-05-09 19:10:11 +06:30
parent fe306dc26b
commit 0127b23e93
9 changed files with 113 additions and 78 deletions

View File

@@ -71,7 +71,6 @@
delimiter = ""
end %>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
@@ -96,20 +95,24 @@
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
(order_reservation.taxes).each do |tax| %>
<% end
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
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge
total_delivery_tax += delivery_tax
total_convenience_tax += convenience_tax
total_commercial_tax += commercial_tax
total_tax += order_reservation.total_tax
total_amount += order_reservation.total_amount
grand_total += order_reservation.grand_total
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
@@ -123,7 +126,7 @@
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%d %m %Y %I:%M %p") %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>

View File

@@ -63,19 +63,25 @@
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
(order_reservation.taxes).each do |tax| %>
<% end
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
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge
total_delivery_tax += delivery_tax
total_convenience_tax += convenience_tax
total_commercial_tax += commercial_tax
total_tax += order_reservation.total_tax
total_amount += order_reservation.total_amount
grand_total += order_reservation.grand_total
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
@@ -89,7 +95,7 @@
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%d %m %Y %I:%M %p") %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>