Class: OrderFax
- Defined in:
- app/documents/order_fax.rb
Constant Summary collapse
- BATCH_SIZE =
250
Constants inherited from RenderPdf
RenderPdf::BOTTOM_MARGIN, RenderPdf::DEFAULT_FONT, RenderPdf::FOOTER_FONT_SIZE, RenderPdf::FOOTER_SPACE, RenderPdf::HEADER_FONT_SIZE, RenderPdf::HEADER_SPACE, RenderPdf::TOP_MARGIN
Instance Attribute Summary
Attributes inherited from OrderPdf
Instance Method Summary collapse
Methods inherited from OrderPdf
#each_group_order_article_for_order_article, #each_group_order_article_for_ordergroup, #each_ordergroup, #each_ordergroup_batch, #group_order_article_quantity_with_tolerance, #group_order_article_result, #group_order_articles, #initialize, #nice_table, #order_article_price, #order_article_price_per_unit, #ordergroups, #stock_ordergroup_name
Methods inherited from RenderPdf
#down_or_page, #font_path, #font_size, #fontsize, #initialize, #number_to_currency, #pdf_add_page_breaks?, #to_pdf
Methods included from ApplicationHelper
#base_errors, #bootstrap_flash_patched, #close_button, #expand, #foodcoop_css_path, #foodcoop_css_tag, #format_currency, #format_date, #format_datetime, #format_datetime_timespec, #format_iban, #format_roles, #format_time, #heading_helper, #icon, #items_per_page, #link_to_gmaps, #link_to_top, #pagination_links_remote, #remote_link_to, #show_title?, #show_user, #show_user_link, #sort_link_helper, #tab_is_active?, #truncate, #weekday
Methods included from PathHelper
#finance_group_transactions_path
Constructor Details
This class inherits a constructor from OrderPdf
Instance Method Details
#body ⇒ Object
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 |
# File 'app/documents/order_fax.rb', line 12 def body contact = FoodsoftConfig[:contact].symbolize_keys # From paragraph bounding_box [margin_box.right - 200, margin_box.top], width: 200 do text FoodsoftConfig[:name], size: fontsize(9), align: :right move_down 5 text contact[:street], size: fontsize(9), align: :right move_down 5 text "#{contact[:zip_code]} #{contact[:city]}", size: fontsize(9), align: :right move_down 5 if order.supplier.try(:customer_number).present? text "#{Supplier.human_attribute_name :customer_number}: #{order.supplier[:customer_number]}", size: fontsize(9), align: :right move_down 5 end if contact[:phone].present? text "#{Supplier.human_attribute_name :phone}: #{contact[:phone]}", size: fontsize(9), align: :right move_down 5 end if contact[:email].present? text "#{Supplier.human_attribute_name :email}: #{contact[:email]}", size: fontsize(9), align: :right end end # Recipient bounding_box [margin_box.left, margin_box.top - 60], width: 200 do text order.name move_down 5 text order.supplier.try(:address).to_s if order.supplier.try(:fax).present? move_down 5 text "#{Supplier.human_attribute_name :fax}: #{order.supplier[:fax]}" end end move_down 5 text Date.today.strftime(I18n.t('date.formats.default')), align: :right move_down 10 text "#{Delivery.human_attribute_name :date}:" move_down 10 if order.supplier.try(:contact_person).present? text "#{Supplier.human_attribute_name :contact_person}: #{order.supplier[:contact_person]}" move_down 10 end # Articles total = 0 data = [I18n.t('documents.order_fax.rows')] each_order_article do |oa| subtotal = oa.units_to_order * oa.price.unit_quantity * oa.price.price total += subtotal data << [oa.article.order_number, oa.units_to_order, oa.article.name, oa.price.unit_quantity, oa.article.unit, number_to_currency(oa.price.price), number_to_currency(subtotal)] end data << [I18n.t('documents.order_fax.total'), nil, nil, nil, nil, nil, number_to_currency(total)] table data, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table| table.header = true table.cells.border_width = 1 table.cells.border_color = '666666' table.row(0).border_bottom_width = 2 table.columns(1).align = :right table.columns(3..6).align = :right table.row(data.length - 1).columns(0..5).borders = %i[top bottom] table.row(data.length - 1).columns(0).borders = %i[top bottom left] table.row(data.length - 1).border_top_width = 2 end # font_size: fontsize(8), # vertical_padding: 3, # border_style: :grid, # headers: ["BestellNr.", "Menge","Name", "Gebinde", "Einheit","Preis/Einheit"], # align: {0 => :left} end |
#filename ⇒ Object
4 5 6 |
# File 'app/documents/order_fax.rb', line 4 def filename I18n.t('documents.order_fax.filename', name: order.name, date: order.ends.to_date) + '.pdf' end |
#title ⇒ Object
8 9 10 |
# File 'app/documents/order_fax.rb', line 8 def title false end |