Class: Spree::PurchaseOrderItem
- Inherits:
-
Object
- Object
- Spree::PurchaseOrderItem
- Includes:
- ReceivableItem
- Defined in:
- app/models/spree/purchase_order_item.rb
Overview
One SKU on a purchase order: how many were ordered, how many have arrived, and what the merchant agreed to pay per unit.
Instance Method Summary collapse
- #display_total_cost ⇒ Spree::Money
- #display_unit_cost ⇒ Spree::Money
-
#total_cost ⇒ BigDecimal
What the whole line costs at the agreed unit price.
Methods included from ReceivableItem
#incoming, #outstanding, #over_received?, #quantity_expected, #quantity_over, #quantity_settled, #under_received?
Instance Method Details
#display_total_cost ⇒ Spree::Money
36 37 38 |
# File 'app/models/spree/purchase_order_item.rb', line 36 def display_total_cost Spree::Money.new(total_cost, currency: currency) end |
#display_unit_cost ⇒ Spree::Money
31 32 33 |
# File 'app/models/spree/purchase_order_item.rb', line 31 def display_unit_cost Spree::Money.new(unit_cost, currency: currency) end |
#total_cost ⇒ BigDecimal
What the whole line costs at the agreed unit price. Ordered rather than received quantity: this is what the supplier will invoice.
26 27 28 |
# File 'app/models/spree/purchase_order_item.rb', line 26 def total_cost unit_cost.to_d * quantity_ordered.to_i end |