StabilStandar.com

System 2.7

(c) StabilStandar.com, 2012-2018
email: info@stabilstandar.com



Table of contents
------------------------------
Command-line arguments
Scripting
HTTP API
System configuration
Privileges
Free/open source software



Command-line arguments
Accepted command-line arguments: 
- info: shows information
- api: starts API server
  api <database_url> [port]
- local: starts database server, accepting only local connections
  local [tcp:port] [web:port] [pg:port]
- server: starts database server
  server [tcp:port] [web:port] [pg:port]
- create: creates and initializes database
  create <path>
Note: 
- default API port: 8080
- api: <database_url>, one of the following:
       path
       tcp://host/path
       tcp://host:port/path
- tcp: TCP server, web: web server (encrypted), pg: PostgreSQL server
- without tcp, web, or pg specified, all of them will be started
- tcp, web, or pg requires port number
- tcp, web, or pg may be specified in arbitrary order
- path may be specified in relative or absolute path
- path is specified without file name extension
- default user name or password: admin
- login screen will be shown when no accepted arguments are found
Example: 
java -jar System.jar info
java -jar System.jar api data
java -jar System.jar api tcp://localhost/~/data 8080
java -jar System.jar create data
java -jar System.jar local
java -jar System.jar server
java -jar System.jar server tcp:9092
java -jar System.jar server tcp:9092 web:8082 pg:5435


Scripting
Scripting: 
- Language: BeanShell
- Arguments passed to script: 
  - database: database connection
  - user: username
  - admin: has administrative privileges
  - application: application name
  - version: application version
  - privileges: list of user privileges (String)
  - argument: map of additional arguments (if applicable)
    - id: selected id
    - ids: all ids (table)
    - rows: all rows (table, List of List of Object)
    - delivery_order_id
    - incoming_shipment_id
- Return value: (optional) result of last evaluated expression
- Available database tables: system_data and system_user_data
- Special variable: output (case-sensitive, non-null, if assigned) will be
  displayed in a print preview dialog (for script category other than print, 
  sales_1, sales_2, purchase_1, and purchase_2)
- Category: 
  - default: default script
  - print: return value will be displayed in a print preview dialog
  - sales_1: sales order (1)
  - sales_2: sales order (2)
  - purchase_1: purchase order (1)
  - purchase_2: purchase order (2)
  - contact: contact
  - product: product
  - account: account
  - asset: asset
  - purchase: purchase order
  - sales: sales order
  - expense: expense
  - payment: payment (third party)
  - appointment: appointment/medical record
  - medical_check_up: medical check-up
  - notification: notification (appointment)
- Additional commands: 
  - systemDate: date/time
    systemDate(java.sql.Date date, int amount, int type)
    systemDate(java.sql.Timestamp date, int amount, int type)
    systemDate(java.util.Date date, int amount, int type)
    - amount: add (positive) or subtract (negative)
    - type: 1: second (java.util.Date)
    - type: 2: second (java.sql.Timestamp)
    - type: 3: minute (java.util.Date)
    - type: 4: minute (java.sql.Timestamp)
    - type: 5: hour of day (java.util.Date)
    - type: 6: hour of day (java.sql.Timestamp)
    - type: 7: day of year (java.util.Date)
    - type: 8: day of year (java.sql.Timestamp)
    - type: 9: month (java.util.Date)
    - type:10: month (java.sql.Timestamp)
    - type:11: year (java.util.Date)
    - type:12: year (java.sql.Timestamp)
  - systemDialog: dialogs
    systemDialog(message)
    systemDialog(message, title)
    systemDialog(message, title, type)
    systemDialog(message, title, type, data)
    - type: 1: confirmation
    - type: 2: input dialog
    - type: 3: date picker
    - type: 4: combo box (user)
    - type: 5: color chooser
    - type: 6: color chooser (color code)
    - type: 7: formatted text (number)
    - type: 8: spinner (number, use data to specify value, min, max, step)
    - type: 9: spinner (percent)
    - type:10: password
    - type:11: check box
    - type:12: check boxes (comma-separated (message), returns a list)
    - type:13: check boxes (comma-separated (message), returns a list (selected))
    - type:14: radio buttons (comma-separated (message), returns selected index)
    - type:15: file chooser (save)
    - type:16: file chooser (open)
    - type:17: combo box (use data to specify items)
    - type:18: combo box and formatted text (number, use data to specify items)
    - type:19: combo box and text (use data to specify items)
    - type:20: combo box and formatted text (number, use data to specify items, yes/no/cancel)
    - type:21: combo box and text (use data to specify items, yes/no/cancel)
    - data: list of object
    systemDialog(message, title, data, row, column, separator, index)
    - data: list of rows
    - row: starting row
    - column: column
    - separator: separator string
    - index: array index (split)
    systemDialog(message, title, fields, data, additional)
    - fields: list of table columns
    - data: list of table rows
    - additional: additional empty rows
  - systemFormat: formatting functions
    systemFormat(int number)
    systemFormat(long number)
    systemFormat(float number)
    systemFormat(double number)
    systemFormat(BigDecimal number)
    systemFormat(Date date)
    systemFormat(java.util.Date date)
    systemFormat(Timestamp timestamp)
  - systemGet: system functions
    systemGet(type)
    systemGet(type, id)
    systemGet(type, id, info)
    - type: 1: current date (java.sql.Date)
    - type: 2: current date time (java.sql.Timestamp)
    - type: 3: system configuration (requires id (unused), info (configuration key))
    - type: 4: contact information (requires id, info (comma-separated fields or empty string))
    - type: 5: contact label (requires id)
    - type: 6: product information (requires id, info (comma-separated fields or empty string))
    - type: 7: product label (requires id)
    - type: 8: product list price (requires id)
    - type: 9: product cost price (requires id)
    - type:10: product stock quantity (requires id)
    - type:11: product type (requires id, returns 1: stockable, 2: service, 3: kit, -1: error)
    - type:12: product kit detail (requires id, returns a list of list of Long (product id), Integer (quantity))
    - type:13: product kit availability (requires id and info (int, quantity), returns true, false, or null)
  - systemJournal: journal
    systemJournal(Map debit, Map credit, int type, String note, long reference, long extra, long extraReference, int done)
    systemJournal(Map debit, Map credit, String note, long reference)
    - debit: map of account id and amount <Long, BigDecimal> (debit)
    - credit: map of account id and amount <Long, BigDecimal> (credit)
    note: returns a list of journal id or a negative integer (error)
  - systemNumberToWords: number to words [en, id]
    systemNumberToWords(language, BigDecimal number, ignore)
  - systemParse: parsing functions
    systemParse(type, value)
    - type: 1: integer
    - type: 2: float
    - type: 3: decimal (default)
    - type: 4: decimal
    - type: 5: date
    - type: 6: timestamp
  - systemQuery: database query functions
    systemQuery(query)
    systemQuery(query, width, height)
  - systemRandom: random number generation functions
    systemRandom(int type, String extra)
    - type: 1: boolean
    - type: 2: double
    - type: 3: integer
    - type: 4: long
    systemRandom(double bound)
    systemRandom(double origin, double bound)
    systemRandom(int bound)
    systemRandom(int origin, int bound)
    systemRandom(long bound)
    systemRandom(long origin, long bound)
  - systemType: data type conversion
    systemType(java.util.Date date, type)
    - type: 1: java.sql.Date
    - type: 2: java.sql.Timestamp
    systemType(java.sql.Date date, type)
    - type: 1: java.util.Date
    systemType(java.sql.Timestamp timestamp, type)
    - type: 1: java.util.Date
    - type: 2: java.sql.Date


