TransformerDocument extends BusinessDocument
Description of TransformerDocument
Table of Contents
MODEL_NAMESPACE | '\\FacturaScripts\\Dinamic\\Model\\' | |
---|---|---|
$documentGeneration | bool | |
$editable | Indicates whether the document can be modified | bool |
$estados | \FacturaScripts\Dinamic\Model\EstadoDocumento[] | |
$idestado | Document status, from EstadoDocumento model. | int |
$cifnif | VAT number of the customer or supplier. | string |
$codalmacen | Warehouse in which the merchandise enters. | string |
$codigo | Unique identifier for humans. | string |
$dtopor1 | Percentage of discount. | float |
$dtopor2 | Percentage of discount. | float |
$fecha | Date of the document. | string |
$femail | Date on which the document was sent by email. | string |
$hora | Document time. | string |
$irpf | Default retention for this document. Each line can have a different retention. | float|int |
$neto | Sum of the pvptotal of lines. Total of the document before taxes. | float|int |
$netosindto | Sum of the pvptotal of lines. Total of the document before taxes and global discounts. | float|int |
$nick | User who created this document. User model. | string |
$numero | Number of the document. Unique within the series. | string |
$observaciones | Notes of the document. | string |
$total | Total sum of the document, with taxes. | float|int |
$totaliva | Sum of the VAT of the lines. | float|int |
$totaleuros | Total expressed in euros, if it were not the currency of the document. | float|int |
$totalirpf | Total sum of the IRPF withholdings of the lines. | float|int |
$totalrecargo | Total sum of the equivalence surcharge of the lines. | float|int |
$totalsuplidos | Total sum of supplied lines. | float|int |
$idempresa | int | |
$coddivisa | Currency of the document. | string |
$tasaconv | Rate of conversion to Euros of the selected currency. | float|int |
$codejercicio | Exercise code. | string |
$codpago | Payment method code. | string |
$codserie | string | |
$previousData | Previous data array. | array |
$checkedTables | List of already tested tables. | array |
$dataBase | It provides direct access to the database. | DataBase |
childrenDocuments() | Returns all children documents of this one. | \FacturaScripts\Core\Model\Base\TransformerDocument[] |
clear() | Reset the values of all model properties. | mixed |
delete() | Removes this document from the database. | bool |
getAvailableStatus() | Returns all available status for this type of document. | \FacturaScripts\Dinamic\Model\EstadoDocumento[] |
getAvaliableStatus() | \FacturaScripts\Dinamic\Model\EstadoDocumento[] | |
getStatus() | Returns the EstadoDocumento model for this document. | EstadoDocumento |
install() | This function is called when creating the model table. Returns the SQL that will be executed after the creation of the table. Useful to insert values default. | string |
parentDocuments() | Returns all parent document of this one. | \FacturaScripts\Core\Model\Base\TransformerDocument[] |
save() | Saves data in the database. | bool |
setDocumentGeneration() | mixed | |
onChange() | Check changed fields before updata the database. | bool |
setPreviousData() | Sets fields to be watched. | mixed |
getLines() | Returns the lines associated with the document. | array |
getNewLine() | Returns a new line for this business document. | mixed |
getNewProductLine() | Returns a new line for this business document completed with the product data. | mixed |
getSubject() | Returns the subject of this document. | mixed |
setAuthor() | Sets the author for this document. | bool |
setSubject() | Sets subject for this document. | bool |
subjectColumn() | Returns the name of the column for subject. | mixed |
updateSubject() | Updates subjects data in this document. | bool |
clear() | Reset the values of all model properties. | mixed |
getEUDiscount() | Returns the Equivalent Unified Discount. | float |
install() | This function is called when creating the model table. Returns the SQL that will be executed after the creation of the table. Useful to insert values default. | string |
paid() | bool | |
primaryDescriptionColumn() | Returns the name of the column that describes the model, such as name, description. | string |
save() | Stores the model data in the database. | bool |
setDate() | Assign the date and find an accounting exercise. | bool |
subjectColumnValue() | string | |
test() | Returns true if there are no errors in the values of the model properties. | bool |
onChange() | This method is called before save (update) when some field has changed. | bool |
saveUpdate() | Update the model data in the database. | bool |
setPreviousData() | Saves previous values. | mixed |
setWarehouse() | Sets warehouse and company for this document. | bool |
getCompany() | Empresa | |
setCurrency() | mixed | |
clearExerciseCache() | void | |
getExercise() | Ejercicio | |
getPaymentMethod() | FormaPago | |
getSerie() | Serie | |
__construct() | ModelClass constructor. | mixed |
delete() | Remove the model data from the database. | bool |
loadFromCode() | Fill the class with the registry values whose primary column corresponds to the value $cod, or according to the condition where indicated, if value is not reported in $cod. | bool |
onDelete() | This method is called after a record is removed from the database. | mixed |
onInsert() | This method is called after a new record is saved on the database (saveInsert). | mixed |
onUpdate() | This method is called after a record is updated on the database (saveUpdate). | mixed |
saveInsert() | Insert the model data in the database. | bool |
all() | Returns all models that correspond to the selected filters. | static[] |
codeModelAll() | Allows to use this model as source in CodeModel special model. | \FacturaScripts\Dinamic\Model\CodeModel[] |
codeModelSearch() | Allows to use this model as source in CodeModel special model. | \FacturaScripts\Dinamic\Model\CodeModel[] |
count() | Returns the number of records in the model that meet the condition. | int |
exists() | Returns true if the model data is stored in the database. | bool |
get() | Returns the model whose primary column corresponds to the value $cod | static|bool |
newCode() | Returns the following code for the reported field or the primary key of the model. | int |
primaryDescription() | Descriptive identifier for humans of the data record | string |
url() | Returns the url where to see / modify the data. | string |
getOrderBy() | Convert an array of filters order by in string. | string |
getRecord() | Read the record whose primary column corresponds to the value $cod or the first that meets the indicated condition. | array |
addExtension() | Adds an extension to this model. | mixed |
getModelFields() | Returns the list of fields in the table. | array |
loadModelFields() | Loads table fields if is necessary. | mixed |
modelClassName() | Returns the name of the class of the model. | string |
modelName() | Returns the name of the model. | string |
pipe() | Executes all $name methods added from the extensions. | mixed |
pipeFalse() | Executes all $name methods added from the extensions until someone returns false. | bool |
primaryColumn() | Returns the name of the column that is the model's primary key. | string |
tableName() | Returns the name of the table that uses this model. | string |
changePrimaryColumnValue() | Change the value of the primary column in the model and the database. | bool |
loadFromData() | Assign the values of the $data array to the model properties. | mixed |
primaryColumnValue() | Returns the current value of the main column of the model. | mixed |
toArray() | Returns an array with the model fields values. | array |
checkTable() | Checks and updates the structure of the table if necessary. | bool |
getBoolValueForField() | Returns the boolean value for the field. | bool|null |
getFloatValueForField() | Returns the float value for the field. | float|null |
getIntegerValueForField() | Returns the integer value by controlling special cases for the PK and FK. | int|null |
toolBox() | ToolBox |
Constants
MODEL_NAMESPACE
mixed
$MODEL_NAMESPACE
= '\\FacturaScripts\\Dinamic\\Model\\'
AUDIT_CHANNEL
mixed
$AUDIT_CHANNEL
= 'audit'
DATE_STYLE
mixed
$DATE_STYLE
= 'd-m-Y'
DATETIME_STYLE
mixed
$DATETIME_STYLE
= 'd-m-Y H:i:s'
HOUR_STYLE
mixed
$HOUR_STYLE
= 'H:i:s'
Properties
$documentGeneration
private
static bool
$documentGeneration
= true
$editable
Indicates whether the document can be modified
public
bool
$editable
$estados
private
static \FacturaScripts\Dinamic\Model\EstadoDocumento[]
$estados
$idestado
Document status, from EstadoDocumento model.
public
int
$idestado
$cifnif
VAT number of the customer or supplier.
public
string
$cifnif
$codalmacen
Warehouse in which the merchandise enters.
public
string
$codalmacen
$codigo
Unique identifier for humans.
public
string
$codigo
$dtopor1
Percentage of discount.
public
float
$dtopor1
$dtopor2
Percentage of discount.
public
float
$dtopor2
$fecha
Date of the document.
public
string
$fecha
$femail
Date on which the document was sent by email.
public
string
$femail
$hora
Document time.
public
string
$hora
$irpf
Default retention for this document. Each line can have a different retention.
public
float|int
$irpf
$neto
Sum of the pvptotal of lines. Total of the document before taxes.
public
float|int
$neto
$netosindto
Sum of the pvptotal of lines. Total of the document before taxes and global discounts.
public
float|int
$netosindto
$nick
User who created this document. User model.
public
string
$nick
$numero
Number of the document. Unique within the series.
public
string
$numero
$observaciones
Notes of the document.
public
string
$observaciones
$total
Total sum of the document, with taxes.
public
float|int
$total
$totaliva
Sum of the VAT of the lines.
public
float|int
$totaliva
$totaleuros
Total expressed in euros, if it were not the currency of the document.
public
float|int
$totaleuros
$totalirpf
Total sum of the IRPF withholdings of the lines.
public
float|int
$totalirpf
$totalrecargo
Total sum of the equivalence surcharge of the lines.
public
float|int
$totalrecargo
$totalsuplidos
Total sum of supplied lines.
public
float|int
$totalsuplidos
$idempresa
public
int
$idempresa
$coddivisa
Currency of the document.
public
string
$coddivisa
$tasaconv
Rate of conversion to Euros of the selected currency.
public
float|int
$tasaconv
$codejercicio
Exercise code.
public
string
$codejercicio
$codpago
Payment method code.
public
string
$codpago
$codserie
public
string
$codserie
$previousData
Previous data array.
protected
array
$previousData
= []
$checkedTables
List of already tested tables.
private
static array
$checkedTables
= []
$dataBase
It provides direct access to the database.
protected
static DataBase
$dataBase
Methods
childrenDocuments()
Returns all children documents of this one.
public
childrenDocuments(
)
: \FacturaScripts\Core\Model\Base\TransformerDocument[]
Return values
\FacturaScripts\Core\Model\Base\TransformerDocument[]clear()
Reset the values of all model properties.
public
clear(
)
: mixed
Return values
mixeddelete()
Removes this document from the database.
public
delete(
)
: bool
Return values
boolgetAvailableStatus()
Returns all available status for this type of document.
public
getAvailableStatus(
)
: \FacturaScripts\Dinamic\Model\EstadoDocumento[]
Return values
\FacturaScripts\Dinamic\Model\EstadoDocumento[]getAvaliableStatus()
public
getAvaliableStatus(
)
: \FacturaScripts\Dinamic\Model\EstadoDocumento[]
Tags
Return values
\FacturaScripts\Dinamic\Model\EstadoDocumento[]getStatus()
Returns the EstadoDocumento model for this document.
public
getStatus(
)
: EstadoDocumento
Return values
EstadoDocumentoinstall()
This function is called when creating the model table. Returns the SQL that will be executed after the creation of the table. Useful to insert values default.
public
install(
)
: string
Return values
stringparentDocuments()
Returns all parent document of this one.
public
parentDocuments(
)
: \FacturaScripts\Core\Model\Base\TransformerDocument[]
Return values
\FacturaScripts\Core\Model\Base\TransformerDocument[]save()
Saves data in the database.
public
save(
)
: bool
Return values
boolsetDocumentGeneration()
public
setDocumentGeneration(
$value :
bool
)
: mixed
Parameters
- $value : bool
Return values
mixedonChange()
Check changed fields before updata the database.
protected
onChange(
$field :
string
)
: bool
Parameters
- $field : string
Return values
boolsetPreviousData()
Sets fields to be watched.
protected
setPreviousData(
[ $fields :
array
= [] ]
)
: mixed
Parameters
- $fields : array = []
Return values
mixedgetLines()
Returns the lines associated with the document.
public
abstract getLines(
)
: array
Return values
arraygetNewLine()
Returns a new line for this business document.
public
abstract getNewLine(
[ $data :
array
= [] ]
[, $exclude :
array
= [] ]
)
: mixed
Parameters
- $data : array = []
- $exclude : array = []
Return values
mixedgetNewProductLine()
Returns a new line for this business document completed with the product data.
public
abstract getNewProductLine(
$reference :
mixed
)
: mixed
Parameters
- $reference : mixed
Return values
mixedgetSubject()
Returns the subject of this document.
public
abstract getSubject(
)
: mixed
Return values
mixedsetAuthor()
Sets the author for this document.
public
abstract setAuthor(
$user :
mixed
)
: bool
Parameters
- $user : mixed
Return values
boolsetSubject()
Sets subject for this document.
public
abstract setSubject(
$subject :
mixed
)
: bool
Parameters
- $subject : mixed
Return values
boolsubjectColumn()
Returns the name of the column for subject.
public
abstract subjectColumn(
)
: mixed
Return values
mixedupdateSubject()
Updates subjects data in this document.
public
abstract updateSubject(
)
: bool
Return values
boolclear()
Reset the values of all model properties.
public
clear(
)
: mixed
Return values
mixedgetEUDiscount()
Returns the Equivalent Unified Discount.
public
getEUDiscount(
)
: float
Return values
floatinstall()
This function is called when creating the model table. Returns the SQL that will be executed after the creation of the table. Useful to insert values default.
public
install(
)
: string
Return values
stringpaid()
public
paid(
)
: bool
Return values
boolprimaryDescriptionColumn()
Returns the name of the column that describes the model, such as name, description.
public
primaryDescriptionColumn(
)
: string
..
Return values
stringsave()
Stores the model data in the database.
public
save(
)
: bool
Return values
boolsetDate()
Assign the date and find an accounting exercise.
public
setDate(
$date :
string
, $hour :
string
)
: bool
Parameters
- $date : string
- $hour : string
Return values
boolsubjectColumnValue()
public
subjectColumnValue(
)
: string
Return values
stringtest()
Returns true if there are no errors in the values of the model properties.
public
test(
)
: bool
It runs inside the save method.
Return values
boolonChange()
This method is called before save (update) when some field has changed.
protected
onChange(
$field :
string
)
: bool
Parameters
- $field : string
Return values
boolsaveUpdate()
Update the model data in the database.
protected
saveUpdate(
[ $values :
array
= [] ]
)
: bool
Parameters
- $values : array = []
Return values
boolsetPreviousData()
Saves previous values.
protected
setPreviousData(
[ $fields :
array
= [] ]
)
: mixed
Parameters
- $fields : array = []
Return values
mixedsetWarehouse()
Sets warehouse and company for this document.
protected
setWarehouse(
$codalmacen :
string
)
: bool
Parameters
- $codalmacen : string
Return values
boolgetCompany()
public
getCompany(
)
: Empresa
Return values
EmpresasetCurrency()
public
setCurrency(
$coddivisa :
string
[, $purchase :
bool
= false ]
)
: mixed
Parameters
- $coddivisa : string
- $purchase : bool = false
Return values
mixedclearExerciseCache()
public
clearExerciseCache(
)
: void
Tags
getExercise()
public
getExercise(
[ $codejercicio :
string
= '' ]
)
: Ejercicio
Parameters
- $codejercicio : string = ''
Return values
EjerciciogetPaymentMethod()
public
getPaymentMethod(
)
: FormaPago
Return values
FormaPagogetSerie()
public
getSerie(
)
: Serie
Return values
Serie__construct()
ModelClass constructor.
public
__construct(
[ $data :
array
= [] ]
)
: mixed
Parameters
- $data : array = []
Return values
mixeddelete()
Remove the model data from the database.
public
delete(
)
: bool
Return values
boolloadFromCode()
Fill the class with the registry values whose primary column corresponds to the value $cod, or according to the condition where indicated, if value is not reported in $cod.
public
loadFromCode(
$code :
string
[, $where :
array
= [] ]
[, $order :
array
= [] ]
)
: bool
Initializes the values of the class if there is no record that meet the above conditions. Returns True if the record exists and False otherwise.
Parameters
- $code : string
- $where : array = []
- $order : array = []
Return values
boolonDelete()
This method is called after a record is removed from the database.
protected
onDelete(
)
: mixed
Return values
mixedonInsert()
This method is called after a new record is saved on the database (saveInsert).
protected
onInsert(
)
: mixed
Return values
mixedonUpdate()
This method is called after a record is updated on the database (saveUpdate).
protected
onUpdate(
)
: mixed
Return values
mixedsaveInsert()
Insert the model data in the database.
protected
saveInsert(
[ $values :
array
= [] ]
)
: bool
Parameters
- $values : array = []
Return values
boolall()
Returns all models that correspond to the selected filters.
public
all(
[ $where :
array
= [] ]
[, $order :
array
= [] ]
, $offset :
int
[, $limit :
int
= 50 ]
)
: static[]
Parameters
- $where : array = []
filters to apply to model records.
- $order : array = []
fields to use in the sorting. For example ['code' => 'ASC']
- $offset : int
- $limit : int = 50
Return values
static[]codeModelAll()
Allows to use this model as source in CodeModel special model.
public
codeModelAll(
[ $fieldCode :
string
= '' ]
)
: \FacturaScripts\Dinamic\Model\CodeModel[]
Parameters
- $fieldCode : string = ''
Return values
\FacturaScripts\Dinamic\Model\CodeModel[]codeModelSearch()
Allows to use this model as source in CodeModel special model.
public
codeModelSearch(
$query :
string
[, $fieldCode :
string
= '' ]
[, $where :
\FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
= [] ]
)
: \FacturaScripts\Dinamic\Model\CodeModel[]
Parameters
- $query : string
- $fieldCode : string = ''
- $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = []
Return values
\FacturaScripts\Dinamic\Model\CodeModel[]count()
Returns the number of records in the model that meet the condition.
public
count(
[ $where :
\FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
= [] ]
)
: int
Parameters
- $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = []
filters to apply to model records.
Return values
intexists()
Returns true if the model data is stored in the database.
public
exists(
)
: bool
Return values
boolget()
Returns the model whose primary column corresponds to the value $cod
public
get(
$code :
string
)
: static|bool
Parameters
- $code : string
Return values
static|boolnewCode()
Returns the following code for the reported field or the primary key of the model.
public
newCode(
[ $field :
string
= '' ]
[, $where :
array
= [] ]
)
: int
Parameters
- $field : string = ''
- $where : array = []
Return values
intprimaryDescription()
Descriptive identifier for humans of the data record
public
primaryDescription(
)
: string
Return values
stringurl()
Returns the url where to see / modify the data.
public
url(
[ $type :
string
= 'auto' ]
[, $list :
string
= 'List' ]
)
: string
Parameters
- $type : string = 'auto'
- $list : string = 'List'
Return values
stringgetOrderBy()
Convert an array of filters order by in string.
private
getOrderBy(
$order :
array
)
: string
Parameters
- $order : array
Return values
stringgetRecord()
Read the record whose primary column corresponds to the value $cod or the first that meets the indicated condition.
private
getRecord(
$code :
string
[, $where :
array
= [] ]
[, $order :
array
= [] ]
)
: array
Parameters
- $code : string
- $where : array = []
- $order : array = []
Return values
arrayaddExtension()
Adds an extension to this model.
public
abstract static addExtension(
$extension :
mixed
)
: mixed
Parameters
- $extension : mixed
Return values
mixedgetModelFields()
Returns the list of fields in the table.
public
abstract getModelFields(
)
: array
Return values
arrayloadModelFields()
Loads table fields if is necessary.
protected
abstract loadModelFields(
&$dataBase :
DataBase
, $tableName :
string
)
: mixed
Parameters
- $dataBase : DataBase
- $tableName : string
Return values
mixedmodelClassName()
Returns the name of the class of the model.
public
abstract modelClassName(
)
: string
Return values
stringmodelName()
Returns the name of the model.
protected
abstract modelName(
)
: string
Return values
stringpipe()
Executes all $name methods added from the extensions.
public
abstract pipe(
$name :
string
, ...$arguments :
array
)
: mixed
Parameters
- $name : string
- $arguments : array
Return values
mixedpipeFalse()
Executes all $name methods added from the extensions until someone returns false.
public
abstract pipeFalse(
$name :
string
, ...$arguments :
array
)
: bool
Parameters
- $name : string
- $arguments : array
Return values
boolprimaryColumn()
Returns the name of the column that is the model's primary key.
public
abstract static primaryColumn(
)
: string
Return values
stringtableName()
Returns the name of the table that uses this model.
public
abstract static tableName(
)
: string
Return values
stringchangePrimaryColumnValue()
Change the value of the primary column in the model and the database.
public
changePrimaryColumnValue(
$newValue :
mixed
)
: bool
Parameters
- $newValue : mixed
Return values
boolloadFromData()
Assign the values of the $data array to the model properties.
public
loadFromData(
[ $data :
array
= [] ]
[, $exclude :
array
= [] ]
)
: mixed
Parameters
- $data : array = []
- $exclude : array = []
Return values
mixedprimaryColumnValue()
Returns the current value of the main column of the model.
public
primaryColumnValue(
)
: mixed
Return values
mixedtoArray()
Returns an array with the model fields values.
public
toArray(
)
: array
Return values
arraycheckTable()
Checks and updates the structure of the table if necessary.
private
checkTable(
)
: bool
Return values
boolgetBoolValueForField()
Returns the boolean value for the field.
private
getBoolValueForField(
$field :
array
, $value :
string
)
: bool|null
Parameters
- $field : array
- $value : string
Return values
bool|nullgetFloatValueForField()
Returns the float value for the field.
private
getFloatValueForField(
$field :
array
, $value :
string
)
: float|null
Parameters
- $field : array
- $value : string
Return values
float|nullgetIntegerValueForField()
Returns the integer value by controlling special cases for the PK and FK.
private
getIntegerValueForField(
$field :
array
, $value :
string
)
: int|null
Parameters
- $field : array
- $value : string
Return values
int|nulltoolBox()
protected
static toolBox(
)
: ToolBox