Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sj sr report changes #236

Merged
merged 2 commits into from
Dec 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/models/sub_service_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ def update_org_tree
self.update_column(:org_tree_display, my_tree)
end

def org_tree
orgs = organization.parents
orgs << organization
end

def set_effective_date_for_cost_calculations
self.line_items.each{|li| li.pricing_scheme = 'effective'}
end
Expand Down
8 changes: 8 additions & 0 deletions app/reports/service_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,26 @@ def column_attrs

if params[:institution_id]
attrs[Institution] = [params[:institution_id], :abbreviation]
else
attrs["Institution"] = "org_tree.select{|org| org.type == 'Institution'}.first.try(:abbreviation)"
end

if params[:provider_id]
attrs[Provider] = [params[:provider_id], :abbreviation]
else
attrs["Provider"] = "org_tree.select{|org| org.type == 'Provider'}.first.try(:abbreviation)"
end

if params[:program_id]
attrs[Program] = [params[:program_id], :abbreviation]
else
attrs["Program"] = "org_tree.select{|org| org.type == 'Program'}.first.try(:abbreviation)"
end

if params[:core_id]
attrs[Core] = [params[:core_id], :abbreviation]
else
attrs["Core"] = "org_tree.select{|org| org.type == 'Core'}.first.try(:abbreviation)"
end

attrs["SRID"] = :display_id
Expand Down