Module: Ksef::FA3::Builder::Advances

Included in:
Ksef::FA3::Builder
Defined in:
lib/ksef/fa3/builder/advances.rb

Overview

The DSL calls for the advance-payment family — the order a ZAL collects against and the advance invoices a ROZ settles (docs/REFERENCE.md §8.5).

Mixed into Ksef::FA3::Builder, so @order, @order_lines and @advances are its state.

Instance Method Summary collapse

Instance Method Details

#order(**attributes) ⇒ Object

The order or contract an advance invoice collects against (Zamowienie, art. 106f ust. 1 pkt 4). Sets the order's own total; call #order_line for its positions.

Parameters:

  • attributes (Hash) —

    :total — the whole order including tax, which is not what this invoice charges. See Order.



16
17
18
# File 'lib/ksef/fa3/builder/advances.rb', line 16

def order(**attributes)
  @order = normalise(attributes, ORDER_KEYS, {}, "order")
end

#order_line(**attributes) ⇒ Object

Appends one position of the order. Nothing here is derived — see OrderLine.

Parameters:

  • attributes (Hash) —

    :name, :quantity (or :qty), :unit, :net_unit_price, :net_amount, :vat_amount, :vat_rate (or :vat), :row_number, :state_before



24
25
26
# File 'lib/ksef/fa3/builder/advances.rb', line 24

def order_line(**attributes)
  @order_lines << OrderLine.new(**normalise(attributes, ORDER_LINE_KEYS, LINE_ALIASES, "order line"))
end

#settles(**attributes) ⇒ Object

Names one advance invoice this settlement invoice settles (FakturaZaliczkowa). Call once per advance invoice; art. 106f ust. 3 allows up to a hundred.

Parameters:

  • attributes (Hash) —

    exactly one of :ksef_number (issued through KSeF) or :number (issued outside it)



33
34
35
# File 'lib/ksef/fa3/builder/advances.rb', line 33

def settles(**attributes)
  @advances << AdvanceInvoice.new(**normalise(attributes, ADVANCE_KEYS, {}, "settles"))
end