dolibarr 24.0.3
tax.lib.php File Reference

Library for tax module. More...

Go to the source code of this file.

Functions

 tax_prepare_head (ChargeSociales $object)
 Prepare array with list of tabs.
 
 tax_get_situation_ratio ($db, $lineid)
 Get the ratio for a legacy situation line, restricting previous lines and credits to its entity/cycle.
 
 tax_by_thirdparty ($type, $db, $y, $date_start, $date_end, $modetax, $direction, $m=0, $q=0)
 Look for collectable VAT clients in the chosen year (and month)
 
 tax_by_rate ($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
 Gets Tax to collect for the given year (and given quarter or month) The function gets the Tax in split results, as the Tax declaration asks to report the amounts for different Tax rates as different lines.
 

Detailed Description

Library for tax module.

Definition in file tax.lib.php.

Function Documentation

◆ tax_by_rate()

tax_by_rate ( $type,
$db,
$y,
$q,
$date_start,
$date_end,
$modetax,
$direction,
$m = 0 )

Gets Tax to collect for the given year (and given quarter or month) The function gets the Tax in split results, as the Tax declaration asks to report the amounts for different Tax rates as different lines.

Parameters
'vat'|'localtax1'|'localtax2'$type Tax type, either 'vat', 'localtax1' or 'localtax2'
DoliDB$dbDatabase handler object
int$yYear
int<0,4>$q Quarter
int|''$date_start Start date
int|''$date_end End date
int$modetaxNot used
'sell'|'buy'$direction 'sell' (customer invoice) or 'buy' (supplier invoices)
int<0,12>$m Month
Returns
int<-3,-1>|array<int|string,array{totalht:float,vat:float,localtax1:float,localtax2:float,dtotal_ttc:float[],dtype:int[],datef:int[],datep:int[],company_name:string[],company_id:int[],company_alias:string[],company_email:string[],company_tva_intra:string[],company_client:int[],company_fournisseur:int[],company_customer_code:string[],company_supplier_code:string[],company_customer_accounting_code:string[],company_supplier_accounting_code:string[],company_status:int[],user_id:int[],drate:string[],ddate_start:int[],ddate_end:int[],facid:int[],facnum:string[],type:int[],ftotal_ttc:float[],descr:string[],totalht_list:string[],vat_list:float[],localtax1_list:float[],localtax2_list:float[],pid:int[],pref:string[],ptype:int[],payment_id:int[],payment_ref:string[],payment_amount:float[]}> Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developed, -3 if error

Definition at line 747 of file tax.lib.php.

References $conf, $date_start, $db, dol_get_first_day(), dol_get_last_day(), dol_print_error(), dol_syslog(), getDolGlobalInt(), getDolGlobalString(), price2num(), string, tax_get_situation_ratio(), and Facture\TYPE_SITUATION.

◆ tax_by_thirdparty()

tax_by_thirdparty ( $type,
$db,
$y,
$date_start,
$date_end,
$modetax,
$direction,
$m = 0,
$q = 0 )

Look for collectable VAT clients in the chosen year (and month)

Parameters
'vat'|'localtax1'|'localtax2'$type Tax type, either 'vat', 'localtax1' or 'localtax2'
DoliDB$dbDatabase handle
int$yYear
int|''$date_start Start date
int|''$date_end End date
int$modetaxNot used
'sell'|'buy'$direction 'sell' or 'buy'
int<0,12>$m Month
int<0,4>$q Quarter
Returns
int<-3,-1>|array<int|string,array{totalht:float,vat:float,localtax1:float,localtax2:float,dtotal_ttc:float[],dtype:int[],datef:int[],datep:int[],company_name:string[],company_id:int[],company_alias:string[],company_email:string[],company_tva_intra:string[],company_client:int[],company_fournisseur:int[],company_customer_code:string[],company_supplier_code:string[],company_customer_accounting_code:string[],company_supplier_accounting_code:string[],company_status:int[],user_id:int[],drate:string[],ddate_start:int[],ddate_end:int[],facid:int[],facnum:string[],type:int[],ftotal_ttc:float[],descr:string[],totalht_list:string[],vat_list:float[],localtax1_list:float[],localtax2_list:float[],pid:int[],pref:string[],ptype:int[],payment_id:int[],payment_ref:string[],payment_amount:float[]}> Array with details of VATs (per third party), -1 if no accountancy module, -2 if not yet developed, -3 if error

Definition at line 160 of file tax.lib.php.

References $conf, $date_start, $db, dol_get_first_day(), dol_get_last_day(), dol_print_error(), dol_syslog(), getDolGlobalInt(), getDolGlobalString(), price2num(), string, tax_get_situation_ratio(), and Facture\TYPE_SITUATION.

◆ tax_get_situation_ratio()

tax_get_situation_ratio ( $db,
$lineid )

Get the ratio for a legacy situation line, restricting previous lines and credits to its entity/cycle.

Called only for sales situation invoices with INVOICE_USE_SITUATION = 1.

Parameters
DoliDB$dbDatabase handle
int$lineidInvoice line id
Returns
float|false Situation ratio, or false on error

Definition at line 108 of file tax.lib.php.

References $db, dol_print_error(), dol_syslog(), getEntity(), and Facture\TYPE_SITUATION.

Referenced by tax_by_rate(), and tax_by_thirdparty().

◆ tax_prepare_head()

tax_prepare_head ( ChargeSociales $object)

Prepare array with list of tabs.

Parameters
ChargeSociales$objectObject related to tabs
Returns
array<array{0:string,1:string,2:string}> Array of tabs to show

Definition at line 40 of file tax.lib.php.

References $conf, $db, $object, complete_head_from_modules(), Link\count(), dol_dir_list(), dol_sanitizeFileName(), and getDolGlobalString().