GetBudgetData - accountsIQ/API-Wiki GitHub Wiki

The GetBudgetData function returns the budget data of the company, in the currency of the company, for the criteria supplied.

Declaration

C#

public WSResult2OfWSBudgetHeader GetBudgetData(string token, WSBudgetOptions options)

Visual Basic

Public Function GetBudgetData(ByVal token As String, ByVal options as WSBudgetOptions) As WSResult2OfWSBudgetHeader 

Parameter List

Parameter Type Description
token String The session token retrieved during authentication.
options WSBudgetOptions The options you wish to apply to the budget data.

Example

The following example retrieves the budget template data for all accounts, pre-populating using budget data for 2019. including accounts with 0 movements but do not include BI Codes:

C#

Integration ws = new Integration();

String auth = ws.Login(entityID, partnerKey, userKey);
if( auth != null )
{
  var options = new WSBudgetOptions();
  options.Year = 2019;
  options.AccountSelection = AccountSelection.All;
  options.ValueSelection = ValueSelection.Budget;
  options.IncludeZeroMovement = true;
  options.IncludeBiCode = false;
  WSResult2OfWSBudgetHeader result = this.ws.GetBudgetData(this.auth, WSBudgetOptions options);
  
  if (result.Result.Status == OperationStatus.Success)
  {
    //Get GL "1000" budget value for Period 5 of 2019 financial year
    //If you set IncludeBiCode to true you will have to add entry.DepartmentID == "BICodeYouWant" to your query 

    var glAccountData = result.Result.Entries.Single(entry=>entry.GlAccountCode == "1000");
    var periodValue = glAccountData.Data.Single(periodData=>periodData.PeriodNumber == 5).Value;
    Console.Write(periodValue);
  }
  else 
  {
    //Log result.Result.Status and result.Result.ErrorCode
    Console.WriteLine("Failed to retrieve budget data");
  }
}
⚠️ **GitHub.com Fallback** ⚠️