Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/pdfs/event_procedures_report_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def start_new_page_if_needed

def add_item_details(item)
add_item_line(truncate_text(item.patient.name), item_paid?(item))
add_item_line(truncate_text(item.procedure.name), item.total_amount.format)
add_item_line(truncate_text(item.procedure.name), "")
add_item_line(
"#{truncate_text(item.hospital.name)} - #{truncate_text(item.health_insurance.name)}",
item_date(item)
"#{truncate_text(item.hospital.name)} - #{truncate_text(item.health_insurance.name)} - #{item_date(item)}",
item_amount(item)
)
end

Expand All @@ -82,4 +82,8 @@ def item_paid?(item)
def item_date(item)
item.date.strftime("%d/%m/%Y")
end

def item_amount(item)
item.total_amount.format(thousands_separator: ".", decimal_mark: ",")
end
end
16 changes: 8 additions & 8 deletions app/pdfs/medical_shifts_report_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def start_new_page_if_needed
end

def add_item_details(item)
add_item_line(truncate_text(item.hospital_name), item_start_date(item))
add_item_line(item_workload(item), item.amount.format)
add_item_line(item_start_hour(item), item_paid?(item))
add_item_line(truncate_text(item.hospital_name), item_amount(item))
add_item_line(item_workload(item), "")
add_item_line(item_start_date(item), item_paid?(item))
end

def add_item_line(left_text, right_text)
Expand All @@ -77,18 +77,18 @@ def item_shift(item)
end

def item_workload(item)
"#{item_shift(item)} - #{item.workload_humanize}"
"#{item_shift(item)} - #{item.workload_humanize} - #{item.start_hour.strftime('%H:%M')}"
end

def item_start_date(item)
item.start_date.strftime("%d/%m/%Y")
end

def item_start_hour(item)
"Início: #{item.start_hour.strftime('%H:%M')}"
end

def item_paid?(item)
item.paid ? "Pago" : "A Receber"
end

def item_amount(item)
item.amount.format(thousands_separator: ".", decimal_mark: ",")
end
end
5 changes: 2 additions & 3 deletions spec/pdfs/event_procedures_report_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
event_procedures.each do |event_procedure|
expect(text_analysis.strings).to include(
event_procedure.procedure.name,
event_procedure.procedure.amount.format,
event_procedure.patient.name,
"#{event_procedure.hospital.name} - #{event_procedure.health_insurance.name}",
event_procedure.date.strftime("%d/%m/%Y")
"#{event_procedure.hospital.name} - #{event_procedure.health_insurance.name} -
#{event_procedure.date.strftime('%d/%m/%Y')}".squish
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/pdfs/medical_shifts_report_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
medical_shifts.each do |medical_shift|
expect(text_analysis.strings).to include(
medical_shift.hospital_name,
medical_shift.amount.format,
medical_shift.amount.format(thousands_separator: ".", decimal_mark: ","),
medical_shift.start_date.strftime("%d/%m/%Y")
)
end
Expand Down