appraisermetrics_report_service 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76209e93e69b409b9e9c24ceca2dac133599adfd
4
- data.tar.gz: 6183ca92a72da04e99b70000f7591fb37160407d
3
+ metadata.gz: 1636e2ee5c97a81021794dc71ac8c49956ecc06e
4
+ data.tar.gz: 5bb6f84f088ae66e32edcb84c414d6169309e492
5
5
  SHA512:
6
- metadata.gz: 58082fe0e600d82681f7db4f2614f9ba4fb4f5f0833fa383607b61fb467150996a6f1eaa390324d194569198d28799f77d291651af7dbc67294f99bf1562531b
7
- data.tar.gz: ece0f82c35142dad2dc552e91e322cd03c957baafbac720aaa1a61a7f4cbdbd2d7702083262595e2c75a189e5304d239c729d601f9adf29972c19bb2aab3fb81
6
+ metadata.gz: 3393a08515e9e51bfb30c9cd0a31c884ec9ab2317f0b78a01e75202aeaccb77016e55936d90da05089986d9cf4ebe6d47a94b8c83866ebd94161290f2bbee59f
7
+ data.tar.gz: 3a1c7e7b48d80261efbf458ef4c1b70890c2f077eb69aff4a849dba13c33c3d931513bb409dcb8c1f0ab6f3d20a064b6a16739b25a422a23edf10155d13f7776
@@ -1,3 +1,3 @@
1
1
  module AppraisermetricsReportService
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -6,4 +6,5 @@ module AppraisermetricsReportService
6
6
  require 'report_utils'
7
7
  require 'closed_sale'
8
8
  require 'eval_report'
9
- end
9
+ end
10
+ I18n.enforce_available_locales = false
data/lib/closed_sale.rb CHANGED
@@ -10,7 +10,7 @@ class ClosedSale < Prawn::Document
10
10
  end
11
11
 
12
12
  def write_content(report_doc, images, office_logo) # the call to add content to pdf
13
- font_size 6
13
+ font_size 7
14
14
  @rep = report_doc
15
15
  @property_images = images
16
16
  @office_logo = office_logo
@@ -19,6 +19,7 @@ class ClosedSale < Prawn::Document
19
19
 
20
20
  # render office logo image if present
21
21
  stroke_bounds
22
+ move_down 10
22
23
  render_logo
23
24
 
24
25
  # rendering tables
@@ -30,7 +31,7 @@ class ClosedSale < Prawn::Document
30
31
  property_class
31
32
  end
32
33
 
33
- move_down 45
34
+ move_down 5
34
35
  stroke_horizontal_rule
35
36
  move_down 5
36
37
  float do
@@ -42,7 +43,7 @@ class ClosedSale < Prawn::Document
42
43
  transaction_summary
43
44
  end
44
45
 
45
- move_down 45
46
+ move_down 25
46
47
  stroke_horizontal_rule
47
48
  move_down 5
48
49
  float do
@@ -53,7 +54,7 @@ class ClosedSale < Prawn::Document
53
54
  physical_overview
54
55
  end
55
56
 
56
- move_down 45
57
+ move_down 15
57
58
  stroke_horizontal_rule
58
59
  move_down 5
59
60
  float do
@@ -63,10 +64,12 @@ class ClosedSale < Prawn::Document
63
64
  indent(270) do
64
65
  income_expense
65
66
  end
66
- cursor_pos = cursor
67
- stroke_line [270, 720], [270, cursor_pos]
68
67
 
69
- start_new_page
68
+ stroke_line [270, 720], [270, 0]
69
+
70
+ if page_count == 1
71
+ start_new_page
72
+ end
70
73
 
71
74
  ## page 2 ##
72
75
  stroke_horizontal_rule
@@ -79,55 +82,58 @@ class ClosedSale < Prawn::Document
79
82
  indent(270) do
80
83
  legal_transaction
81
84
  end
82
- move_down 45
85
+
86
+ # stroke boundary line
87
+ stroke_line [270, 720], [270, cursor]
88
+ move_down 30
83
89
  stroke_horizontal_rule
84
90
  move_down 5
85
91
  # move to full width table
86
92
  if @rep[:transactions] && @rep[:transactions].any?
87
93
  transaction_history
88
- move_down 45
94
+ move_down 30
89
95
  stroke_horizontal_rule
90
96
  move_down 5
91
97
  end
