dolibarr 20.0.0
|
Library with functions to calculate prices. More...
Go to the source code of this file.
Functions | |
calcul_price_total ($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller='', $localtaxes_array=[], $progress=100, $multicurrency_tx=1, $pu_devise=0, $multicurrency_code='') | |
Calculate totals (net, vat, ...) of a line. | |
Library with functions to calculate prices.
Definition in file price.lib.php.
calcul_price_total | ( | $qty, | |
$pu, | |||
$remise_percent_ligne, | |||
$txtva, | |||
$uselocaltax1_rate, | |||
$uselocaltax2_rate, | |||
$remise_percent_global, | |||
$price_base_type, | |||
$info_bits, | |||
$type, | |||
$seller = '', | |||
$localtaxes_array = [], | |||
$progress = 100, | |||
$multicurrency_tx = 1, | |||
$pu_devise = 0, | |||
$multicurrency_code = '' ) |
Calculate totals (net, vat, ...) of a line.
Value for localtaxX_type are '0' : local tax not applied '1' : local tax apply on products and services without vat (localtax is calculated on amount without tax) '2' : local tax apply on products and services including vat (localtax is calculated on amount + tax) '3' : local tax apply on products without vat (localtax is calculated on amount without tax) '4' : local tax apply on products including vat (localtax is calculated on amount + tax) '5' : local tax apply on services without vat (localtax is calculated on amount without tax) '6' : local tax apply on services including vat (localtax is calculated on amount + tax)
float | $qty | Quantity |
float | $pu | Unit price (HT or TTC depending on price_base_type. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2) |
float | $remise_percent_ligne | Discount for line |
float | $txtva | 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array) |
float | $uselocaltax1_rate | 0=do not use localtax1, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. |
float | $uselocaltax2_rate | 0=do not use localtax2, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. |
float | $remise_percent_global | 0 |
string | $price_base_type | 'HT'=Unit price parameter $pu is HT, 'TTC'=Unit price parameter $pu is TTC (HT+VAT but not Localtax. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2) |
int | $info_bits | Miscellaneous information on line |
int | $type | 0/1=Product/service |
Societe | string | $seller | Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. |
array | $localtaxes_array | Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). |
integer | $progress | Situation invoices progress (value from 0 to 100, 100 by default) |
double | $multicurrency_tx | Currency rate (1 by default) |
double | $pu_devise | Amount in currency |
string | $multicurrency_code | Value of the foreign currency if multicurrency is used ('EUR', 'USD', ...). It will be used for rounding according to currency. |
11=pu_tax1 for pu_ht, !! should not be used 12=pu_tax2 for pu_ht, !! should not be used 13=?? !! should not be used 14=total_tax1 for total_ht_without_discount, !! should not be used 15=total_tax2 for total_ht_without_discount, !! should not be used
16=multicurrency_total_ht 17=multicurrency_total_tva 18=multicurrency_total_ttc 19=multicurrency_pu_ht 20=multicurrency_pu_vat 21=multicurrency_pu_ttc 22=multicurrency_total_ht_without_discount 23=multicurrency_total_vat_without_discount 24=multicurrency_total_ttc_without_discount 25=multicurrency_total_tax1 for total_ht 26=multicurrency_total_tax2 for total_ht
Definition at line 88 of file price.lib.php.
References calcul_price_total(), dol_print_error(), dol_syslog(), getDolGlobalString(), and price2num().
Referenced by Commande\addline(), CommandeFournisseur\addline(), Contrat\addline(), ExpenseReport\addline(), Facture\addline(), FactureFournisseur\addline(), FactureFournisseurRec\addline(), FactureRec\addline(), Propal\addline(), SupplierProposal\addline(), FichinterRec\addLineRec(), ExpenseReport\applyOffset(), calcul_price_total(), ExpenseReport\checkRules(), Expedition\fetch_lines(), pdf_octopus\getInfosLineLastSituation(), migrate_price_commande(), migrate_price_commande_fournisseur(), migrate_price_contrat(), migrate_price_facture(), migrate_price_propal(), ContratLigne\update(), Facture\update_percent(), Commande\updateline(), CommandeFournisseur\updateline(), Contrat\updateline(), ExpenseReport\updateline(), Facture\updateline(), FactureFournisseur\updateline(), FactureFournisseurRec\updateline(), FactureRec\updateline(), Propal\updateline(), and SupplierProposal\updateline().