update number_formattable. update dashboard query.

This commit is contained in:
Thein Lin Kyaw
2019-11-28 14:13:00 +06:30
parent 47c12c6faa
commit 2010b6a4bb
8 changed files with 225 additions and 319 deletions

View File

@@ -67,24 +67,16 @@
<div class="row clearfix">
<%
if !@from.nil? && @from != ""
from_date = DateTime.parse(@from).utc.getlocal.strftime("%d-%m-%Y")
from_date = @from.strftime("%d-%m-%Y")
from_time = @from.strftime("%H:%M") if @from.strftime("%H:%M") != "00:00"
else
from_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
from_date = Time.now.strftime('%d-%m-%Y')
end
if !@to.nil? && @to != ""
to_date = DateTime.parse(@to).utc.getlocal.strftime("%d-%m-%Y")
to_date = @to.strftime("%d-%m-%Y")
to_time = @to.strftime("%H:%M") if @to.strftime("%H:%M") != "23:59"
else
to_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
end
if !@from_time.nil?
from_time = @from_time
else
from_time = ''
end
if !@to_time.nil?
to_time = @to_time
else
to_time = ''
to_date = Time.now.strftime('%d-%m-%Y')
end
%>
<div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
@@ -217,26 +209,21 @@
<table class="table">
<% if !(@total_payment_methods.nil?) %>
<% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %>
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' && payment.payment_method != 'unionpay' %>
<tr>
<% if payment.payment_method == 'paypar' %>
<td>Redeem Sale : </td>
<% else %>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<% end %>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= number_format(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %>
<% end %>
</td>
</tr>
<% end %>
<% if payment.payment_method != 'card' %>
<tr>
<% if payment.payment_method == 'paypar' %>
<td>Redeem Sale : </td>
<% else %>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<% end %>
<td align="right">
<%= number_format(@sale_data.find {|x| x.key?(payment.payment_method) }[payment.payment_method], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %>
</td>
</tr>
<% end %>
<% end %>
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
<% total_card = @sale_data.find {|x| x.key?("card") } %>
<% if !total_card.nil? %>
<tr>
<td><%= t("views.right_panel.detail.other_payment") %> : </td>