92
98
 
93
99
  if @rep[:utilities] && @rep[:utilities].any?
94
100
  utilities
95
- move_down 45
101
+ move_down 30
96
102
  stroke_horizontal_rule
97
103
  move_down 5
98
104
  end
99
105
 
100
106
  if @rep[:improvements] && @rep[:improvements].any?
101
107
  improvements
102
- move_down 45
108
+ move_down 30
103
109
  stroke_horizontal_rule
104
110
  move_down 5
105
111
  end
106
112
 
107
113
  if @rep[:waterrights] && @rep[:waterrights].any?
108
114
  water_rights
109
- move_down 45
115
+ move_down 30
110
116
  stroke_horizontal_rule
111
117
  move_down 5
112
118
  end
113
119
 
114
120
  if @rep[:waterdistributions] && @rep[:waterdistributions].any?
115
121
  water_distribution
116
- move_down 45
122
+ move_down 30
117
123
  stroke_horizontal_rule
118
124
  move_down 5
119
125
  end
120
126
 
121
127
  if @rep[:crops] && @rep[:crops].any?
122
128
  crop_yield
123
- move_down 45
129
+ move_down 30
124
130
  stroke_horizontal_rule
125
131
  move_down 5
126
132
  end
127
133
 
128
134
  if @rep[:estimatedproductivity] && @rep[:estimatedproductivity].any?
129
135
  estimated_productivity
130
- move_down 45
136
+ move_down 30
131
137
  stroke_horizontal_rule
132
138
  move_down 5
133
139
  end
@@ -137,7 +143,7 @@ class ClosedSale < Prawn::Document
137
143
 
138
144
  if @rep[:plantings] && @rep[:plantings].any?
139
145
  perm_plantings
140
- move_down 45
146
+ move_down 30
141
147
  stroke_horizontal_rule
142
148
  move_down 5
143
149
  end
@@ -153,7 +159,7 @@ class ClosedSale < Prawn::Document
153
159
 
154
160
  def render_logo
155
161
  if @office_logo
156
- image @office_logo, height: 25
162
+ image @office_logo, height: 35
157
163
  end
158
164
  end
159
165
 
@@ -179,6 +185,13 @@ class ClosedSale < Prawn::Document
179
185
  else
180
186
  text "No Image"
181
187
  end
188
+
189
+ table([["Property Location and Directions:"], ["#{@rep[:directions_or_ownership_comments]}"]]) do
190
+ cells.padding = [1, 2.5]
191
+ cells.style(border_width: 0)
192
+ column(0).width = 270
193
+ row(0).style(align: :center, background_color: 'd7d7d7', font_style: :bold)
194
+ end
182
195
  end
183
196
 
184
197
  def land_classification
@@ -243,7 +256,7 @@ class ClosedSale < Prawn::Document
243
256
  columns(1..3).style(align: :right)
244
257
  cells.style(border_width: 0)
245
258
  cells.padding = [1, 2.5]
246
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
259
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
247
260
  row(1).style(align: :right, font_style: :bold, border_bottom_width: 0.5)
248
261
  row(-3).style(border_bottom_width: 0.5, font_style: :bold)
249
262
  end
@@ -277,7 +290,7 @@ class ClosedSale < Prawn::Document
277
290
  columns(2..3).width = 67
278
291
  columns(1..3).style(align: :right, font_style: :bold)
279
292
  column(0).style(align: :left, font_style: :bold)
280
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, border_top_width: 0.5)
293
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, border_top_width: 0.5)
281
294
  cells.style(border_width: 0)
282
295
  row(1).style(border_bottom_width: 0.5, align: :center, font_style: nil)
283
296
  cells.padding = [1, 2.5]
@@ -295,7 +308,7 @@ class ClosedSale < Prawn::Document
295
308
  column(0).width = 270
296
309
  cells.padding = [1, 2.5]
297
310
  cells.style(border_width: 0)
298
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
311
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
299
312
  end
300
313
  end
301
314
 
@@ -333,8 +346,7 @@ class ClosedSale < Prawn::Document
333
346
  ["City:", "#{@rep[:city]}", "County:", "#{@rep[:ordinance_authority]}"],
334
347
  ["State:", "#{@rep[:county_state]}".strip.split('').last(2).join(""), "Zip Code:", "#{@rep[:zip_code]}"],
