diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 836106386..9599f551c 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -146,14 +146,20 @@ class ReportsController < ApplicationController def generate content = params[:data] content = I18n.t('projects.reports.new.no_content_for_PDF_html') if content.blank? + + template = {} + respond_to do |format| format.pdf do - render pdf: 'report', header: { html: { template: 'reports/header.pdf.erb' }}, - footer: { html: { template: 'reports/footer.pdf.erb', - locals: { current_time: I18n.l(Time.zone.now, format: :full) }}}, + render pdf: 'report', header: { html: { template: 'reports/templates/template_1/_header.html.erb', locals: {template: template} }}, + footer: { html: { template: 'reports/templates/template_1/_footer.html.erb', locals: {template: template} }}, locals: { content: content }, - template: 'reports/report.pdf.erb', - disable_javascript: true + cover: render_to_string(partial: 'reports/templates/template_1/report.html.erb', + locals: { + template: template + }), + disable_javascript: true, + template: 'reports/report.pdf.erb' end format.docx do @user = current_user diff --git a/app/views/reports/templates/template_1/_footer.html.erb b/app/views/reports/templates/template_1/_footer.html.erb new file mode 100644 index 000000000..c7a4d0f52 --- /dev/null +++ b/app/views/reports/templates/template_1/_footer.html.erb @@ -0,0 +1,93 @@ + + +
+ + + + + +|
+
+ ANALYST(S)
+
+
+ <%= template[:analysts] %>
+
+ |
+
+
+ ANALYST EMPLOYEE NO.
+
+
+ <%= template[:analyst_number] %>
+
+ |
+
+
+ CHECKED BY:
+
+
+ <%= template[:checked_by] %>
+
+ |
+ + PAGE OF + | +||||||
| Single-Sided | +|||||||||
| + GENERAL CONTINUATION SHEET + | +
+
+ PRODUCT
+
+
+ <%= template[:product] %>
+
+ |
+
+
+ SAMPLE NUMBER
+
+
+ <%= template[:sample_number] %>
+
+ |
+
| + ANALYST WORKSHEET + | +
+
+ 1. PRODUCT
+
+
+ <%= template[:product] %>
+
+ |
+
+
+ 2. SAMPLE NUMBER
+
+
+ <%= template[:sample_number] %>
+
+ |
+ ||||||||||||||||||||||
+
|
+
+
+ 4. DATE RECEIVED
+
+
+ <%= template[:date_recieved] %>
+
+ |
+
+
+ 5.RECEIVED FROM
+
+
+ <%= template[:recieved_from] %>
+
+ |
+
+
+ 6. DISTRICT OR LABORATORY
+
+
+ <%= template[:district_laboratory] %>
+
+ |
+ |||||||||||||||||||||
|
+
+ 7. DESCRIPTION OF SAMPLE
+
+
+ <%= template[:sample_description] %>
+
+ |
+ ||||||||||||||||||||||||
|
+
+ 8. NET CONTENTS
+
+ |
+
+
|
+
+
+ 9. LABELING
+
+ |
+
+
|
+ |||||||||||||||||||||
|
+
+ 10. SUMMARY OF ANALYSIS
+
+
+ <%= template[:analysis_summary] %>
+
+ |
+ ||||||||||||||||||||||||
|
+
+ 11. RESERVE SAMPLE
+
+
+ <%= template[:reserve_sample] %>
+
+ |
+ ||||||||||||||||||||||||
|
+
+ 12. a. ANALYST SIGNATURE (Broke Seal )
+
+
+ <%= template.dig(:analyst_signature, :a) %>
+
+ |
+
+
+ 13. WORKSHEET CHECK
+
+ |
+
+
+ a. BY
+
+
+ <%= template.dig(:worksheet_check, :by) %>
+
+ |
+ ||||||||||||||||||||||
|
+
+ b. DATE
+
+
+ <%= template.dig(:worksheet_check, :date) %>
+
+ |
+ ||||||||||||||||||||||||
|
+
+ b.
+
+
+ <%= template.dig(:analyst_signature, :b) %>
+
+ |
+
+
+ 13. DATE REPORTED
+
+
+ <%= template[:date_reported] %>
+
+ |
+ |||||||||||||||||||||||
|
+
+ c.
+
+
+ <%= template.dig(:analyst_signature, :c) %>
+
+ |
+ + PAGE 1 OF + | +|||||||||||||||||||||||