diff --git a/app/pdfs/event_procedures_report_pdf.rb b/app/pdfs/event_procedures_report_pdf.rb index a84b386..74401a7 100644 --- a/app/pdfs/event_procedures_report_pdf.rb +++ b/app/pdfs/event_procedures_report_pdf.rb @@ -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 @@ -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 diff --git a/app/pdfs/medical_shifts_report_pdf.rb b/app/pdfs/medical_shifts_report_pdf.rb index c7b75af..550ba68 100644 --- a/app/pdfs/medical_shifts_report_pdf.rb +++ b/app/pdfs/medical_shifts_report_pdf.rb @@ -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) @@ -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 diff --git a/spec/pdfs/event_procedures_report_pdf_spec.rb b/spec/pdfs/event_procedures_report_pdf_spec.rb index b5e2273..2af2a94 100644 --- a/spec/pdfs/event_procedures_report_pdf_spec.rb +++ b/spec/pdfs/event_procedures_report_pdf_spec.rb @@ -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 diff --git a/spec/pdfs/medical_shifts_report_pdf_spec.rb b/spec/pdfs/medical_shifts_report_pdf_spec.rb index 217dc04..38e489f 100644 --- a/spec/pdfs/medical_shifts_report_pdf_spec.rb +++ b/spec/pdfs/medical_shifts_report_pdf_spec.rb @@ -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