Skip to content

Commit

Permalink
Merge pull request #245 from sparc-request/ml-project_summary_report_…
Browse files Browse the repository at this point in the history
…changes

Ml project summary report changes
  • Loading branch information
Stuart-Johnson committed Oct 20, 2017
2 parents 8f2182f + 90c5a57 commit 0a3fabf
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/reports/project_summary_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,31 @@ def generate(document)
participant_totals << participant_total
visit_group_subtotals = add_parallel_arrays(visit_group_subtotals, participant_costs)

csv << ["", "Subject #{participant.label}", participant.status, display_cost_array(participant_costs + [participant_total])].flatten
csv << ["", "#{participant.mrn}", participant.status, display_cost_array(participant_costs + [participant_total])].flatten
end

arm_subtotal = sum_up(visit_group_subtotals)
csv << [""]
csv << ["", "Arm Total - #{arm.name}", "", display_cost_array(visit_group_subtotals + [arm_subtotal])].flatten
csv << ["", "#{arm.name} Total", "", display_cost_array(visit_group_subtotals + [arm_subtotal])].flatten
arms_total += arm_subtotal
end

csv << [""]
csv << [""]
csv << ["Clinical Services Invoiceable Total", display_cost(arms_total)]
csv << [""]
csv << [""]
csv << [""]
csv << ["Non-Clinical Services"]
csv << ["", "Name", "Cost"]
csv << ["", "Service", "Quantity Completed", "Quantity Type", "Cost"]
csv << [""]

study_level_charges = 0
protocol.fulfillments.fulfilled_in_date_range(@start_date, @end_date).each do |f|
csv << ["", f.service_name, display_cost(f.service_cost)]
csv << ["", f.service_name, f.quantity.to_s, f.line_item.try(:quantity_type), display_cost(f.service_cost)]
study_level_charges += f.service_cost
end

csv << [""]
csv << [""]
csv << ["Non-Clinical Services Invoiceable Total", display_cost(study_level_charges)]
csv << ["Non-Clinical Services Invoiceable Total", "", "", "", display_cost(study_level_charges)]
csv << [""]
csv << [""]
csv << ["Study Total", display_cost(arms_total + study_level_charges)]
Expand Down

0 comments on commit 0a3fabf

Please sign in to comment.