ruport 0.8.14 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +42 -107
- data/Rakefile +29 -32
- data/examples/centered_pdf_text_box.rb +13 -19
- data/examples/example.csv +3 -0
- data/examples/line_plotter.rb +15 -15
- data/examples/pdf_complex_report.rb +10 -23
- data/examples/pdf_table_with_title.rb +12 -12
- data/examples/rope_examples/itunes/Rakefile +22 -1
- data/examples/rope_examples/itunes/config/environment.rb +4 -0
- data/examples/rope_examples/itunes/lib/init.rb +32 -2
- data/examples/rope_examples/itunes/util/build +50 -16
- data/examples/rope_examples/sales_report/README +1 -1
- data/examples/rope_examples/sales_report/Rakefile +22 -1
- data/examples/rope_examples/sales_report/config/environment.rb +4 -0
- data/examples/rope_examples/sales_report/lib/init.rb +32 -2
- data/examples/rope_examples/sales_report/lib/reports/sales.rb +10 -16
- data/examples/rope_examples/sales_report/util/build +50 -16
- data/examples/row_renderer.rb +39 -0
- data/examples/ruport_list/png_embed.rb +61 -0
- data/examples/ruport_list/roadmap.png +0 -0
- data/examples/sample.rb +16 -0
- data/examples/simple_pdf_lines.rb +24 -0
- data/lib/ruport.rb +143 -57
- data/lib/ruport/acts_as_reportable.rb +246 -0
- data/lib/ruport/data.rb +1 -2
- data/lib/ruport/data/grouping.rb +311 -0
- data/lib/ruport/data/record.rb +113 -84
- data/lib/ruport/data/table.rb +275 -174
- data/lib/ruport/formatter.rb +149 -0
- data/lib/ruport/formatter/csv.rb +87 -0
- data/lib/ruport/formatter/html.rb +89 -0
- data/lib/ruport/formatter/pdf.rb +357 -0
- data/lib/ruport/formatter/text.rb +151 -0
- data/lib/ruport/generator.rb +127 -30
- data/lib/ruport/query.rb +46 -99
- data/lib/ruport/renderer.rb +238 -194
- data/lib/ruport/renderer/grouping.rb +67 -0
- data/lib/ruport/renderer/table.rb +25 -98
- data/lib/ruport/report.rb +45 -96
- data/test/acts_as_reportable_test.rb +229 -0
- data/test/csv_formatter_test.rb +97 -0
- data/test/{_test_database.rb → database_test_.rb} +0 -0
- data/test/grouping_test.rb +305 -0
- data/test/html_formatter_test.rb +104 -0
- data/test/pdf_formatter_test.rb +25 -0
- data/test/{test_query.rb → query_test.rb} +32 -121
- data/test/{test_record.rb → record_test.rb} +40 -23
- data/test/renderer_test.rb +344 -0
- data/test/{test_report.rb → report_test.rb} +74 -44
- data/test/samples/ticket_count.csv +124 -0
- data/test/{test_sql_split.rb → sql_split_test.rb} +0 -0
- data/test/{test_table.rb → table_test.rb} +255 -44
- data/test/text_formatter_test.rb +144 -0
- data/util/bench/data/record/bench_as_vs_to.rb +17 -0
- data/util/bench/data/record/bench_constructor.rb +46 -0
- data/util/bench/data/record/bench_indexing.rb +65 -0
- data/util/bench/data/record/bench_reorder.rb +35 -0
- data/util/bench/data/record/bench_to_a.rb +19 -0
- data/util/bench/data/table/bench_column_manip.rb +103 -0
- data/util/bench/data/table/bench_dup.rb +24 -0
- data/util/bench/data/table/bench_init.rb +67 -0
- data/util/bench/data/table/bench_manip.rb +125 -0
- data/util/bench/formatter/bench_csv.rb +14 -0
- data/util/bench/formatter/bench_html.rb +14 -0
- data/util/bench/formatter/bench_pdf.rb +14 -0
- data/util/bench/formatter/bench_text.rb +14 -0
- data/util/bench/samples/tattle.csv +1237 -0
- metadata +121 -143
- data/TODO +0 -21
- data/examples/invoice.rb +0 -142
- data/examples/invoice_report.rb +0 -29
- data/examples/line_graph.rb +0 -38
- data/examples/rope_examples/itunes/config/ruport_config.rb +0 -8
- data/examples/rope_examples/sales_report/config/ruport_config.rb +0 -8
- data/lib/ruport/attempt.rb +0 -63
- data/lib/ruport/config.rb +0 -204
- data/lib/ruport/data/groupable.rb +0 -93
- data/lib/ruport/data/taggable.rb +0 -80
- data/lib/ruport/format.rb +0 -1
- data/lib/ruport/format/csv.rb +0 -29
- data/lib/ruport/format/html.rb +0 -42
- data/lib/ruport/format/latex.rb +0 -47
- data/lib/ruport/format/pdf.rb +0 -233
- data/lib/ruport/format/plugin.rb +0 -31
- data/lib/ruport/format/svg.rb +0 -60
- data/lib/ruport/format/text.rb +0 -103
- data/lib/ruport/format/xml.rb +0 -32
- data/lib/ruport/layout.rb +0 -1
- data/lib/ruport/layout/component.rb +0 -7
- data/lib/ruport/mailer.rb +0 -99
- data/lib/ruport/renderer/graph.rb +0 -46
- data/lib/ruport/report/graph.rb +0 -14
- data/lib/ruport/system_extensions.rb +0 -71
- data/test/test_config.rb +0 -88
- data/test/test_format_text.rb +0 -63
- data/test/test_graph_renderer.rb +0 -97
- data/test/test_groupable.rb +0 -56
- data/test/test_mailer.rb +0 -170
- data/test/test_renderer.rb +0 -151
- data/test/test_ruport.rb +0 -58
- data/test/test_table_renderer.rb +0 -141
- data/test/test_taggable.rb +0 -52
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruport
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-04-
|
6
|
+
version: 0.10.0
|
7
|
+
date: 2007-04-22 00:00:00 -04:00
|
8
8
|
summary: A generalized Ruby report generation and templating engine.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,150 +29,156 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Gregory Brown
|
31
31
|
files:
|
32
|
-
- examples/
|
33
|
-
- examples/
|
34
|
-
- examples/
|
35
|
-
- examples/
|
32
|
+
- examples/rope_examples
|
33
|
+
- examples/ruport_list
|
34
|
+
- examples/simple_pdf_lines.rb
|
35
|
+
- examples/row_renderer.rb
|
36
|
+
- examples/RWEmerson.jpg
|
36
37
|
- examples/line_plotter.rb
|
38
|
+
- examples/centered_pdf_text_box.rb
|
39
|
+
- examples/sample.rb
|
40
|
+
- examples/example.csv
|
37
41
|
- examples/pdf_complex_report.rb
|
38
42
|
- examples/pdf_table_with_title.rb
|
39
|
-
- examples/rope_examples
|
40
|
-
- examples/RWEmerson.jpg
|
41
|
-
- examples/rope_examples/itunes
|
42
43
|
- examples/rope_examples/sales_report
|
43
|
-
- examples/rope_examples/itunes
|
44
|
-
- examples/rope_examples/
|
45
|
-
- examples/rope_examples/
|
46
|
-
- examples/rope_examples/
|
47
|
-
- examples/rope_examples/
|
48
|
-
- examples/rope_examples/itunes/Rakefile
|
49
|
-
- examples/rope_examples/itunes/README
|
50
|
-
- examples/rope_examples/itunes/sql
|
51
|
-
- examples/rope_examples/itunes/templates
|
52
|
-
- examples/rope_examples/itunes/test
|
53
|
-
- examples/rope_examples/itunes/util
|
54
|
-
- examples/rope_examples/itunes/config/ruport_config.rb
|
55
|
-
- examples/rope_examples/itunes/data/mix.txt
|
56
|
-
- examples/rope_examples/itunes/lib/helpers.rb
|
57
|
-
- examples/rope_examples/itunes/lib/init.rb
|
58
|
-
- examples/rope_examples/itunes/lib/reports
|
59
|
-
- examples/rope_examples/itunes/lib/reports.rb
|
60
|
-
- examples/rope_examples/itunes/lib/reports/playlist.rb
|
61
|
-
- examples/rope_examples/itunes/log/ruport.log
|
62
|
-
- examples/rope_examples/itunes/test/test_playlist.rb
|
63
|
-
- examples/rope_examples/itunes/util/build
|
64
|
-
- examples/rope_examples/itunes/util/sql_exec
|
44
|
+
- examples/rope_examples/itunes
|
45
|
+
- examples/rope_examples/sales_report/sql
|
46
|
+
- examples/rope_examples/sales_report/test
|
47
|
+
- examples/rope_examples/sales_report/output
|
48
|
+
- examples/rope_examples/sales_report/log
|
65
49
|
- examples/rope_examples/sales_report/config
|
66
|
-
- examples/rope_examples/sales_report/data
|
67
50
|
- examples/rope_examples/sales_report/lib
|
68
|
-
- examples/rope_examples/sales_report/
|
69
|
-
- examples/rope_examples/sales_report/
|
51
|
+
- examples/rope_examples/sales_report/data
|
52
|
+
- examples/rope_examples/sales_report/util
|
53
|
+
- examples/rope_examples/sales_report/templates
|
70
54
|
- examples/rope_examples/sales_report/Rakefile
|
71
55
|
- examples/rope_examples/sales_report/README
|
72
|
-
- examples/rope_examples/sales_report/
|
73
|
-
- examples/rope_examples/sales_report/
|
74
|
-
- examples/rope_examples/sales_report/
|
75
|
-
- examples/rope_examples/sales_report/
|
76
|
-
- examples/rope_examples/sales_report/config/
|
77
|
-
- examples/rope_examples/sales_report/lib/helpers.rb
|
78
|
-
- examples/rope_examples/sales_report/lib/init.rb
|
56
|
+
- examples/rope_examples/sales_report/test/test_sales.rb
|
57
|
+
- examples/rope_examples/sales_report/output/books.pdf
|
58
|
+
- examples/rope_examples/sales_report/output/books.txt
|
59
|
+
- examples/rope_examples/sales_report/log/ruport.log
|
60
|
+
- examples/rope_examples/sales_report/config/environment.rb
|
79
61
|
- examples/rope_examples/sales_report/lib/reports
|
80
62
|
- examples/rope_examples/sales_report/lib/reports.rb
|
63
|
+
- examples/rope_examples/sales_report/lib/helpers.rb
|
64
|
+
- examples/rope_examples/sales_report/lib/init.rb
|
81
65
|
- examples/rope_examples/sales_report/lib/reports/sales.rb
|
82
|
-
- examples/rope_examples/sales_report/log/ruport.log
|
83
|
-
- examples/rope_examples/sales_report/output/books.pdf
|
84
|
-
- examples/rope_examples/sales_report/output/books.txt
|
85
|
-
- examples/rope_examples/sales_report/test/test_sales.rb
|
86
66
|
- examples/rope_examples/sales_report/util/build
|
87
67
|
- examples/rope_examples/sales_report/util/sql_exec
|
68
|
+
- examples/rope_examples/itunes/sql
|
69
|
+
- examples/rope_examples/itunes/test
|
70
|
+
- examples/rope_examples/itunes/output
|
71
|
+
- examples/rope_examples/itunes/log
|
72
|
+
- examples/rope_examples/itunes/config
|
73
|
+
- examples/rope_examples/itunes/lib
|
74
|
+
- examples/rope_examples/itunes/data
|
75
|
+
- examples/rope_examples/itunes/util
|
76
|
+
- examples/rope_examples/itunes/templates
|
77
|
+
- examples/rope_examples/itunes/Rakefile
|
78
|
+
- examples/rope_examples/itunes/README
|
79
|
+
- examples/rope_examples/itunes/test/test_playlist.rb
|
80
|
+
- examples/rope_examples/itunes/log/ruport.log
|
81
|
+
- examples/rope_examples/itunes/config/environment.rb
|
82
|
+
- examples/rope_examples/itunes/lib/reports
|
83
|
+
- examples/rope_examples/itunes/lib/reports.rb
|
84
|
+
- examples/rope_examples/itunes/lib/helpers.rb
|
85
|
+
- examples/rope_examples/itunes/lib/init.rb
|
86
|
+
- examples/rope_examples/itunes/lib/reports/playlist.rb
|
87
|
+
- examples/rope_examples/itunes/data/mix.txt
|
88
|
+
- examples/rope_examples/itunes/util/build
|
89
|
+
- examples/rope_examples/itunes/util/sql_exec
|
90
|
+
- examples/ruport_list/png_embed.rb
|
91
|
+
- examples/ruport_list/roadmap.png
|
88
92
|
- lib/ruport
|
89
93
|
- lib/ruport.rb
|
90
94
|
- lib/uport.rb
|
91
|
-
- lib/ruport/
|
92
|
-
- lib/ruport/
|
95
|
+
- lib/ruport/formatter
|
96
|
+
- lib/ruport/query
|
97
|
+
- lib/ruport/renderer
|
93
98
|
- lib/ruport/data
|
94
|
-
- lib/ruport/data.rb
|
95
99
|
- lib/ruport/extensions.rb
|
96
|
-
- lib/ruport/
|
97
|
-
- lib/ruport/format.rb
|
98
|
-
- lib/ruport/generator.rb
|
99
|
-
- lib/ruport/layout
|
100
|
-
- lib/ruport/layout.rb
|
101
|
-
- lib/ruport/mailer.rb
|
102
|
-
- lib/ruport/query
|
100
|
+
- lib/ruport/formatter.rb
|
103
101
|
- lib/ruport/query.rb
|
104
|
-
- lib/ruport/
|
102
|
+
- lib/ruport/generator.rb
|
105
103
|
- lib/ruport/renderer.rb
|
106
|
-
- lib/ruport/
|
104
|
+
- lib/ruport/data.rb
|
107
105
|
- lib/ruport/report.rb
|
108
|
-
- lib/ruport/
|
109
|
-
- lib/ruport/
|
110
|
-
- lib/ruport/
|
111
|
-
- lib/ruport/
|
112
|
-
- lib/ruport/
|
113
|
-
- lib/ruport/format/csv.rb
|
114
|
-
- lib/ruport/format/html.rb
|
115
|
-
- lib/ruport/format/latex.rb
|
116
|
-
- lib/ruport/format/pdf.rb
|
117
|
-
- lib/ruport/format/plugin.rb
|
118
|
-
- lib/ruport/format/svg.rb
|
119
|
-
- lib/ruport/format/text.rb
|
120
|
-
- lib/ruport/format/xml.rb
|
121
|
-
- lib/ruport/layout/component.rb
|
106
|
+
- lib/ruport/acts_as_reportable.rb
|
107
|
+
- lib/ruport/formatter/html.rb
|
108
|
+
- lib/ruport/formatter/text.rb
|
109
|
+
- lib/ruport/formatter/pdf.rb
|
110
|
+
- lib/ruport/formatter/csv.rb
|
122
111
|
- lib/ruport/query/sql_split.rb
|
123
|
-
- lib/ruport/renderer/
|
112
|
+
- lib/ruport/renderer/grouping.rb
|
124
113
|
- lib/ruport/renderer/table.rb
|
125
|
-
- lib/ruport/
|
126
|
-
-
|
114
|
+
- lib/ruport/data/record.rb
|
115
|
+
- lib/ruport/data/table.rb
|
116
|
+
- lib/ruport/data/grouping.rb
|
127
117
|
- test/samples
|
128
|
-
- test/
|
129
|
-
- test/
|
130
|
-
- test/
|
131
|
-
- test/
|
132
|
-
- test/
|
133
|
-
- test/
|
134
|
-
- test/
|
135
|
-
- test/
|
136
|
-
- test/
|
137
|
-
- test/
|
138
|
-
- test/
|
139
|
-
- test/
|
140
|
-
- test/
|
141
|
-
- test/
|
142
|
-
- test/samples/
|
118
|
+
- test/acts_as_reportable_test.rb
|
119
|
+
- test/csv_formatter_test.rb
|
120
|
+
- test/record_test.rb
|
121
|
+
- test/database_test_.rb
|
122
|
+
- test/query_test.rb
|
123
|
+
- test/renderer_test.rb
|
124
|
+
- test/html_formatter_test.rb
|
125
|
+
- test/table_test.rb
|
126
|
+
- test/text_formatter_test.rb
|
127
|
+
- test/grouping_test.rb
|
128
|
+
- test/sql_split_test.rb
|
129
|
+
- test/report_test.rb
|
130
|
+
- test/pdf_formatter_test.rb
|
131
|
+
- test/samples/query_test.sql
|
132
|
+
- test/samples/test.yaml
|
133
|
+
- test/samples/erb_test.sql
|
143
134
|
- test/samples/data.csv
|
135
|
+
- test/samples/foo.rtxt
|
144
136
|
- test/samples/data.tsv
|
137
|
+
- test/samples/stonecodeblog.sql
|
138
|
+
- test/samples/ticket_count.csv
|
139
|
+
- test/samples/ruport_test.sql
|
140
|
+
- test/samples/addressbook.csv
|
145
141
|
- test/samples/dates.csv
|
146
142
|
- test/samples/document.xml
|
147
|
-
- test/samples/erb_test.sql
|
148
|
-
- test/samples/foo.rtxt
|
149
|
-
- test/samples/query_test.sql
|
150
|
-
- test/samples/ruport_test.sql
|
151
|
-
- test/samples/stonecodeblog.sql
|
152
143
|
- test/samples/test.sql
|
153
|
-
- test/samples/test.yaml
|
154
144
|
- bin/rope
|
145
|
+
- util/bench/formatter
|
146
|
+
- util/bench/samples
|
147
|
+
- util/bench/data
|
148
|
+
- util/bench/formatter/bench_html.rb
|
149
|
+
- util/bench/formatter/bench_text.rb
|
150
|
+
- util/bench/formatter/bench_pdf.rb
|
151
|
+
- util/bench/formatter/bench_csv.rb
|
152
|
+
- util/bench/samples/tattle.csv
|
153
|
+
- util/bench/data/table
|
154
|
+
- util/bench/data/record
|
155
|
+
- util/bench/data/table/bench_column_manip.rb
|
156
|
+
- util/bench/data/table/bench_init.rb
|
157
|
+
- util/bench/data/table/bench_manip.rb
|
158
|
+
- util/bench/data/table/bench_dup.rb
|
159
|
+
- util/bench/data/record/bench_constructor.rb
|
160
|
+
- util/bench/data/record/bench_reorder.rb
|
161
|
+
- util/bench/data/record/bench_to_a.rb
|
162
|
+
- util/bench/data/record/bench_indexing.rb
|
163
|
+
- util/bench/data/record/bench_as_vs_to.rb
|
155
164
|
- Rakefile
|
156
165
|
- setup.rb
|
157
166
|
- README
|
158
167
|
- LICENSE
|
159
|
-
- TODO
|
160
168
|
- AUTHORS
|
161
169
|
test_files:
|
162
|
-
- test/
|
163
|
-
- test/
|
164
|
-
- test/
|
165
|
-
- test/
|
166
|
-
- test/
|
167
|
-
- test/
|
168
|
-
- test/
|
169
|
-
- test/
|
170
|
-
- test/
|
171
|
-
- test/
|
172
|
-
- test/
|
173
|
-
- test/
|
174
|
-
- test/test_table_renderer.rb
|
175
|
-
- test/test_taggable.rb
|
170
|
+
- test/acts_as_reportable_test.rb
|
171
|
+
- test/csv_formatter_test.rb
|
172
|
+
- test/record_test.rb
|
173
|
+
- test/query_test.rb
|
174
|
+
- test/renderer_test.rb
|
175
|
+
- test/html_formatter_test.rb
|
176
|
+
- test/table_test.rb
|
177
|
+
- test/text_formatter_test.rb
|
178
|
+
- test/grouping_test.rb
|
179
|
+
- test/sql_split_test.rb
|
180
|
+
- test/report_test.rb
|
181
|
+
- test/pdf_formatter_test.rb
|
176
182
|
rdoc_options:
|
177
183
|
- --title
|
178
184
|
- Ruport Documentation
|
@@ -182,7 +188,6 @@ rdoc_options:
|
|
182
188
|
extra_rdoc_files:
|
183
189
|
- README
|
184
190
|
- LICENSE
|
185
|
-
- TODO
|
186
191
|
- AUTHORS
|
187
192
|
executables:
|
188
193
|
- rope
|
@@ -192,22 +197,22 @@ requirements: []
|
|
192
197
|
|
193
198
|
dependencies:
|
194
199
|
- !ruby/object:Gem::Dependency
|
195
|
-
name:
|
200
|
+
name: transaction-simple
|
196
201
|
version_requirement:
|
197
202
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
198
203
|
requirements:
|
199
|
-
- - "
|
204
|
+
- - "="
|
200
205
|
- !ruby/object:Gem::Version
|
201
|
-
version: 1.
|
206
|
+
version: 1.4.0
|
202
207
|
version:
|
203
208
|
- !ruby/object:Gem::Dependency
|
204
|
-
name:
|
209
|
+
name: fastercsv
|
205
210
|
version_requirement:
|
206
211
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
207
212
|
requirements:
|
208
213
|
- - ">="
|
209
214
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
215
|
+
version: 1.1.0
|
211
216
|
version:
|
212
217
|
- !ruby/object:Gem::Dependency
|
213
218
|
name: pdf-writer
|
@@ -218,30 +223,3 @@ dependencies:
|
|
218
223
|
- !ruby/object:Gem::Version
|
219
224
|
version: 1.1.3
|
220
225
|
version:
|
221
|
-
- !ruby/object:Gem::Dependency
|
222
|
-
name: mailfactory
|
223
|
-
version_requirement:
|
224
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
225
|
-
requirements:
|
226
|
-
- - ">="
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
version: 1.2.3
|
229
|
-
version:
|
230
|
-
- !ruby/object:Gem::Dependency
|
231
|
-
name: scruffy
|
232
|
-
version_requirement:
|
233
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
234
|
-
requirements:
|
235
|
-
- - ">="
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
version: 0.2.2
|
238
|
-
version:
|
239
|
-
- !ruby/object:Gem::Dependency
|
240
|
-
name: gem_plugin
|
241
|
-
version_requirement:
|
242
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
243
|
-
requirements:
|
244
|
-
- - ">="
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version: 0.2.2
|
247
|
-
version:
|
data/TODO
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
= TODO
|
2
|
-
|
3
|
-
--
|
4
|
-
|
5
|
-
* fix whitespace
|
6
|
-
|
7
|
-
* table should have record_class constructor
|
8
|
-
|
9
|
-
* logging in util/build.rb?
|
10
|
-
|
11
|
-
* Table#add_row ?
|
12
|
-
|
13
|
-
* Table#col_merge
|
14
|
-
|
15
|
-
* Table#join
|
16
|
-
|
17
|
-
--
|
18
|
-
|
19
|
-
- Any future plans are available on Ruport's Trac website
|
20
|
-
|
21
|
-
http://stonecode.svnrepository.com/ruport/trac.cgi
|
data/examples/invoice.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
module Ruport
|
2
|
-
module Extensions
|
3
|
-
class Invoice < Ruport::Renderer
|
4
|
-
|
5
|
-
include Renderer::Helpers
|
6
|
-
|
7
|
-
required_option :customer_info
|
8
|
-
required_option :company_info
|
9
|
-
required_option :order_info
|
10
|
-
option :title
|
11
|
-
required_option :comments
|
12
|
-
|
13
|
-
stage :invoice_headers
|
14
|
-
stage :invoice_body
|
15
|
-
stage :invoice_footer
|
16
|
-
|
17
|
-
finalize :invoice
|
18
|
-
|
19
|
-
module InvoiceHelpers
|
20
|
-
def build_company_header
|
21
|
-
@tod = pdf_writer.y
|
22
|
-
text_box(options.company_info)
|
23
|
-
end
|
24
|
-
|
25
|
-
def build_customer_header
|
26
|
-
move_cursor -10
|
27
|
-
text_box(options.customer_info)
|
28
|
-
end
|
29
|
-
|
30
|
-
def build_title
|
31
|
-
add_title(options.title) if options.title
|
32
|
-
end
|
33
|
-
|
34
|
-
def add_title( title )
|
35
|
-
rounded_text_box("<b>#{title}</b>") do |o|
|
36
|
-
o.fill_color = Color::RGB::Gray80
|
37
|
-
o.radius = 5
|
38
|
-
o.width = layout.header_width || 200
|
39
|
-
o.height = layout.header_height || 20
|
40
|
-
o.font_size = layout.header_font_size || 11
|
41
|
-
o.x = pdf_writer.absolute_right_margin - o.width
|
42
|
-
o.y = pdf_writer.absolute_top_margin
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def build_order_header
|
47
|
-
if options.order_info
|
48
|
-
rounded_text_box("<b>#{options.order_info}</b>") do |o|
|
49
|
-
o.radius = 5
|
50
|
-
o.heading = "Billing Information"
|
51
|
-
o.width = layout.header_width || 200
|
52
|
-
o.height = layout.header_height || 80
|
53
|
-
o.font_size = layout.header_font_size || 10
|
54
|
-
o.x = pdf_writer.absolute_right_margin - o.width
|
55
|
-
o.y = pdf_writer.absolute_top_margin - 25
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def text_box(content,opts={})
|
61
|
-
::PDF::SimpleTable.new do |table|
|
62
|
-
table.data = content.to_a.inject([]) do |s,line|
|
63
|
-
s << { "value" => line, }
|
64
|
-
end
|
65
|
-
|
66
|
-
table.column_order = "value"
|
67
|
-
table.show_headings = false
|
68
|
-
table.show_lines = :outer
|
69
|
-
table.shade_rows = :none
|
70
|
-
table.width = opts[:width] || 200
|
71
|
-
table.orientation = opts[:orientation] || :right
|
72
|
-
table.position = opts[:position] || :left
|
73
|
-
table.font_size = opts[:font_size] || 10
|
74
|
-
table.render_on(pdf_writer)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
class PDF < Ruport::Format::PDF
|
80
|
-
|
81
|
-
include InvoiceHelpers
|
82
|
-
Invoice.add_format self, :pdf
|
83
|
-
|
84
|
-
def build_invoice_headers
|
85
|
-
build_company_header
|
86
|
-
build_customer_header
|
87
|
-
build_title
|
88
|
-
build_order_header
|
89
|
-
end
|
90
|
-
|
91
|
-
def build_invoice_body
|
92
|
-
|
93
|
-
pdf_writer.start_page_numbering(500,20,8,:right)
|
94
|
-
pdf_writer.y = 550
|
95
|
-
|
96
|
-
Ruport::Renderer::Table.render_pdf { |r|
|
97
|
-
r.data = data
|
98
|
-
r.plugin.pdf_writer = pdf_writer
|
99
|
-
r.layout.table_width = layout.body_width || 450
|
100
|
-
}
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
def build_invoice_footer
|
105
|
-
# footer
|
106
|
-
pdf_writer.open_object do |footer|
|
107
|
-
pdf_writer.save_state
|
108
|
-
pdf_writer.stroke_color! Color::RGB::Black
|
109
|
-
pdf_writer.stroke_style! ::PDF::Writer::StrokeStyle::DEFAULT
|
110
|
-
if options.comments
|
111
|
-
pdf_writer.y -= 20
|
112
|
-
text_box options.comments,
|
113
|
-
:position => layout.comments_position || 110,
|
114
|
-
:width => layout.comments_width || 400,
|
115
|
-
:font_size => layout.comments_font_size || 14,
|
116
|
-
:orientation => layout.comments_orientation
|
117
|
-
end
|
118
|
-
pdf_writer.add_text_wrap( 50, 20, 200, "Generated at " +
|
119
|
-
Time.now.strftime(options.date_format || "%H:%M %Y-%m-%d"), 8)
|
120
|
-
|
121
|
-
pdf_writer.restore_state
|
122
|
-
pdf_writer.close_object
|
123
|
-
pdf_writer.add_object(footer, :all_pages)
|
124
|
-
end
|
125
|
-
pdf_writer.stop_page_numbering(true, :current)
|
126
|
-
end
|
127
|
-
|
128
|
-
def finalize_invoice
|
129
|
-
output << pdf_writer.render
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
module Ruport::Report::Invoice
|
138
|
-
def render_invoice(&block)
|
139
|
-
Ruport::Extensions::Invoice.render_pdf(&block)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|