Difference between revisions of "CommonFormula"
m (→functions) |
|||
Line 25: | Line 25: | ||
==getBalance(a)== | ==getBalance(a)== | ||
return the balance of the account a | return the balance of the account a | ||
+ | |||
Example: | Example: | ||
<pre>getBalance(1) return 25.01 | <pre>getBalance(1) return 25.01 | ||
Line 31: | Line 32: | ||
==formatDate('pattern',%SOME_DATE)== | ==formatDate('pattern',%SOME_DATE)== | ||
return the formatted %SOME_DATE | return the formatted %SOME_DATE | ||
+ | |||
Example: | Example: | ||
− | <pre>formatDate(' | + | <pre>formatDate('w',%START_DATE) returns the day of week of START_DATE</pre> |
==addTime(%SOME_DATE, %SOME_TZ)== | ==addTime(%SOME_DATE, %SOME_TZ)== | ||
return %SOME_DATE with added time depending of %SOME_TZ | return %SOME_DATE with added time depending of %SOME_TZ | ||
+ | |||
Example: | Example: | ||
<pre>addTime(%NOW_DATE, %USER_TZ) returns the current date converted to user timezone by adding timezone time difference</pre> | <pre>addTime(%NOW_DATE, %USER_TZ) returns the current date converted to user timezone by adding timezone time difference</pre> | ||
Line 41: | Line 44: | ||
==subTime(%SOME_DATE, %SOME_TZ)== | ==subTime(%SOME_DATE, %SOME_TZ)== | ||
return %SOME_DATE with substracted time depeding of %SOME_TZ | return %SOME_DATE with substracted time depeding of %SOME_TZ | ||
+ | |||
Example: | Example: | ||
<pre>subTime(%NOW_DATE, 'Europe/Paris') returns the current date converted to France timezone by substracting timezone time difference</pre> | <pre>subTime(%NOW_DATE, 'Europe/Paris') returns the current date converted to France timezone by substracting timezone time difference</pre> |
Revision as of 11:18, 22 June 2010
Contents
- 1 conditional processing
- 2 conditional processing with operator OR/AND
- 3 functions
- 3.1 max(a,b)
- 3.2 min(a,b)
- 3.3 abs(a)
- 3.4 roundCeil(a,b)
- 3.5 getAccount(a, %PILOT)
- 3.6 getBalance(a)
- 3.7 formatDate('pattern',%SOME_DATE)
- 3.8 addTime(%SOME_DATE, %SOME_TZ)
- 3.9 subTime(%SOME_DATE, %SOME_TZ)
- 3.10 sumFlightTime(%PILOT, 'year', 'month', 'day', 'hour', 'minute', 'position' )
- 3.11 getFlowSumBetweenAccount('accound id 1', 'account id 2', 'start date', 'end date')
- 4 variables
conditional processing
(test) ? true-case : false-case
conditional processing with operator OR/AND
( test1 OR test2 ) ? true-case : false-case ( test1 AND test2 ) ? true-case : false-case
functions
max(a,b)
return the maximum between a and b
min(a,b)
return the minimum between a and b
abs(a)
return the absolute value of a
roundCeil(a,b)
return the a value round top to b
Example:
roundCeil(106,5) return 110
getAccount(a, %PILOT)
return the account id of the account type id "a" from the member %PILOT
Example:
getAccount(1, %PILOT) return 4
getBalance(a)
return the balance of the account a
Example:
getBalance(1) return 25.01 getBalance(getAccount(1, %PILOT)) return 35.01
formatDate('pattern',%SOME_DATE)
return the formatted %SOME_DATE
Example:
formatDate('w',%START_DATE) returns the day of week of START_DATE
addTime(%SOME_DATE, %SOME_TZ)
return %SOME_DATE with added time depending of %SOME_TZ
Example:
addTime(%NOW_DATE, %USER_TZ) returns the current date converted to user timezone by adding timezone time difference
subTime(%SOME_DATE, %SOME_TZ)
return %SOME_DATE with substracted time depeding of %SOME_TZ
Example:
subTime(%NOW_DATE, 'Europe/Paris') returns the current date converted to France timezone by substracting timezone time difference
sumFlightTime(%PILOT, 'year', 'month', 'day', 'hour', 'minute', 'position' )
return the total flight time of a pilot since a starting date. Position at 0 is first pilot, position at 1 is second pilot
sumFlightTime(%PILOT, 2008, 01, 01, 00, 00, 0 ) returns the total flight time of first pilot since 2008-01-01 00:00:00
getFlowSumBetweenAccount('accound id 1', 'account id 2', 'start date', 'end date')
return the balance difference between account 1 and account 2 from a start date to an end date
getFlowSumBetweenAccount(%ACCOUNT1, %ACCOUNT2, '2008-01-01', %NOW_DATE)
variables
%DURATION
flight time input into the form
%COUNTER_DEPARTURE
counter departure input into the form
%COUNTER_ARRIVAL
counter arrival input into the form
%PILOT
pilot id
%USER_ID
user id
%LASTNAME
member lastname
%FIRSTNAME
member firstname
%NOW_DATE
current date (format is YYYY-MM-DD hh:mm:ss)
%START_DATE
date of flight beginning (format is YYYY-MM-DD hh:mm:ss)
%ACCOUNTING_START_DATE
accounting start date (format is YYYY-MM-DD hh:mm:ss)
%USER_TZ
member timezone
%ENTITY_TZ
structure/entity timezone
%QTY
quantity of purcharsed item(s)
%ACCOUNT1
debit account id
%ACCOUNT2
credit account id