This commit is contained in:
yarzar_code
2020-01-12 20:07:28 +06:30
parent 314cc507a3
commit dff2c69627
89 changed files with 492 additions and 469 deletions

View File

@@ -1,7 +1,7 @@
class Reports::HourlySaleitemController < BaseReportController
authorize_resource :class => false
def index
@account = Account.where("shop_code='#{@shop.shop_code}'")
@account = Account.all
from, to = get_date_range_from_params
@start_time = params[:start_time]
@@ -12,16 +12,16 @@ class Reports::HourlySaleitemController < BaseReportController
shift = ''
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL",shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL",shift_sale.shift_started_at)
else
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ?",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
end
@@ -31,7 +31,7 @@ class Reports::HourlySaleitemController < BaseReportController
@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_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type,filter,@start_time,@end_time)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}