diff --git a/.idea/workspace.xml b/.idea/workspace.xml index aa32b1ed..8a05bbbf 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,33 +2,11 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - @@ -72,31 +50,91 @@ - - + + - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -105,68 +143,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -194,6 +172,7 @@ order_item origami_commissions_path green + reports_dailysale_index_path @@ -202,10 +181,6 @@ @@ -448,6 +427,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -911,12 +913,12 @@ - + - @@ -929,12 +931,13 @@ + - + @@ -963,64 +966,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1077,14 +1022,6 @@ - - - - - - - - @@ -1317,14 +1254,6 @@ - - - - - - - - @@ -1349,14 +1278,6 @@ - - - - - - - - @@ -1366,9 +1287,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/reports/commission_controller.rb b/app/controllers/reports/commission_controller.rb new file mode 100644 index 00000000..2d421ef5 --- /dev/null +++ b/app/controllers/reports/commission_controller.rb @@ -0,0 +1,50 @@ +class Reports::CommissionController < BaseReportController + # authorize_resource :class => false + + def index + + 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 + + respond_to do |format| + format.html + format.xls + end + end + + def show + from, to = get_date_range_from_params + + @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) + + 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") + local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p") + opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc + closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc + 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) + end + + out = {:status => 'ok', :message => date_arr} + + respond_to do |format| + format.json { render json: out } + end + end +end + diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index cdb2d51b..a8369af2 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -55,6 +55,7 @@
  • <%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %>
  • <%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %>
  • <%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %>
  • +