diff --git a/app/controllers/reports/hourly_saleitem_controller.rb b/app/controllers/reports/hourly_saleitem_controller.rb index 68883c68..893d4d17 100644 --- a/app/controllers/reports/hourly_saleitem_controller.rb +++ b/app/controllers/reports/hourly_saleitem_controller.rb @@ -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 diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index f3062d69..b581eae8 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -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") diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index fee19a31..8bbf1c6d 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -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 diff --git a/app/models/sale.rb b/app/models/sale.rb index acbb25b7..68620a1b 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -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") diff --git a/app/views/reports/hourly_saleitem/index.html.erb b/app/views/reports/hourly_saleitem/index.html.erb index f5491203..e98f61a7 100644 --- a/app/views/reports/hourly_saleitem/index.html.erb +++ b/app/views/reports/hourly_saleitem/index.html.erb @@ -11,7 +11,7 @@
| @@ -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 %> @@ -85,24 +90,21 @@ | <%= sale.date_format %> | <% end %> - - <% 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 %> -|||||
| - | Total Qty: | -<%= total_qty%> | -Grand Total: | -- | ||
| + | Total Qty: | +<%= total_qty%> | +Grand Total: | ++ | ||