dolibarr  7.0.0-beta
Functions
price.lib.php File Reference

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)
 Calculate totals (net, vat, ...) of a line. More...
 

Detailed Description

Library with functions to calculate prices.

Definition in file price.lib.php.

Function Documentation

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 
)

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)

Parameters
int$qtyQuantity
float$puUnit price (HT or TTC selon price_base_type)
float$remise_percent_ligneDiscount for line
float$txtva0=do not apply standard tax, Vat rate=apply
float$uselocaltax1_rate0=do not use this localtax, >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_rate0=do not use this localtax, >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_global0
string$price_base_typeHT=Unit price parameter is HT, TTC=Unit price parameter is TTC
int$info_bitsMiscellaneous informations on line
int$type0/1=Product/service
Societe$sellerThirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
array$localtaxes_arrayArray with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
integer$progressSituation invoices progress (value from 0 to 100, 100 by default)
double$multicurrency_txCurrency rate (1 by default)
double$pu_deviseAmount in currency
Returns
array [ 0=total_ht, 1=total_vat, (main vat only) 2=total_ttc, (total_ht + main vat + local taxes) 3=pu_ht, 4=pu_vat, (main vat only) 5=pu_ttc, 6=total_ht_without_discount, 7=total_vat_without_discount, (main vat only) 8=total_ttc_without_discount, (total_ht + main vat + local taxes) 9=total_tax1 for total_ht, 10=total_tax2 for total_ht,

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 85 of file price.lib.php.

References $resql, dol_print_error(), dol_syslog(), float, and price2num().

Referenced by SupplierProposal\addline(), Propal\addline(), FactureRec\addline(), Commande\addline(), Contrat\addline(), FactureFournisseur\addline(), CommandeFournisseur\addline(), ExpenseReport\addline(), Facture\addline(), Facturation\ajoutArticle(), ExpenseReport\applyOffset(), ExpenseReport\checkRules(), Expedition\fetch_lines(), migrate_price_commande(), migrate_price_commande_fournisseur(), migrate_price_contrat(), migrate_price_facture(), migrate_price_propal(), ContratLigne\update(), Facture\update_percent(), SupplierProposal\updateline(), Propal\updateline(), FactureRec\updateline(), FactureFournisseur\updateline(), Contrat\updateline(), ExpenseReport\updateline(), CommandeFournisseur\updateline(), Facture\updateline(), and Commande\updateline().