GetTrialBalanceFromStartOfPeriod - accountsIQ/API-Wiki GitHub Wiki

The GetTrialBalanceFromStartOfPeriod function returns the trial balance movements for a company since the start of a period. In order to get year to dates, please see GetTrialBalanceForPeriod function.

This function is not available on consolidation entities.

Declaration

C#

public WSResult2OfWSTrialBalance GetTrialBalanceFromStartOfPeriod(string token, DateTime date)

Visual Basic

Public Function GetTrialBalanceFromStartOfPeriod(ByVal token As String, ByVal date As DateTime) As WSResult2OfWSTrialBalance  

Parameter List

Here is the parameter list required to use the function:

Parameter Type Description
token String The session token retrieved during authentication.
date DateTime A date in time. The movements will be calculated from the end of the period immediately before the period containing the given date, up to the given date.

Please see WSTrialBalance for the detail of the return type.

Examples

C#

// Integration is the reference to the accountsIQ web service
Integration ws = new Integration();

// Try to login using the entity ID, the integrator partner key and the user provided key
string auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
  WSResultStatusOfWSTrialBalance result = ws.GetTrialBalanceFromStartOfPeriod(auth, DateTime.Now);
  if (result.Status == OperationStatus.Success)
  {
      // The operation succeeded
      Console.WriteLine(String.Format("Trial balance movements for {0} - {1} {2}", 
         result.Result.FinancialYear, result.Result.PeriodNumber, result.Result.PeriodName));
      foreach(var glbal in result.Result.Balances)
      {
          var depts = String.Join(", ", glbal.DepartmentBalances.Select(d => d.DepartmentID));
          Console.WriteLine(String.Format("Balance on GL {0} is {1} spread across the following departments: {2}",
           glbal.GLAccountCode, glbal.OverallPeriodMovement, depts));
      }
  }
  else if (result.HasExpired)
  {
      // The login has expired. Log the user in again.
  }
  else if (result.Status == OperationStatus.Failure)
  {
      // The operation failed.
      // The ErrorCode field will provide more information as to what is the cause of the failure.
  }
}
else
{
  // The login failed. For security reasons, we cannot give more information on what went wrong.
  // The most likely cause is an incorrect user key or an expired partner key.

  // Put here your error handling for invalid login. Either one of the three piece of information can be incorrect.
}

See Also

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