Class: ClosedSale
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- ClosedSale
- Includes:
- ReportUtils
- Defined in:
- lib/closed_sale.rb
Instance Method Summary collapse
- #additional_images ⇒ Object
- #cash_flow ⇒ Object
- #comments ⇒ Object
- #crop_yield ⇒ Object
- #estimated_productivity ⇒ Object
- #externalities ⇒ Object
- #finish_tables(cursor_left, cursor_right) ⇒ Object
- #improvements ⇒ Object
- #income_expense ⇒ Object
-
#initialize ⇒ ClosedSale
constructor
A new instance of ClosedSale.
- #land_classification ⇒ Object
- #legal_transaction ⇒ Object
- #meta_data ⇒ Object
- #perm_plantings ⇒ Object
- #physical_overview ⇒ Object
- #profile_image ⇒ Object
- #property_class ⇒ Object
- #property_type_and_address ⇒ Object
- #render_logo ⇒ Object
- #transaction_history ⇒ Object
- #transaction_summary ⇒ Object
- #utilities ⇒ Object
- #water_distribution ⇒ Object
- #water_rights ⇒ Object
-
#write_content(report_doc, images, office_logo) ⇒ Object
the call to add content to pdf.
Methods included from ReportUtils
average_land_val, conditional_externs_array, #datemaker, #flip_improvements_array, maximum_land_val, median_land_val, minimum_land_val, #moneymaker, #no_nil_array, #no_nil_number, #no_nil_string, parallel_text, static_strings
Constructor Details
#initialize ⇒ ClosedSale
Returns a new instance of ClosedSale.
8 9 10 |
# File 'lib/closed_sale.rb', line 8 def initialize() super() end |
Instance Method Details
#additional_images ⇒ Object
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
# File 'lib/closed_sale.rb', line 760 def additional_images if @property_images && @property_images.count > 1 start_new_page if @property_images[1] bounding_box([0, 690], height: 330, width: 250) do image @property_images[1], width: 240 end end if @property_images[2] bounding_box([270, 690], height: 330, width: 250) do image @property_images[2], width: 240 end end if @property_images[3] bounding_box([0, 340], height: 330, width: 250) do image @property_images[3], width: 240 end end if @property_images[4] bounding_box([270, 340], height: 330, width: 250) do image @property_images[4], width: 240 end end end end |
#cash_flow ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/closed_sale.rb', line 284 def cash_flow cash_flow_data = [ [{content: "Cash Flow - Production Analysis", colspan: 4}], ["Income Source", "Stable $/Unit", "Stablilized Yield/Unit", "No. of Source, i.e. AC"] ] incomes = @rep[:incomes] if incomes # node could be nil incomes.each do |i| if i # array could be nil cash_flow_data.push( [ i[:incomesrc], moneymaker(i[:stabcashperunit], false), '%.2f' % no_nil_number(i[:stabilizedyield]), '%.2f' % no_nil_number(i[:totalunits]) ] ) end end end table(cash_flow_data) do columns(0..1).width = 68 columns(2..3).width = 67 columns(1..3).style(align: :right, font_style: :bold) column(0).style(align: :left, font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, border_top_width: 0.5) cells.style(border_width: 0) row(1).style(border_bottom_width: 0.5, align: :center, font_style: nil) cells.padding = [1, 2.5] end end |
#comments ⇒ Object
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/closed_sale.rb', line 319 def comments comments_data = [ ["Comments"] ] comment_sections = [ :sale_adjustment_comments, :general_comments, :atmarket_comments, :lease_comments, :change_of_use, :water_rights_cont, :water_distribution_comment, :easements_description, :mineral_rights, :permanent_plantings, :property_improvement_comments ] comment_sections.each do |c| # only include if exists if @rep[c] comments_data << ["#{@rep[c]}"] end end table(comments_data) do row(0).style align: :center column(0).width = 270 cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) end end |
#crop_yield ⇒ Object
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/closed_sale.rb', line 665 def crop_yield crops = @rep[:crops] crop_data = [ [{content: "Crop Yield Summary", colspan: 7}], ["Crop Year", "Commodity Identified", "Unit of Measure", "Average Yield", " ", " ", ", "] ] if crops # node could be nil crops.each do |c| if c # array could be empty crop_data.push( ["#{c[:year]}", "#{c[:commodity]}", "#{c[:unit]}", "#{c[:avgyield]}"] ) end end end table(crop_data) do column(0).width = 135 columns(1..6).width = 67.5 columns(0..6).style(font_style: :bold) column(3).style(align: :right) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#estimated_productivity ⇒ Object
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/closed_sale.rb', line 695 def estimated_productivity estimatedproductivity = @rep[:estimatedproductivity] production_data = [ [{content: "Estimated Productivity", colspan: 4}], ["Commodity Identification", "Unit Measure", "Estimated Yield", " "] ] if estimatedproductivity && estimatedproductivity.any? estimatedproductivity.each do |p| production_data.push( ["#{p[:commodity]}", "#{p[:unit]}", "#{p[:estmtdyield]}"] ) end end table(production_data) do columns(0..3).width = 135 columns(0..3).style(font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#externalities ⇒ Object
749 750 751 752 753 754 755 756 757 758 |
# File 'lib/closed_sale.rb', line 749 def externalities extern_data = ReportUtils.conditional_externs_array(@rep) # instance method to populate dynamic array table(extern_data) do columns(0..3).width = 135 columns([1, 3]).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) end end |
#finish_tables(cursor_left, cursor_right) ⇒ Object
789 790 791 792 793 794 795 |
# File 'lib/closed_sale.rb', line 789 def finish_tables(cursor_left, cursor_right) # use this method to move a floated cursor down to align two tables move_cursor_amount = cursor_right - cursor_left move_down move_cursor_amount unless move_cursor_amount < 0 stroke_horizontal_rule move_down 5 end |
#improvements ⇒ Object
595 596 597 598 599 600 601 602 603 604 605 606 607 608 |
# File 'lib/closed_sale.rb', line 595 def improvements improvements_array = @rep[:improvements] sorted_array = flip_improvements_array(improvements_array) table(sorted_array) do columns(0..7).width = 67.5 columns(1..7).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#income_expense ⇒ Object
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/closed_sale.rb', line 474 def income_expense income = Money.new(no_nil_number(@rep[:eff_gross_income]) * 100, 'USD') expense = Money.new(no_nil_number(@rep[:total_expenses]) * 100, 'USD') noi = income - expense noi_string = noi.format(no_cents: :true) expense_ratio = "#{((expense / income) * 100).round(2)}" + "%" income_expense_data = [ [{content: "Income/Expense Information", colspan: 4}], ["Total Farm Income:", income.format(no_cents: true), "Total Income to LL:", income.format(no_cents: true)], ["Total Farm Expenses:", expense.format(no_cents: true), "Total Exp pd by LL:", expense.format(no_cents: true)], ["NOI:", noi_string, "Expense Ratio:", expense_ratio], ["Cap Rate or OAR", "#{@rep[:overall_capitalization_rate]}%", " ", " "], [{content: "Cash Flow Comments:", colspan: 4}], [{content: @rep[:income_comments], colspan: 4}], ["Annual Water $/Acre:", moneymaker(@rep[:irrig_cost_per_acre], true)], ["Annual Pumping $/Acre:", moneymaker(@rep[:pumping_cost_per_acre], true)] ] table(income_expense_data) do columns(0..1).width = 68 columns(2..3).width = 67 columns(0..3).style(align: :right) cells.padding = [1, 2.5] cells.style(border_width: 0) columns([1, 3]).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) row([5, 6]).style(align: :left) end end |
#land_classification ⇒ Object
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/closed_sale.rb', line 216 def land_classification classification_data = [ [{content: "Land Classification Breakdown", colspan: 4}], ["Land Class:", "Acres:", "$/Acre:", "Total:"], ] land_classes = @rep[:landclassifications] if land_classes # node could be nil total_acres = 0 # value to add to in loop total_dollar = 0 land_classes.each do |l| if l # array could be empty if l[:priceperacre] # priceperacre could be nil, avoid nomethod errors below by checking m = Money.new(l[:priceperacre][:cents], l[:priceperacre][:currency_iso]) per_acre_string = m.format(no_cents: true) total_string = (m * l[:numacres]).format(no_cents: true) total_acres += no_nil_number(l[:numacres]) # add to total total_dollar += m.to_f * l[:numacres] classification_data.push( [ "#{l[:landclass]}", '%.2f' % no_nil_number(l[:numacres]), # => adds .00 to acres per_acre_string, total_string ] ) end end end # end block total_dollar_string = Money.new(total_dollar * 100, 'USD').format(no_cents: true) total_per_acre = Money.new((total_dollar / total_acres) * 100, 'USD') total_per_acre_string = total_per_acre.format(no_cents: true) # push totals into table classification_data.push( ["", "", "", ""], # line space ["Totals", '%.2f' % total_acres, total_per_acre_string, total_dollar_string] ) if @rep[:imprv_unitprice] improv_alloc = Money.new(@rep[:imprv_unitprice][:cents], 'USD') else improv_alloc = Money.new(0, 'USD') end classification_data.push([ "Total $ to Imprv", moneymaker(@rep[:total_imprv_budget], true), "Imprv $/AC Alloc", improv_alloc.format(no_cents: :true)], [{content: "Total Land and Improvement $/AC", colspan: 3}, (total_per_acre + improv_alloc).format(no_cents: :true)]) end table(classification_data) do # land classification breakdown table columns(0..1).width = 68 columns(2..3).width = 67 columns(1..3).style(align: :right) cells.style(border_width: 0) cells.padding = [1, 2.5] row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) row(1).style(align: :right, font_style: :bold, border_bottom_width: 0.5) row(-3).style(border_bottom_width: 0.5, font_style: :bold) end end |
#legal_transaction ⇒ Object
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
# File 'lib/closed_sale.rb', line 505 def legal_transaction taxes = @rep[:taxes] tax_parcel_nos = "" if taxes && taxes.any? taxes.each {|t| tax_parcel_nos << "#{t[:tax_parcel_no]}, "} end assessed_val_check = @rep[:total_assessed_value] ? (@rep[:total_assessed_value].to_f) : 0 assessed_value = Money.new(assessed_val_check * 100, 'USD').format(no_cents: true) real_estate_tax_check = @rep[:total_RET] ? (@rep[:total_RET].to_f) : 0 real_estate_taxes = Money.new(real_estate_tax_check * 100, 'USD').format(no_cents: true) legal_transaction_data = [ [{content: "Legal/Transaction Detail", colspan: 4}], ["Tax Parcel ID(s)", {content: tax_parcel_nos, colspan: 3}], [" ", " ", " ", " "], ["Year of Assessment:", "#{@rep[:year_of_assessment]}", "Year of RE Taxes:", "#{@rep[:year_of_real_estate_taxes]}"], ["Assessed Value:", assessed_value, "RE Taxes", real_estate_taxes], ["Financing:", "#{@rep[:financing_type]}", "Property Rights:", "#{@rep[:property_rights]}"], ["At Market Trans?:", "#{@rep[:atmarket_trans]}", "Days on Market:", "#{@rep[:exposure_period]}"], [{content: "Transaction History Comments:", colspan: 4}], [{content: "#{@rep[:listing_comments]}", colspan: 4}] ] table(legal_transaction_data) do columns(0..1).width = 68 columns(2..3).width = 67 columns([1, 3]).style(font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) end end |
#meta_data ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/closed_sale.rb', line 186 def = [ ["Record Number:", "#{@rep[:sequence]}"], ["Record Created By:", "#{@rep[:record_created_by]}"], ["Date Created or Last Modified:", datemaker(@rep[:record_edited])] ] table() do # record meta data table with image columns(0..1).width = 135 columns([0]).style(font_style: :bold) cells.style(border_width: 0) cells.padding = [1, 2.5] end end |
#perm_plantings ⇒ Object
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
# File 'lib/closed_sale.rb', line 721 def perm_plantings planting_data = [ [{content: "Permanent Plantings", colspan: 8}], ["Planting", "Variety", "Ac. Type", "No. of Acres", "Average Age", "Plants/Acre", "Unit Description", "Average Yield"] ] plantings = @rep[:plantings] if plantings # node could be nil plantings.each do |p| if p # array could be empty planting_data.push( ["#{p[:planting]}", "#{p[:variety]}", "#{p[:acres]}", "#{p[:numacres]}", "#{p[:avgage]}", "#{p[:plantsacre]}", "#{p[:unitdescr1]}", "#{p[:avgproduction]}"] ) end end end table(planting_data) do columns(0..7).width = 67.5 columns(0..7).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#physical_overview ⇒ Object
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/closed_sale.rb', line 446 def physical_overview overview_data = [ [{content: "Physical Overview", colspan: 4}], ["Farming Practice:", "#{@rep[:farming_practices]}", {content: "Predominant Soil Type and Description:", colspan: 2}], ["Ann. Rainfall-Inches:", "#{@rep[:avg_precipitation]}", {content: "#{@rep[:soils]}", colspan: 2, rowspan: 3}], ["Avg Frost Free Days:", "#{@rep[:growing_season]}"], ["Elevation(Range):", "#{@rep[:elevation]}"], ["Predom Top Slope:", "#{@rep[:topography]}", "Legal Access:", {content: "#{@rep[:legal_access]}", rowspan: 2}], ["Corn Suitability Rating:", @rep[:CSR2]], ["Land Use Zone:", "#{@rep[:land_use_zone]}", "Physical Access:", "#{@rep[:physical_access]}"], ["Flood Zone:", no_nil_array(@rep[:flood_zone]).join(", "), "Wetlands:", "#{@rep[:wetlands]}"], [{content: "Land Development Potential, Change or Use, or Limitations Comments:", colspan: 4}], [{content: "#{@rep[:development_potential]}" , colspan: 4}] ] table(overview_data) do columns(0..1).width = 68 columns(2..3).width = 67 columns([0, 2]).style(align: :right) columns([1, 3]).style(font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) row(9).style(align: :left) row(-1).style(align: :left) end end |
#profile_image ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/closed_sale.rb', line 201 def profile_image if @property_images && @property_images.any? image "#{@property_images.first}", width: 265 else text "No Image" end table([["Property Location and Directions:"], ["#{@rep[:directions_or_ownership_comments]}"]]) do cells.padding = [1, 2.5] cells.style(border_width: 0) column(0).width = 270 row(0).style(align: :center, background_color: 'd7d7d7', font_style: :bold) end end |
#property_class ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/closed_sale.rb', line 353 def property_class property_data = [ ["Property Classification:", "#{@rep[:land_use_zone]}"], ["Transaction Type:", "#{@rep[:type_of_transaction]}"], ["Property Name:", "#{@rep[:property_name]}"] ] table(property_data) do column(0).style(align: :right) column([1]).style(font_style: :bold) columns(0..1).width = 135 cells.style(border_width: 0) cells.padding = [1, 2.5] end end |
#property_type_and_address ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/closed_sale.rb', line 369 def property_type_and_address pos = @rep[:position] # lat and long if pos && pos[0] && pos[1] lat, long = pos[0].round(6), pos[1].round(6) else lat, long = " ", " " end property_inclusions = no_nil_array(@rep[:property_inclusions]).join(" ") town_range = "" if @rep[:townshipINT] if @rep[:townshipINT] > 0 town_range << "#{@rep[:townshipINT]}N" else town_range << "#{@rep[:townshipINT]}S" end end if @rep[:rangeINT] if @rep[:rangeINT] > 0 town_range << ", #{@rep[:rangeINT]}E" else town_range << "#{@rep[:rangeINT]}W" end end type_and_address_data = [ [{content: "Property Type and Address", colspan: 4}], ["Property Name:", "#{@rep[:property_name]}", "Primary Land Use:", "#{@rep[:primary_ag_use]}"], ["What does this property include?", {content: property_inclusions, colspan: 3}], ["Address:", {content: "#{@rep[:property_address_number]}" + " #{@rep[:street_or_road_name]}", colspan: 3}], ["City:", "#{@rep[:city]}", "County:", "#{@rep[:county_state]}".slice(0..-4)], ["State:", "#{@rep[:county_state]}".strip.split('').last(2).join(""), "Zip Code:", "#{@rep[:zip_code]}"], ["Township/Range:", town_range, "Section(s):", "#{@rep[:legal_description]}"], ["Latitude:", lat, "Longitude:", long] ] table(type_and_address_data) do columns(0..1).width = 68 columns(2..3).width = 67 columns([0, 2]).style(align: :right) columns([1, 3]).style(font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) end end |
#render_logo ⇒ Object
179 180 181 182 183 |
# File 'lib/closed_sale.rb', line 179 def render_logo if @office_logo image @office_logo, height: 35 end end |
#transaction_history ⇒ Object
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/closed_sale.rb', line 540 def transaction_history transaction_history_data = [ [{content: "Transaction History", colspan: 4}], ["Historic Transaction Type", "Transaction Description", "Date", "Sale Price, List Price, or List Price"] ] transactions = @rep[:historyrecords] if transactions # node could be nil transactions.each do |t| if t # array could be nil transaction_history_data.push( ["#{t[:transType]}", "#{t[:transDescr]}", datemaker(t[:transDate]), moneymaker(t[:price], true)] ) end end end table(transaction_history_data) do columns(0..3).width = 135 columns(0..3).style(align: :right, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#transaction_summary ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/closed_sale.rb', line 418 def transaction_summary price = moneymaker(@rep[:sale_price], true) adjustment = moneymaker(@rep[:sale_adjustment], true) ce_sale_price = moneymaker(@rep[:cesaleprice], true) transaction_data = [ [{content: "Transaction Summary", colspan: 4}], ["Sale Price $:", price, "Sale Date:", datemaker(@rep[:sale_date])], ["Cond. Adjust $:", '(' + adjustment +')', "Adj. CE Sale $:", ce_sale_price], ["Unit Description:", "#{@rep[:unit]}", "No. of Units:", '%.2f' % no_nil_number(@rep[:num_of_units])], ["Instrument No.:", "#{@rep[:public_rec_ref_numer]}", "$/Unit:", moneymaker(@rep[:cesaleunitprice], true)], ["Seller:", "#{@rep[:grantor]}", "Buyer:", "#{@rep[:grantee]}"], ["Extent of Verification:", {content: no_nil_array(@rep[:verifications]).join(', '), colspan: 3}], [{content: "#{@rep[:grantor]}" + " #{@rep[:information_source_contact]}", colspan: 2}, "Date Inspected:", datemaker(@rep[:date_inspected]) ] ] table(transaction_data) do columns(0..1).width = 68 columns(2..3).width = 67 columns([0, 2]).style align: :right cells.padding = [1, 2.5] cells.style(border_width: 0) columns([1, 3]).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) end end |
#utilities ⇒ Object
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/closed_sale.rb', line 568 def utilities utilities_data = [ [{content: "Description of Utilities", colspan: 4}], ["Utility Description", "Service Availability", "Service Provider", "Comments"] ] utilities = @rep[:utilities] if utilities # node could be nil utilities.each do |u| if u # array could be empty utilities_data.push( ["#{u[:description]}", "#{u[:availability]}", "#{u[:provider]}", "#{u[:comments]}"] ) end end end table(utilities_data) do columns(0..3).width = 135 columns(0..3).style(align: :right, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#water_distribution ⇒ Object
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
# File 'lib/closed_sale.rb', line 637 def water_distribution distribution_data = [ [{content: "Water Distribution System", colspan: 8}], ["Water Distrib. Equip.", "Manuf.", "Make/Brand", "Type", "Description", "Yr. Manufactured", "Remaining Ec. Life", "No. Acres Irrigated"] ] distributions = @rep[:waterdistributions] if distributions # node could be nil distributions.each do |d| if d # array could be empty distribution_data.push( ["#{d[:waterdistrEq]}", "#{d[:manufacturer]}", "#{d[:brand]}", "#{d[:eqType]}", "#{d[:descr]}", "#{d[:yearManuf]}", "#{d[:remainingEcLife]}", "#{d[:irrAcres]}"] ) end end end table(distribution_data) do columns(0..7).width = 67.5 columns(0..7).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#water_rights ⇒ Object
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
# File 'lib/closed_sale.rb', line 610 def water_rights water_rights_data = [ [{content: "Water Rights", colspan: 8}], ["Water Right No.", "Water Right", "Water Source", "Priority Date", "Beneficial Use", "No. Acres Irrigated", "Annual Volume Ac-Ft", "Period of Use"] ] rights = @rep[:waterrights] if rights # node could be nil rights.each do |r| if r # array could be empty water_rights_data.push( ["#{r[:waterrightNum]}", "#{r[:waterRight]}", "#{r[:waterSrc]}", datemaker(r[:priorityDate]), "#{r[:purpose]}", "#{r[:numIrrAcres]}", "#{r[:annVolume]}"] ) end end end table(water_rights_data) do columns(0..7).width = 67.5 columns(0..7).style(font_style: :bold) row(0).style(align: :center, background_color: 'd7d7d7', size: 11, font_style: :bold) cells.padding = [1, 2.5] cells.style(border_width: 0) row(1).style(border_bottom_width: 0.5, font_style: nil) end end |
#write_content(report_doc, images, office_logo) ⇒ Object
the call to add content to pdf
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/closed_sale.rb', line 12 def write_content(report_doc, images, office_logo) # the call to add content to pdf font_size 7 @rep = report_doc @property_images = images @office_logo = office_logo ## page 1 ## # render office logo image if present stroke_bounds move_down 10 render_logo # rendering tables float do end indent(270) do property_class end move_down 5 stroke_horizontal_rule move_down 5 float do profile_image @image_cursor = cursor end indent(270) do property_type_and_address transaction_summary @transaction_cursor = cursor end finish_tables(@image_cursor, @transaction_cursor) float do land_classification @land_class_cursor = cursor end indent(270) do physical_overview @physical_cursor = cursor end finish_tables(@land_class_cursor, @physical_cursor) # stroke this line before potential overunning to next page stroke_line [270, 720], [270, 0] float do cash_flow @cash_cursor = cursor end indent(270) do income_expense @income_cursor = cursor end income_move = @income_cursor - @cash_cursor move_down income_move unless income_move < 0 if page_count == 1 start_new_page end ## page 2 ## stroke_horizontal_rule stroke_bounds move_down 5 float do comments @comments_cursor = cursor end indent(270) do legal_transaction @legal_cursor = cursor end # comments might be long or short, make sure they don't overrun the next section move_cursor_amount = @legal_cursor - @comments_cursor move_down move_cursor_amount unless move_cursor_amount < 0 # stroke boundary line stroke_line [270, 720], [270, cursor] stroke_horizontal_rule move_down 5 # move to full width table if @rep[:transactions] && @rep[:transactions].any? transaction_history move_down 30 stroke_horizontal_rule move_down 5 end if @rep[:utilities] && @rep[:utilities].any? utilities move_down 30 stroke_horizontal_rule move_down 5 end if @rep[:improvements] && @rep[:improvements].any? improvements move_down 30 stroke_horizontal_rule move_down 5 end if @rep[:waterrights] && @rep[:waterrights].any? water_rights move_down 30 stroke_horizontal_rule move_down 5 end if @rep[:waterdistributions] && @rep[:waterdistributions].any? water_distribution move_down 30 stroke_horizontal_rule move_down 5 end if @rep[:crops] && @rep[:crops].any? crop_yield move_down 30 stroke_horizontal_rule move_down 5 end if @rep[:estimatedproductivity] && @rep[:estimatedproductivity].any? estimated_productivity move_down 30 stroke_horizontal_rule move_down 5 end # stroke bounds again for third page if @rep[:plantings] && @rep[:plantings].any? perm_plantings move_down 30 stroke_horizontal_rule move_down 5 end stroke_bounds # check to see if externalities needs to be populated if @rep[:property_affectedby] || @rep[:has_hazardous_waste] || @rep[:problem_descr] || @rep[:env_problems] || @rep[:env_problem_descr] || @rep[:ttowers] || @rep[:windgeneratortype] || @rep[:tt_annual_income] || @rep[:windspeed] || @rep[:transtower_comments] || @rep[:num_of_gentowers] || @rep[:avgtowerhight] || @rep[:windgenincome] || @rep[:windgen_comment] externalities end ## page 4 ## additional_images end |