FacturaScripts

AccountingCreation
in package

Class to create accounting sub-accounts automatically:

  • General
  • Customer
  • Supplier
Tags
author

Carlos García Gómez [email protected]

author

Jose Antonio Cuello Principal [email protected]

Table of Contents

$exercise  : Ejercicio
__construct()  : mixed
Class constructor
copyAccountToExercise()  : Cuenta
Create an account into informed exercise.
copySubAccountToExercise()  : Subcuenta
Create a subaccount into informed exercise.
createFromAccount()  : Subcuenta
Create a sub-account with the code and the reported description belonging to the group and exercise.
createSubjectAccount()  : Subcuenta
Create the accounting sub-account for the informed customer or supplier.
fillToLength()  : string
Complete to the indicated length with zeros.
getFreeSubjectSubaccount()  : string
Calculate an accounting sub-account from the customer or supplier code
checkExercise()  : bool
Load exercise and check if it can be used

Properties

Methods

__construct()

Class constructor

public __construct() : mixed
Return values
mixed

copyAccountToExercise()

Create an account into informed exercise.

public copyAccountToExercise(Cuenta $account, string $codejercicio) : Cuenta
Parameters
$account : Cuenta
$codejercicio : string
Return values
Cuenta

copySubAccountToExercise()

Create a subaccount into informed exercise.

public copySubAccountToExercise(Subcuenta $subAccount, string $codejercicio) : Subcuenta
  • Check exercise is open.
    • Check subaccount exists.

For new subaccount:

  • Search acount and copy from source subacount if dont exists.
  • Save new subaccount.
Parameters
$subAccount : Subcuenta
$codejercicio : string
Return values
Subcuenta

createFromAccount()

Create a sub-account with the code and the reported description belonging to the group and exercise.

public createFromAccount(Cuenta $account, string $code[, string $description = '' ]) : Subcuenta
Parameters
$account : Cuenta

Parent group account

$code : string

The code of the subaccount

$description : string = ''

The description of the subaccount

Return values
Subcuenta

createSubjectAccount()

Create the accounting sub-account for the informed customer or supplier.

public createSubjectAccount(Cliente|Proveedor &$subject, Cuenta $account) : Subcuenta

If the customer or supplier does not have an associated accounting subaccount, one is calculated automatically.

Parameters
$subject : Cliente|Proveedor

Customer or Supplier model

$account : Cuenta

Parent group account model

Return values
Subcuenta

fillToLength()

Complete to the indicated length with zeros.

public fillToLength(int $length, string $value[, string $prefix = '' ]) : string
Parameters
$length : int
$value : string
$prefix : string = ''
Return values
string

getFreeSubjectSubaccount()

Calculate an accounting sub-account from the customer or supplier code

public getFreeSubjectSubaccount(Cliente|Proveedor $subject, Cuenta $account) : string
Parameters
$subject : Cliente|Proveedor

Customer or Supplier model

$account : Cuenta

Parent group account model

Return values
string

checkExercise()

Load exercise and check if it can be used

private checkExercise(string $code) : bool
Parameters
$code : string
Return values
bool

Search results