daily & hourly report

This commit is contained in:
NyanLinHtut
2019-12-23 14:51:37 +06:30
parent 450c847da6
commit 358ff50934
7 changed files with 323 additions and 259 deletions

View File

@@ -1110,15 +1110,17 @@ $(function() {
});
if (inclusive_tax >0){
inclusive_total = total_price / inclusive_tax;
total_price = total_price;
}
if (exclusive_tax >0){
exclusive_total = total_price * exclusive_tax;
total_price = total_price + exclusive_total;
}
total_price = total_price + exclusive_total + inclusive_total;
var fixed_total_price = parseFloat(total_price).toFixed(2);
var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2);
$('#total_tax').empty();
$('#total_tax').append(exclusive_total + inclusive_total);
$('#total_tax').append(parseInt(exclusive_total) + parseInt(inclusive_total));
$('#sub_total').empty();
$('#sub_total').append(fixed_total_price);

View File

@@ -33,8 +33,7 @@ class BaseReportController < ActionController::Base
if params[:from].present? && params[:to].present?
from = Time.parse(params[:from])
to = Time.parse(params[:to])
puts "from - to<<<<<<<<<<<<<<<<<<<<"
puts "#{from},#{to}"
else
case period.to_i
when PERIOD["today"]

View File

@@ -45,7 +45,7 @@ class Printer::PrinterWorker
if printer_destination.nil?
printer_destination = self.printer_destination
end
copy = self.print_copies
#Print only when printer information is not null
if !self.printer_destination.nil?

View File

@@ -788,7 +788,7 @@ def self.daily_sales_list(from,to)
daily_total = connection.select_all("SELECT
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) - (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as total_sale,
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as total_sale,
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
@@ -796,7 +796,7 @@ def self.daily_sales_list(from,to)
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21 as tax,
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0))-(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21) as net_sale,
SUM(grand_total + total_discount) as gross_sale,
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale,
CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
SUM(kbzpay_amount) as kbzpay_amount,
SUM(mpu_amount) as mpu_amount,
@@ -2068,9 +2068,14 @@ def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,acco
query = self.get_hourly_item_query(type,filter,false)
end
puts "start time - end time >>>>>>>>>"
puts "#{start_time},#{end_time}"
unless start_time.blank? && end_time.blank?
from_date = from.to_date
to_date = to.to_date
from_date_time = DateTime.new(from_date.year, from_date.month, from_date.day, start_time.hour, start_time.min, start_time.sec, start_time.zone)
to_date_time = DateTime.new(to_date.year, to_date.month, to_date.day, end_time.hour, end_time.min, end_time.sec, end_time.zone)
receipt_date = "sales.receipt_date between '#{from_date_time}' and '#{to_date_time}'"
query = self.get_hourly_item_query(type,filter,false)
end
# query = self.get_hourly_item_query(type,filter)

View File

@@ -24,11 +24,11 @@
<table class="table table-bordered">
<thead>
<tr>
<th colspan="<%= column_count = @payment_methods.length + 8 %>"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
<th colspan="<%= column_count = @payment_methods.length + 12 %>"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% @count = 1 %>
<% @payment_methods.each_slice(10) do |slice| %>
<tr>
<!-- <tr>
<th></th>
<th></th>
<% alph = "A" %>
@@ -46,7 +46,7 @@
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
</tr>
</tr> -->
<!-- <tr>
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
@@ -73,6 +73,12 @@
<th></th>
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
<th colspan=4 style='text-align:center;'>Outgoing</th>
<th style='text-align:center;'><i class="material-icons md-18" data-toggle="tooltip" data-placement="top" title="Gross Sales = (Income+Discount) - (FOC+Void)">live_help</i></th>
<th style='text-align:center;'><i class="material-icons md-18" data-toggle="tooltip" data-placement="top" title="Total Sales = Gross Sales - Discount">live_help</i></th>
<% if @tax.blank? %>
<th style='text-align:center;'><i class="material-icons md-18" data-toggle="tooltip" data-placement="top" title="Tax = Total Sales / 21">live_help</i></th>
<% end %>
<th style='text-align:center;'><i class="material-icons md-18" data-toggle="tooltip" data-placement="top" title="Net Sales = Total Sales - Tax">live_help</i></th>
</tr>
<tr>
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>

View File

