merge with august sprint for commission

This commit is contained in:
Yan
2017-08-29 18:44:31 +06:30
26 changed files with 3377 additions and 788 deletions

View File

@@ -2,21 +2,14 @@ class Reports::CommissionController < BaseReportController
# authorize_resource :class => false
def index
from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
commissioner = params[:commissioner].to_i
@commissioner = Commissioner.active.all
from, to = get_date_range_from_params
@shift = ''
if params[:shift_name].to_i != 0
@shift = ShiftSale.find(params[:shift_name])
end
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
@from = from
@to = to
if @shift.present?
@shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_data = @shift
end
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
@from = from_date
@to = to_date
respond_to do |format|
format.html