FacturaScripts

TotalModel extends TotalModel
in package

Class created by Core/Base/PluginDeploy

Tags
author

FacturaScripts [email protected]

Table of Contents

$code  : string
Value of the code field of the model read.
$totals  : array<string|int, mixed>
Total values of the fields of the read model.
$dataBase  : DataBase
It provides direct access to the database.
__construct()  : mixed
Constructor and class initializer
all()  : array<string|int, static>
Load a list of TotalModel (code and fields of statistics) for the indicated table.
clearTotals()  : mixed
Reset the totals to 0.0
sum()  : float
dataBase()  : DataBase
getFieldSQL()  : string
Returns the / fields as part of the SQL query.

Properties

$code

Value of the code field of the model read.

public string $code

$totals

Total values of the fields of the read model.

public array<string|int, mixed> $totals

Methods

__construct()

Constructor and class initializer

public __construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
$data : array<string|int, mixed> = []
Return values
mixed

all()

Load a list of TotalModel (code and fields of statistics) for the indicated table.

public static all(string $tableName, array<string|int, DataBaseWhere$where, array<string|int, mixed> $fieldList[, string $fieldCode = '' ]) : array<string|int, static>
Parameters
$tableName : string
$where : array<string|int, DataBaseWhere>
$fieldList : array<string|int, mixed>

(['key' => 'SUM(total)', 'key2' => 'MAX(total)' ...])

$fieldCode : string = ''

(for multiples rows agruped by field code)

Return values
array<string|int, static>

clearTotals()

Reset the totals to 0.0

public clearTotals(array<string|int, mixed> $totalFields) : mixed
Parameters
$totalFields : array<string|int, mixed>
Return values
mixed

sum()

public static sum(string $tableName, string $fieldName, array<string|int, mixed> $where) : float
Parameters
$tableName : string
$fieldName : string
$where : array<string|int, mixed>
Return values
float

getFieldSQL()

Returns the / fields as part of the SQL query.

private static getFieldSQL(string $fieldCode, array<string|int, mixed> $fieldList) : string
Parameters
$fieldCode : string
$fieldList : array<string|int, mixed>
Return values
string

Search results