diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index f5c3d469dda..5442203a348 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -909,7 +909,8 @@ if ($resql)
print "\n";
$projectstatic=new Project($db);
-
+ $discount = new DiscountAbsolute($db);
+
if ($num > 0)
{
$i=0;
@@ -923,6 +924,9 @@ if ($resql)
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut;
+ $facturestatic->total_ttc=$obj->total_ttc;
+ $facturestatic->paye=$obj->paye;
+ $facturestatic->fk_soc=$obj->fk_soc;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private;
@@ -942,7 +946,12 @@ if ($resql)
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
- $remaintopay = $obj->total_ttc - $totalpay;
+ $remaintopay = $facturestatic->total_ttc - $totalpay;
+ if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) {
+ $remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id);
+ $remaintopay = -$remaincreditnote;
+ $totalpay = $facturestatic->total_ttc - $remaintopay;
+ }
print '
';
if (! empty($arrayfields['f.facnumber']['checked']))
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 23bde56dff9..4a5bca5d547 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5176,6 +5176,12 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
}
}
+ // Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle
+ if (! empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany())
+ {
+ return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice);
+ }
+
// Sinon la TVA proposee par defaut=0. Fin de regle.
// Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe
//print 'VATRULE 5';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index f192f4d967d..aade72a64bb 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1788,6 +1788,7 @@ MAIN_PDF_MARGIN_LEFT=Left margin on PDF
MAIN_PDF_MARGIN_RIGHT=Right margin on PDF
MAIN_PDF_MARGIN_TOP=Top margin on PDF
MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF
+NothingToSetup=There is no specific setup to do for this module.
SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups
EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
SeveralLangugeVariatFound=Several language variants found