hourly sale items report

This commit is contained in:
NyanLinHtut
2019-08-19 10:45:50 +06:30
parent 67793b282e
commit e443c5431e
8 changed files with 801 additions and 302 deletions

View File

@@ -26,9 +26,9 @@ class Reports::HourlySaleitemController < BaseReportController
account_type = params[:account_type]
@type = params[:sale_type]
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
logger.debug 'product>>>>>>>>>>>>>>>>>>>>>>>>>>'
logger.debug @sale_data.group(:date_format)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
# logger.debug 'product>>>>>>>>>>>>>>>>>>>>>>>>>>'
# logger.debug @sale_data.group(:date_format)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@@ -56,6 +56,8 @@ 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 }}
respond_to do |format|
format.html
@@ -76,8 +78,6 @@ class Reports::HourlySaleitemController < BaseReportController
shift_id = sale.id.nil? ? '-' : sale.id
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
date_arr.push(str)
logger.debug 'show date arr####################'
logger.debug date_arr
end
# @totalByAccount = Hash.new {|hash, key| hash[key] = 0}
@@ -122,7 +122,7 @@ class Reports::HourlySaleitemController < BaseReportController
@type = params[:period_type]
period_name = get_period_name(params[:period])
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
other_charges = Sale.get_other_charges()
if shift.present?
@total_other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)