HTTP API
Description: 
- Method: POST
- Output: JSON
- Content-Type: application/x-www-form-urlencoded
- Default client error: 400 (bad request)
- Default response: {"id":0,"message":"","status":400}
- Successful: 200 (ok)
/login: login test
 required: username password privilege
 error: 403 (login, privilege)
 success: login: <non-empty string>
/contact/create: create new contact
 required: username password privilege contact_name
 error: 403 (login, privilege)
 success: contact: <non-empty string>
/appointment/list: get appointment list
 required: username password privilege date
 error: 403 (login, privilege)
 success: list: <list>
/appointment/template: get user template
 required: username password privilege
 error: 403 (login, privilege)
 success: template: <string>
/medical/record/get: get medical record
 required: username password privilege contact_id
 error: 412 (contact), 403 (login, privilege)
 success: record: <HTML string>
/medical/checkup/get: get medical check-up data
 required: username password privilege contact_id
 error: 412 (contact), 403 (login, privilege)
 success: record: <HTML string>
/medical/record/add: add medical record
 required: username password privilege contact_id appointment_id record
 error: 412 (contact, appointment, mismatch), 403 (login, privilege)
 success: add: <int: 1>


System configuration
System configuration parameters:
module_medical 
tag_medical_check_up [tag or color code]
sale_order_list_user 
sale_order_link_users 
sale_order_insufficient_quantity 
appointment_check_availability 
automatic_refresh 
automatic_refresh_interval 
automatic_refresh_interval_message 
automatic_search_new_record 
editor_font_size 
print_font_size 
currency_symbol 
currency_name 
payment_verification_note 
number_to_words_language [en, id]
number_to_words_ignore_zero 
prefix_sale_order 
prefix_sale_invoice 
prefix_sale_delivery 
prefix_purchase_order 
prefix_purchase_delivery 
prefix_medical_check_up 
print_header_sale_order_1 
print_footer_sale_order_1 
print_header_sale_delivery_1 
print_footer_sale_delivery_1 
print_header_purchase_order_1 
print_footer_purchase_order_1 
print_header_purchase_delivery_1 
print_footer_purchase_delivery_1 
print_header_medical_check_up_1 
print_footer_medical_check_up_1 
line_break_sale_1 
line_break_purchase_1 
line_break_medical_1 
line_break_1 
script_visible 
notification_day_before 
notification_counter 
notification_message_1 [{0} title, {1} name, {2} date, {3} user]
notification_message_2 
notification_message_3 
require_check_update 
require_download_update 
require_download_update_append_version 


Privileges
User privileges:
admin
profile
user/select
user/another
file/user
file
message
contact/create
contact/all
contact/extra
account
account/asset
account/expense
account/manual
account/payment
account/all
product/all
warehouse
warehouse/all
appointment
sales
purchase
hr
hr/all
medical
medical/all
void
correction
print
print/module
override
report/1
report/2
report/3
extension
code
code/all
external
store
store/all
pos
pos/all
export
import
log
game


Free/open source software
This application uses the following free/open source software: 
- Apache Commons Codec (Apache License 2.0)
  http://commons.apache.org/codec/
- BeanShell (LGPL 2.1)
  http://www.beanshell.org
- H2 Database (MPL 2.0 or EPL 1.0)
  http://www.h2database.com
- Jasypt Java Simplified Encryption (Apache License 2.0)
  http://www.jasypt.org
- Jetty (Apache License 2.0 or EPL 1.0)
  http://www.eclipse.org/jetty/
- json-simple (Apache License 2.0)
  http://code.google.com/p/json-simple/
- SwingX (LGPL 2.1+)