CORE POS - IS4C
The CORE POS front end
Static Public Member Functions | List of all members
Database Class Reference
Inheritance diagram for Database:
LibraryClass

Static Public Member Functions

static tDataConnect ()
 
static pDataConnect ()
 
static mDataConnect ()
 
static getsubtotals ()
 
static LineItemTaxes ()
 
static gettransno ($CashierNo)
 
static testremote ()
 
static uploadtoServer ()
 
static getMatchingColumns ($connection, $table_name, $table2="")
 
static localMatchingColumns ($connection, $table1, $table2)
 
static uploadCCdata ()
 
static loadglobalvalues ()
 
static loadglobalvalue ($param, $val)
 
static setglobalvalue ($param, $value)
 
static setglobalvalues ($arr)
 
static setglobalflags ($value)
 
static changeLttTaxCode ($fromName, $toName)
 
static rotateTempData ()
 
static clearTempTables ()
 
static logger ($msg="")
 

Detailed Description

Functions related to the database

Member Function Documentation

static Database::changeLttTaxCode (   $fromName,
  $toName 
)
static

Change one tax code in all items of localtemptrans to a different one. Parameters are the names of the taxes, as in taxrates.description

Parameters
$fromNameThe name of the tax changed from.
$fromNameThe name of the tax changed to.
static Database::clearTempTables ( )
static

Truncate current transaction tables. Clears data from:

  • translog.localtemptrans
  • translog.couponApplied
Returns
[boolean] success or failure

Success or failure is based on whether translog.localtemptrans is cleared correctly.

static Database::getMatchingColumns (   $connection,
  $table_name,
  $table2 = "" 
)
static

Get a list of columns that exist on the local db and the server db for the given table.

Parameters
$connectiona SQLManager object that's already connected
$table_namethe table
$table2is provided, it match columns from local.table_name against remote.table2
Returns
[string] comma separated list of column names

Cache column information by table in the session In standalone mode, a transfer query likely failed and the cache may be wrong so always requery in that case.

static Database::getsubtotals ( )
static

Load values from subtotals view into session. Essentially refreshes totals in the session.

9May14 Andy I belive this query is equivalent to the old subtotals => lttsubtotals => lttsummary I've omitted tax since those are already calculated separately. A few conditions here should obviously be more configurable, but first I want to get rid of or simply the old nested views

fsEligible is the complicated one. That's:

  1. Total foodstampable items
  2. Minus transaction-level discount on those items
  3. Minus any foodstamp tenders already applied. localtemptrans.total is negative on tenders so the query uses an addition sign but in effect it's subracting.

If FS eligible amount is greater than the current transaction total and total is positive, limit the eligible amount to the current total. This may not be technically correct but the resulting change causes a lot of headaches depending what kind of change is allowed for earlier tenders, if change is allowed for those tenders at all.

The other case is a refund to FS. Over-tendering on a refund doesn't make any sense.

static Database::gettransno (   $CashierNo)
static

Get the next transaction number for a given cashier

Parameters
$CashierNocashier number (emp_no in tables)
Returns
integer transaction number
static Database::LineItemTaxes ( )
static

Calculate taxes using new-style taxView.

Returns
an array of records each containing:
  • id
  • description
  • amount (taxes actually due)
  • exempt (taxes exempted because of foodstamps) There will always be one record for each existing tax rate.
static Database::loadglobalvalue (   $param,
  $val 
)
static

Set new value in session.

Parameters
$paramkeycode
$valnew value
static Database::loadglobalvalues ( )
static

Read globalvalues settings into session.

static Database::localMatchingColumns (   $connection,
  $table1,
  $table2 
)
static

Get a list of columns in both tables.

Parameters
$connectiona SQLManager object that's already connected
$table1a database table
$table2a database table
Returns
[string] comma separated list of column names
static Database::logger (   $msg = "")
static

Log a message to the lane log

Parameters
$msgA string containing the message to log.
Returns
True on success, False on failure
static Database::mDataConnect ( )
static

Connect to the remote server database

Returns
a SQLManager object
static Database::pDataConnect ( )
static

Connect to the operational database (local)

Returns
a SQLManager object

Add both local databases to the connection object

19Mar2015 Temporary measure to support failback using old, non-adodb SQLManager

Switch connection object to the requested database

static Database::rotateTempData ( )
static

Rotate current transaction data Current data in translog.localtemptrans is inserted into:

  • translog.dtransactions
  • translog.localtrans
  • translog.localtranstoday (if not a view)
  • translog.localtrans_today (if present)
Returns
[boolean] success or failure

Success or failure is based on whether or not the insert into translog.dtransactions succeeds. That's the most important query in terms of ensuring data flows properly to the server.

If store_id column is present in lane dtransactions table and the lane's store_id has been configured, assign that value to the column. Otherwise it may be handled but some other mechanism such as triggers or column default values.

static Database::setglobalflags (   $value)
static

Sets TTLFlag and FntlFlag in globalvalues table

Parameters
$valuevalue for both fields.
static Database::setglobalvalue (   $param,
  $value 
)
static

Update setting in globalvalues table.

Parameters
$paramkeycode
$valuenew value
static Database::setglobalvalues (   $arr)
static

Update many settings in globalvalues table and in session

Parameters
$arrAn array of keys and values
static Database::tDataConnect ( )
static

Connect to the transaction database (local)

Returns
a SQLManager object

Add both local databases to the connection object

19Mar2015 Temporary measure to support failback using old, non-adodb SQLManager

Switch connection object to the requested database

static Database::testremote ( )
static

See if the remote database is available This function calls uploadtoServer() if the initial test works.

Returns
integer
  • 1 server available
  • 0 server down
static Database::uploadCCdata ( )
static

Transfer credit card tables to the server. See uploadtoServer().

Returns
boolean success / failure
static Database::uploadtoServer ( )
static

Copy tables from the lane to the remote server The following tables are copied:

  • dtransactions
  • suspended
  • efsnetRequest
  • efsnetResponse
  • efsnetRequestMod
  • efsnetTokens
  • CapturedSignature

On success the local tables are truncated. The efsnet tables are copied in the uploadCCdata() function but that gets called automatically.

Returns
  • 1 upload succeeded
  • 0 upload failed

The documentation for this class was generated from the following file: