GetAllocationsByTransactionId - accountsIQ/API-Wiki GitHub Wiki

The GetAllocationsByTransactionId function returns the list of allocations. An allocation represents a link between a credit transaction and a debit transaction. The allocation indicates the amount allocated, the date of the allocation and the two transaction IDs involved in the allocation. The amount dictates whether the allocation is partial or full.

For example, a payment of 5000 EUR can be used to pay fully an invoice of 3500 EUR and partially another invoice of 3000 EUR. In this case, the allocations records for the payment will contain two entries { Payment 1, Invoice 1, 3500 }, { Payment 1, Invoice 2, 1500 }. The allocations records for the first invoice will only contain one entry { Payment 1, Invoice 1, 3500 }. Only transactions linked to a customer/debtor or supplier/vendor/creditor will have allocations, other types of transactions are not allocated.

Declaration

C#

public WSResult2OfArrayOfWSAllocationTransactionDTO GetAllocationsByTransactionId(string token, string transactionId)

Visual Basic

Public Function GetAllocationsByTransactionId(ByVal token As String, ByVal transactionId as String) As WSResult2OfArrayOfWSAllocationTransactionDTO

Parameter List

Parameter Type Description
Token String The session token retrieved during authentication.
transactionId String The allocation records will be retrieved for the uniquely identified by this transaction ID. Only transactions linked to a debtor or a creditor will have allocations. General journals, bank transactions, etc. do not have any allocations.

Example

The following example retrieves the list of all allocation transactions linked to the specified transaction Id:

C#

Integration ws = new Integration();

String auth = ws.Login(entityID, partnerKey, userKey);
String transactionId = "1234";
if( auth != null )
{
    WSResult2OfArrayOfWSAllocationTransactionDTO result = ws.GetAllocationsByTransactionId(auth, transactionId);
    if (result.Result.FirstOrDefault() == null)
    {
       Console.WriteLine($" No allocations for id {transactionId}");
    }
    else
    {
        var allocationTransactions = result.Result.FirstOrDefault().AllocationEntries.ToList();

        allocationTransactions.ForEach(y =>
            Console.WriteLine($"Allocation Id: {y.AllocationId} " +
            $"\nAllocation Date: {y.AllocationDate} " +
            $"\nAllocation Amount: {y.AllocationAmount} " +
            $"\nAllocation Type: {y.AllocatedToTransactionType} " +
            $"\nExternal Ref: {y.AllocatedToExternalReference}" +
            $"\nInternal Number: {y.AllocatedToInternalNumber}" +
            $"\nAllocated to Transaction Id: {y.AllocatedToTransactionID}" +
            $"\r\n----------------------------------\r\n"));
    }
    Console.ReadLine();
}

See Also

⚠️ **GitHub.com Fallback** ⚠️