Home

StatisticsAndBillingRedirect

writeStats(Object spreadsheetData, Object sheet, Object type, Object from, Object to)

Writes statistics into the sheet

Arguments:

Name Type Description
spreadsheetData Object data to write into sheet
sheet Object sheet
type Object switches writing stats to different modes
from Object from which data to write stats
to Object to which data to write stats

setProp(Object prop, Object value)

Wrapper function.

Arguments:

Name Type Description
prop Object
value Object

getClients()

Return Values:

Type Description
Array<Object> array with name of all clients

msToTime(Object duration)

Converts duration into time format string @duration miliseconds

Arguments:

Name Type Description
duration Object

Return Values:

Type Description
string duration in format h:mm:ss:SSS

getSortedObjProps(Object obj)

Creates array of object properties and sortes them

Arguments:

Name Type Description
obj Object Object with string properties

Return Values:

Type Description
Array<Object> sorted array of obj properties

getResource(Object resource)

Helper function to create main HTML. It can return html, javascript ot strings we need to include in our page.

Arguments:

Name Type Description
resource Object string describing wanted resource

Return Values:

Type Description
Object requested resource or null if resource not found

createPresentableHTML(Object content, Object sourceType, Object title)

Creates presentable HTML for a browser *cannot be run from library, becaouse of filename

Arguments:

Name Type Description
content Object depends on a sourceType, if sourceType isn't string, it includes file with name == content
sourceType Object is string indicating values 'string'/'file' for source type, takes file as default for any other value
title Object title of a window

Return Values:

Type Description
string string of html

doGet(Object e)

Serves HTML and checks user's permissionto view it

Arguments:

Name Type Description
e Object url parameters setting this webapp's beahviour

Return Values:

Type Description
Object HTML page with javascript

include(Object filename)

Generates HMTL from a file. *just shortcut a for a long command

Arguments:

Name Type Description
filename Object name of file to be included

Return Values:

Type Description
string html

writeToCell(Object sheet, Object row, Object col, Object value)

Writes data to specific cell

Arguments:

Name Type Description
sheet Object where to write
row Object where to write
col Object where to write
value Object value to write

writeBilling(Object spreadsheetData, Object sheet, Object client)

Writes billing into the sheet

Arguments:

Name Type Description
spreadsheetData Object data to write into sheet
sheet Object sheet
client Object name of client

getProp(Object name)

Wrapper function.

Arguments:

Name Type Description
name Object

writeToCellSpec(Object sheet, Object row, Object col, Object obj)

Writes data to specific cell in a format specified in obj

Arguments:

Name Type Description
sheet Object where to write
row Object where to write
col Object where to write
obj Object obj with input data and its format (as {value: xx, color: xx, isDuration: xx, roundPrice: xx, oneDigitFormat: xx, twoDigitFormat: xx})

setRuntimeProperties(Object params)

Sets runtime properties

Arguments:

Name Type Description
params Object object with properties to set

createBilling(Object from, Object to, Object client)

Creates billing spreadsheet in user's google drive and generates data into it

Arguments:

Name Type Description
from Object from which day bill is going to be created
to Object to which day bill is going to be created
client Object name of client

Return Values:

Type Description
string url of new spreadsheet

processStatOrBillObj(Object formObject, Object isBill)

Parses and validates data from formObject, then it creates Billing or Statistics.

Arguments:

Name Type Description
formObject Object Object received from client's browser form.
isBill Object if true processes billing form, statistics otherwise

Return Values:

Type Description
Object object which designates success or failure (in a case form had nonvalid data)

roundToTwo(Object num)

Rounds to two places, "banking format" @num number

Arguments:

Name Type Description
num Object

Return Values:

Type Description
number number with two places decimal

createStatistics(Object from, Object to)

Creates statistics spreadsheet in user's google drive and generates data into it

Arguments:

Name Type Description
from Object from which day stats are going to be created
to Object to which day stats are going to be created

Return Values:

Type Description
string url of new spreadsheet

processForm(Object formObject)

Processes form and returns result.

Arguments:

Name Type Description
formObject Object Form object

Return Values:

Type Description
Object object which designates success or failure