forked from Wavyzz/dolibarr
Merge remote-tracking branch 'origin/3.7' into develop
Conflicts: build/debian/changelog htdocs/compta/facture.php htdocs/core/lib/price.lib.php htdocs/install/mysql/migration/3.6.0-3.7.0.sql htdocs/opensurvey/public/studs.php htdocs/projet/element.php
This commit is contained in:
@@ -3,4 +3,4 @@ dolibarr (3.8.0-3) UNRELEASED; urgency=low
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 3 Mar 2015 12:00:00 +0100
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Sun, 21 March 2015 12:00:00 +0100
|
||||
|
||||
@@ -605,8 +605,9 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
|
||||
|
||||
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
||||
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
@@ -649,7 +650,6 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '<tr><td align="left"><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
||||
print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
@@ -1061,15 +1061,15 @@ else
|
||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax1",$mysoc->country_code);
|
||||
print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax2",$mysoc->country_code);
|
||||
print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||
print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -100,6 +100,7 @@ print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Add hook to add information
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -67,7 +67,7 @@ if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("CustomerArea"));
|
||||
print_fiche_titre($langs->trans("CommercialArea"));
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@@ -186,7 +186,7 @@ if (! $found)
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@@ -253,7 +253,7 @@ if (! $found)
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -2358,15 +2360,25 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||
|
||||
$newclassname = $classname;
|
||||
if ($newclassname == 'Propal')
|
||||
switch ($classname) {
|
||||
case 'Propal':
|
||||
$newclassname = 'CommercialProposal';
|
||||
elseif ($newclassname == 'Commande')
|
||||
break;
|
||||
case 'Commande':
|
||||
$newclassname = 'Order';
|
||||
elseif ($newclassname == 'Expedition')
|
||||
break;
|
||||
case 'Expedition':
|
||||
$newclassname = 'Sending';
|
||||
elseif ($newclassname == 'Fichinter')
|
||||
break;
|
||||
case 'Contrat':
|
||||
$newclassname = 'Contract';
|
||||
break;
|
||||
case 'Fichinter':
|
||||
$newclassname = 'Intervention';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
}
|
||||
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
|
||||
//We check if Origin document has already an invoice attached to it
|
||||
|
||||
@@ -192,7 +192,7 @@ class HookManager
|
||||
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error)?'':" ".$this->error).(empty($this->errors)?'':" ".join(",",$this->errors)), LOG_ERR);
|
||||
}
|
||||
|
||||
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||
}
|
||||
// Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
||||
|
||||
@@ -3269,7 +3269,7 @@ function get_localtax_by_third($local)
|
||||
/**
|
||||
* Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
|
||||
* TODO
|
||||
* This function is called to retrieve type for building PDF. Such call of function must be removed.
|
||||
* This function is also called to retrieve type for building PDF. Such call of function must be removed.
|
||||
* Instead this function must be called when adding a line to get (array of localtax and type) and
|
||||
* provide it to the function calcul_price_total.
|
||||
*
|
||||
|
||||
@@ -29,13 +29,12 @@
|
||||
/**
|
||||
* 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 (vat is not applied for local tax calculation)
|
||||
* '2' : local tax apply on products and services before vat (vat is calculated on amount + localtax)
|
||||
* '3' : local tax apply on products without vat (vat is not applied for local tax calculation)
|
||||
* '4' : local tax apply on products before vat (vat is calculated on amount + localtax)
|
||||
* '5' : local tax apply on services without vat (vat is not applied for local tax calculation)
|
||||
* '6' : local tax apply on services before vat (vat is calculated on amount + localtax)
|
||||
* '7' : local tax is a fix amount applied on global invoice
|
||||
* '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)
|
||||
*
|
||||
* @param int $qty Quantity
|
||||
* @param float $pu Unit price (HT or TTC selon price_base_type)
|
||||
@@ -44,28 +43,28 @@
|
||||
* @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply, -1=autodetect according to seller
|
||||
* @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply, -1=autodetect according to seller
|
||||
* @param float $remise_percent_global 0
|
||||
* @param string $price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC
|
||||
* @param string $price_base_type HT=Unit price parameter is HT, TTC=Unit price parameter is TTC
|
||||
* @param int $info_bits Miscellaneous informations on line
|
||||
* @param int $type 0/1=Product/service
|
||||
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
|
||||
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function).
|
||||
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
|
||||
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
|
||||
* @return result[ 0=total_ht,
|
||||
* 1=total_vat,
|
||||
* 2=total_ttc,
|
||||
* 1=total_vat, (main vat only)
|
||||
* 2=total_ttc, (total_ht + main vat + local taxes)
|
||||
* 3=pu_ht,
|
||||
* 4=pu_tva,
|
||||
* 4=pu_vat, (main vat only)
|
||||
* 5=pu_ttc,
|
||||
* 6=total_ht_without_discount,
|
||||
* 7=total_vat_without_discount,
|
||||
* 8=total_ttc_without_discount,
|
||||
* 9=amount tax1 for total_ht,
|
||||
* 10=amount tax2 for total_ht,
|
||||
* 11=amount tax1 for pu_ht,
|
||||
* 12=amount tax2 for pu_ht,
|
||||
* 13=not used???,
|
||||
* 14=amount tax1 for total_ht_without_discount,
|
||||
* 15=amount tax2 for 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,
|
||||
* 15=total_tax2 for total_ht_without_discount]
|
||||
*/
|
||||
function 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)
|
||||
{
|
||||
@@ -137,10 +136,27 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100));
|
||||
$tot_avec_remise = $tot_avec_remise_ligne * (1 - ($remise_percent_global / 100));
|
||||
|
||||
// initialize result
|
||||
// initialize result array
|
||||
for ($i=0; $i <= 15; $i++) $result[$i] = 0;
|
||||
|
||||
// if there's some localtax including vat, we calculate localtaxes (we will add later)
|
||||
|
||||
//If input unit price is 'HT', we need to have the totals with main VAT for a correct calculation
|
||||
if ($price_base_type != 'TTC')
|
||||
{
|
||||
$tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)),'MU');
|
||||
$tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)),'MU');
|
||||
$pu_wt = price2num($pu * (1 + ($txtva / 100)),'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tot_sans_remise_wt = $tot_sans_remise;
|
||||
$tot_avec_remise_wt = $tot_avec_remise;
|
||||
$pu_wt = $pu;
|
||||
}
|
||||
|
||||
//print 'rr'.$price_base_type.'-'.$txtva.'-'.$tot_sans_remise_wt."-".$pu_wt."-".$uselocaltax1_rate."-".$localtax1_rate."-".$localtax1_type."\n";
|
||||
|
||||
$localtaxes = array(0,0,0);
|
||||
$apply_tax = false;
|
||||
switch($localtax1_type) {
|
||||
@@ -155,13 +171,13 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax1_rate && $apply_tax) {
|
||||
$result[14] = price2num(($tot_sans_remise * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise, 'MT');
|
||||
$result[14] = price2num(($tot_sans_remise_wt * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise_wt, 'MT');
|
||||
$localtaxes[0] += $result[14];
|
||||
|
||||
$result[9] = price2num(($tot_avec_remise * (1 + ( $localtax1_rate / 100))) - $tot_avec_remise, 'MT');
|
||||
$result[9] = price2num(($tot_avec_remise_wt * (1 + ( $localtax1_rate / 100))) - $tot_avec_remise_wt, 'MT');
|
||||
$localtaxes[1] += $result[9];
|
||||
|
||||
$result[11] = price2num(($pu * (1 + ( $localtax1_rate / 100))) - $pu, 'MU');
|
||||
$result[11] = price2num(($pu_wt * (1 + ( $localtax1_rate / 100))) - $pu_wt, 'MU');
|
||||
$localtaxes[2] += $result[11];
|
||||
}
|
||||
|
||||
@@ -178,13 +194,13 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise, 'MT');
|
||||
$result[15] = price2num(($tot_sans_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise_wt, 'MT');
|
||||
$localtaxes[0] += $result[15];
|
||||
|
||||
$result[10] = price2num(($tot_avec_remise * (1 + ( $localtax2_rate / 100))) - $tot_avec_remise, 'MT');
|
||||
$result[10] = price2num(($tot_avec_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_avec_remise_wt, 'MT');
|
||||
$localtaxes[1] += $result[10];
|
||||
|
||||
$result[12] = price2num(($pu * (1 + ( $localtax2_rate / 100))) - $pu, 'MU');
|
||||
$result[12] = price2num(($pu_wt * (1 + ( $localtax2_rate / 100))) - $pu_wt, 'MU');
|
||||
$localtaxes[2] += $result[12];
|
||||
}
|
||||
|
||||
@@ -193,42 +209,42 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
{
|
||||
// We work to define prices using the price without tax
|
||||
$result[6] = price2num($tot_sans_remise, 'MT');
|
||||
$result[8] = price2num(($tot_sans_remise + $localtaxes[0]) * (1 + ( (($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result8bis= price2num(($tot_sans_remise + $localtaxes[0]) * (1 + ( $txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[8] = price2num($tot_sans_remise * (1 + ( (($info_bits & 1)?0:$txtva) / 100)) + $localtaxes[0], 'MT'); // Selon TVA NPR ou non
|
||||
$result8bis= price2num($tot_sans_remise * (1 + ( $txtva / 100)) + $localtaxes[0], 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[7] = price2num($result8bis - ($result[6] + $localtaxes[0]), 'MT');
|
||||
|
||||
$result[0] = price2num($tot_avec_remise, 'MT');
|
||||
$result[2] = price2num(($tot_avec_remise + $localtaxes[1]) * (1 + ( (($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result2bis= price2num(($tot_avec_remise + $localtaxes[1]) * (1 + ( $txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[2] = price2num($tot_avec_remise * (1 + ( (($info_bits & 1)?0:$txtva) / 100)) + $localtaxes[1], 'MT'); // Selon TVA NPR ou non
|
||||
$result2bis= price2num($tot_avec_remise * (1 + ( $txtva / 100)) + $localtaxes[1], 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[1] = price2num($result2bis - ($result[0] + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax)
|
||||
|
||||
$result[3] = price2num($pu, 'MU');
|
||||
$result[5] = price2num(($pu + $localtaxes[2]) * (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non
|
||||
$result5bis= price2num(($pu + $localtaxes[2]) * (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR)
|
||||
$result[5] = price2num($pu * (1 + ( (($info_bits & 1)?0:$txtva) / 100)) + $localtaxes[2], 'MU'); // Selon TVA NPR ou non
|
||||
$result5bis= price2num($pu * (1 + ($txtva / 100)) + $localtaxes[2], 'MU'); // Si TVA consideree normale (non NPR)
|
||||
$result[4] = price2num($result5bis - ($result[3] + $localtaxes[2]), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
// We work to define prices using the price with tax
|
||||
$result[8] = price2num($tot_sans_remise + $localtaxes[0], 'MT');
|
||||
$result[6] = price2num(($tot_sans_remise + $localtaxes[0]) / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result6bis= price2num(($tot_sans_remise + $localtaxes[0]) / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[6] = price2num($tot_sans_remise / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result6bis= price2num($tot_sans_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[7] = price2num($result[8] - ($result6bis + $localtaxes[0]), 'MT');
|
||||
|
||||
$result[2] = price2num($tot_avec_remise + $localtaxes[1], 'MT');
|
||||
$result[0] = price2num(($tot_avec_remise + $localtaxes[1]) / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result0bis= price2num(($tot_avec_remise + $localtaxes[1]) / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[1] = price2num($result[2] - ($result0bis + $localtaxes[1]), 'MT'); // Total VAT = TTC - HT
|
||||
$result[0] = price2num($tot_avec_remise / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result0bis= price2num($tot_avec_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[1] = price2num($result[2] - ($result0bis + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax)
|
||||
|
||||
$result[5] = price2num(($pu + $localtaxes[2]), 'MU');
|
||||
$result[3] = price2num(($pu + $localtaxes[2]) / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non
|
||||
$result3bis= price2num(($pu + $localtaxes[2]) / (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR)
|
||||
$result[5] = price2num($pu + $localtaxes[2], 'MU');
|
||||
$result[3] = price2num($pu / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non
|
||||
$result3bis= price2num($pu / (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR)
|
||||
$result[4] = price2num($result[5] - ($result3bis + $localtaxes[2]), 'MU');
|
||||
}
|
||||
|
||||
// if there's some localtax without vat, we calculate localtaxes (we will add them at end)
|
||||
|
||||
//If price is 'TTC' we need to have the totals without VAT for a correct calculation
|
||||
//If input unit price is 'TTC', we need to have the totals without main VAT for a correct calculation
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)),'MU');
|
||||
@@ -249,7 +265,6 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax1_rate && $apply_tax) {
|
||||
|
||||
$result[14] = price2num(($tot_sans_remise * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax1 for total_ht_without_discount
|
||||
$result[8] += $result[14]; // total_ttc_without_discount + tax1
|
||||
|
||||
@@ -304,6 +319,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
}
|
||||
|
||||
// initialize result array
|
||||
//for ($i=0; $i <= 15; $i++) $result[$i] = (float) $result[$i];
|
||||
|
||||
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.$conf->global->MAIN_ROUNDING_RULE_TOT.' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -469,7 +469,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<tr class="liste_total nodrag nodrop">';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
if ($showproject) print '<td></td><td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
@@ -99,7 +99,7 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($typ
|
||||
<td>
|
||||
<table class="nobordernopadding">
|
||||
<tr><td>
|
||||
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo $param_chain; ?></textarea>
|
||||
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo dol_htmlcleanlastbr($param_chain); ?></textarea>
|
||||
</td><td><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
@@ -328,7 +328,7 @@ class Export
|
||||
function conditionDate($Field, $Value, $Sens)
|
||||
{
|
||||
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
|
||||
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." ".$Value;
|
||||
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
|
||||
elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
|
||||
else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
|
||||
return $Condition;
|
||||
|
||||
@@ -139,6 +139,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (83
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (84, 8, '9','0','VAT reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (85, 8, '4.8','0','VAT reduced rate',1);
|
||||
|
||||
-- IVORY COST (id country=21)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1);
|
||||
|
||||
-- JAPAN (id country=123)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1231, 123, '0','0','VAT Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1232, 123, '5','0','VAT Rate 5',1);
|
||||
|
||||
@@ -1174,3 +1174,6 @@ ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_commandefourndet INT
|
||||
ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) after fieldrequired;
|
||||
ALTER TABLE llx_extrafields ADD COLUMN list integer DEFAULT 0 after perms;
|
||||
|
||||
-- IVORY COST (id country=21)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1);
|
||||
|
||||
@@ -398,7 +398,7 @@ ExtrafieldParamHelpsellist=Parameters list comes from a table<br>Syntax : table_
|
||||
ExtrafieldParamHelpchkbxlst=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
LibraryToBuildPDF=Library used to build PDF
|
||||
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>
|
||||
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (vat is not applied on local tax)<br>2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)<br>3 : local tax apply on products without vat (vat is not applied on local tax)<br>4 : local tax apply on products before vat (vat is calculated on amount + localtax)<br>5 : local tax apply on services without vat (vat is not applied on local tax)<br>6 : local tax apply on services before vat (vat is calculated on amount + localtax)
|
||||
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (localtax is calculated on amount without tax)<br>2 : local tax apply on products and services including vat (localtax is calculated on amount + main tax)<br>3 : local tax apply on products without vat (localtax is calculated on amount without tax)<br>4 : local tax apply on products including vat (vat is calculated on amount + main vat)<br>5 : local tax apply on services without vat (localtax is calculated on amount without tax)<br>6 : local tax apply on services including vat (localtax is calculated on amount + tax)
|
||||
SMS=SMS
|
||||
LinkToTestClickToDial=Enter a phone number to call to show a link to test the ClickToDial url for user <strong>%s</strong>
|
||||
RefreshPhoneLink=Refresh link
|
||||
@@ -852,12 +852,12 @@ LocalTax2IsUsedDescES= The RE rate by default when creating prospects, invoices,
|
||||
LocalTax2IsNotUsedDescES= By default the proposed IRPF is 0. End of rule.
|
||||
LocalTax2IsUsedExampleES= In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules.
|
||||
LocalTax2IsNotUsedExampleES= In Spain they are bussines not subject to tax system of modules.
|
||||
CalcLocaltax=Reports
|
||||
CalcLocaltax1ES=Sales - Purchases
|
||||
CalcLocaltax=Reports on local taxes
|
||||
CalcLocaltax1=Sales - Purchases
|
||||
CalcLocaltax1Desc=Local Taxes reports are calculated with the difference between localtaxes sales and localtaxes purchases
|
||||
CalcLocaltax2ES=Purchases
|
||||
CalcLocaltax2=Purchases
|
||||
CalcLocaltax2Desc=Local Taxes reports are the total of localtaxes purchases
|
||||
CalcLocaltax3ES=Sales
|
||||
CalcLocaltax3=Sales
|
||||
CalcLocaltax3Desc=Local Taxes reports are the total of localtaxes sales
|
||||
LabelUsedByDefault=Label used by default if no translation can be found for code
|
||||
LabelOnDocuments=Label on documents
|
||||
|
||||
@@ -163,3 +163,5 @@ LabelRIB=BAN Label
|
||||
NoBANRecord=No BAN record
|
||||
DeleteARib=Delete BAN record
|
||||
ConfirmDeleteRib=Are you sure you want to delete this BAN record ?
|
||||
StartDate=Start date
|
||||
EndDate=End date
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -636,19 +637,14 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$element->fetch($elementarray[$i]);
|
||||
if ($tablename != 'expensereport_det') $element->fetch_thirdparty();
|
||||
|
||||
if ($tablename == 'don') $total_ht_by_line=$element->amount;
|
||||
else
|
||||
{
|
||||
$total_ht_by_line=$element->total_ht;
|
||||
}
|
||||
else $total_ht_by_line=$element->total_ht;
|
||||
|
||||
$total_ht = $total_ht + $total_ht_by_line;
|
||||
|
||||
if ($tablename == 'don') $total_ttc_by_line=$element->amount;
|
||||
else
|
||||
{
|
||||
$total_ttc_by_line=$element->total_ttc;
|
||||
}
|
||||
else $total_ttc_by_line=$element->total_ttc;
|
||||
|
||||
$total_ttc = $total_ttc + $total_ttc_by_line;
|
||||
}
|
||||
@@ -672,8 +668,31 @@ foreach ($listofreferent as $key => $value)
|
||||
$total_ttc = -$total_ttc;
|
||||
}
|
||||
|
||||
switch ($classname) {
|
||||
case 'FactureFournisseur':
|
||||
$newclassname = 'SupplierInvoice';
|
||||
break;
|
||||
case 'Facture':
|
||||
$newclassname = 'Bill';
|
||||
break;
|
||||
case 'Propal':
|
||||
$newclassname = 'CommercialProposal';
|
||||
break;
|
||||
case 'Commande':
|
||||
$newclassname = 'Order';
|
||||
break;
|
||||
case 'Expedition':
|
||||
$newclassname = 'Sending';
|
||||
break;
|
||||
case 'Contrat':
|
||||
$newclassname = 'Contract';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
}
|
||||
|
||||
print '<tr >';
|
||||
print '<td align="left" >'.$name.'</td>';
|
||||
print '<td align="left">'.$langs->trans($newclassname).'</td>';
|
||||
print '<td align="right">'.$i.'</td>';
|
||||
print '<td align="right">'.price($total_ht).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 567 B |
@@ -135,7 +135,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
global $mysoc;
|
||||
$mysoc=new Societe($db);
|
||||
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT'
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value)
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
|
||||
@@ -159,7 +159,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
|
||||
print __METHOD__." result2=".join(', ',$result2)."\n";
|
||||
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result2,'Test3');
|
||||
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result2,'Test3 ES');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, nor localtax2 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
@@ -170,7 +170,6 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__." result3=".join(', ',$result3)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0),$result3,'Test4');
|
||||
//$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result3);
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, nor localtax2 (other method autodetect)
|
||||
$mysoc->country_code='ES';
|
||||
@@ -181,7 +180,28 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__." result3=".join(', ',$result3)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0),$result3,'Test5');
|
||||
//$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result3);
|
||||
|
||||
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (method we provide value)
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
//$localtaxes=getLocalTaxesFromRate(18, 0, null, $mysoc);
|
||||
//var_dump($locataxes);
|
||||
$result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
|
||||
print __METHOD__." result3=".join(', ',$result3)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0),$result3,'Test6 CI');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect)
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
|
||||
print __METHOD__." result3=".join(', ',$result3)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0),$result3,'Test7 CI');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user