This view contains the payment orders and their paid amounts collected from released (non voided) payment transactions. Each item represents a payment order with an additional property - PaidAmount.
Only payment orders that are not fully paid are returned i.e. there will be no items with OrderAmount equal to PaidAmount. The useful information from this view is the remaining amount to pay which is OrderAmount minus PaidAmount.
The view can be filtered to query the payment status of a document.
The query bellow will return all payment orders for the specified document (in this case a sales order) that are not fully paid:
https://example.com/api/domain/odata/Finance_Payments_OrderBalances?$filter=RefDocument eq 'Crm_Sales_SalesOrders(b488d924-6332-e311-81cb-00155d001f00)'
Note that there may be more than one item in the returned result because the not fully paid payment orders for the sales order may be more than one. To calculate the remaining amount to pay we need to calculate SUM(item.OrderAmount - item.PaidAmount).
13 Comments