335
348
  ["Township/Range:","#{@rep[:townshipINT]}" + "#{@rep[:rangeINT]}", "Section(s):", "#{@rep[:legal_description]}"],
336
- ["Latitude:", lat, "Longitude:", long],
337
- [{content: "Property Location and Directions:" + "#{@rep[:directions_or_ownership_comments]}", colspan: 4}]
349
+ ["Latitude:", lat, "Longitude:", long]
338
350
  ]
339
351
 
340
352
  table(type_and_address_data) do
@@ -344,7 +356,7 @@ class ClosedSale < Prawn::Document
344
356
  columns([1, 3]).style(font_style: :bold)
345
357
  cells.padding = [1, 2.5]
346
358
  cells.style(border_width: 0)
347
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
359
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
348
360
  end
349
361
  end
350
362
 
@@ -372,7 +384,7 @@ class ClosedSale < Prawn::Document
372
384
  cells.padding = [1, 2.5]
373
385
  cells.style(border_width: 0)
374
386
  columns([1, 3]).style(font_style: :bold)
375
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
387
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
376
388
  end
377
389
  end
378
390
 
@@ -398,8 +410,9 @@ class ClosedSale < Prawn::Document
398
410
  columns([1, 3]).style(font_style: :bold)
399
411
  cells.padding = [1, 2.5]
400
412
  cells.style(border_width: 0)
401
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
413
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
402
414
  row(9).style(align: :left)
415
+ row(-1).style(align: :left)
403
416
  end
404
417
  end
405
418
 
@@ -429,7 +442,7 @@ class ClosedSale < Prawn::Document
429
442
  cells.padding = [1, 2.5]
430
443
  cells.style(border_width: 0)
431
444
  columns([1, 3]).style(font_style: :bold)
432
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
445
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
433
446
  row([5, 6]).style(align: :left)
434
447
  end
435
448
  end
@@ -464,7 +477,7 @@ class ClosedSale < Prawn::Document
464
477
  columns([1, 3]).style(font_style: :bold)
465
478
  cells.padding = [1, 2.5]
466
479
  cells.style(border_width: 0)
467
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
480
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
468
481
  end
469
482
  end
470
483
 
@@ -491,7 +504,7 @@ class ClosedSale < Prawn::Document
491
504
  columns(0..3).style(align: :right, font_style: :bold)
492
505
  cells.padding = [1, 2.5]
493
506
  cells.style(border_width: 0)
494
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
507
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
495
508
  row(1).style(border_bottom_width: 0.5, font_style: nil)
496
509
  end
497
510
  end
@@ -518,7 +531,7 @@ class ClosedSale < Prawn::Document
518
531
  columns(0..3).style(align: :right, font_style: :bold)
519
532
  cells.padding = [1, 2.5]
520
533
  cells.style(border_width: 0)
521
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
534
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
522
535
  row(1).style(border_bottom_width: 0.5, font_style: nil)
523
536
  end
524
537
  end
@@ -531,7 +544,7 @@ class ClosedSale < Prawn::Document
531
544
  table(sorted_array) do
532
545
  columns(0..7).width = 67.5
533
546
  columns(1..7).style(font_style: :bold)
534
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
547
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
535
548
  cells.padding = [1, 2.5]
536
549
  cells.style(border_width: 0)
537
550
  row(1).style(border_bottom_width: 0.5, font_style: nil)
@@ -558,7 +571,7 @@ class ClosedSale < Prawn::Document
558
571
  table(water_rights_data) do
559
572
  columns(0..7).width = 67.5
560
573
  columns(0..7).style(font_style: :bold)
561
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
574
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
562
575
  cells.padding = [1, 2.5]
563
576
  cells.style(border_width: 0)
564
577
  row(1).style(border_bottom_width: 0.5, font_style: nil)
@@ -586,7 +599,7 @@ class ClosedSale < Prawn::Document
586
599
  table(distribution_data) do
587
600
  columns(0..7).width = 67.5
588
601
  columns(0..7).style(font_style: :bold)
589
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
602
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
590
603
  cells.padding = [1, 2.5]
591
604
  cells.style(border_width: 0)
592
605
  row(1).style(border_bottom_width: 0.5, font_style: nil)
@@ -615,7 +628,7 @@ class ClosedSale < Prawn::Document
615
628
  column(0).width = 135
616
629
  columns(1..6).width = 67.5
617
630
  columns(0..6).style(font_style: :bold)
