Balan::GetBalanceEx (Interface: Balan)
 
Gets the balance for a group of account numbers and for a period.
 
DOUBLE GetBalanceEx (
    BSTR bsAccount,
    SHORT sBeginMonth,
    SHORT sEndMonth
)
 
Parameters
bsAccount
[in] The account number of which you want to know the balance.
sBeginMonth
[in] The month from when you want to know the balance.
sEndMonth
[in] The month to when you want to know the balance.
 
Return value
A DOUBLE containing the balance for the given account number in the given period.
 
Remarks
The account number, which is normally composed of digits only, can contain the wild card '?' (which stands for any digit) and can end with '*' (all account numbers beginning with the digits before the '*').
The month parameters (sBeginMonth and sEndMonth) can have a value from 1 to 25 (a financial year can cover 2 complete calendar years) and if 0 is given for the begin month (the value for the end month is ignored in that case), the balance of the complete financial year is returned.
If you supply an end month that is smaller than the begin month, no exception will be thrown and 0.0 will be returned.
The balance that is returned is limited to the given account only, it is not the sum of the balances of its sub-accounts. There are a few exceptions, for class accounts (accounts consisting of 1 digit, e.g. '2') and prefix accounts (customers, suppliers, deposits, banks, postal cheques and cash) the balance returned is the sum of the balances of the sub-accounts.
 
See Also
CreateBalan
GetBalance
GetBalanceField
 
Samples
 
C++
 
// Retrieve the balance of the class account '2' for the period of January to April (contains the sum of the balances of the sub-accounts)
double lfBalance = pBalan->GetBalanceEx ("2", 1, 4);

// Retrieve the balance of the account '2009' for the month of February (contains only the balances of this account)
lfBalance = pBalan->GetBalanceEx ("2009", 2, 2);

// Retrieve the balance of all customers (assuming that '400' is the customer prefix account) for the complete financial year
lfBalance = pBalan->GetBalanceEx ("400", 0, 0);

// Retrieve the balance of the accounts 1204, 1214, 1224, ..., 1294 for the month of April
lfBalance = pBalan->GetBalanceEx ("1204", 4, 4) + pBalan->GetBalanceEx ("1214", 4, 4) + ... + pBalan->GetBalanceEx ("1294", 4, 4);
// ...or using the '?'-wildcard
lfBalance = pBalan->GetBalanceEx ("12?4", 4, 4);

// Retrieve the balance of the account 1204 and all its sub-accounts (12041, 12042, 120420, 120421) for the month of May
lfBalance = pBalan->GetBalanceEx ("1204", 5, 5) + pBalan->GetBalanceEx ("12041", 5, 5) + pBalan->GetBalanceEx ("12042", 5, 5) + pBalan->GetBalanceEx ("120420", 5, 5) + pBalan->GetBalanceEx ("120421", 5, 5);
// ...or using the '*'-wildcard
lfBalance = pBalan->GetBalanceEx ("1204*", 5, 5);

C#
 
// Retrieve the balance of the class account '2' for the period of January to April (contains the sum of the balances of the sub-accounts)
double lfBalance = oBalan.GetBalanceEx ("2", 1, 4);

// Retrieve the balance of the account '2009' for the month of February (contains only the balances of this account)
lfBalance = oBalan.GetBalanceEx ("2009", 2, 2);

// Retrieve the balance of all customers (assuming that '400' is the customer prefix account) for the complete financial year
lfBalance = oBalan.GetBalanceEx ("400", 0, 0);

// Retrieve the balance of the accounts 1204, 1214, 1224, ..., 1294 for the month of April
lfBalance = oBalan.GetBalanceEx ("1204", 4, 4) + oBalan.GetBalanceEx ("1214", 4, 4) + ... + oBalan.GetBalanceEx ("1294", 4, 4);
// ...or using the '?'-wildcard
lfBalance = oBalan.GetBalanceEx ("12?4", 4, 4);

// Retrieve the balance of the account 1204 and all its sub-accounts (12041, 12042, 120420, 120421) for the month of May
lfBalance = oBalan.GetBalanceEx ("1204", 5, 5) + oBalan.GetBalanceEx ("12041", 5, 5) + oBalan.GetBalanceEx ("12042", 5, 5) + oBalan.GetBalanceEx ("120420", 5, 5) + oBalan.GetBalanceEx ("120421", 5, 5);
// ...or using the '*'-wildcard
lfBalance = oBalan.GetBalanceEx ("1204*", 5, 5);

VBS
 
Dim lfBalance

' Retrieve the balance of the class account '2' for the period of January to April (contains the sum of the balances of the sub-accounts)
lfBalance = oBalan.GetBalanceEx("2", 1, 4)

' Retrieve the balance of the account '2009' for the month of February (contains only the balances of this account)
lfBalance = oBalan.GetBalanceEx("2009", 2, 2)

' Retrieve the balance of all customers (assuming that '400' is the customer prefix account) for the complete financial year
lfBalance = oBalan.GetBalanceEx("400", 0, 0)

' Retrieve the balance of the accounts 1204, 1214, 1224, ..., 1294 for the month of April
lfBalance = oBalan.GetBalanceEx("1204", 4, 4) + oBalan.GetBalanceEx("1214", 4, 4) + ... + oBalan.GetBalanceEx("1294", 4, 4)
' ...or using the '?'-wildcard
lfBalance = oBalan.GetBalanceEx("12?4", 4, 4)

' Retrieve the balance of the account 1204 and all its sub-accounts (12041, 12042, 120420, 120421) for the month of May
lfBalance = oBalan.GetBalanceEx("1204", 5, 5) + oBalan.GetBalanceEx("12041", 5, 5) + oBalan.GetBalanceEx("12042", 5, 5) + oBalan.GetBalanceEx("120420", 5, 5) + oBalan.GetBalanceEx("120421", 5, 5)
' ...or using the '*'-wildcard
lfBalance = oBalan.GetBalanceEx("1204*", 5, 5)

VB.NET
 
Dim lfBalance As Double

' Retrieve the balance of the class account '2' for the period of January to April (contains the sum of the balances of the sub-accounts)
lfBalance = oBalan.GetBalanceEx("2", 1, 4)

' Retrieve the balance of the account '2009' for the month of February (contains only the balances of this account)
lfBalance = oBalan.GetBalanceEx("2009", 2, 2)

' Retrieve the balance of all customers (assuming that '400' is the customer prefix account) for the complete financial year
lfBalance = oBalan.GetBalanceEx("400", 0, 0)

' Retrieve the balance of the accounts 1204, 1214, 1224, ..., 1294 for the month of April
lfBalance = oBalan.GetBalanceEx("1204", 4, 4) + oBalan.GetBalanceEx("1214", 4, 4) + ... + oBalan.GetBalanceEx("1294", 4, 4)
' ...or using the '?'-wildcard
lfBalance = oBalan.GetBalanceEx("12?4", 4, 4)

' Retrieve the balance of the account 1204 and all its sub-accounts (12041, 12042, 120420, 120421) for the month of May
lfBalance = oBalan.GetBalanceEx("1204", 5, 5) + oBalan.GetBalanceEx("12041", 5, 5) + oBalan.GetBalanceEx("12042", 5, 5) + oBalan.GetBalanceEx("120420", 5, 5) + oBalan.GetBalanceEx("120421", 5, 5)
' ...or using the '*'-wildcard
lfBalance = oBalan.GetBalanceEx("1204*", 5, 5)