Export Payoff data

Payoff is a module in Next Project used for self billing in member organizations, where each member that will receive payment is treated as a supplier in Next. This section is only relevant if you are using that module.

Entities/terminology in the Payoff module

A payoff (avräkning) contains one or more supplier payoffs - a clearer way to think of a payoff is as a payoff run (avräkningskörning).

A supplier payoff represents a single payoff to a supplier.

A supplier payoff work order row item represents a work order row that was processed in a supplier payoff.

A supplier payoff cost item represents a voucher row that was processed in a supplier payoff.

A record in the payoff endpoint can be linked to 0 or more records in the supplier payoff endpoint, the latter entity contains the field PayoffId that constitutes this link.

A record in in the supplier payoff endpoint can be linked to 0 or more records in supplier payoff work order row item and 0 or more records in supplier payoff cost item. The latter entities contain the field SupplierPayoffId that constitutes this link.

Relevant endpoints

GET /payoff/ List Payoffs

GET /payoff/{payoff_id}/supplierpayoff/ List Supplier Payoffs In Payoff

GET /payoff/supplierpayoff/{supplierpayoff_id}/rowitem/ List Work Order Row Items In Supplier Payoff

GET /payoff/supplierpayoff/{supplierpayoff_id}/costitem/ List Cost Items In Supplier Payoff

Process

The final goal of reading payoff data in an integration is usually to create supplier invoices in the accounting system, so that a member can get paid.

Recommended process to export payoffs:

  1. get all payoffs where locked = true and exporteddate is null

  2. for each payoff

    1. for each supplierpayoff in payoff where supplierpayoff.exporteddate is null

      1. create a supplierinvoice in accounting system

        1. for each supplierpayoffrowitem in supplierpayoff

          1. aggregate data
        2. for each supplierpayoffcostitem in supplierpayoff

          1. aggregate data
        3. create supplierinvoice rows in accounting system based on aggregations

      2. Post the supplierinvoice with rows into accounting system

    2. mark supplierpayoff as exported by PUT on fieldsexporteddate, externalno (= supplier invoice no in erp), integrationmessage

  3. mark payoff as exported by PUT on fieldexporteddate

  4. done

Aggregations

There are usually many work order row items connected to a supplier payoff. In order to not create a supplier invoice row for each such row, that info is usually connected to relevant cost items and aggregated in an appropriate way. For example, a customer using Next might want to aggregate the data on Project no + Work order no + Account no and for each such aggregated row a supplier invoice row is created in the accounting system. It is up to the Next customer and the integrator to come up with an appropriate aggregate.

Account mapping

The accounts to post to in the accounting system (after reading the payoff data in Next) need to be configured and handled inside the integration.