618
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
631
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
619
632
  cells.padding = [1, 2.5]
620
633
  cells.style(border_width: 0)
621
634
  row(1).style(border_bottom_width: 0.5, font_style: nil)
@@ -643,7 +656,7 @@ class ClosedSale < Prawn::Document
643
656
  columns(0..3).style(font_style: :bold)
644
657
  cells.padding = [1, 2.5]
645
658
  cells.style(border_width: 0)
646
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
659
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
647
660
  row(1).style(border_bottom_width: 0.5, font_style: nil)
648
661
  end
649
662
  end
@@ -669,7 +682,7 @@ class ClosedSale < Prawn::Document
669
682
  table(planting_data) do
670
683
  columns(0..7).width = 67.5
671
684
  columns(0..7).style(font_style: :bold)
672
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
685
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
673
686
  cells.padding = [1, 2.5]
674
687
  cells.style(border_width: 0)
675
688
  row(1).style(border_bottom_width: 0.5, font_style: nil)
@@ -681,14 +694,14 @@ class ClosedSale < Prawn::Document
681
694
  table(extern_data) do
682
695
  columns(0..3).width = 135
683
696
  columns([1, 3]).style(font_style: :bold)
684
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
697
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
685
698
  cells.padding = [1, 2.5]
686
699
  cells.style(border_width: 0)
687
700
  end
688
701
  end
689
702
 
690
703
  def additional_images
691
- if @property_images && @property_images.any?
704
+ if @property_images && @property_images.count > 1
692
705
  start_new_page
693
706
  if @property_images[1]
694
707
  bounding_box([0, 690], height: 330, width: 250) do
@@ -715,15 +728,5 @@ class ClosedSale < Prawn::Document
715
728
  end
716
729
  end
717
730
  end
718
- end
719
-
720
- # misc. notes
721
-
722
- # the first page of the report is split into two columns using bounding boxes, each is 270 p wide
723
731
 
724
- ##### tables ######
725
- # - 4 column layout [68, 67, 67, 68]
726
- # - 3 column tables can be used if needed [90, 90, 90]
727
- # - 2 column layout [135, 135]
728
- # - for dynamic layouts within an existing layout, pass colspan and content to data array like so:
729
- # - {content: "double span", colspan: 2} => spans two columns with content
732
+ end
data/lib/eval_report.rb CHANGED
@@ -448,7 +448,7 @@ class EvalReport < Prawn::Document
448
448
  cells.style(border_width: 0)
449
449
  cells.padding = [1, 2.5]
450
450
  row(0).style(align: :center, font_style: :bold, border_bottom_width: 0.5)
451
- column(0).style(align: :right)
451
+ column(0).style(align: :center)
452
452
  end
453
453
 
454
454
  stroke_bounds
@@ -663,19 +663,58 @@ class EvalReport < Prawn::Document
663
663
  end
664
664
 
665
665
  def property_features # container method to create various tables
666
- font_size 6
667
- transaction_history
668
- utilities
669
- improvements
670
- water_rights
671
- water_distribution
666
+ font_size 7
667
+ stroke_bounds
668
+ if @sub[:transactions] && @sub[:transactions].any?
669
+ transaction_history
670
+ move_down 15
671
+ stroke_horizontal_rule
672
+ move_down 5
673
+ end
674
+
675
+ if @sub[:utilities] && @sub[:utilities].any?
676
+ utilities
677
+ move_down 15
678
+ stroke_horizontal_rule
679
+ move_down 5
680
+ end
681
+
682
+ if @sub[:improvements] && @sub[:improvements].any?
683
+ improvements
684
+ move_down 15
685
+ stroke_horizontal_rule
686
+ move_down 5
687
+ end
688
+
689
+ if @sub[:waterrights] && @sub[:waterrights].any?
690
+ water_rights
691
+ move_down 15
692
+ stroke_horizontal_rule
693
+ move_down 5
694
+ end
695
+
696
+ if @sub[:waterdistributions] && @sub[:waterdistributions].any?
697
+ water_distribution
698
+ move_down 15
699
+ stroke_horizontal_rule
700
+ move_down 5
701
+ end
672
702
 
673
- start_new_page
703
+ if @sub[:crops] && @sub[:crops].any?
704
+ crop_yield
705
+ move_down 15
706
+ stroke_horizontal_rule
707
+ move_down 5
708
+ end
674
709
 
