diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 7315e6de5fa..e4c3df29950 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -650,9 +650,12 @@ if ($_GET['action'] == 'create')
$propal->fetch($_GET['propalid']);
$societe_id = $propal->soc_id;
$projet=$propal->projetidp;
+
+ $soc->fetch($societe_id);
$cond_reglement_id = $propal->cond_reglement_id;
$mode_reglement_id = $propal->mode_reglement_id;
- $soc->fetch($societe_id);
+ $remise_percent = $propal->remise_percent;
+ $remise_absolue = $propal->remise_absolue;
}
elseif ($_GET['commandeid'])
{
@@ -661,9 +664,12 @@ if ($_GET['action'] == 'create')
$societe_id = $commande->soc_id;
$projet=$commande-> projet_id;
$ref_client=$commande->ref_client;
+
+ $soc->fetch($societe_id);
$cond_reglement_id = $commande->cond_reglement_id;
$mode_reglement_id = $commande->mode_reglement_id;
- $soc->fetch($societe_id);
+ $remise_percent = $commande->remise_percent;
+ $remise_absolue = $commande->remise_absolue;
}
elseif ($_GET['contratid'])
{
@@ -671,14 +677,22 @@ if ($_GET['action'] == 'create')
$contrat->fetch($_GET['contratid']);
$societe_id = $contrat->societe->id;
$projet=$contrat->fk_projet;
+
$soc=$contrat->societe;
+ $cond_reglement_id = $soc->cond_reglement;
+ $mode_reglement_id = $soc->mod_reglement;
+ $remise_percent = $soc->remise_client;
+ $remise_absolue = 0;
}
else
{
$societe_id=$socidp;
+
$soc->fetch($societe_id);
$cond_reglement_id = $soc->cond_reglement;
$mode_reglement_id = $soc->mode_reglement;
+ $remise_percent = $soc->remise_client;
+ $remise_absolue = 0;
}
@@ -712,11 +726,14 @@ if ($_GET['action'] == 'create')
print '';
// Remise relative
- $relative_discount=$soc->remise_client;
print '
| '.$langs->trans("CustomerRelativeDiscount").' | ';
print '';
- print ' %';
+ if (! $_GET['propalid'] && ! $_GET['commandeid'] && ! $_GET['contratid']) print '';
+ print ' %';
print ' | '.img_info().' ';
+ $relative_discount=$soc->remise_client;
if ($relative_discount)
{
print $langs->trans("CompanyHasRelativeDiscount",$relative_discount);
@@ -728,11 +745,14 @@ if ($_GET['action'] == 'create')
print ' |
';
// Remise avoirs
- $absolute_discount=$soc->getCurrentDiscount();
print '| '.$langs->trans("CustomerAbsoluteDiscount").' | ';
print '';
- print ' '.$langs->trans("Currency".$conf->monnaie);
+ if (! $_GET['propalid'] && ! $_GET['commandeid'] && ! $_GET['contratid']) print '';
+ print ' '.$langs->trans("Currency".$conf->monnaie);
print ' | '.img_info().' ';
+ $absolute_discount=$soc->getCurrentDiscount();
if ($absolute_discount)
{
print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
@@ -813,7 +833,6 @@ if ($_GET['action'] == 'create')
print '';
print ' |
| '.$langs->trans('Proposal').' | '.$propal->ref.' |
';
- print '| '.$langs->trans('GlobalDiscount').' | '.$propal->remise_percent.'% |
';
print '| '.$langs->trans('TotalHT').' | '.price($propal->price).' |
';
print '| '.$langs->trans('TotalVAT').' | '.price($propal->tva)." |
";
print '| '.$langs->trans('TotalTTC').' | '.price($propal->total)." |
";
@@ -835,8 +854,8 @@ if ($_GET['action'] == 'create')
elseif ($_GET['contratid'] > 0)
{
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
- $contrat->remise_absolue=0;
- $contrat->remise_percent=$soc->remise_client;
+ $contrat->remise_absolue=$remise_absolue;
+ $contrat->remise_percent=$remise_percent;
$contrat->update_price();
print ''."\n";
diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php
index 92c3a5e6d10..7314a6612fa 100644
--- a/htdocs/compta/propal.php
+++ b/htdocs/compta/propal.php
@@ -229,7 +229,7 @@ if ($_GET["propalid"] > 0)
print '';
if ($_GET['action'] == 'editconditions')
{
- $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$propal->id,$propal->cond_reglement_id,'cond_reglement_id');
+ $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'cond_reglement_id');
}
else
{
@@ -321,20 +321,7 @@ if ($_GET["propalid"] > 0)
print '';
}
- // Remise globale
-/* TODO Remise a mettre sur meme principe que factures
- print ' | | '.$langs->trans('GlobalDiscount').' | ';
- if ($propal->brouillon == 1 && $user->rights->propale->creer)
- {
- print ''.$propal->remise_percent.'%';
- print ' | ';
- }
- else
- {
- print ''.$propal->remise_percent.'% | ';
- }
- print '
';
-*/
+ // Amount
print '| '.$langs->trans('AmountHT').' | ';
print ''.price($propal->price).' | ';
print ''.$langs->trans("Currency".$conf->monnaie).' |
';
@@ -374,7 +361,9 @@ if ($_GET["propalid"] > 0)
print ''.$langs->trans('Qty').' | ';
print ''.$langs->trans('Discount').' | ';
print ''.$langs->trans('AmountHT').' | ';
- print ' | | ';
+ print ' | ';
+ print ' | ';
+ print ' | ';
print "\n";
}
$var=true;
@@ -405,7 +394,7 @@ if ($_GET["propalid"] > 0)
{
print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
}
- print $objp->description?'
'.stripslashes(nl2br($objp->description)):'';
+ print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):'';
print '';
}
else
@@ -438,7 +427,7 @@ if ($_GET["propalid"] > 0)
}
print ''.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)." | \n";
- print ' | | ';
+ print ' | ';
print '';
}
@@ -455,6 +444,117 @@ if ($_GET["propalid"] > 0)
dolibarr_print_error($db);
}
+ /*
+ * Lignes de remise
+ */
+
+ // Remise relative
+ $var=!$var;
+ print '';
+
+ // Remise absolue
+ $var=!$var;
+ print '';
+
print '';
}