Classes & Methods
Core first-party framework classes of the Merciglobal Cloud ERP library. These build the screens, grids, reports and integrations of the ERP. (Bundled third-party libraries — PHPMailer, Symfony, FastExcelWriter, digitalsign, PayU — are intentionally excluded.)
All require apis/main_webservices.php (directly or via the project funcs.php).
On this page: BaseForm · Criteria · ListView · BaseSelect · Filter · Cart · Hot · BaseCarousel · Grid · subGrid · simpleForm · htmlRep3 · htmlRep2 · htmlRep · htmlRepAjax · Cache_Filesystem · Cache_APC · Gr_Cache_Filesystem · paymentGateway · kanban · kanban_sys · Panels · Pane · Alert · AlertSystem · prepost · S3 · ociS3 · SLA · wbot · xQRcode · Browser · csvReader · csvReaderCol · PDF · htmlPDF · ai · ai_mobileapp · dbf_class · EWayBill · xcached · xcachedQry
BaseForm
- The primary screen/form builder. Construct with a title, then add buttons, criteria, labels, grids and content and call
render(). Backbone of almost every ERP page.
Public methods
__construct($ctitle = "", $cpaneltype = "", $nSecAutoRedirect=0, $layout='2X', $menu='yes', $flag='')enableGeoTrack($lset=true)addCodeToWindowOnLoad($cCode)addCodeToVarFunc($cfieldname, $cCode)addGroupStart()addGroupEnd()addUrlScheme($scheme, $caption='', $icon='')addImage($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $style='', $divstyle='', $fname='', $tabindex=0)addSection($caption='', $replaceunderscore=true)addChart($name, $value, $caption='', $subtitle='', $type='bar')addDashBoard($charts)addAdvDashBoard()addTextField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $min='', $case='U', $len=0, $style='', $fname='', $tabindex=0, $carry='false', $exclass='')addGeoField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $style='')addTimeField($name = '', $value = '', $caption = '', $fname='', $tabindex=0)addEmailField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $min='', $fname='', $tabindex=0)addSearchField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $table='', $field='')addPrintButton($name = '', $value = '', $caption = '', $location='', $icon='')addLabel($name = '', $style = '')addShortcutLinks($name='', $icon='', $href='#', $onclick='', $tip='', $bgclr='')addProgressBar($name = '')addRawHtml($html='')addDebug($html='', $title='')addHot($code='')addDiv($name = '', $style = '')addFullRow($html)addHiddenField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $fname='')addHiddenFormField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $fname='')addPassword($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $min='', $fname='', $tabindex=0)addButton($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $type='', $lCancelValidate=false, $confirm='N')addJSButton($name = '', $value = '', $caption = '', $enabled=true, $onclick='', $float=false)addFloatButton($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $type='', $lCancelValidate=false)addLink($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $newwin=false)addTextArea($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $rows=5, $editloc='', $delloc='', $image='', $fname='', $tabindex=0)addHtmlEditor($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $rows=5, $lookup='', $fname='', $tabindex=0)addHtmlViewer($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $rows=5)addBack($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $jsfunc='')addNext($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $submit=false, $jscript='')addBtnMenu($name='', $values=array()addCustomButton($cap='', $link='', $icon='')addSelect($name='', $value='', $caption = '', $location='', $icon='', $enabled='', $multi=false, $allowdash=true, $style='', $searchable=true, $fname='', $ajax_query='', $filtervalue='', $qry_displayfieldname='', $tabindex=0, $linkinfo='', $cTable='', $cField='', $ai_autohide=false, $carry='false', $len=0)addTour($pageid='', $element='', $message='')addDateField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $min='', $max='', $morethan='', $fname='', $style='', $tabindex=0, $carry='false')addNumField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $min='', $max='', $morethan='', $jspre='', $jspost='', $mindigit='', $len=0, $style='', $fname='', $ngvalue='', $round=false, $tabindex=0, $autogen=false, $carry='false')addGetImage($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $compulsory=true, $fname='', $tabindex=0)addGetFile($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $compulsory=true, $fname='', $tabindex=0)addGetVideo($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $compulsory=true, $fname='', $tabindex=0)addQRcode($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='')addCarousel($name = '', $value='', $caption = '', $location='', $icon='', $enabled='')addCart($name = '', $value='', $caption = '', $location='', $icon='', $enabled='', $cart=false, $whatsapp=false, $enlarge=false, $search=false, $cartlink=false)addButtonBar($name = '', $value='', $caption = '', $location='', $icon='', $enabled='', $type='')addLocationMap($name = '', $value='', $caption = '', $location='', $icon='', $enabled='')addListView($ListView, $ExportQry='', $print=false, $curpage=1, $pages=0, $baseqry='', $cTable='', $fields='', $isreport='')addCriteria($criteria)addCriteriaX($criteria)addFilter($name, $filterobject)addFormValid($cScript)addUserScripts($cScript)addSimpleList($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='')addTabPages($name = '', $value = '')addElement($cHtml)addCard($cardform)rowStart()gridStart()gridEnd()footerStart()rowEnd($rowdel=false, $rowadd=false)footerEnd($rowdel=false, $rowadd=false)addScriptAfterBody($cScript)addScript($cScript)addNotice($cmsg)addNotification($cmsg)render($call=0,$homefolder='')html_createTableTabs()html_sectionastab()initnotifications()sectionAsTab($section)renderForm($call=0,$homefolder='')html_scriptAfterBody()html_declarewindowonloadfuncs($call)html_declarevarfuncsToJs()html_UserScripts()html_headelem()baseBtnCap($aTemp)html_tableheader($title,$full=true)html_scripts($call)
:material-file-code: Source: apis/base2.1.php
Criteria
- Builds the filter/criteria panel for reports and screens (date ranges, folders, selectable inputs). Attach to a BaseForm via
addCriteria().
Public methods
__construct($criteriaid='')addFolder($cFolder)addHelp($cTab, $contents)addStartEndDate($cTab, $sDate, $eDate, $cap='', $remember=false, $defid='')addStartEndSerial($cTab, $start, $end, $cap='', $defid='')addCheckBox($cTab, $caption, $checked=false, $visible=true, $defid='')addNumField($cTab, $caption, $value, $defid='')addTextField($cTab, $caption, $value, $defid='')addTextArea($cTab, $caption, $value, $defid='')addDateField($cTab, $caption, $value, $defid='')addDateField2($cTab, $caption, $value, $defid='')addLabel($cTab, $caption, $defid='')checkList($cTab, $idfield, $displayfield, $cTable, $cWhere='', $apreselect=[], $allselected=false, $defid='')arrayList($cTab, $alist, $apreselect=array()radioList($cTab, $alist, $apreselect=array()QueryList($cTab, $cQuery, $defid='')addDynamicCriteria()
:material-file-code: Source: apis/base2.1.php
ListView
- Renders tabular list/grid views of data with columns, formatting and actions.
Public methods
__construct($redirectOnClick)addHeader($aHeader)addColWd($aColWd)SetAlign($aAlign)addRows($aRows)WriteRow($aRow)Render()addFilterBtn($table, $cBtn, $field, $fldequal, $focused)
:material-file-code: Source: apis/base2.1.php
BaseSelect
- Builds select/dropdown inputs (including data-bound and dependent selects).
Public methods
__construct()addOption($id, $value, $selected='false', $icon='', $location='', $key='')
:material-file-code: Source: apis/base2.1.php
Filter
- Encapsulates a reusable filter definition applied to list data.
Public methods
__construct()addTitle($cTitle)addOption($cOption, $lchecked=false)
:material-file-code: Source: apis/base2.1.php
Cart
- Shopping/selection cart abstraction used by ecommerce and multi-select flows.
Public methods
__construct()addItem($id, $img, $h3, $cap='', $price=0, $selected=false, $qty=0)
:material-file-code: Source: apis/base2.1.php
Hot
- Handsontable-style editable grid (the
hot_*data grids) wrapper for spreadsheet-like entry.
Public methods
__construct($container)render()
:material-file-code: Source: apis/base2.1.php
BaseCarousel
- Image/content carousel UI component.
Public methods
__construct()addOption($img, $h3, $cap)
:material-file-code: Source: apis/base2.1.php
Grid
- Child/line-item grid attached to a form table (the
*gtables). Manages columns, rows, totals and back-updates for document line items.
Public methods
__construct($form, $mode, $cTableG, $gridonfield, $fieldaftergrid, $cTable, $masterid)addColumnFromField($aTempx)render()
:material-file-code: Source: apis/core3.php
subGrid
- Nested grid within a grid row for deeper line-item hierarchies.
Public methods
__construct($subgTable, $mode)addColumnFromField($aTempx)render()
:material-file-code: Source: apis/coresubg.php
simpleForm
- Lightweight form abstraction for simple data-entry blocks.
Public methods
__construct()addFullRow($html)addRawHtml($html='')addHiddenField($name = '', $value = '', $caption = '', $location='', $icon='', $enabled='', $fname='')addScriptAfterBody($cScript)render()echol($cLine)renderObjects($Objects)
:material-file-code: Source: apis/subgrid.php
htmlRep3
- HTML report builder (v3). Add title, alignment, column widths, hidden columns, header and rows;
render($form)into a form orrenderHTML()to a string.
Public methods
__construct($repid='')addTitle($title)addLine()addLabel()setAlign($aAlign)setColWd($aColWd)addHiddenCol($aHiddenCol)addHeader($aHeader)getfieldcap($header)getAlphaChars($str)addRow($aData, $nID=0, $bold=false, $xstyle='')render($form=null)renderHTML()
:material-file-code: Source: apis/cl_htmlrep3.php
htmlRep2
- Earlier HTML report builder (v2).
Public methods
__construct($repid='', $form)addHeader($titles)addRow($aData)render($sumfields=array()
:material-file-code: Source: apis/cl_htmlrep2.php
htmlRep
- Original HTML report builder (v1).
Public methods
__construct($simple=false, $compinfo=true, $repid='', $freeze=false, $approxrows=0, $repfile = '')pdfhiddenCol($col)pdfcolpos($col=0)pdf($col=0,$value='',$bold=false,$title=false,$trim=true)pdfborder($col)pdfbox($col)pdfskip()pdfindexHeader()pdfindex()xls($col=0,$value,$bold=false)xlsborder($col=0)xlsSkip()flush($force=false)addTitle($cTitle,$formatted=false)setAlign($aAlign)setColWd($aColWd)addHiddenCol($aHiddenCol)addHeader($aHeader, $cCaption='', $altCap='')starttable()addRow($aData, $nID=0, $bold=false, $xstyle='')addCaptionRow($caption, $bgclr='#ffffb3')align($x)addLine($aCells)end()getExcel()render($form=null)
:material-file-code: Source: apis/cl_htmlrep.php
htmlRepAjax
- Ajax-driven variant of the HTML report builder for asynchronously loaded report data.
Public methods
__construct($compinfo=true, $repid='', $approxrows=0, $xlsfile='', $tot_acs=0, $ctr=0)save()xlsRow($data,$header=false)addTitle($cTitle, $formatted=false)setAlign($aAlign)setColWd($aColWd)addHiddenCol($aHiddenCol)addHeader($aHeader, $cCaption='', $altCap='')starttable()addBoldRow($aData, $nID=0, $bold=false, $xstyle='')addRow($aData, $nID=0, $bold=false, $class='')addCaptionRow($caption, $bgclr='#ffffb3')align($x)addLine($aCells)end()render()
:material-file-code: Source: apis/cl_htmlrepajax.php
Cache_Filesystem
- Filesystem cache store used via
new cache_FileSystem(). Methods:fetch,store($k,$d,$ttl),delete,deleteMatching, plus project/domain-wide helpers. Project/domain scoped.
Public methods
fetch($key)store($key,$data,$ttl=0)delete($key)empty()deleteMatching($expr='')deleteMatchingOnAllDomains($expr='')deleteProjectAllKeys($project='')deletematchingforallprojects($key)listMatchingOnAllDomains($expr='',$cargo='')
:material-file-code: Source: apis/cl_cache.php
Cache_APC
- APC-backed cache store with the same fetch/store/delete contract.
Public methods
fetch($key)store($key,$data,$ttl)delete($key)
:material-file-code: Source: apis/cl_cache.php
Gr_Cache_Filesystem
- Group/graph filesystem cache variant.
Public methods
store($key,$data,$ttl)fetch($key)delete($key)deletematching($key)deletematchingforallprojects($key)count()clear()
:material-file-code: Source: apis/cl_cache.php
paymentGateway
- Unified payment-gateway client for initiating and verifying online payments.
Public methods
__construct($pfolder='')createOrder($orderId='',$amount=0,$currency='INR',$cust_name='',$cust_email='',$cust_phone='',$product='')verifyPayment($orderId='')
:material-file-code: Source: apis/cl_paygate.php
kanban
- Kanban board renderer for card-based workflow screens.
Public methods
__construct($data)
:material-file-code: Source: apis/cl_kanban.php
kanban_sys
- System-level kanban configuration/support for the kanban board.
:material-file-code: Source: apis/cl_kanban.php
Panels
- Container managing a set of UI panes/panels.
Public methods
addPane($pane)getPanes()getpane($title)
:material-file-code: Source: apis/cl_panes.php
Pane
- A single UI pane/panel within a Panels container.
Public methods
__construct($title,$cTable,$approval_fld)
:material-file-code: Source: apis/cl_panes.php
Alert
- Represents a single alert/notification item.
Public methods
__construct($title,$table,$event)
:material-file-code: Source: apis/cl_alerts.php
AlertSystem
- Manages creation, dispatch and display of user alerts/notifications.
Public methods
addAlert($alert)getAlerts()getAlert($title)
:material-file-code: Source: apis/cl_alerts.php
prepost
- Pre/post event handler hub for table save lifecycle hooks (before/after add/edit).
Public methods
setValue($cVar, $xValue, $execpostvalid=true)
:material-file-code: Source: apis/cl_prepost.php
S3
- S3-compatible object storage client for uploads/downloads.
Public methods
__construct($deffolder='')list()upload($key, $content='', $srcPath='')getContents($key)download($key,$file)delete($key)address($key)
:material-file-code: Source: apis/cl_s3.php
ociS3
- Oracle Cloud (OCI) object-storage client variant of the S3 helper.
Public methods
__construct()upload($key,$content='')download($key,$file)list()delete($key)
:material-file-code: Source: apis/cl_s3.php
SLA
- Service-level-agreement timer/escalation helper for tickets and tasks.
Public methods
__construct($tablename,$tableid,$eventtype)parse_msg_template($template, $rowdata)
:material-file-code: Source: apis/cl_sla.php
wbot
- WhatsApp bot client for sending/handling unofficial WhatsApp messages.
Public methods
__construct($pfolder='',$botmobile='')msg_recd($info)doInitialize($botmobile)record_msg($info)process_msg($info)dolog($msg,$file='')send($url)lead_setleadmgr($leadid=0,$userid=0)lead_getleadmgr($leadid)lead_msg_captured($mobile)lead_getleadinfo($leadid)lead_leadfwinfo($fwid)lead_msg_assignment($leadid)lead_msg_statusUpdated($leadid,$lastfwid,$status)
:material-file-code: Source: apis/cl_wbot.php
xQRcode
- QR-code generation helper (backs
genQrCodePng).
Public methods
__construct($value, $level='L')getQrSize()disableBorder()displayFPDF(&$fpdf, $x, $y, $w, $background=array(255,255,255)displayHTML()displayPNG($w=100, $background=array(255,255,255)
:material-file-code: Source: apis/cl_qrcode.php
Browser
- User-agent/browser detection utility.
Public methods
Browser($useragent="")reset()isBrowser($browserName)getBrowser()setBrowser($browser)getPlatform()setPlatform($platform)getVersion()setVersion($version)getAolVersion()setAolVersion($version)isAol()isMobile()isRobot()setAol($isAol)getUserAgent()setUserAgent($agent_string)isChromeFrame()__toString()
:material-file-code: Source: apis/cl_browser.php
csvReader
- Streaming CSV reader.
Public methods
__construct($qr)fetch_fields()getrow($fh=0)sort($sortonfld='')close()
:material-file-code: Source: apis/cl_csvreader.php
csvReaderCol
- Column-aware CSV reader.
Public methods
__construct($col)update($value)
:material-file-code: Source: apis/cl_csvreadercol.php
PDF
- FPDF-derived PDF document class (backs
merciPDF).
Public methods
init($pagesize='A4',$orient='P',$unit='mm')set10CPI()setFontEx($font='Courier', $style='', $size=12)SetColorEx($clr='#000000')merciglobalSign()save($browser=false,$saveasfile='')saveas($saveasfile, $sign=[], $tablename='', $tableid=0)end($printjs=false,$sign=[],$tablename='',$tableid=0)end2()StartPage()skip($nskip=1)SetBold($on=false)SetSize($pointsize=12)saywrap($prow=0, $pcol=0, $str, $wd=99999, $rowht=1)say($prow=0, $pcol=0, $str, $mode='L', $bold=false, $clr=null)sayImage($file, $prow=0, $pcol=0, $ht=0, $wd=0)line($prow=0, $pcol=0, $prow2=0.01, $pcol2=80, $borderclr='#2b2b2b')box($prow, $pcol, $ht, $wd, $clr='#f2f2f2', $borderclr='#2b2b2b')RoundedRect($prow, $pcol, $ht, $wd, $r, $corners = '1234', $style = '')_Arc($x1, $y1, $x2, $y2, $x3, $y3)IncludeJS($script)_putjavascript()_putresources()_putcatalog()AutoPrint($dialog=false)qrcode($code, $col=0, $row=0, $wd=100, $imght_rows=7, $imgwd_cols=12, $background=null, $color=null)Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')EAN13($x, $y, $barcode, $h=16, $w=.35)UPC_A($x, $y, $barcode, $h=16, $w=.35)GetCheckDigit($barcode)TestCheckDigit($barcode)Barcode($x, $y, $barcode, $h, $w, $len)
:material-file-code: Source: apis/cl_mercipdf.php
htmlPDF
- HTML-to-PDF rendering class.
Public methods
__construct($orientation='P', $unit='mm', $format='A4')WriteHTML($html)OpenTag($tag, $attr)CloseTag($tag)SetStyle($tag, $enable)PutLink($URL, $txt)saveas($saveasfile, $sign=[], $tablename='', $tableid=0)
:material-file-code: Source: apis/cl_mercipdf.php
ai
- AI services client (LLM calls, module help, generation) used across the AI features.
Public methods
__construct()getSummary($content,$ai='cgpt')getVCard($image)getDressCode($image)isAutoRespondedMsg($content,$ai='cgpt')correctCompanyName($city='',$company='',$ai='cgpt')parseDoc($mobile, $docpath, $ai='gemini', $mode='API', $doctype='invoice', $notes2Api='')cgpt_execute($post_data)gemini_execute($post_data)claude_execute($post_data)
:material-file-code: Source: apis/cl_ai.php
ai_mobileapp
- AI services client tailored for the mobile app.
Public methods
genImage($prompt='',$ai='cgpt')
:material-file-code: Source: apis/cl_ai_mobileapp.php
dbf_class
- DBF (dBASE/FoxPro) file reader — open legacy .dbf files and read rows via
getRow/getRowAssoc.
Public methods
dbf_class($filename)getRow($recnum)getRowAssoc($recnum)
:material-file-code: Source: apis/dbf_class.php
EWayBill
- E-Way Bill client for generating/cancelling GST e-way bills programmatically.
Public methods
__construct($table, $docid, $cust_acid, $trans_id=0, $docno, $docdt, $totalvalue, $cgst=0, $sgst=0, $igst=0, $lrno, $lrdt, $vehicle='', $transport='', $transportid='', $netamt=0, $cessvalue=0, $shipto_id=0, $dispfrom_id=0, $supplytype='O', $subsupplytype=1, $doctype='INV', $vehicleType='R')addItem($name,$desc,$hsn,$qty,$unit='PCS',$taxable,$srate,$crate,$irate,$cessrate=0,$cessadvol=0)generate($form=null,&$html=null)GovtCopy()GovtCopy2($htm=null)GovtCopyLink()
:material-file-code: Source: apis/funcs_ac.php
xcached
- In-session query-result cache container.
Public methods
__construct($form)close()size()remove($query)get($query)set($query,$row)
:material-file-code: Source: apis/cached.php
xcachedQry
- Cached query rows holder used by
xcached.
Public methods
__construct()close()addrow($row)addrows($rows)getrow()getrows()
:material-file-code: Source: apis/cached.php