FacturaScripts

InvoiceToAccounting extends AccountingClass
in package

Clase para la generación de asientos contables a partir de un documento de venta/compra y la liquidación de sus recibos.

Tags

Jose Antonio Cuello Principal [email protected]

Raúl Jiménez Jiménez [email protected]

Table of Contents

Constants

SPECIAL_CREDITOR_ACCOUNT  : mixed = 'ACREED'
SPECIAL_CUSTOMER_ACCOUNT  : mixed = 'CLIENT'
SPECIAL_EXPENSE_ACCOUNT  : mixed = 'GTOBAN'
SPECIAL_IRPF_PURCHASE_ACCOUNT  : mixed = 'IRPFPR'
SPECIAL_IRPF_SALES_ACCOUNT  : mixed = 'IRPF'
SPECIAL_NEGATIVE_PREV_ACCOUNT  : mixed = 'PRENEG'
SPECIAL_PAYMENT_ACCOUNT  : mixed = 'CAJA'
SPECIAL_POSITIVE_PREV_ACCOUNT  : mixed = 'PREVIO'
SPECIAL_PROFIT_LOSS_ACCOUNT  : mixed = 'PYG'
SPECIAL_SUPPLIER_ACCOUNT  : mixed = 'PROVEE'
SPECIAL_TAX_IMPACTED_ACCOUNT  : mixed = 'IVAREP'
SPECIAL_TAX_SUPPORTED_ACCOUNT  : mixed = 'IVASOP'

Properties

$exercise  : Ejercicio
$counterpart  : Subcuenta
$creation  : AccountingCreation
$document  : FacturaCliente|FacturaProveedor
$subtotals  : array<string|int, mixed>
Subtotales del documento calculados con Calculator::getSubtotals.

Methods

__construct()  : mixed
Class constructor
generate()  : mixed
Método para lanzar el proceso de contabilización
getCustomerAccount()  : Subcuenta
Get the accounting sub-account for the customer and the fiscal year.
getCustomerGroupAccount()  : Subcuenta
Get the accounting sub-account for the group's customer and the fiscal year.
getExpenseAccount()  : Subcuenta
Get the banking expenses sub-account for payments in the fiscal year.
getIRPFPurchaseAccount()  : Subcuenta
Get the accounting sub-account for Purchase Retention.
getIRPFSalesAccount()  : Subcuenta
Get the accounting sub-account for Sales Retention.
getPaymentAccount()  : Subcuenta
Get the accounting sub-account for the payment method in the fiscal year.
getSpecialAccount()  : Cuenta
Get the accounting account set as special.
getSpecialSubAccount()  : Subcuenta
Get an accounting sub-account for the special type indicated If there is no, search within the group of accounts for the special type
getSubAccount()  : Subcuenta
Get the indicated accounting sub-account.
getSupplierAccount()  : Subcuenta
Get the accounting sub-account for the supplier and the fiscal year.
getTaxImpactedAccount()  : Subcuenta
Get the accounting sub-account for Impacted Tax.
getTaxSupportedAccount()  : Subcuenta
Get the accounting sub-account for Supported Tax.
addBasicLine()  : bool
Add a standard line to the accounting entry based on the reported sub-account
addCustomerLine()  : bool
Añade la línea del cliente al asiento y guarda su subcuenta como contrapartida para las siguientes líneas (IVA, IRPF, mercancía).
addGoodsPurchaseLine()  : bool
Añade la línea de compra de mercancías al asiento, una por cada subcuenta de producto/familia. En facturas rectificativas usa la cuenta especial DEVCOM si está configurada; en caso contrario cae a COMPRA.
addGoodsSalesLine()  : bool
Añade la línea de venta de mercancías al asiento, una por cada subcuenta de producto/familia. En facturas rectificativas usa la cuenta especial DEVVEN si está configurada; en caso contrario cae a VENTAS.
addLinesFromTotals()  : bool
Add a group of lines from array of subaccounts/amount.
addPurchaseIrpfLines()  : bool
addPurchaseSuppliedLines()  : bool
addPurchaseTaxLines()  : bool
Añade la línea de impuestos de compras al asiento contable
addSalesIrpfLines()  : bool
addSalesSuppliedLines()  : bool
Añade la línea de suplidos de ventas al asiento contable
addSalesTaxLines()  : bool
Añade la línea de impuestos de ventas al asiento contable
addSupplierLine()  : bool
Añade la línea del proveedor al asiento y guarda su subcuenta como contrapartida para las siguientes líneas (IVA, IRPF, mercancía).
addSurchargeLine()  : bool
Add a line of taxes to the accounting entry based on the sub-account and values reported
addTaxLine()  : bool
Add a line of taxes to the accounting entry based on the sub-account and values reported
getBasicLine()  : Partida
Obtain a standard line to the accounting entry based on the reported sub-account
initialChecks()  : bool
Comprobaciones previas a la contabilización: el documento no está ya contabilizado, tiene total, el ejercicio existe y está abierto, tiene plan contable, los subtotales se calculan correctamente y hay cuentas dadas de alta en ese ejercicio.
loadSubtotals()  : bool
purchaseAccountingEntry()  : void
Genera el asiento contable para un documento de compra.
salesAccountingEntry()  : void
Genera el asiento contable para un documento de venta.
setAccountingData()  : void
Asigna al asiento los datos básicos del documento (ejercicio, concepto, fecha, empresa, importe) y copia el diario y el canal analítico desde la Serie.

Constants

SPECIAL_IRPF_PURCHASE_ACCOUNT

public mixed SPECIAL_IRPF_PURCHASE_ACCOUNT = 'IRPFPR'

SPECIAL_NEGATIVE_PREV_ACCOUNT

public mixed SPECIAL_NEGATIVE_PREV_ACCOUNT = 'PRENEG'

SPECIAL_POSITIVE_PREV_ACCOUNT

public mixed SPECIAL_POSITIVE_PREV_ACCOUNT = 'PREVIO'

SPECIAL_TAX_IMPACTED_ACCOUNT

public mixed SPECIAL_TAX_IMPACTED_ACCOUNT = 'IVAREP'

SPECIAL_TAX_SUPPORTED_ACCOUNT

public mixed SPECIAL_TAX_SUPPORTED_ACCOUNT = 'IVASOP'

Properties

$subtotals

Subtotales del documento calculados con Calculator::getSubtotals.

protected array<string|int, mixed> $subtotals

Claves: 'iva' (array por tipo de IVA con neto/iva/recargo/totaliva/totalrecargo/codimpuesto), 'irpf' (porcentaje) y 'totalirpf' (importe).

Methods

getCustomerAccount()

Get the accounting sub-account for the customer and the fiscal year.

public getCustomerAccount(Cliente &$customer[, string $specialAccount = self::SPECIAL_CUSTOMER_ACCOUNT ]) : Subcuenta
  • First check the customer
  • Second check the customer group
  • Third search for the sub-account classified as a special account for customers
  • Fourth search for the general account classified as a special account for customers and then search for a sub account belonging to the account
Parameters
$customer : Cliente
$specialAccount : string = self::SPECIAL_CUSTOMER_ACCOUNT
Return values
Subcuenta

getCustomerGroupAccount()

Get the accounting sub-account for the group's customer and the fiscal year.

public getCustomerGroupAccount(GrupoClientes $group[, string $specialAccount = self::SPECIAL_CUSTOMER_ACCOUNT ]) : Subcuenta
Parameters
$group : GrupoClientes
$specialAccount : string = self::SPECIAL_CUSTOMER_ACCOUNT
Return values
Subcuenta

getExpenseAccount()

Get the banking expenses sub-account for payments in the fiscal year.

public getExpenseAccount(string $codpago[, string $specialAccount = self::SPECIAL_EXPENSE_ACCOUNT ]) : Subcuenta
Parameters
$codpago : string
$specialAccount : string = self::SPECIAL_EXPENSE_ACCOUNT
Return values
Subcuenta

getIRPFPurchaseAccount()

Get the accounting sub-account for Purchase Retention.

public getIRPFPurchaseAccount(Retencion $retention[, string $specialAccount = self::SPECIAL_IRPF_PURCHASE_ACCOUNT ]) : Subcuenta
Parameters
$retention : Retencion
$specialAccount : string = self::SPECIAL_IRPF_PURCHASE_ACCOUNT
Return values
Subcuenta

getIRPFSalesAccount()

Get the accounting sub-account for Sales Retention.

public getIRPFSalesAccount(Retencion $retention[, string $specialAccount = self::SPECIAL_IRPF_SALES_ACCOUNT ]) : Subcuenta
Parameters
$retention : Retencion
$specialAccount : string = self::SPECIAL_IRPF_SALES_ACCOUNT
Return values
Subcuenta

getPaymentAccount()

Get the accounting sub-account for the payment method in the fiscal year.

public getPaymentAccount(string $codpago[, string $specialAccount = self::SPECIAL_PAYMENT_ACCOUNT ]) : Subcuenta
Parameters
$codpago : string
$specialAccount : string = self::SPECIAL_PAYMENT_ACCOUNT
Return values
Subcuenta

getSpecialAccount()

Get the accounting account set as special.

public getSpecialAccount(string $specialAccount) : Cuenta
Parameters
$specialAccount : string
Return values
Cuenta

getSpecialSubAccount()

Get an accounting sub-account for the special type indicated If there is no, search within the group of accounts for the special type

public getSpecialSubAccount(string $specialAccount) : Subcuenta
Parameters
$specialAccount : string
Return values
Subcuenta

getSupplierAccount()

Get the accounting sub-account for the supplier and the fiscal year.

public getSupplierAccount(Proveedor $supplier[, string $specialAccount = self::SPECIAL_SUPPLIER_ACCOUNT ]) : Subcuenta

If it does not exist, search for the sub-account associated with the special type indicated

Parameters
$supplier : Proveedor
$specialAccount : string = self::SPECIAL_SUPPLIER_ACCOUNT
Return values
Subcuenta

getTaxImpactedAccount()

