Class: Search::ItemLedgerEntryPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::ItemLedgerEntryPresenter
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/item_ledger_entry_presenter.rb
Overview
Presenter: item ledger entry presenter.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#category ⇒ String?
Short type abbreviation (
POR,INV, …) from ItemLedgerEntry::TYPE_ABBREVIATIONS, or nil when the search row has nocategorycolumn. -
#cycle_count_link ⇒ ActiveSupport::SafeBuffer?
Link to the cycle-count session that produced this entry.
-
#delivery_link ⇒ ActiveSupport::SafeBuffer?
Link to the Delivery this entry was written for (store transfers, mostly).
-
#document_link ⇒ ActiveSupport::SafeBuffer?
First non-nil source-document link in priority order: PO → Invoice → RMA → cycle-count.
-
#entry_link ⇒ ActiveSupport::SafeBuffer
Link to the ItemLedgerEntry detail page.
-
#gl_link ⇒ ActiveSupport::SafeBuffer?
Link to the GL LedgerTransaction this ILE is paired with.
-
#invoice_link ⇒ ActiveSupport::SafeBuffer?
Link to the source Invoice, when this entry came from a fulfillment.
-
#item_link ⇒ ActiveSupport::SafeBuffer?
Link to the Item this entry refers to.
-
#po_link ⇒ ActiveSupport::SafeBuffer?
Link to the source PurchaseOrder, when this entry came from a PO receipt.
-
#rma_link ⇒ ActiveSupport::SafeBuffer?
Link to the source RMA when the entry came from a return.
-
#serial_numbers ⇒ String?
Comma-joined list of serial numbers (per-item-instance ids) attached to the entry, or nil for searches that don't select the column.
Methods inherited from BasePresenter
#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u
Constructor Details
This class inherits a constructor from BasePresenter
Instance Method Details
#category ⇒ String?
Short type abbreviation (POR, INV, …) from
ItemLedgerEntry::TYPE_ABBREVIATIONS, or nil when the
search row has no category column.
18 19 20 21 22 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 18 def category return unless r.has_columns?(:category) ItemLedgerEntry::TYPE_ABBREVIATIONS[r.category] end |
#cycle_count_link ⇒ ActiveSupport::SafeBuffer?
Link to the cycle-count session that produced this entry.
79 80 81 82 83 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 79 def cycle_count_link return unless r.has_columns?(:cycle_count_id) h.link_to r.cycle_count_id, h.cycle_count_path(r.cycle_count_id) end |
#delivery_link ⇒ ActiveSupport::SafeBuffer?
Link to the Delivery this entry was written for (store
transfers, mostly).
63 64 65 66 67 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 63 def delivery_link return unless r.has_columns?(:delivery_id) h.link_to r.delivery_id, h.delivery_path(r.delivery_id) end |
#document_link ⇒ ActiveSupport::SafeBuffer?
First non-nil source-document link in priority order:
PO → Invoice → RMA → cycle-count.
96 97 98 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 96 def document_link po_link || invoice_link || rma_link || cycle_count_link end |
#entry_link ⇒ ActiveSupport::SafeBuffer
Link to the ItemLedgerEntry detail page.
10 11 12 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 10 def entry_link h.link_to r.id, h.item_ledger_entry_path(r.id) end |
#gl_link ⇒ ActiveSupport::SafeBuffer?
Link to the GL LedgerTransaction this ILE is paired with.
87 88 89 90 91 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 87 def gl_link return unless r.has_columns?(:gl_number, :ledger_transaction_id) h.link_to r.gl_number, h.ledger_transaction_path(r.ledger_transaction_id) end |
#invoice_link ⇒ ActiveSupport::SafeBuffer?
Link to the source Invoice, when this entry came from a
fulfillment.
54 55 56 57 58 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 54 def invoice_link return unless r.has_columns?(:invoice_number, :invoice_id) h.link_to r.invoice_number, h.invoice_path(r.invoice_id) end |
#item_link ⇒ ActiveSupport::SafeBuffer?
Link to the Item this entry refers to.
26 27 28 29 30 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 26 def item_link return unless r.has_columns?(:item_id, :item_sku) h.link_to r.item_sku, h.item_path(r.item_id) end |
#po_link ⇒ ActiveSupport::SafeBuffer?
Link to the source PurchaseOrder, when this entry came from
a PO receipt.
45 46 47 48 49 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 45 def po_link return unless r.has_columns?(:po_number, :po_id) h.link_to r.po_number, h.purchase_order_path(r.po_id) end |
#rma_link ⇒ ActiveSupport::SafeBuffer?
Link to the source RMA when the entry came from a return.
71 72 73 74 75 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 71 def rma_link return unless r.has_columns?(:rma_number, :rma_id) h.link_to r.rma_number, h.rma_path(r.rma_id) end |
#serial_numbers ⇒ String?
Comma-joined list of serial numbers (per-item-instance ids)
attached to the entry, or nil for searches that don't select
the column.
36 37 38 39 40 |
# File 'app/presenters/search/item_ledger_entry_presenter.rb', line 36 def serial_numbers return unless r.has_columns?(:serial_numbers) r.serial_numbers.join(', ') end |