Function Reference
Developer reference for the documented helper functions of the Merciglobal Cloud ERP library (/apis). These are extracted from the in-code documentation headers across the core library files (core.php, core2.php, core2_a.php, core4.php, base2.1.php, funcs_ac.php, gstr.php, excel.php, bi.php, cl_htmlrep3.php).
Getting started
Include the library entry point — it auto-connects to the current project database and loads every function below:
require_once $_SERVER['DOCUMENT_ROOT'].'/apis/main_webservices.php';
!!! tip "Table-name tokens"
In SQL strings, write tables as #tablename# (or #tablename). myExecute() expands them to the real pj_<client>_<table> names, and #compid# / #yearid# to the current company/year. Always put a space (and ideally an alias) right after a #table token — never a newline or ) immediately after it.
Categories
A total of 208 documented functions, grouped by purpose:
| Category | Functions | Covers |
|---|---|---|
| Context & Session | 39 | Current company, year, branch, user identity and environment. |
| Users & Rights | 18 | User lookups, access rights and role checks. |
| Database & Queries | 14 | Running queries, reports and list grids against the project DB. |
| Tables & Schema | 31 | Table existence, field structure, unique keys, grids and links. |
| Strings, Numbers & Dates | 32 | String, number, array and date helpers. |
| Defaults & Script Vars | 10 | Per-project key/value defaults and on-screen script variables. |
| Geo & Location | 8 | Distance, lat/long and address helpers. |
| Communication | 7 | Email, SMS, push notifications and alerts. |
| Files, Images & PDF | 16 | File handling, image resize, PDF/QR and media conversion. |
| CSV & Excel | 7 | CSV and Excel import/export helpers. |
| Accounting & GST | 14 | Accounting, GST and state-code helpers. |
| Menus, UI & Audit | 12 | Menus, UI rendering, transactions and audit/compliance. |
| Classes & Methods | 42 | First-party framework classes (BaseForm, Criteria, Grid, htmlRep3, caches, integrations) and their public methods. |
| Ajax Endpoints | 152 | Catalog of ajax*.php server endpoints, their purpose and the params they read. |