Get the accounting sub-account for Impacted Tax.

public getTaxImpactedAccount(Impuesto $tax[, string $specialAccount = self::SPECIAL_TAX_IMPACTED_ACCOUNT ]) : Subcuenta
Parameters
$tax : Impuesto
$specialAccount : string = self::SPECIAL_TAX_IMPACTED_ACCOUNT
Return values
Subcuenta

getTaxSupportedAccount()

Get the accounting sub-account for Supported Tax.

public getTaxSupportedAccount(Impuesto $tax[, string $specialAccount = self::SPECIAL_TAX_SUPPORTED_ACCOUNT ]) : Subcuenta
Parameters
$tax : Impuesto
$specialAccount : string = self::SPECIAL_TAX_SUPPORTED_ACCOUNT
Return values
Subcuenta

addBasicLine()

Add a standard line to the accounting entry based on the reported sub-account

protected addBasicLine(Asiento $accountEntry, Subcuenta $subaccount, bool $isDebit[, float $amount = null ]) : bool
Parameters
$accountEntry : Asiento
$subaccount : Subcuenta
$isDebit : bool
$amount : float = null
Return values
bool

addCustomerLine()

Añade la línea del cliente al asiento y guarda su subcuenta como contrapartida para las siguientes líneas (IVA, IRPF, mercancía).

protected addCustomerLine(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addGoodsPurchaseLine()

Añade la línea de compra de mercancías al asiento, una por cada subcuenta de producto/familia. En facturas rectificativas usa la cuenta especial DEVCOM si está configurada; en caso contrario cae a COMPRA.

protected addGoodsPurchaseLine(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addGoodsSalesLine()

Añade la línea de venta de mercancías al asiento, una por cada subcuenta de producto/familia. En facturas rectificativas usa la cuenta especial DEVVEN si está configurada; en caso contrario cae a VENTAS.

protected addGoodsSalesLine(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addLinesFromTotals()

Add a group of lines from array of subaccounts/amount.

protected addLinesFromTotals(Asiento $accountEntry, array<string|int, mixed> $totals, bool $isDebit, Subcuenta $counterpart, string $accountError, string $saveError) : bool
Parameters
$accountEntry : Asiento
$totals : array<string|int, mixed>
$isDebit : bool
$counterpart : Subcuenta
$accountError : string
$saveError : string
Return values
bool

addPurchaseTaxLines()

Añade la línea de impuestos de compras al asiento contable

protected addPurchaseTaxLines(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addSalesSuppliedLines()

Añade la línea de suplidos de ventas al asiento contable

protected addSalesSuppliedLines(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addSalesTaxLines()

Añade la línea de impuestos de ventas al asiento contable

protected addSalesTaxLines(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addSupplierLine()

Añade la línea del proveedor al asiento y guarda su subcuenta como contrapartida para las siguientes líneas (IVA, IRPF, mercancía).

protected addSupplierLine(Asiento $entry) : bool
Parameters
$entry : Asiento
Return values
bool

addSurchargeLine()

Add a line of taxes to the accounting entry based on the sub-account and values reported

protected addSurchargeLine(Asiento $accountEntry, Subcuenta $subaccount, Subcuenta $counterpart, bool $isDebit, array<string|int, mixed> $values) : bool
Parameters
$accountEntry : Asiento
$subaccount : Subcuenta
$counterpart : Subcuenta
$isDebit : bool
$values : array<string|int, mixed>
Return values
bool

addTaxLine()

Add a line of taxes to the accounting entry based on the sub-account and values reported

protected addTaxLine(Asiento $accountEntry, Subcuenta $subaccount, Subcuenta $counterpart, bool $isDebit, array<string|int, mixed> $values) : bool
Parameters
$accountEntry : Asiento
$subaccount : Subcuenta
$counterpart : Subcuenta
$isDebit : bool
$values : array<string|int, mixed>
Return values
bool

getBasicLine()

Obtain a standard line to the accounting entry based on the reported sub-account

protected getBasicLine(Asiento $accountEntry, Subcuenta $subaccount, bool $isDebit[, float $amount = null ]) : Partida
Parameters
$accountEntry : Asiento
$subaccount : Subcuenta
$isDebit : bool
$amount : float = null
Return values
Partida

initialChecks()

Comprobaciones previas a la contabilización: el documento no está ya contabilizado, tiene total, el ejercicio existe y está abierto, tiene plan contable, los subtotales se calculan correctamente y hay cuentas dadas de alta en ese ejercicio.

protected initialChecks() : bool
Return values
bool

purchaseAccountingEntry()

Genera el asiento contable para un documento de compra.

protected purchaseAccountingEntry() : void

salesAccountingEntry()

Genera el asiento contable para un documento de venta.

protected salesAccountingEntry() : void

setAccountingData()

Asigna al asiento los datos básicos del documento (ejercicio, concepto, fecha, empresa, importe) y copia el diario y el canal analítico desde la Serie.

protected setAccountingData(Asiento &$entry, string $concept) : void
Parameters
$entry : Asiento
$concept : string
On this page

Search results