675
- crop_yield
676
- perm_plantings
677
- externalities
710
+ if @sub[:plantings] && @sub[:plantings].any?
711
+ perm_plantings
712
+ move_down 15
713
+ stroke_horizontal_rule
714
+ move_down 5
715
+ end
678
716
 
717
+ externalities
679
718
  start_new_page
680
719
  font_size 11
681
720
  end
@@ -1052,231 +1091,197 @@ class EvalReport < Prawn::Document
1052
1091
 
1053
1092
  # table methods for the property_features_method
1054
1093
  def transaction_history
1055
- bounding_box([0, 700], height: 135, width: 540) do
1056
- transaction_history_data = [
1057
- [{content: "Transaction History", colspan: 4}],
1058
- ["Historic Transaction Type", "Transaction Description", "Date", "Sale Price, List Price, or List Price"]
1059
- ]
1094
+ transaction_history_data = [
1095
+ [{content: "Transaction History", colspan: 4}],
1096
+ ["Historic Transaction Type", "Transaction Description", "Date", "Sale Price, List Price, or List Price"]
1097
+ ]
1060
1098
 
1061
- transactions = @sub[:historyrecords]
1099
+ transactions = @sub[:historyrecords]
1062
1100
 
1063
- if transactions # node could be nil
1064
- transactions.each do |t|
1065
- if t # array could be nil
1066
- transaction_history_data.push(
1067
- ["#{t[:transType]}", "#{t[:transDescr]}", datemaker(t[:transDate]), moneymaker(t[:price], true)]
1068
- )
1069
- end
1101
+ if transactions # node could be nil
1102
+ transactions.each do |t|
1103
+ if t # array could be nil
1104
+ transaction_history_data.push(
1105
+ ["#{t[:transType]}", "#{t[:transDescr]}", datemaker(t[:transDate]), moneymaker(t[:price], true)]
1106
+ )
1070
1107
  end
1071
1108
  end
1109
+ end
1072
1110
 
1073
- table(transaction_history_data) do
1074
- columns(0..3).width = 135
1075
- columns(0..3).style(align: :right, font_style: :bold)
1076
- cells.padding = [1, 2.5]
1077
- cells.style(border_width: 0)
1078
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1079
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1080
- end
1081
- stroke_bounds
1111
+ table(transaction_history_data) do
1112
+ columns(0..3).width = 135
1113
+ columns(0..3).style(align: :right, font_style: :bold)
1114
+ cells.padding = [1, 2.5]
1115
+ cells.style(border_width: 0)
1116
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1117
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1082
1118
  end
1083
1119
  end
1084
1120
 
1085
1121
  def utilities
1086
- bounding_box([0, 565], height: 120, width: 540) do
1087
- utilities_data = [
1088
- [{content: "Description of Utilities", colspan: 4}],
1089
- ["Utility Description", "Service Availability", "Service Provider", "Comments"]
1090
- ]
1122
+ utilities_data = [
1123
+ [{content: "Description of Utilities", colspan: 4}],
1124
+ ["Utility Description", "Service Availability", "Service Provider", "Comments"]
1125
+ ]
1091
1126
 
1092
- utilities = @sub[:utilities]
1093
- if utilities # node could be nil
1094
- utilities.each do |u|
1095
- if u # array could be empty
1096
- utilities_data.push(
1097
- ["#{u[:description]}", "#{u[:availability]}", "#{u[:provider]}", "#{u[:comments]}"]
1098
- )
1099
- end
1127
+ utilities = @sub[:utilities]
1128
+ if utilities # node could be nil
1129
+ utilities.each do |u|
1130
+ if u # array could be empty
1131
+ utilities_data.push(
1132
+ ["#{u[:description]}", "#{u[:availability]}", "#{u[:provider]}", "#{u[:comments]}"]
1133
+ )
1100
1134
  end
1101
1135
  end
1136
+ end
1102
1137
 
1103
- table(utilities_data) do
1104
- columns(0..3).width = 135
1105
- columns(0..3).style(align: :right, font_style: :bold)
1106
- cells.padding = [1, 2.5]
1107
- cells.style(border_width: 0)
1108
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1109
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1110
- end
1111
- stroke_bounds
1138
+ table(utilities_data) do
1139
+ columns(0..3).width = 135
1140
+ columns(0..3).style(align: :right, font_style: :bold)
1141
+ cells.padding = [1, 2.5]
1142
+ cells.style(border_width: 0)
1143
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1144
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1112
1145
  end
