Single entry accounting – functions

1. retrieve the (invoice) operations

$operations = cfoBi::getOperations()

return:

Array
(
[1] => Goods aquisition
[2] => Service aquisition
[3] => Goods sale
[4] => Service sale
)

2. retrieve accounting accounts for a specified (invoice) operation (exemple for operation #1)

$conturi = cfoBi::getOperationAccounts(1)

return:

Array
(
[accounts_debitor] => Array
(
[195] => Array
(
[code] => 301
[name] => Materii prime
[updateSalesStock] => 0
)

[196] => Array
(
[code] => 302
[name] => Materiale consumabile
[updateSalesStock] => 0
)

(...)

[211] => Array
(
[code] => 381
[name] => Ambalaje
[updateSalesStock] => 0
)

)

[accounts_creditor] => Array
(
[192] => Array
(
[code] => 401
[name] => Furnizori
[updateSalesStock] => 0
)

)

)

3. register all necessary accounting notes (example: when saving an invoice for buying products)

$operation       : the ID of the operation (i.e. ap_operation.id)
$totalWithoutVat   : the total amount of money excluding VAT
$vatValue       : the total VAT
$debitorAccountCode  : the code of the debitor account
$creditorAccountCode : the code of the creditor account
$vatTypeMe      : my company's VAT type (i.e. company.vatType)
$vatTypePartner    : the partner's company VAT type (i.e. partner.vatType)
$sourceId       : the ID of the originator (eg: for invoices it is the invoiceItem.id)
$sourceType      : the type of the source (eg: for invoices it is accountingNote::$SOURCETYLE_INVOICE)
$transactionDate   : (Y-m-d H:i:s) the datetime of the transaction (if you have only the date part, the concatenate the current time)
$rez = cfoBi::registerAccountingNotes(1,100,20,301,401,2,2,131313,accountingNote::$SOURCETYLE_INVOICE);

returns:

  • -1xx : cannot create the accounting note for totalWithoutVat
  • -2xx : cannot create accounting note for vatValue (where applies)
  • -99003 : unspecified vat type of the partner (should be 1,2 or 3)
  • -99004 : cannot find specified operation
  • true : on success

Values for xx :

  • 1 : cannot find the current company
  • 2 : cannot find the specified debitor account
  • 3 : cannot find the specified creditor account

 

About

Software Development Manager, Architect

Categories: Conta |

Leave a Reply

Your email address will not be published. Required fields are marked *

[TOP]