transactions for order reservation and api for tax profile
This commit is contained in:
@@ -114,6 +114,11 @@
|
||||
<a href="<%= transactions_surveys_path %>"><%= t("views.right_panel.detail.survey") %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if can? :manage, OrderReservation %>
|
||||
<li>
|
||||
<a href="<%= transactions_order_reservations_path %>"><%= t("views.right_panel.detail.order_reservation") %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% if can? :index, :dailysale %>
|
||||
|
||||
181
app/views/transactions/order_reservations/index.html.erb
Normal file
181
app/views/transactions/order_reservations/index.html.erb
Normal file
@@ -0,0 +1,181 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t :order_reservation %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<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-">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<%= 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">
|
||||
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
|
||||
<input type="text" id="filter" name="filter" class="form-control" placeholder="Status" style="margin-right: 10px;height: 34px;">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label>
|
||||
<select name="period" id="sel_period" class="form-control">
|
||||
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
|
||||
<option value="0">Today</option>
|
||||
<option value="1">Yesterday</option>
|
||||
<option value="2">This week</option>
|
||||
<option value="3">Last week</option>
|
||||
<option value="4">Last 7 days</option>
|
||||
<option value="5">This month</option>
|
||||
<option value="6">Last month</option>
|
||||
<option value="7">Last 30 days</option>
|
||||
<option value="8">This year</option>
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<label class=""><%= t("views.right_panel.detail.from") %></label>
|
||||
<input class="form-control datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<label class=""><%= t("views.right_panel.detail.to") %></label>
|
||||
<input class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<label></label>
|
||||
<br><input type="submit" value="Search" class='btn btn-primary btn-md'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.order_reservation_id") %></th>
|
||||
<th><%= t("views.right_panel.detail.type") %></th>
|
||||
<th><%= t("views.right_panel.detail.requested_time") %></th>
|
||||
<th><%= t("views.right_panel.detail.status") %></th>
|
||||
<th><%= t :payment_method %></th>
|
||||
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
|
||||
<th><%= t("views.right_panel.detail.sub_total") %></th>
|
||||
<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.convenience_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>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<%
|
||||
discount_amount = 0.0
|
||||
delivery_fee = 0.0
|
||||
convenience_charge = 0.0
|
||||
delivery_tax = 0.0
|
||||
convenience_tax = 0.0
|
||||
commercial_tax = 0.0
|
||||
%>
|
||||
<% if @order_reservations != 0 %>
|
||||
<% @order_reservations.each do |order_reservation| %>
|
||||
<%
|
||||
provider = ""
|
||||
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]
|
||||
end
|
||||
end
|
||||
%>
|
||||
<%
|
||||
if order_reservation.provider == 'pick_up'
|
||||
provider = "Pick-Up"
|
||||
elsif order_reservation.provider == 'direct_delivery'
|
||||
provider = "Direct Delivery"
|
||||
else
|
||||
provider = order_reservation.provider
|
||||
end
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to order_reservation.order_reservation_id, transactions_order_reservation_path(order_reservation) %>
|
||||
<td><%= order_reservation.order_reservation_type %></td>
|
||||
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
|
||||
<td><%= order_reservation.status %></td>
|
||||
<td><%= provider%></td>
|
||||
<td><%= order_reservation.payment_type%></td>
|
||||
<td><%= order_reservation.payment_status%></td>
|
||||
<td><%= number_with_precision(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<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(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(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>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr><td colspan="16"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<% if @order_reservations != 0 %>
|
||||
<%= paginate @order_reservations %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#from').val("<%= params[:from] %>");
|
||||
$('#to').val("<%= params[:to] %>");
|
||||
$('#sel_period').val("<%= params[:period] %>");
|
||||
$('#filter').val("<%= params[:filter] %>");
|
||||
});
|
||||
</script>
|
||||
257
app/views/transactions/order_reservations/show.html.erb
Executable file
257
app/views/transactions/order_reservations/show.html.erb
Executable file
@@ -0,0 +1,257 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item"><a href="<%= transactions_order_reservations_path %>"><%= t :order_reservation %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t :details %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', transactions_order_reservations_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#order_reservation" role="tab"><%= t :order_reservation_details %> </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab"><%= t :customer_details %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><%= t :delivery_details %></a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px;">
|
||||
<div class="tab-pane active" id="order_reservation" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t :reference_number %></th>
|
||||
<th><%= t("views.right_panel.detail.type") %></th>
|
||||
<th><%= t("views.right_panel.detail.requested_time") %></th>
|
||||
<th><%= t("views.right_panel.detail.cooking_time") %></th>
|
||||
<th><%= t("views.right_panel.detail.status") %></th>
|
||||
<th><%= t("views.right_panel.detail.remark") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @order_reservation.transaction_ref %></td>
|
||||
<td><%= @order_reservation.order_reservation_type %></td>
|
||||
<td><%= @order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
|
||||
<td><%= @order_reservation.expected_waiting_time rescue '-' %></td>
|
||||
<td><%= @order_reservation.status %></td>
|
||||
<td><%= @order_reservation.order_remark ? @order_reservation.order_remark : @order_reservation.reservation_remark %></td>
|
||||
</tr>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<th><%= t :sale %> <%= t("views.right_panel.detail.item_txt") %> <%= t("views.right_panel.detail.name_txt2") %></th>
|
||||
<th><%= t("views.right_panel.detail.qty") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.total_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.created_at") %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<% @order_reservation.order_reservation_items.each do |item| %>
|
||||
<tr>
|
||||
<td><%=item.item_name rescue ' '%></td>
|
||||
<td><%=item.qty rescue ' '%></td>
|
||||
<td><%= number_with_precision(item.price > 0 ? item.price : item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= number_with_precision(item.price > 0 ? item.qty * item.price : item.qty * item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%=l item.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<%
|
||||
discount_amount = 0.0
|
||||
delivery_fee = 0.0
|
||||
convenience_charge = 0.0
|
||||
delivery_tax = 0.0
|
||||
convenience_tax = 0.0
|
||||
commercial_tax = 0.0
|
||||
|
||||
total_discount_amount = 0
|
||||
total_delivery_fee = 0
|
||||
total_convenience_charge = 0
|
||||
total_delivery_tax = 0
|
||||
total_convenience_tax = 0
|
||||
total_commercial_tax = 0
|
||||
total_tax = 0.0
|
||||
total_amount = 0.0
|
||||
grand_total = 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]
|
||||
end
|
||||
end
|
||||
total_discount_amount += discount_amount.to_f
|
||||
total_delivery_fee += delivery_fee.to_f
|
||||
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
|
||||
%>
|
||||
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% if total_discount_amount > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.discount_amount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_discount_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_delivery_fee > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.delivery_fee") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_delivery_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_convenience_charge > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.convenience_charge") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_convenience_charge, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- <% if total_delivery_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.delivery_tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_delivery_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_convenience_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.convenience_tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_convenience_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_commercial_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.commercial_tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_commercial_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %> -->
|
||||
<% if total_tax > 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.tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if grand_total > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> </td>
|
||||
<td colspan="3"><%= number_with_precision(grand_total, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- panel-2 -->
|
||||
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.company") %></th>
|
||||
<th><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.email") %></th>
|
||||
<th><%= t("views.right_panel.detail.nrc_passport_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.address") %></th>
|
||||
<th><%= t("views.right_panel.detail.dob") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if !@customer.nil? %>
|
||||
<tr>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- panel-3 -->
|
||||
<div class="tab-pane" id="delivery" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.provider") %></th>
|
||||
<th><%= t("views.right_panel.detail.delivery_type") %></th>
|
||||
<th><%= t("views.right_panel.detail.address") %></th>
|
||||
<th><%= t("views.right_panel.detail.township") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if !@delivery.nil? %>
|
||||
<%
|
||||
if @delivery.provider == 'pick_up'
|
||||
provider = "Pick-Up"
|
||||
elsif @delivery.provider == 'direct_delivery'
|
||||
provider = "Direct Delivery"
|
||||
else
|
||||
provider = @delivery.provider
|
||||
end
|
||||
%>
|
||||
<tr>
|
||||
<td><%= provider%></td>
|
||||
<td><%= @delivery.delivery_type%></td>
|
||||
<td><%= @delivery.address%></td>
|
||||
<td><%= @delivery.township%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user