Remove sales total report

This commit is contained in:
luisramos0
2019-12-13 16:05:10 +00:00
parent cb3397fd1a
commit c59326743b
5 changed files with 4 additions and 78 deletions

View File

@@ -39,48 +39,6 @@ module Spree
respond_with(@reports)
end
def sales_total
params[:q] = {} unless params[:q]
if params[:q][:created_at_gt].blank?
params[:q][:created_at_gt] = Time.zone.now.beginning_of_month
else
params[:q][:created_at_gt] = begin
Time.zone.
parse(params[:q][:created_at_gt]).beginning_of_day
rescue
Time.zone.now.beginning_of_month
end
end
if params[:q] && params[:q][:created_at_lt].present?
params[:q][:created_at_lt] = begin
Time.zone.parse(params[:q][:created_at_lt]).end_of_day
rescue
""
end
end
params[:q][:completed_at_not_null] = (params[:q].delete(:completed_at_not_null) == "1")
params[:q][:s] ||= "created_at desc"
@search = Order.complete.ransack(params[:q])
@orders = @search.result
@totals = {}
@orders.each do |order|
unless @totals[order.currency]
@totals[order.currency] = { item_total: ::Money.new(0, order.currency),
adjustment_total: ::Money.new(0, order.currency),
sales_total: ::Money.new(0, order.currency) }
end
@totals[order.currency][:item_total] += order.display_item_total.money
@totals[order.currency][:adjustment_total] += order.display_adjustment_total.money
@totals[order.currency][:sales_total] += order.display_total.money
end
end
def customers
@report_types = report_types[:customers]
@report_type = params[:report_type]
@@ -314,7 +272,6 @@ module Spree
:orders_and_fulfillment,
:customers,
:products_and_inventory,
:sales_total,
:users_and_enterprises,
:enterprise_fee_summary,
:order_cycle_management,

View File

@@ -1,26 +0,0 @@
- content_for :page_title do
= Spree.t(:sales_totals)
- content_for :page_actions do
%li= link_to_with_icon 'icon-arrow-left', Spree.t(:back_to_reports_list), spree.admin_reports_url, class: 'button'
- content_for :table_filter_title do
= Spree.t(:date_range)
- content_for :table_filter do
= render partial: 'spree/admin/shared/report_criteria', locals: {}
%table.admin-report
%thead
%tr
%th= Spree.t(:currency)
%th= Spree.t(:item_total)
%th= Spree.t(:adjustment_total)
%th= Spree.t(:sales_total)
%tbody
- @totals.each do |key, row|
%tr.align-center
%td= key
%td= row[:item_total].format
%td= row[:adjustment_total].format
%td= row[:sales_total].format

View File

@@ -1046,9 +1046,6 @@ en:
products_and_inventory:
name: Products & Inventory
description:
sales_total:
name: Sales Total
description: Sales Total For All Orders
users_and_enterprises:
name: Users & Enterprises
description: Enterprise Ownership & Status

View File

@@ -14,18 +14,16 @@ feature '
create(:distributor_enterprise)
])
end
it "does not show super admin only reports" do
it "does not show super admin only report" do
login_to_admin_as user
click_link "Reports"
expect(page).not_to have_content "Sales Total"
expect(page).not_to have_content "Users & Enterprises"
end
end
context "As an admin user" do
it "shows the super admin only reports" do
it "shows the super admin only report" do
login_to_admin_section
click_link "Reports"
expect(page).to have_content "Sales Total"
expect(page).to have_content "Users & Enterprises"
end
end

View File

@@ -219,7 +219,7 @@ module Spree
include_examples "allows access to Enterprise Fee Summary"
it "should not be able to read other reports" do
is_expected.not_to have_ability([:sales_total, :group_buys, :payments, :orders_and_distributors, :users_and_enterprises, :xero_invoices], for: Spree::Admin::ReportsController)
is_expected.not_to have_ability([:group_buys, :payments, :orders_and_distributors, :users_and_enterprises, :xero_invoices], for: Spree::Admin::ReportsController)
end
it "should not be able to access customer actions" do
@@ -412,7 +412,7 @@ module Spree
include_examples "allows access to Enterprise Fee Summary"
it "should not be able to read other reports" do
is_expected.not_to have_ability([:sales_total, :users_and_enterprises], for: Spree::Admin::ReportsController)
is_expected.not_to have_ability([:users_and_enterprises], for: Spree::Admin::ReportsController)
end
it "should be able to access customer actions" do