@@ -7,249 +7,307 @@
<body>
<div class="row">
<div class="col-md-12 col-lg-12">
<div class="card" style="width:129%;">
<div class="card mbl_card">
<div class="body table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th colspan="<%= column_count = @payment_methods.length + 8 %>"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
<th colspan="<%= column_count = @payment_methods.length + 12 %>"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<tr>
<% @count = 1 %>
<% @payment_methods.each_slice(10) do |slice| %>
<% end %>
<tr>
<th></th>
<th></th>
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
<th colspan=4 style='text-align:center;'>Outgoing</th>
</tr>
<tr>
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
<% if @payment_methods.include? ("MPU") %>
<th style='text-align:center;' class='mobile'><%= t("views.right_panel.detail.mpu_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Master") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.master_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.master_sales") %></th>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.visa_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.visa_sales") %></th>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.jcb_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.jcb_sales") %></th>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.unionpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.kbzpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.alipay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.paymal_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.paymal_sales") %></th>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.dinga_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.dinga_sales") %></th>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.junctionpay_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.junctionpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.redeem_sales") %></th>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<% if @payment_methods.include? ("GiftVoucher") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<% end %>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.gross_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.total_sales") %></th>
<% if @tax.blank? %>
<th style='text-align:center;'><%= t("views.right_panel.detail.tax") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
</tr>
</thead>
<% unless @sale_data.blank? %>
<tbody>
<% void = 0 %>
<% mpu = 0 %>
<% master = 0 %>
<% visa = 0 %>
<% jcb = 0 %>
<% unionpay = 0 %>
<% alipay = 0 %>
<% paymal = 0 %>
<% dinga = 0 %>
<% junctionpay = 0 %>
<% giftvoucher = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% kbzpay = 0 %>
<% total = 0 %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% count = 1 %> <% rounding_adj = 0 %>
<% @sale_data.each do |sale| %>
<% void += sale[:void_amount] %>
<% mpu += sale[:mpu_amount] %>
<% master += sale[:master_amount] %>
<% visa += sale[:visa_amount] %>
<% jcb += sale[:jcb_amount] %>
<% unionpay += sale[:unionpay_amount] %>
<% alipay += sale[:alipay_amount] %>
<% paymal += sale[:paymal_amount] %>
<% dinga += sale[:dinga_amount] %>
<% junctionpay += sale[:junctionpay_amount] %>
<% giftvoucher += sale[:giftvoucher_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
<% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %>
<% kbzpay += sale[:kbzpay_amount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %>
<% old_grand_total += sale[:old_grand_total].to_f %>
<% rounding_adj += sale[:rounding_adj].to_f %>
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<% if @payment_methods.include? ("MPU") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Master") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<% unless @sale_data.blank? %>
<tbody>
<% void = 0 %>
<% mpu = 0 %>
<% master = 0 %>
<% visa = 0 %>
<% jcb = 0 %>
<% unionpay = 0 %>
<% alipay = 0 %>
<% paymal = 0 %>
<% dinga = 0 %>
<% junctionpay = 0 %>
<% giftvoucher = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% kbzpay = 0 %>
<% total = 0 %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% gross_sale = 0 %>
<% total_sale = 0 %>
<% tax = 0 %>
<% net_sale = 0 %>
<% count = 1 %> <% rounding_adj = 0 %>
<% @sale_data.each do |sale| %>
<% void += sale[:void_amount] %>
<% mpu += sale[:mpu_amount] %>
<% master += sale[:master_amount] %>
<% visa += sale[:visa_amount] %>
<% jcb += sale[:jcb_amount] %>
<% unionpay += sale[:unionpay_amount] %>
<% alipay += sale[:alipay_amount] %>
<% paymal += sale[:paymal_amount] %>
<% dinga += sale[:dinga_amount] %>
<% junctionpay += sale[:junctionpay_amount] %>
<% giftvoucher += sale[:giftvoucher_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
<% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %>
<% kbzpay += sale[:kbzpay_amount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %>
<% old_grand_total += sale[:old_grand_total].to_f %>
<% rounding_adj += sale[:rounding_adj].to_f %>
<% gross_sale += sale[:gross_sale].to_f %>
<% total_sale += sale[:total_sale].to_f %>
<% tax += sale[:tax].to_f %>
<% net_sale += sale[:net_sale].to_f %>
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<% if @payment_methods.include? ("MPU") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Master") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:unionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]),delimiter => ',') rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]),delimiter => ',') rescue '-'%></td>
<% if @payment_methods.include? ("GiftVoucher") %>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:giftvoucher_amount]),delimiter => ',') rescue '-'%></td>
<% end %>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), delimiter => ',') rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f),delimiter => ',') rescue '-'%></td>
<!-- <td style='text-align:right;'><%= number_with_delimiter(sale[:grand_total].to_f + sale[:rounding_adj].to_f ,delimiter => ',') rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]),delimiter => ',') rescue '-'%></td>
<% if @payment_methods.include? ("PAYMAL") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:dinga_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:junctionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<td style='text-align:right;'><%= number_format(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% count = count + 1 %>
<% end %>
<% colspan = 7 %>
<tr style="font-weight:600;">
<td colspan="2" style='text-align:center;'><b>Total</b></td>
<% if @payment_methods.include? ("MPU") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",mpu),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("Master") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",master),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",visa), delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",jcb),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",unionpay),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",alipay),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",kbzpay),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",paymal),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",dinga),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",junctionpay),delimiter => ',') rescue '-'%></b></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",paypar),delimiter => ',') rescue '-'%></b></td>
<% end %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",cash),delimiter => ',') rescue '-'%></b></td>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",credit),delimiter => ',') rescue '-'%></b></td>
<td style='color:red;text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",void),delimiter => ',') rescue '-'%></b></td>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",foc), delimiter => ',') rescue '-'%></b></td>
<% if @payment_methods.include? ("GiftVoucher") %>
<% colspan += 1 %>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",giftvoucher), delimiter => ',') rescue '-'%></b></td>
<% end %>
<td style='text-align:right;'><b>(<%= number_with_delimiter(discount,delimiter => ',') rescue '-'%>)</b></td>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",rounding_adj),delimiter => ',') rescue '-'%></b></td>
<td style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",grand_total),delimiter => ',') rescue '-'%></b></td>
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_format(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if @tax.blank? %>
<td style='text-align:right;'><%= number_format(sale[:tax], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<tr>
<td colspan="<%= column_count %>">&nbsp;</td>
</tr>
<% count = count + 1 %>
<% end %>
<% colspan = 7 %>
<tr style="font-weight:600;">
<td colspan="2" style='text-align:center;'>Total</td>
<% if @payment_methods.include? ("MPU") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("Master") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("VISA") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("JCB") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("UNIONPAY") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paymal, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(dinga, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(junctionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<% colspan += 1 %>
<td style='text-align:right;'><%= number_format(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(gross_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(total_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(tax, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<tr style="font-weight:600;">
<td colspan="<%= column_count %>">&nbsp;</td>
</tr>
<% total_tax = 0 %>
<% net = 0 %>
<% unless @tax.blank? %>
<% @tax.each do |tax|
total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td colspan="2" style='text-align:right;'><%= number_format(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% end %>
<% net = grand_total %>
<% net = net - rounding_adj%>
<% net = net - total_tax %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td colspan="5" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% total_tax = 0 %>
<% net = 0 %>
<% unless @tax.blank? %>
<% @tax.each do |tax|
total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><b><%= tax.tax_name rescue '-'%></b></td>
<td colspan="2" style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount),delimiter => ',') rescue '-'%></b></td>
</tr>
<% end %>
<% end %>
<% net = grand_total %>
<% net = net - rounding_adj%>
<% net = net - total_tax %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><b><%= t("views.right_panel.detail.net_amount") %></b></td>
<td colspan="2" style='text-align:right;'><b><%= number_with_delimiter(sprintf("%.2f",net),delimiter => ',') rescue '-'%></b></td>
</tr>
</tbody>
<% end %>
</table>
</div>
<% else %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td colspan="5" style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div>
</body>

View File

@@ -10,23 +10,49 @@
<!-- <div class="col-lg-2 col-md-2 col-sm-2 text-">
<input type="submit" value="Filter" class='btn btn-primary'>
</div> -->
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.start_time") %></label>
<input data-behaviour='timepicker' class="form-control m-t-3 timepicker" name="start_time" id="start_time" type="text" placeholder="From Time" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.end_time") %></label>
<input data-behaviour='timepicker' class="form-control m-t-3 timepicker" name="end_time" id="end_time" type="text" placeholder="To Time" style="height: 32px;">
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.start_time") %></label>
<input data-behaviour='timepicker' type="text" name="start_time" id="start_time" class="timepicker form-control col-md-8" placeholder="Start Time">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.end_time") %></label>
<input data-behaviour='timepicker' type="text" name="end_time" id="end_time" class="timepicker form-control col-md-8" placeholder="End Time">
</div> -->
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from_time") %></label>
<input data-behaviour='timepicker' class="form-control m-t-3 timepicker" value="<%= @start_time %>" name="start_time" id="start_time" type="text" placeholder="From Time" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to_time") %></label>
<input data-behaviour='timepicker' class="form-control m-t-3 timepicker" value="<%= @end_time %>" name="end_time" id="end_time" type="text" placeholder="To Time" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div>
<!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> -->
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl">Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<option value="">Select Type</option>
<option value="revenue" selected>Revenue Only</option>
<option value="all">All Type</option>
<option value="discount">Discount Only</option>
<option value="void">Void Only</option>
<option value="foc">Foc Only</option>
<option value="promotion">Promotion Only</option>
<option value="other">Other Amount Only</option>
</select>
</div> -->
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_account") %></label>
<select name="account_type" id="account_type" class="form-control">
<option value = "">Select Account</option>
<% @account.each do |acc| %>
<option value="<%=acc.title%>" class="<%=acc.title%>" > <%=acc.title%></option>
<%end %>
</select>
</div> -->
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
@@ -43,38 +69,6 @@
<option value="9">Last year</option>
</select>
</div>
<!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> -->
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl">Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<option value="">Select Type</option>
<option value="revenue" selected>Revenue Only</option>
<option value="all">All Type</option>
<option value="discount">Discount Only</option>
<option value="void">Void Only</option>
<option value="foc">Foc Only</option>
<option value="promotion">Promotion Only</option>
<option value="other">Other Amount Only</option>
</select>
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_account") %></label>
<select name="account_type" id="account_type" class="form-control">
<option value = "">Select Account</option>
<% @account.each do |acc| %>
<option value="<%=acc.title%>" class="<%=acc.title%>" > <%=acc.title%></option>
<%end %>
</select>
</div> -->
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" >