Created
November 9, 2012 15:39
-
-
Save opsb/4046381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Reports | |
| module CauseCumulativeCommission | |
| extend self | |
| def build(name, cause, opts=ReportOptions.new) | |
| { | |
| :name => name, | |
| :columns => [['date', 'Date'], ['number', cause.name]], | |
| :rows => begin | |
| (opts.start_date..opts.end_date).step.inject([]) do |rows, date| | |
| rows << [date, cause.metrics.commission(date).round(2)] | |
| rows | |
| end | |
| end, | |
| :options => { | |
| chartArea: { width: '90%', height: '75%' }, | |
| legend: 'bottom' | |
| } | |
| } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment