AlbaranCliente
extends SalesDocument
in package
Uses
ModelTrait
Customer's delivery note or delivery note. Represents delivery to a customer of a material that has been sold to you. It implies the exit of this material from the company's warehouse.
Tags
Table of Contents
- AUDIT_CHANNEL = 'audit'
- DATE_STYLE = 'd-m-Y'
- DATETIME_STYLE = 'd-m-Y H:i:s'
- HOUR_STYLE = 'H:i:s'
- MODEL_NAMESPACE = '\\FacturaScripts\\Dinamic\\Model\\'
- $apartado : string
- Mailbox of the client.
- $cifnif : string
- VAT number of the customer or supplier.
- $ciudad : string
- Customer's city.
- $codagente : string
- Agent who created this document. Agente model.
- $codalmacen : string
- Warehouse in which the merchandise enters.
- $codcliente : string
- Customer of this document.
- $coddivisa : string
- Currency of the document.
- $codejercicio : string
- Exercise code.
- $codigo : string
- Unique identifier for humans.
- $codigoenv : string
- Shipping tracking code.
- $codpago : string
- Payment method code.
- $codpais : string
- Customer's country.
- $codpostal : string
- Customer's postal code.
- $codserie : string
- $codtrans : string
- Shipping code for the shipment.
- $direccion : string
- Customer's address
- $dtopor1 : float
- Percentage of discount.
- $dtopor2 : float
- Percentage of discount.
- $editable : bool
- Indicates whether the document can be modified
- $fecha : string
- Date of the document.
- $femail : string
- Date on which the document was sent by email.
- $hora : string
- Document time.
- $idalbaran : int
- Primary key. Integer.
- $idcontactoenv : int
- ID of contact for shippment.
- $idcontactofact : int
- ID of contact for invoice.
- $idempresa : int
- $idestado : int
- Document status, from EstadoDocumento model.
- $irpf : float|int
- Default retention for this document. Each line can have a different retention.
- $neto : float|int
- Sum of the pvptotal of lines. Total of the document before taxes.
- $netosindto : float|int
- Sum of the pvptotal of lines. Total of the document before taxes and global discounts.
- $nick : string
- User who created this document. User model.
- $nombrecliente : string
- Customer name.
- $numdocs : int
- Number of attached documents.
- $numero : string
- Number of the document. Unique within the series.
- $numero2 : string
- Optional number available to the user.
- $observaciones : string
- Notes of the document.
- $operacion : string
- Indicates the type of document operation, example: intra-community
- $provincia : string
- Customer's province.
- $tasaconv : float|int
- Rate of conversion to Euros of the selected currency.
- $total : float|int
- Total sum of the document, with taxes.
- $totalbeneficio : float
- sum total of the benefits of the lines.
- $totalcoste : float
- total sum of the costs of the lines.
- $totaleuros : float|int
- Total expressed in euros, if it were not the currency of the document.
- $totalirpf : float|int
- Total sum of the IRPF withholdings of the lines.
- $totaliva : float|int
- Sum of the VAT of the lines.
- $totalrecargo : float|int
- Total sum of the equivalence surcharge of the lines.
- $totalsuplidos : float|int
- Total sum of supplied lines.
- $checkedTables : array<string|int, mixed>
- List of already tested tables.
- $dataBase : DataBase
- It provides direct access to the database.
- $dont_copy_fields : array<string|int, mixed>
- $fields : array<string|int, mixed>
- List of fields in the table.
- $previousData : array<string|int, mixed>
- Previous data array.
- $documentGeneration : bool
- $estados : array<string|int, EstadoDocumento>
- __construct() : mixed
- ModelClass constructor.
- addExtension() : mixed
- Adds an extension to this model.
- all() : array<string|int, static>
- Returns all models that correspond to the selected filters.
- changePrimaryColumnValue() : bool
- Change the value of the primary column in the model and the database.
- childrenDocuments() : array<string|int, TransformerDocument>
- Returns all children documents of this one.
- clear() : mixed
- Reset the values of all model properties.
- codeModelAll() : array<string|int, CodeModel>
- Allows to use this model as source in CodeModel special model.
- codeModelSearch() : array<string|int, CodeModel>
- Allows to use this model as source in CodeModel special model.
- count() : int
- Returns the number of records in the model that meet the condition.
- country() : string
- delete() : bool
- Remove the model data from the database.
- dontCopyField() : void
- dontCopyFields() : array<string|int, mixed>
- exists() : bool
- Returns true if the model data is stored in the database.
- get() : static|false
- Returns the model whose primary column corresponds to the value $cod
- getAvailableStatus() : array<string|int, EstadoDocumento>
- Returns all available status for this type of document.
- getCompany() : Empresa
- getEUDiscount() : float
- Returns the Equivalent Unified Discount.
- getExercise() : Ejercicio
- getLines() : array<string|int, LineaAlbaranCliente>
- Returns the lines associated with the delivery note.
- getModelFields() : array<string|int, mixed>
- Returns the list of fields in the table.
- getNewLine() : LineaAlbaranCliente
- Returns a new line for the document.
- getNewProductLine() : mixed
- Returns a new line for this business document completed with the product data.
- getPaymentMethod() : FormaPago
- getRate() : Tarifa
- getSerie() : Serie
- getStatus() : EstadoDocumento
- Returns the EstadoDocumento model for this document.
- getSubject() : mixed
- Returns the subject of this document.
- install() : string
- 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.
- loadFromCode() : bool
- 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.
- loadFromData() : mixed
- Assign the values of the $data array to the model properties.
- modelClassName() : string
- Returns the name of the class of the model.
- newCode() : int
- Returns the following code for the reported field or the primary key of the model.
- paid() : bool
- parentDocuments() : array<string|int, TransformerDocument>
- Returns all parent document of this one.
- pipe() : mixed
- Executes all $name methods added from the extensions.
- pipeFalse() : bool
- Executes all $name methods added from the extensions until someone returns false.
- primaryColumn() : string
- primaryColumnValue() : mixed
- Returns the current value of the main column of the model.
- primaryDescription() : string
- Descriptive identifier for humans of the data record
- primaryDescriptionColumn() : string
- Returns the name of the column that describes the model, such as name, description.
- save() : bool
- Stores the model data in the database.
- setAuthor() : bool
- Sets the author for this document.
- setCurrency() : mixed
- setDate() : bool
- Assign the date and find an accounting exercise.
- setDocumentGeneration() : mixed
- setIntracomunitaria() : bool
- setSubject() : bool
- Sets subject for this document.
- setWarehouse() : bool
- Sets warehouse and company for this document.
- subjectColumn() : mixed
- Returns the name of the column for subject.
- subjectColumnValue() : string
- table() : DbQuery
- tableName() : string
- test() : bool
- Returns true if there are no errors in the values of the model properties.
- toArray() : array<string|int, mixed>
- Returns an array with the model fields values.
- updateSubject() : bool
- Updates subjects data in this document.
- url() : string
- Returns the url where to see / modify the data.
- loadModelFields() : mixed
- Loads table fields if is necessary.
- modelName() : string
- Returns the name of the model.
- onChange() : bool
- This method is called before save (update) when some field has changed.
- onDelete() : mixed
- This method is called after a record is removed from the database.
- onInsert() : mixed
- This method is called after a new record is saved on the database (saveInsert).
- onUpdate() : mixed
- This method is called after a record is updated on the database (saveUpdate).
- saveInsert() : bool
- Insert the model data in the database.
- saveUpdate() : bool
- Update the model data in the database.
- setContact() : bool
- setCustomer() : bool
- setPreviousData() : mixed
- Saves previous values.
- toolBox() : ToolBox
- Returns a new instance of the ToolBox class.
- checkTable() : bool
- Checks and updates the structure of the table if necessary.
- getBoolValueForField() : bool|null
- Returns the boolean value for the field.
- getFloatValueForField() : float|null
- Returns the float value for the field.
- getIntegerValueForField() : int|null
- Returns the integer value by controlling special cases for the PK and FK.
- getOrderBy() : string
- Convert an array of filters order by in string.
- getRecord() : array<string|int, mixed>
- Read the record whose primary column corresponds to the value $cod or the first that meets the indicated condition.
Constants
AUDIT_CHANNEL
public
mixed
AUDIT_CHANNEL
= 'audit'
DATE_STYLE
public
mixed
DATE_STYLE
= 'd-m-Y'
DATETIME_STYLE
public
mixed
DATETIME_STYLE
= 'd-m-Y H:i:s'
HOUR_STYLE
public
mixed
HOUR_STYLE
= 'H:i:s'
MODEL_NAMESPACE
public
mixed
MODEL_NAMESPACE
= '\\FacturaScripts\\Dinamic\\Model\\'
Properties
$apartado
Mailbox of the client.
public
string
$apartado
$cifnif
VAT number of the customer or supplier.
public
string
$cifnif
$ciudad
Customer's city.
public
string
$ciudad
$codagente
Agent who created this document. Agente model.
public
string
$codagente
$codalmacen
Warehouse in which the merchandise enters.
public
string
$codalmacen
$codcliente
Customer of this document.
public
string
$codcliente
$coddivisa
Currency of the document.
public
string
$coddivisa
$codejercicio
Exercise code.
public
string
$codejercicio
$codigo
Unique identifier for humans.
public
string
$codigo
$codigoenv
Shipping tracking code.
public
string
$codigoenv
$codpago
Payment method code.
public
string
$codpago
$codpais
Customer's country.
public
string
$codpais
$codpostal
Customer's postal code.
public
string
$codpostal
$codserie
public
string
$codserie
$codtrans
Shipping code for the shipment.
public
string
$codtrans
$direccion
Customer's address
public
string
$direccion
$dtopor1
Percentage of discount.
public
float
$dtopor1
$dtopor2
Percentage of discount.
public
float
$dtopor2
$editable
Indicates whether the document can be modified
public
bool
$editable
$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
$idalbaran
Primary key. Integer.
public
int
$idalbaran
$idcontactoenv
ID of contact for shippment.
public
int
$idcontactoenv
$idcontactofact
ID of contact for invoice.
public
int
$idcontactofact
$idempresa
public
int
$idempresa
$idestado
Document status, from EstadoDocumento model.
public
int
$idestado
$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
$nombrecliente
Customer name.
public
string
$nombrecliente
$numdocs
Number of attached documents.
public
int
$numdocs
$numero
Number of the document. Unique within the series.
public
string
$numero
$numero2
Optional number available to the user.
public
string
$numero2
$observaciones
Notes of the document.
public
string
$observaciones
$operacion
Indicates the type of document operation, example: intra-community
public
string
$operacion
$provincia
Customer's province.
public
string
$provincia
$tasaconv
Rate of conversion to Euros of the selected currency.
public
float|int
$tasaconv
$total
Total sum of the document, with taxes.
public
float|int
$total
$totalbeneficio
sum total of the benefits of the lines.
public
float
$totalbeneficio
$totalcoste
total sum of the costs of the lines.
public
float
$totalcoste
$totaleuros
Total expressed in euros, if it were not the currency of the document.
public
float|int
$totaleuros
totaleuros = total / tasaconv It is not necessary to fill it, when doing save() the value is calculated.
$totalirpf
Total sum of the IRPF withholdings of the lines.
public
float|int
$totalirpf
$totaliva
Sum of the VAT of the lines.
public
float|int
$totaliva
$totalrecargo
Total sum of the equivalence surcharge of the lines.
public
float|int
$totalrecargo
$totalsuplidos
Total sum of supplied lines.
public
float|int
$totalsuplidos
$checkedTables
List of already tested tables.
protected
static array<string|int, mixed>
$checkedTables
= []
$dataBase
It provides direct access to the database.
protected
static DataBase
$dataBase
$dont_copy_fields
protected
static array<string|int, mixed>
$dont_copy_fields
= ['codejercicio', 'codigo', 'codigorect', 'fecha', 'femail', 'hora', 'idasiento', 'idestado', 'idfacturarect', 'neto', 'netosindto', 'numero', 'pagada', 'total', 'totalirpf', 'totaliva', 'totalrecargo', 'totalsuplidos']
$fields
List of fields in the table.
protected
static array<string|int, mixed>
$fields
= []
$previousData
Previous data array.
protected
array<string|int, mixed>
$previousData
= []
$documentGeneration
private
static bool
$documentGeneration
= true
$estados
private
static array<string|int, EstadoDocumento>
$estados
Methods
__construct()
ModelClass constructor.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
Return values
mixed —addExtension()
Adds an extension to this model.
public
abstract static addExtension(mixed $extension) : mixed
Parameters
- $extension : mixed
Return values
mixed —all()
Returns all models that correspond to the selected filters.
public
static all([array<string|int, mixed> $where = [] ][, array<string|int, mixed> $order = [] ], int $offset[, int $limit = 50 ]) : array<string|int, static>
Parameters
- $where : array<string|int, mixed> = []
-
filters to apply to model records.
- $order : array<string|int, mixed> = []
-
fields to use in the sorting. For example ['code' => 'ASC']
- $offset : int
- $limit : int = 50
Return values
array<string|int, static> —changePrimaryColumnValue()
Change the value of the primary column in the model and the database.
public
changePrimaryColumnValue(mixed $newValue) : bool
Parameters
- $newValue : mixed
Return values
bool —childrenDocuments()
Returns all children documents of this one.
public
childrenDocuments() : array<string|int, TransformerDocument>
Return values
array<string|int, TransformerDocument> —clear()
Reset the values of all model properties.
public
clear() : mixed
Return values
mixed —codeModelAll()
Allows to use this model as source in CodeModel special model.
public
codeModelAll([string $fieldCode = '' ]) : array<string|int, CodeModel>
Parameters
- $fieldCode : string = ''
Return values
array<string|int, CodeModel> —codeModelSearch()
Allows to use this model as source in CodeModel special model.
public
codeModelSearch(string $query[, string $fieldCode = '' ][, array<string|int, DataBaseWhere> $where = [] ]) : array<string|int, CodeModel>
Parameters
- $query : string
- $fieldCode : string = ''
- $where : array<string|int, DataBaseWhere> = []
Return values
array<string|int, CodeModel> —count()
Returns the number of records in the model that meet the condition.
public
count([array<string|int, DataBaseWhere> $where = [] ]) : int
Parameters
- $where : array<string|int, DataBaseWhere> = []
-
filters to apply to model records.
Return values
int —country()
public
country() : string
Return values
string —delete()
Remove the model data from the database.
public
delete() : bool
Return values
bool —dontCopyField()
public
static dontCopyField(string $field) : void
Parameters
- $field : string
Return values
void —dontCopyFields()
public
static dontCopyFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —exists()
Returns true if the model data is stored in the database.
public
exists() : bool
Return values
bool —get()
Returns the model whose primary column corresponds to the value $cod
public
get(string $code) : static|false
Parameters
- $code : string
Return values
static|false —getAvailableStatus()
Returns all available status for this type of document.
public
getAvailableStatus() : array<string|int, EstadoDocumento>
Return values
array<string|int, EstadoDocumento> —getCompany()
public
getCompany() : Empresa
Return values
Empresa —getEUDiscount()
Returns the Equivalent Unified Discount.
public
getEUDiscount() : float
Return values
float —getExercise()
public
getExercise([string $codejercicio = '' ]) : Ejercicio
Parameters
- $codejercicio : string = ''
Return values
Ejercicio —getLines()
Returns the lines associated with the delivery note.
public
getLines() : array<string|int, LineaAlbaranCliente>
Return values
array<string|int, LineaAlbaranCliente> —getModelFields()
Returns the list of fields in the table.
public
abstract getModelFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —getNewLine()
Returns a new line for the document.
public
getNewLine([array<string|int, mixed> $data = [] ][, array<string|int, mixed> $exclude = ['actualizastock', 'idlinea', 'idalbaran', 'servido'] ]) : LineaAlbaranCliente
Parameters
- $data : array<string|int, mixed> = []
- $exclude : array<string|int, mixed> = ['actualizastock', 'idlinea', 'idalbaran', 'servido']
Return values
LineaAlbaranCliente —getNewProductLine()
Returns a new line for this business document completed with the product data.
public
abstract getNewProductLine(mixed $reference) : mixed
Parameters
- $reference : mixed
Return values
mixed —getPaymentMethod()
public
getPaymentMethod() : FormaPago
Return values
FormaPago —getRate()
public
getRate() : Tarifa
Return values
Tarifa —getSerie()
public
getSerie() : Serie
Return values
Serie —getStatus()
Returns the EstadoDocumento model for this document.
public
getStatus() : EstadoDocumento
Return values
EstadoDocumento —getSubject()
Returns the subject of this document.
public
abstract getSubject() : mixed
Return values
mixed —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.
public
install() : string
Return values
string —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.
public
loadFromCode(string $code[, array<string|int, mixed> $where = [] ][, array<string|int, mixed> $order = [] ]) : 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<string|int, mixed> = []
- $order : array<string|int, mixed> = []
Return values
bool —loadFromData()
Assign the values of the $data array to the model properties.
public
loadFromData([array<string|int, mixed> $data = [] ][, array<string|int, mixed> $exclude = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
- $exclude : array<string|int, mixed> = []
Return values
mixed —modelClassName()
Returns the name of the class of the model.
public
abstract modelClassName() : string
Return values
string —newCode()
Returns the following code for the reported field or the primary key of the model.
public
newCode([string $field = '' ][, array<string|int, mixed> $where = [] ]) : int
Parameters
- $field : string = ''
- $where : array<string|int, mixed> = []
Return values
int —paid()
public
paid() : bool
Return values
bool —parentDocuments()
Returns all parent document of this one.
public
parentDocuments() : array<string|int, TransformerDocument>
Return values
array<string|int, TransformerDocument> —pipe()
Executes all $name methods added from the extensions.
public
abstract pipe(string $name, array<string|int, mixed> ...$arguments) : mixed
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Return values
mixed —pipeFalse()
Executes all $name methods added from the extensions until someone returns false.
public
abstract pipeFalse(string $name, array<string|int, mixed> ...$arguments) : bool
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Return values
bool —primaryColumn()
public
static primaryColumn() : string
Return values
string —primaryColumnValue()
Returns the current value of the main column of the model.
public
primaryColumnValue() : mixed
Return values
mixed —primaryDescription()
Descriptive identifier for humans of the data record
public
primaryDescription() : string
Return values
string —primaryDescriptionColumn()
Returns the name of the column that describes the model, such as name, description.
public
primaryDescriptionColumn() : string
..
Return values
string —save()
Stores the model data in the database.
public
save() : bool
Return values
bool —setAuthor()
Sets the author for this document.
public
abstract setAuthor(mixed $user) : bool
Parameters
- $user : mixed
Return values
bool —setCurrency()
public
setCurrency(string $coddivisa[, bool $purchase = false ]) : mixed
Parameters
- $coddivisa : string
- $purchase : bool = false
Return values
mixed —setDate()
Assign the date and find an accounting exercise.
public
setDate(string $date, string $hour) : bool
Parameters
- $date : string
- $hour : string
Return values
bool —setDocumentGeneration()
public
setDocumentGeneration(bool $value) : mixed
Parameters
- $value : bool
Return values
mixed —setIntracomunitaria()
public
setIntracomunitaria() : bool
Return values
bool —setSubject()
Sets subject for this document.
public
abstract setSubject(mixed $subject) : bool
Parameters
- $subject : mixed
Return values
bool —setWarehouse()
Sets warehouse and company for this document.
public
setWarehouse(string $codalmacen) : bool
Parameters
- $codalmacen : string
Return values
bool —subjectColumn()
Returns the name of the column for subject.
public
abstract subjectColumn() : mixed
Return values
mixed —subjectColumnValue()
public
subjectColumnValue() : string
Return values
string —table()
public
static table() : DbQuery
Return values
DbQuery —tableName()
public
static tableName() : string
Return values
string —test()
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
bool —toArray()
Returns an array with the model fields values.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —updateSubject()
Updates subjects data in this document.
public
abstract updateSubject() : bool
Return values
bool —url()
Returns the url where to see / modify the data.
public
url([string $type = 'auto' ][, string $list = 'List' ]) : string
Parameters
- $type : string = 'auto'
- $list : string = 'List'
Return values
string —loadModelFields()
Loads table fields if is necessary.
protected
abstract loadModelFields(DataBase &$dataBase, string $tableName) : mixed
Parameters
- $dataBase : DataBase
- $tableName : string
Return values
mixed —modelName()
Returns the name of the model.
protected
abstract modelName() : string
Return values
string —onChange()
This method is called before save (update) when some field has changed.
protected
onChange(string $field) : bool
Parameters
- $field : string
Return values
bool —onDelete()
This method is called after a record is removed from the database.
protected
onDelete() : mixed
Return values
mixed —onInsert()
This method is called after a new record is saved on the database (saveInsert).
protected
onInsert() : mixed
Return values
mixed —onUpdate()
This method is called after a record is updated on the database (saveUpdate).
protected
onUpdate() : mixed
Return values
mixed —saveInsert()
Insert the model data in the database.
protected
saveInsert([array<string|int, mixed> $values = [] ]) : bool
Parameters
- $values : array<string|int, mixed> = []
Return values
bool —saveUpdate()
Update the model data in the database.
protected
saveUpdate([array<string|int, mixed> $values = [] ]) : bool
Parameters
- $values : array<string|int, mixed> = []
Return values
bool —setContact()
protected
setContact(Contacto $subject) : bool
Parameters
- $subject : Contacto
Return values
bool —setCustomer()
protected
setCustomer(Cliente $subject) : bool
Parameters
- $subject : Cliente
Return values
bool —setPreviousData()
Saves previous values.
protected
setPreviousData([array<string|int, mixed> $fields = [] ]) : mixed
Parameters
- $fields : array<string|int, mixed> = []
Return values
mixed —toolBox()
Returns a new instance of the ToolBox class.
protected
static toolBox() : ToolBox
Tags
Return values
ToolBox —checkTable()
Checks and updates the structure of the table if necessary.
private
checkTable() : bool
Return values
bool —getBoolValueForField()
Returns the boolean value for the field.
private
getBoolValueForField(array<string|int, mixed> $field, mixed $value) : bool|null
Parameters
- $field : array<string|int, mixed>
- $value : mixed
Return values
bool|null —getFloatValueForField()
Returns the float value for the field.
private
getFloatValueForField(array<string|int, mixed> $field, string $value) : float|null
Parameters
- $field : array<string|int, mixed>
- $value : string
Return values
float|null —getIntegerValueForField()
Returns the integer value by controlling special cases for the PK and FK.
private
getIntegerValueForField(array<string|int, mixed> $field, string $value) : int|null
Parameters
- $field : array<string|int, mixed>
- $value : string
Return values
int|null —getOrderBy()
Convert an array of filters order by in string.
private
static getOrderBy(array<string|int, mixed> $order) : string
Parameters
- $order : array<string|int, mixed>
Return values
string —getRecord()
Read the record whose primary column corresponds to the value $cod or the first that meets the indicated condition.
private
getRecord(string $code[, array<string|int, mixed> $where = [] ][, array<string|int, mixed> $order = [] ]) : array<string|int, mixed>
Parameters
- $code : string
- $where : array<string|int, mixed> = []
- $order : array<string|int, mixed> = []