Skip to content

Commit

Permalink
Followup report: added column citizenship_at
Browse files Browse the repository at this point in the history
  • Loading branch information
martent committed Apr 15, 2019
1 parent 7e49564 commit 37a0721
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 6 additions & 5 deletions app/views/report_workbooks/_economy_followup_headings.xlsx.axlsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ months = %i[Januari Februari Mars April Maj Juni Juli Augusti September Oktober

sheet.add_row(
[
(0..10).map { nil },
(0..11).map { nil },
months.map { |month| [month, nil, nil] },
nil
].flatten,
style: [(0..10).map { nil }, (11..50).map { @style.heading }].flatten
style: [(0..11).map { nil }, (12..51).map { @style.heading }].flatten
)

month_cols = ['Dygn', 'Kostnad', 'Förväntad intäkt']
Expand All @@ -23,15 +23,16 @@ sheet.add_row(
'Inskriven',
'Anvisningsdatum',
'Avslutad',
'Medborgarskap erhölls',
'Prel avslut pga 21 år',
(0..12).map { month_cols },
'Avvikelse'
].flatten,
style: @style.heading
)

sheet.merge_cells sheet.rows.first.cells[(0..10)]
(11..44).step(3).each { |i| sheet.merge_cells(sheet.rows.first.cells[i..(i + 2)]) }
sheet.merge_cells sheet.rows.first.cells[(47..50)]
sheet.merge_cells sheet.rows.first.cells[(0..11)]
(12..45).step(3).each { |i| sheet.merge_cells(sheet.rows.first.cells[i..(i + 2)]) }
sheet.merge_cells sheet.rows.first.cells[(48..51)]

heading_comment(sheet, 'F', 'Kundnummer för barnets ärende i Procapita', 2)
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ last_row = sheet.rows.size
sheet.add_row(
[
'SUMMA:',
(1..10).map { nil },
(11..50).map { |i| "=SUM(#{Axlsx.col_ref(i)}3:#{Axlsx.col_ref(i)}#{last_row})" }
(1..11).map { nil },
(12..51).map { |i| "=SUM(#{Axlsx.col_ref(i)}3:#{Axlsx.col_ref(i)}#{last_row})" }
].flatten
)

(0..50).each do |col|
(0..51).each do |col|
sheet.rows.last.cells[col].style = @style.sum
end
9 changes: 5 additions & 4 deletions app/views/report_workbooks/_economy_followup_rows.xlsx.axlsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ refugees.each do |refugee|
refugee.registered,
refugee.municipality_placement_migrationsverket_at,
refugee.deregistered,
refugee.citizenship_at,
(refugee.date_at_21st_birthday if refugee.will_turn_21_in_year(@year)),
economy_per_month(refugee, age_group, @po_rates),
"=(#{step_sum(row_ref, 11..44, 3)})",
"=(#{step_sum(row_ref, 12..45, 3)})",
"=(#{step_sum(row_ref, 13..46, 3)})",
"=(#{Axlsx.col_ref(49)}#{row_ref}-#{Axlsx.col_ref(48)}#{row_ref})"
"=(#{step_sum(row_ref, 14..47, 3)})",
"=(#{Axlsx.col_ref(50)}#{row_ref}-#{Axlsx.col_ref(49)}#{row_ref})"
].flatten,
style: @style.normal
)

[7, 8, 9, 10].each do |col|
[7, 8, 9, 10, 11].each do |col|
sheet.rows.last.cells[col].style = @style.date
end

[(12..48).step(3).to_a, (13..49).step(3).to_a, 50].flatten.each do |col|
[(13..49).step(3).to_a, (14..50).step(3).to_a, 51].flatten.each do |col|
sheet.rows.last.cells[col].style = @style.currency
end
end

0 comments on commit 37a0721

Please sign in to comment.