dolibarr  17.0.4
Public Member Functions | List of all members
AccountancyCategory Class Reference

Class to manage categories of an accounting account. More...

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 create ($user, $notrigger=0)
 Create object into database. More...
 
 fetch ($id, $code='', $label='')
 Load object in memory from database. More...
 
 update ($user=null, $notrigger=0)
 Update object into database. More...
 
 delete ($user, $notrigger=0)
 Delete object in database. More...
 
 display ($id)
 Function to select into ->lines_display all accounting accounts for a given custom accounting group. More...
 
 getAccountsWithNoCategory ($id)
 Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group. More...
 
 updateAccAcc ($id_cat, $cpts=array())
 Function to add an accounting account in an accounting category. More...
 
 deleteCptCat ($cpt_id)
 Function to delete an accounting account from an accounting category. More...
 
 getCatsCpts ()
 Function to know all custom groupd from an accounting account. More...
 
 getSumDebitCredit ($cpt, $date_start, $date_end, $sens, $thirdparty_code='nofilter', $month=0, $year=0)
 Function to show result of an accounting account from the ledger with a direction and a period. More...
 
 getCats ($categorytype=-1, $active=1)
 Return list of custom groups. More...
 
 getCptsCat ($cat_id, $predefinedgroupwhere='')
 Get all accounting account of a custom group (or a list of custom groups). More...
 

Detailed Description

Class to manage categories of an accounting account.

Definition at line 32 of file accountancycategory.class.php.

Constructor & Destructor Documentation

◆ __construct()

AccountancyCategory::__construct (   $db)

Constructor.

Parameters
DoliDb$dbDatabase handler

Definition at line 137 of file accountancycategory.class.php.

References db.

Member Function Documentation

◆ create()

AccountancyCategory::create (   $user,
  $notrigger = 0 
)

Create object into database.

Parameters
User$userUser that create
int$notrigger0=launch triggers after, 1=disable triggers
Returns
int <0 if KO, Id of created object if OK

Definition at line 150 of file accountancycategory.class.php.

◆ delete()

AccountancyCategory::delete (   $user,
  $notrigger = 0 
)

Delete object in database.

Parameters
User$userUser that delete
int$notrigger0=launch triggers after, 1=disable triggers
Returns
int <0 if KO, >0 if OK

Definition at line 389 of file accountancycategory.class.php.

◆ deleteCptCat()

AccountancyCategory::deleteCptCat (   $cpt_id)

Function to delete an accounting account from an accounting category.

Parameters
int$cpt_idId of accounting account
Returns
int <0 if KO, >0 if OK

Definition at line 576 of file accountancycategory.class.php.

◆ display()

array Lines AccountancyCategory::display (   $id)

Function to select into ->lines_display all accounting accounts for a given custom accounting group.

Parameters
int$idId
Returns
int <0 if KO, 0 if not found, >0 if OK

Definition at line 426 of file accountancycategory.class.php.

◆ fetch()

AccountancyCategory::fetch (   $id,
  $code = '',
  $label = '' 
)

Load object in memory from database.

Parameters
int$idId object
string$codeCode
string$labelLabel
Returns
int <0 if KO, >0 if OK

Definition at line 249 of file accountancycategory.class.php.

◆ getAccountsWithNoCategory()

AccountancyCategory::getAccountsWithNoCategory (   $id)

Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group.

Parameters
int$idId of category to know which account to exclude
Returns
int <0 if KO, 0 if not found, >0 if OK

Definition at line 461 of file accountancycategory.class.php.

◆ getCats()

AccountancyCategory::getCats (   $categorytype = -1,
  $active = 1 
)

Return list of custom groups.

Parameters
int$categorytype-1=All, 0=Only non computed groups, 1=Only computed groups
int$active1= active, 0=not active
Returns
array|int Array of groups or -1 if error

Definition at line 759 of file accountancycategory.class.php.

◆ getCatsCpts()

AccountancyCategory::getCatsCpts ( )

Function to know all custom groupd from an accounting account.

Returns
array|integer Result in table (array), -1 if KO

Definition at line 613 of file accountancycategory.class.php.

◆ getCptsCat()

AccountancyCategory::getCptsCat (   $cat_id,
  $predefinedgroupwhere = '' 
)

Get all accounting account of a custom group (or a list of custom groups).

You must choose between first parameter (personalized group) or the second (free criteria filter)

Parameters
int$cat_idId if personalized accounting group/category
string$predefinedgroupwhereSql criteria filter to select accounting accounts. This value must not come from an input of a user.
Returns
array|int Array of accounting accounts or -1 if error

Definition at line 819 of file accountancycategory.class.php.

◆ getSumDebitCredit()

AccountancyCategory::getSumDebitCredit (   $cpt,
  $date_start,
  $date_end,
  $sens,
  $thirdparty_code = 'nofilter',
  $month = 0,
  $year = 0 
)

Function to show result of an accounting account from the ledger with a direction and a period.

Parameters
int | array$cptAccounting account or array of accounting account
string$date_startDate start
string$date_endDate end
int$sensSens of the account: 0: credit - debit (use this by default), 1: debit - credit
string$thirdparty_codeThirdparty code
int$monthSpecifig month - Can be empty
int$yearSpecifig year - Can be empty
Returns
integer <0 if KO, >= 0 if OK

Definition at line 674 of file accountancycategory.class.php.

◆ update()

AccountancyCategory::update (   $user = null,
  $notrigger = 0 
)

Update object into database.

Parameters
User$userUser that modify
int$notrigger0=launch triggers after, 1=disable triggers
Returns
int <0 if KO, >0 if OK

Definition at line 308 of file accountancycategory.class.php.

◆ updateAccAcc()

AccountancyCategory::updateAccAcc (   $id_cat,
  $cpts = array() 
)

Function to add an accounting account in an accounting category.

Parameters
int$id_catId category
array$cptslist of accounts array
Returns
int <0 if KO, >0 if OK

Definition at line 505 of file accountancycategory.class.php.


The documentation for this class was generated from the following file: