-
Notifications
You must be signed in to change notification settings - Fork 2
GetAllocationsBetween
Leandro Rowies edited this page Nov 10, 2022
·
4 revisions
The GetAllocationsBetween
enables third party systems to poll the company for allocations that have happened based on a set of filtering criteria.
The data set can be filtered by account code range and allocation date range. The maximum number of records returned is 10,000
.
Note: The date parameter is looking at the Transaction Date entered by the User which can be in the past or future. If you'd like to filter Allocations by the Creation Date set by the system at the moment of the allocation process, please use GetAllocationsBetweenWithCreationDate.
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
ledger | String | Must be either `Sales` (for customers) or `Purchases` (for suppliers). Anything else will be rejected. |
since | DateTime | Start of the filtering Transaction Date range (inclusive). Use it to limit the number of records returned. Any allocation that has taken place before this date will not be returned to the caller. |
until | DateTime | End of the filtering Transaction Date range (exclusive). Use it to limit the number of records returned. Any allocation that has taken place after or on this date will not be returned to the caller. |
fromAccountCode | String | Start of the filtering account range (inclusive). Use it to limit the number of records returned. Any allocation on a customer or supplier whose account code falls before (in latin binary sorting order) this value will not be returned. Can be null. |
toAccountCode | String | End of the filtering account range (inclusive). Use it to limit the number of records returned. Any allocation on a customer or supplier whose account code falls after (in latin binary sorting order) this value will not be returned. Can be null. |
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if( auth != null )
{
// This fetches allocations records where the Transaction Date is within the last five days, for any customer whose code starts
// between A and E.
var res = ws.GetAllocationsBetween(auth, "Sales", DateTime.Now.AddDays(-5), DateTime.Now, "A", "E");
Assert.NotNull(res.Result);
foreach(var customerInfo in result.Result)
{
Console.WriteLine("For customer: " + customerInfo.AccountCode);
foreach(var transactionInfo in customerInfo.Allocations)
{
foreach(var allocationInfo in transactionInfo.AllocationEntries)
{
Console.WriteLine(String.Format("{0} was allocated from {1}-{2} to {3}-{4}", allocationInfo.AllocationAmount, allocationInfo.AllocatedToTransactionType, allocationInfo.AllocatedToExternalReference, transactionInfo.TransactionType, transactionInfo.ExternalReference));
}
}
}
}