Class

Book

Book()

This class defines a Book.
A is an abstraction of a structure that you want to control, like a business, project, or personal expenses and so forth.
It contains all Accounts where Transactions are recorded/posted;

Constructor

new Book()

Methods

continueTransactionIterator(continuationToken) → {TransactionIterator}

Resumes a transaction iteration using a continuation token from a previous iterator.
Parameters:
Name Type Description
continuationToken string continuation token from a previous folder iterator
a collection of transactions that remained in a previous iterator when the continuation token was generated

createAccount(name, groupopt, descriptionopt) → {Account}

Create an Account in this book. The type of account will be determined by the type of others Accounts in same group. If not specified, the type ASSET (permanent=true/credit=false) will be set. If all other accounts in same group is in another group, the account will also be added to the other group.
Parameters:
Name Type Attributes Description
name string The name of the Account
group string <optional>
The group of the Account.
description string <optional>
The description of the Account
The created Account object
Account

createTransactionsDataTable(query) → {TransactionsDataTableBuilder}

Create a TransactionsDataTableBuilder based on a query.

This method gives a TransactionsDataTableBuilder to create two dimensional Array representations of transactions dataset.

Go to bkper.com and open report wizard: to learn more about query sintax.
Parameters:
Name Type Description
query string The flter query.
See:
the Transactions list builder.
Example
var book = BkperApp.openById("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");


  book.createTransactionsDataTable("acc:'Bank' after:8/2013 before:9/2013");
  ...
  book.createTransactionsDataTable("after:$m before:$m+1");
  ...
  book.createTransactionsDataTable("#gas");

  

formatDate(date, timeZoneopt) → {string}

Parameters:
Name Type Attributes Description
date Date The date to format as string.
timeZone string <optional>
The output timezone of the result. Default to script's timeZone
The date formated according to date pattern of book
string

formatValue(value) → {string}

Parameters:
Name Type Description
value Number The value to be formatted.
The value formated according to decimal separator and fraction digits of book}
string

getAccount(idOrName) → {Account}

Gets an Account object
Parameters:
Name Type Description
idOrName number | string The id or name of the Account
The matching Account object
Account

getAccounts() → {Array.<Account>}

Gets all Accounts of this Book
Array.<Account>

getBalanceReport(query) → {Report.BalanceReport}

Get balances reports given a query. Balance queries starts with "=".

This method gives a Report.BalanceReport.
Usually balances are used to populate data tables for charts with Chart Services and create great user interfaces, dashboards or insert in documents to report it for users.

Go to bkper.com and open report wizard: to learn more about query sintax.
Parameters:
Name Type Description
query string The report query (starting with '=')
See:
A Balance Report representation
Example
var book = BkperApp.openById("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");



  book.getBalanceReport("=#rental #energy after:8/2013 before:9/2013");
  ...
  book.getBalanceReport("=group:'Expenses' after:$m before:$m+1");
  ...
  book.getBalanceReport("=acc:'Home' acc:'Transport' #medicines after:8/2013 before:12/2013");

  

getDatePattern() → {string}

The date pattern of the Book
string

getDecimalSeparator() → {DecimalSeparator}

The decimal separator of the Book

getFractionDigits() → {string}

The fraction digits of this Book
string

getGroup(idOrName) → {Group}

Gets an Group object
Parameters:
Name Type Description
idOrName number | string The id or name of the Group
The matching Group object
Group

getGroups() → {Array.<Group>}

Gets all @{link Group|Groups} of this Book
Array.<Group>

getId() → {string}

The id of this Book
string

getLastUpdateMs() → {number}

The last update date of the book, in in milliseconds
number

getLocale() → {string}

Deprecated:
The locale of the Book
string

getName() → {string}

The name of this Book
string

getOwnerName() → {string}

The name of this Book Owner
string

getPermission() → {Permission}

The permission of the current user
Permission

getTimeZone() → {string}

The time zone of the book
string

getTimeZoneOffset() → {number}

The time zone offset of the book, in minutes
number

record(transactions, timeZoneopt)

Records Transactions a on the Book. The text is usually amount and description, but it can also can contain an informed Date in full format (dd/mm/yyyy - mm/dd/yyyy).
Parameters:
Name Type Attributes Description
transactions string | Array.<string> | Array.<Array> The text/array/matrix containing transaction records, one per line/row. Each line/row records one transaction.
timeZone string <optional>
The time zone to format dates.
Search for transactions.
Go to bkper.com and open search wizard: to learn more about query syntax.
Parameters:
Name Type Description
query string The query string.
The search result as an iterator.
Example
var book = BkperApp.loadBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
  var transactions = book.search("acc:CreditCard after:28/01/2013 before:29/01/2013");
  ...
  transactions = book.search("#fuel");
  ...
  transactions = book.search("#fuel after:$d-4");
  ...
  transactions = book.search("after:23/01/2013 before:29/01/2013 using:postDate");
  ...
  while (transactions.hasNext()) {
    var transaction = transactions.next();
    Logger.log(transaction.getDescription());
  }