diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 5c632530a8e..798c6219356 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1481,7 +1481,7 @@ if ($action=='create')
{
// Discounts for third party
print '
| ' . $langs->trans('Discounts') . ' | ';
- if ($fourn->remise_percent)
+ if ($societe->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", 'id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $societe->remise_percent . '');
else
print $langs->trans("CompanyHasNoRelativeDiscount");
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index a5488959016..dcd15b61469 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1048,6 +1048,29 @@ if ($action == 'create')
}
print ' |
' . "\n";
+ if ($soc->id > 0)
+ {
+ // Discounts for third party
+ print '| ' . $langs->trans('Discounts') . ' | ';
+ if ($fourn->remise_percent)
+ print $langs->trans("CompanyHasRelativeDiscount", 'id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $soc->remise_percent . '');
+ else
+ print $langs->trans("CompanyHasNoRelativeDiscount");
+ print ' id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">(' . $langs->trans("EditRelativeDiscount") . ')';
+ print '. ';
+ print ' ';
+
+ $absolute_discount = $soc->getAvailableDiscounts('', '', 0, 1);
+
+ if ($absolute_discount)
+ print $langs->trans("CompanyHasAbsoluteDiscount", 'id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . price($absolute_discount) . '', $langs->trans("Currency" . $conf->currency));
+ else
+ print $langs->trans("CompanyHasNoAbsoluteDiscount");
+ print ' id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">(' . $langs->trans("EditGlobalDiscounts") . ')';
+ print '.';
+ print ' |
';
+ }
+
// Terms of payment
print '| ' . $langs->trans('PaymentConditionsShort') . ' | ';
$form->select_conditions_paiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
@@ -1387,6 +1410,45 @@ if ($action == 'create')
print '';
+ // Relative and absolute discounts
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ } else {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (fk_invoice_supplier_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'";
+ }
+
+ $addrelativediscount = 'id . '">' . $langs->trans("EditRelativeDiscounts") . '';
+ $addabsolutediscount = 'id . '">' . $langs->trans("EditGlobalDiscounts") . '';
+ $addcreditnote = 'id . '">' . $langs->trans("AddCreditNote") . '';
+
+ print '| ' . $langs->trans('Discounts') . ' | ';
+ if ($soc->remise_percent)
+ print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
+ else
+ print $langs->trans("CompanyHasNoRelativeDiscount");
+ print '. ';
+ $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
+ $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote, 0, 1);
+ $absolute_discount = price2num($absolute_discount, 'MT');
+ $absolute_creditnote = price2num($absolute_creditnote, 'MT');
+ if ($absolute_discount) {
+ if ($object->statut > SupplierProposal::STATUS_DRAFT) {
+ print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
+ } else {
+ // Remise dispo de type remise fixe (not credit note)
+ print ' ';
+ $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, 0, '', 1, 1);
+ }
+ }
+ if ($absolute_creditnote) {
+ print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '. ';
+ }
+ if (! $absolute_discount && ! $absolute_creditnote)
+ print $langs->trans("CompanyHasNoAbsoluteDiscount") . '.';
+ print ' | ';
+
// Payment term
print '| ';
print ' | |