1113
- # no new page
1114
1146
  end
1115
1147
 
1116
1148
  def improvements
1117
- bounding_box([0, 445], height: 220, width: 540) do
1118
-
1119
- improvements_array = @sub[:improvements]
1120
-
1121
- sorted_array = flip_improvements_array(improvements_array)
1149
+ improvements_array = @sub[:improvements]
1150
+
1151
+ sorted_array = flip_improvements_array(improvements_array)
1122
1152
 
1123
- table(sorted_array) do
1124
- columns(0..7).width = 67.5
1125
- columns(1..7).style(font_style: :bold)
1126
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1127
- cells.padding = [1, 2.5]
1128
- cells.style(border_width: 0, font_size: 6)
1129
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1130
- end
1131
- stroke_bounds
1132
- end
1153
+ table(sorted_array) do
1154
+ columns(0..7).width = 67.5
1155
+ columns(1..7).style(font_style: :bold)
1156
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1157
+ cells.padding = [1, 2.5]
1158
+ cells.style(border_width: 0)
1159
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1160
+ end
1133
1161
  # no new page
1134
1162
  end
1135
1163
 
1136
1164
  def water_rights
1137
- bounding_box([0, 225], height: 115, width: 540) do
1138
-
1139
- water_rights_data = [
1140
- [{content: "Water Rights", colspan: 8}],
1141
- ["Water Right No.", "Water Right", "Water Source", "Priority Date", "Beneficial Use", "No. Acres Irrigated", "Annual Volume Ac-Ft", "Period of Use"]
1142
- ]
1165
+ water_rights_data = [
1166
+ [{content: "Water Rights", colspan: 8}],
1167
+ ["Water Right No.", "Water Right", "Water Source", "Priority Date", "Beneficial Use", "No. Acres Irrigated", "Annual Volume Ac-Ft", "Period of Use"]
1168
+ ]
1143
1169
 
1144
- rights = @sub[:waterrights]
1145
- if rights # node could be nil
1146
- rights.each do |r|
1147
- if r # array could be empty
1148
- water_rights_data.push(
1149
- ["#{r[:waterrightNum]}", "#{r[:waterRight]}", "#{r[:waterSrc]}", datemaker(r[:priorityDate]), "#{r[:purpose]}", "#{r[:numIrrAcres]}", "#{r[:annVolume]}"]
1150
- )
1151
- end
1170
+ rights = @sub[:waterrights]
1171
+ if rights # node could be nil
1172
+ rights.each do |r|
1173
+ if r # array could be empty
1174
+ water_rights_data.push(
1175
+ ["#{r[:waterrightNum]}", "#{r[:waterRight]}", "#{r[:waterSrc]}", datemaker(r[:priorityDate]), "#{r[:purpose]}", "#{r[:numIrrAcres]}", "#{r[:annVolume]}"]
1176
+ )
1152
1177
  end
1153
1178
  end
1179
+ end
1154
1180
 
1155
- table(water_rights_data) do
1156
- columns(0..7).width = 67.5
1157
- columns(0..7).style(font_style: :bold)
1158
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1159
- cells.padding = [1, 2.5]
1160
- cells.style(border_width: 0)
1161
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1162
- end
1163
-
1164
- stroke_bounds
1181
+ table(water_rights_data) do
1182
+ columns(0..7).width = 67.5
1183
+ columns(0..7).style(font_style: :bold)
1184
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1185
+ cells.padding = [1, 2.5]
1186
+ cells.style(border_width: 0)
1187
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1165
1188
  end
1166
1189
  # no new page
1167
1190
  end
1168
1191
 
1169
1192
  def water_distribution
1170
- bounding_box([0, 110], height: 110, width: 540) do
1171
-
1172
- distribution_data = [
1173
- [{content: "Water Distribution System", colspan: 8}],
1174
- ["Water Distrib. Equip.", "Manuf.", "Make/Brand", "Type", "Description", "Yr. Manufactured", "Remaining Ec. Life", "No. Acres Irrigated"]
1175
- ]
1193
+ distribution_data = [
1194
+ [{content: "Water Distribution System", colspan: 8}],
1195
+ ["Water Distrib. Equip.", "Manuf.", "Make/Brand", "Type", "Description", "Yr. Manufactured", "Remaining Ec. Life", "No. Acres Irrigated"]
1196
+ ]
1176
1197
 
