This commit is contained in:
Myat Zin Wai Maw
2019-08-30 14:03:48 +06:30
parent 67793b282e
commit f0be0d19a1
7 changed files with 52 additions and 47 deletions

View File

@@ -56,7 +56,10 @@ class Reports::HourlySaleitemController < BaseReportController
@shift_data = sh
end
end
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
puts @hourly_total_qty.to_json
respond_to do |format|
format.html
format.xls

View File

@@ -64,7 +64,7 @@ class Reports::SaleitemController < BaseReportController
def show
from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
sale_data = @sale_data
date_arr = Array.new
@sale_data.each do |sale|
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")

View File

@@ -38,20 +38,20 @@ class Printer::PrinterWorker
end
def print(file_path,printer_destination = nil )
if printer_destination.nil?
printer_destination = self.printer_destination
end
# if printer_destination.nil?
# printer_destination = self.printer_destination
# end
puts printer_destination
puts '........Printer Destination..........'
# puts printer_destination
# puts '........Printer Destination..........'
copy = self.print_copies
#Print only when printer information is not null
if !self.printer_destination.nil?
(1..copy).each do
page = Cups::PrintJob.new(file_path, printer_destination)
page.print
end
end
# copy = self.print_copies
# #Print only when printer information is not null
# if !self.printer_destination.nil?
# (1..copy).each do
# page = Cups::PrintJob.new(file_path, printer_destination)
# page.print
# end
# end
end
end

View File

@@ -1092,7 +1092,7 @@ def self.get_item_query(type)
"i.unit_price,i.price as price,i.product_name as product_name, " +
"i.menu_category_name,i.menu_category_code as menu_category_id, " +
"date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')
as date_format")
as date_format")
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")

View File

@@ -11,7 +11,7 @@
<div class="row">
<div class="col-md-12">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_waste_and_spoilage_index_path} %>
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_hourly_saleitem_index_path} %>
<hr />
<div class="text-right">
<a href="javascript:export_to('<%=reports_waste_and_spoilage_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
@@ -21,6 +21,7 @@
<table class="table table-striped" border="0">
<% time_arr = Array.new %>
<% sale_item_count =0 %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
@@ -29,6 +30,7 @@
<% time_count = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% sale_item_count =1 %>
<% time_count = time_count + 1 %>
<thead>
<td>&nbsp;</td>
@@ -52,6 +54,9 @@
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% else %>
<%= time_arr %>
<% sale_item_count =sale_item_count +1 %>
<% end %>
<tbody>
<!-- all total qty sum -->
@@ -85,24 +90,21 @@
<td><%= sale.date_format %></td>
</tr>
<% end %>
<!-- new tr -->
<% count = count + 1 %>
<% logger.debug ' normal count+++++++++++++++++++++++++' %>
<% logger.debug sale.sale_items.count %>
<% logger.debug 'time_count count------------------------------------' %>
<% logger.debug time_count %>
<% if sale.sale_items.count == count %>
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>
<td>Total Qty:</td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;">Grand Total:</td>
<td style="border-bottom:2px solid grey;"><span></span></td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
<% @hourly_total_qty.each do |hr| %>
<% if hr["date"].to_s == sale.date_format.to_s && hr["total_qty"].to_i ==sale_item_count%>
<tr style="border-top:2px solid grey;">
<td colspan="2">&nbsp;</td>
<td>Total Qty:</td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;">Grand Total:</td>
<td style="border-bottom:2px solid grey;"><span></span></td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% total_qty =0%>
<% end %>
<% end %>
</tbody>
<% end %>

View File

@@ -21,11 +21,11 @@ class ActionController::Base
end
else
# check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
end
end

View File

@@ -1,10 +1,10 @@
application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path
#environment ENV.fetch("RAILS_ENV") { "production" }
environment "production"
pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
port ENV.fetch("PORT") { 62158 }
workers 2
preload_app!
# application_path="#{File.expand_path("../..", __FILE__)}"
# directory application_path
# #environment ENV.fetch("RAILS_ENV") { "production" }
# environment "production"
# pidfile "#{application_path}/tmp/puma/pid"
# state_path "#{application_path}/tmp/puma/state"
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# port ENV.fetch("PORT") { 62158 }
# workers 2
# preload_app!