FacturaScripts

InvoiceToAccounting extends InvoiceToAccounting
in package

Class created by Core/Base/PluginDeploy

Tags
author

FacturaScripts [email protected]

Table of Contents

SPECIAL_CREDITOR_ACCOUNT  = 'ACREED'
SPECIAL_CUSTOMER_ACCOUNT  = 'CLIENT'
SPECIAL_EXPENSE_ACCOUNT  = 'GTOBAN'
SPECIAL_IRPF_PURCHASE_ACCOUNT  = 'IRPFPR'
SPECIAL_IRPF_SALES_ACCOUNT  = 'IRPF'
SPECIAL_NEGATIVE_PREV_ACCOUNT  = 'PRENEG'
SPECIAL_PAYMENT_ACCOUNT  = 'CAJA'
SPECIAL_POSITIVE_PREV_ACCOUNT  = 'PREVIO'
SPECIAL_PROFIT_LOSS_ACCOUNT  = 'PYG'
SPECIAL_SUPPLIER_ACCOUNT  = 'PROVEE'
SPECIAL_TAX_IMPACTED_ACCOUNT  = 'IVAREP'
SPECIAL_TAX_SUPPORTED_ACCOUNT  = 'IVASOP'
$exercise  : Ejercicio
$counterpart  : Subcuenta
$creation  : AccountingCreation
$document  : ModelClass
$subtotals  : array<string|int, mixed>
Document Subtotals Lines array
__construct()  : mixed
Class constructor
generate()  : mixed
Method to launch the accounting process
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
Add the customer line to the accounting entry
addGoodsPurchaseLine()  : bool
Add the goods purchase line to the accounting entry.
addGoodsSalesLine()  : bool
Add the goods sales line to the accounting entry.
addLinesFromTotals()  : bool
Add a group of lines from array of subaccounts/amount.
addPurchaseIrpfLines()  : bool
addPurchaseSuppliedLines()  : bool
addPurchaseTaxLines()  : bool
Add the purchase line to the accounting entry
addSalesIrpfLines()  : bool
addSalesSuppliedLines()  : bool
Add the supplied line to the accounting entry
addSalesTaxLines()  : bool
Add the sales line to the accounting entry
addSupplierLine()  : bool
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
Perform the initial checks to continue with the accounting process
loadSubtotals()  : bool
purchaseAccountingEntry()  : mixed
Generate the accounting entry for a purchase document.
salesAccountingEntry()  : mixed
Generate the accounting entry for a sales document.
setAccountingData()  : mixed
Assign the document data to the accounting entry
toolBox()  : ToolBox
getAccountFromCode()  : Subcuenta
Get the accounting sub-account according to the indicated code sub-account.

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

Document Subtotals Lines array

protected array<string|int, mixed> $subtotals

Methods

__construct()

Class constructor

public __construct() : mixed
Return values
mixed

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()

Add the customer line to the accounting entry

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

addGoodsPurchaseLine()

Add the goods purchase line to the accounting entry.

protected addGoodsPurchaseLine(Asiento $entry) : bool

Make one line for each product/family purchase subaccount.

Parameters
$entry : Asiento
Return values
bool

addGoodsSalesLine()

Add the goods sales line to the accounting entry.

protected addGoodsSalesLine(Asiento $entry) : bool

Make one line for each product/family sale subaccount.

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()

Add the purchase line to the accounting entry

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

addSalesSuppliedLines()

Add the supplied line to the accounting entry

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

addSalesTaxLines()

Add the sales line to the accounting entry

protected addSalesTaxLines(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()

Perform the initial checks to continue with the accounting process

protected initialChecks() : bool
Return values
bool

purchaseAccountingEntry()

Generate the accounting entry for a purchase document.

protected purchaseAccountingEntry() : mixed
Return values
mixed

salesAccountingEntry()

Generate the accounting entry for a sales document.

protected salesAccountingEntry() : mixed
Return values
mixed

setAccountingData()

Assign the document data to the accounting entry

protected setAccountingData(Asiento &$entry, string $concept) : mixed
Parameters
$entry : Asiento
$concept : string
Return values
mixed

getAccountFromCode()

Get the accounting sub-account according to the indicated code sub-account.

private getAccountFromCode(string $code, string $specialAccount) : Subcuenta
  • First check the tax
  • Second check the special account
Parameters
$code : string
$specialAccount : string
Return values
Subcuenta

Search results