1177
- distributions = @sub[:waterdistributions]
1198
+ distributions = @sub[:waterdistributions]
1178
1199
 
1179
- if distributions # node could be nil
1180
- distributions.each do |d|
1181
- if d # array could be empty
1182
- distribution_data.push(
1183
- ["#{d[:waterdistrEq]}", "#{d[:manufacturer]}", "#{d[:brand]}", "#{d[:eqType]}", "#{d[:descr]}", "#{d[:yearManuf]}", "#{d[:remainingEcLife]}", "#{d[:irrAcres]}"]
1184
- )
1185
- end
1200
+ if distributions # node could be nil
1201
+ distributions.each do |d|
1202
+ if d # array could be empty
1203
+ distribution_data.push(
1204
+ ["#{d[:waterdistrEq]}", "#{d[:manufacturer]}", "#{d[:brand]}", "#{d[:eqType]}", "#{d[:descr]}", "#{d[:yearManuf]}", "#{d[:remainingEcLife]}", "#{d[:irrAcres]}"]
1205
+ )
1186
1206
  end
1187
1207
  end
1208
+ end
1188
1209
 
1189
- table(distribution_data) do
1190
- columns(0..7).width = 67.5
1191
- columns(0..7).style(font_style: :bold)
1192
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1193
- cells.padding = [1, 2.5]
1194
- cells.style(border_width: 0)
1195
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1196
- end
1197
-
1198
- stroke_bounds
1210
+ table(distribution_data) do
1211
+ columns(0..7).width = 67.5
1212
+ columns(0..7).style(font_style: :bold)
1213
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1214
+ cells.padding = [1, 2.5]
1215
+ cells.style(border_width: 0)
1216
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1199
1217
  end
1200
1218
  end
1201
1219
 
1202
1220
  def crop_yield
1203
- bounding_box([0, 700], height: 100, width: 540) do
1204
-
1205
- crops = @sub[:crops]
1221
+ crops = @sub[:crops]
1206
1222
 
1207
- crop_data = [
1208
- [{content: "Crop Yield Summary", colspan: 7}],
1209
- ["Crop Year", "Commodity Identified", "Unit of Measure", "Average Yield", " ", " ", ", "]
1210
- ]
1223
+ crop_data = [
1224
+ [{content: "Crop Yield Summary", colspan: 7}],
1225
+ ["Crop Year", "Commodity Identified", "Unit of Measure", "Average Yield", " ", " ", ", "]
1226
+ ]
1211
1227
 
1212
- if crops # node could be nil
1213
- crops.each do |c|
1214
- if c # array could be empty
1215
- crop_data.push(
1216
- ["#{c[:year]}", "#{c[:commodity]}", "#{c[:unit]}", "#{c[:avgyield]}"]
1217
- )
1218
- end
1228
+ if crops # node could be nil
1229
+ crops.each do |c|
1230
+ if c # array could be empty
1231
+ crop_data.push(
1232
+ ["#{c[:year]}", "#{c[:commodity]}", "#{c[:unit]}", "#{c[:avgyield]}"]
1233
+ )
1219
1234
  end
1220
1235
  end
1236
+ end
1221
1237
 
1222
- table(crop_data) do
1223
- column(0).width = 135
1224
- columns(1..6).width = 67.5
1225
- columns(0..6).style(font_style: :bold)
1226
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1227
- cells.padding = [1, 2.5]
1228
- cells.style(border_width: 0)
1229
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1230
- end
1231
- stroke_bounds
1238
+ table(crop_data) do
1239
+ column(0).width = 135
1240
+ columns(1..6).width = 67.5
1241
+ columns(0..6).style(font_style: :bold)
1242
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1243
+ cells.padding = [1, 2.5]
1244
+ cells.style(border_width: 0)
1245
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1232
1246
  end
1233
1247
  end
1234
1248
 
1235
1249
  def perm_plantings
1236
- bounding_box([0, 600], height: 150, width: 540) do
1237
- planting_data = [
1238
- [{content: "Permanent Plantings", colspan: 8}],
1239
- ["Planting", "Variety", "Ac. Type", "No. of Acres", "Average Age", "Plants/Acre", "Unit Description", "Average Yield"]
1240
- ]
1250
+ planting_data = [
1251
+ [{content: "Permanent Plantings", colspan: 8}],
1252
+ ["Planting", "Variety", "Ac. Type", "No. of Acres", "Average Age", "Plants/Acre", "Unit Description", "Average Yield"]
1253
+ ]
1241
1254
 
1242
- plantings = @sub[:plantings]
1255
+ plantings = @sub[:plantings]
1243
1256
 
1244
- if plantings # node could be nil
1245
- plantings.each do |p|
1246
- if p # array could be empty
1247
- planting_data.push(
1248
- ["#{p[:planting]}", "#{p[:variety]}", "#{p[:acres]}", "#{p[:numacres]}", "#{p[:avgage]}", "#{p[:plantsacre]}", "#{p[:unitdescr1]}", "#{p[:avgproduction]}"]
1249
- )
1250
- end
1257
+ if plantings # node could be nil
1258
+ plantings.each do |p|
1259
+ if p # array could be empty
1260
+ planting_data.push(
1261
+ ["#{p[:planting]}", "#{p[:variety]}", "#{p[:acres]}", "#{p[:numacres]}", "#{p[:avgage]}", "#{p[:plantsacre]}", "#{p[:unitdescr1]}", "#{p[:avgproduction]}"]
1262
+ )
1251
1263
  end
1252
1264
  end
1265
+ end
1253
1266
 
1254
- table(planting_data) do
1255
- columns(0..7).width = 67.5
1256
- columns(0..7).style(font_style: :bold)
1257
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1258
- cells.padding = [1, 2.5]
1259
- cells.style(border_width: 0)
1260
- row(1).style(border_bottom_width: 0.5, font_style: nil)
1261
- end
1262
-
1263
- stroke_bounds
1267
+ table(planting_data) do
1268
+ columns(0..7).width = 67.5
1269
+ columns(0..7).style(font_style: :bold)
1270
+ row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold)
1271
+ cells.padding = [1, 2.5]
1272
+ cells.style(border_width: 0)
1273
+ row(1).style(border_bottom_width: 0.5, font_style: nil)
1264
1274
  end
1265
1275
  end
1266
1276
 
1267
1277
  def externalities
1268
- bounding_box([0, 450], height: 350, width: 540) do
1269
-
1270
- extern_data = ReportUtils.conditional_externs_array(@sub) # instance method to populate dynamic array
1271
- table(extern_data) do
1272
- columns(0..3).width = 135
1273
- columns([1, 3]).style(font_style: :bold)
1274
- row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1275
- cells.padding = [1, 2.5]
1276
- cells.style(border_width: 0)
1277
- end
1278
-
1279
- stroke_bounds
1278
+ extern_data = ReportUtils.conditional_externs_array(@sub) # instance method to populate dynamic array
1279
+ table(extern_data) do
1280
+ columns(0..3).width = 135
1281
+ columns([1, 3]).style(font_style: :bold)
1282
+ row(0).style(align: :center, background_color: 'd7d7d7', font_size: 8, font_style: :bold)
1283
+ cells.padding = [1, 2.5]
1284
+ cells.style(border_width: 0)
1280
1285
  end
1281
1286
  end
1282
1287
 
@@ -701,7 +701,7 @@ describe 'eval report class' do
701
701
  water_distribution
702
702
  end
703
703
  page1 = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
704
- page2 = PDF::Reader.new(StringIO.new(@pdf.render)).page(2).to_s
704
+ page2 = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
705
705
  @water_distribution_content = page1 + page2
706
706
  end
707
707
 
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,8 @@ require 'appraisermetrics_report_service'
5
5
  require 'pdf-reader'
6
6
  require './spec/test_data/sampler'
7
7
 
8
+ I18n.enforce_available_locales = false
9
+
8
10
  RSpec.configure do |config|
9
11
 
10
12
  end
@@ -6,7 +6,7 @@ class Sampler
6
6
  # generate a sample report quickly
7
7
  def self.test_closed_sale
8
8
  c = ClosedSale.new do
9
- write_content(Sampler.get_comp2, Sampler.sample_closed_sale_images, nil)
9
+ write_content(Sampler.get_comp2, Sampler.sample_closed_sale_images, Sampler.sample_logo)
10
10
  render_file("closed_sale.pdf")
11
11
  end
12
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appraisermetrics_report_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - StackPoint
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.4.5
212
+ rubygems_version: 2.2.2
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: '["A service to generate pdf reports"]'