diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index c65b7d6cf60..6cd17690c24 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1477,7 +1477,7 @@ if ($action=='create')
}
print '';
- if ($societe->id > 0)
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0 && $societe->id > 0)
{
/* // TODO handle supplier relative discount
// Discounts for third party
@@ -1881,46 +1881,49 @@ elseif (! empty($object->id))
print '
'.$author->getNomUrl(1, '', 0, 0, 0).' | ';
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)%'";
- }
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
- $addrelativediscount = 'id . '">' . $langs->trans("EditRelativeDiscounts") . '';
- $addabsolutediscount = 'id . '">' . $langs->trans("EditGlobalDiscounts") . '';
- $addcreditnote = 'id . '">' . $langs->trans("AddCreditNote") . '';
-
- print '| ' . $langs->trans('Discounts') . ' | ';
-/* // TODO handle supplier relative discount
- if ($societe->remise_percent)
- print $langs->trans("CompanyHasRelativeDiscount", $societe->remise_percent);
- else
- print $langs->trans("CompanyHasNoRelativeDiscount");
- print '. ';
-*/
- $absolute_discount = $societe->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
- $absolute_creditnote = $societe->getAvailableDiscounts('', $filtercreditnote, 0, 1);
- $absolute_discount = price2num($absolute_discount, 'MT');
- $absolute_creditnote = price2num($absolute_creditnote, 'MT');
- if ($absolute_discount) {
- if ($object->statut > CommandeFournisseur::STATUS_DRAFT) {
- print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
+ // 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 {
- // Remise dispo de type remise fixe (not credit note)
-// print ' ';
- $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $societe->id, $absolute_discount, $filterabsolutediscount, 0, '', 1, 1);
+ $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') . ' | ';
+/* // TODO handle supplier relative discount
+ if ($societe->remise_percent)
+ print $langs->trans("CompanyHasRelativeDiscount", $societe->remise_percent);
+ else
+ print $langs->trans("CompanyHasNoRelativeDiscount");
+ print '. ';
+*/
+ $absolute_discount = $societe->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
+ $absolute_creditnote = $societe->getAvailableDiscounts('', $filtercreditnote, 0, 1);
+ $absolute_discount = price2num($absolute_discount, 'MT');
+ $absolute_creditnote = price2num($absolute_creditnote, 'MT');
+ if ($absolute_discount) {
+ if ($object->statut > CommandeFournisseur::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', $societe->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 ' |
';
}
- 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 '';
// Conditions de reglement par defaut
$langs->load('bills');
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index d9fcf57a4a6..0344890458b 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1913,7 +1913,7 @@ if ($action == 'create')
print '';
- if ($societe->id > 0)
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0 && $societe->id > 0)
{
// Discounts for third party
print '| ' . $langs->trans('Discounts') . ' | ';
@@ -2410,90 +2410,93 @@ else
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
print ' |
';
-
- // Relative and absolute discounts
- $addrelativediscount = 'id . '">' . $langs->trans("EditRelativeDiscounts") . '';
- $addabsolutediscount = 'id . '">' . $langs->trans("EditGlobalDiscounts") . '';
- $addcreditnote = 'id . '">' . $langs->trans("AddCreditNote") . '';
- $viewabsolutediscount = 'id . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '';
-
- print '| ' . $langs->trans('Discounts');
- print ' | ';
-/* // TODO handle supplier relative discount
- if ($societe->remise_percent)
- print $langs->trans("CompanyHasRelativeDiscount", $societe->remise_percent);
- else
- print $langs->trans("CompanyHasNoRelativeDiscount");
- // print ' ('.$addrelativediscount.')';
-*/
- // Is there is commercial discount or down payment available ?
- if ($absolute_discount > 0) {
-// print '. ';
- if ($object->statut > 0 || $object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
- if ($object->statut == 0) {
- print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
- print '. ';
- } else {
- if ($object->statut < 1 || $object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
- $text = $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
- print '' . $text . '. ';
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
+
+ // Relative and absolute discounts
+ $addrelativediscount = 'id . '">' . $langs->trans("EditRelativeDiscounts") . '';
+ $addabsolutediscount = 'id . '">' . $langs->trans("EditGlobalDiscounts") . '';
+ $addcreditnote = 'id . '">' . $langs->trans("AddCreditNote") . '';
+ $viewabsolutediscount = 'id . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '';
+
+ print ' |
| ' . $langs->trans('Discounts');
+ print ' | ';
+/* // TODO handle supplier relative discount
+ if ($societe->remise_percent)
+ print $langs->trans("CompanyHasRelativeDiscount", $societe->remise_percent);
+ else
+ print $langs->trans("CompanyHasNoRelativeDiscount");
+ print ' ('.$addrelativediscount.')';
+*/
+
+ // Is there is commercial discount or down payment available ?
+ if ($absolute_discount > 0) {
+// print '. ';
+ if ($object->statut > 0 || $object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
+ if ($object->statut == 0) {
+ print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
+ print '. ';
} else {
- $text = $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
- $text2 = $langs->trans("AbsoluteDiscountUse");
- print $form->textwithpicto($text, $text2);
+ if ($object->statut < 1 || $object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
+ $text = $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
+ print '' . $text . '. ';
+ } else {
+ $text = $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
+ $text2 = $langs->trans("AbsoluteDiscountUse");
+ print $form->textwithpicto($text, $text2);
+ }
}
+ } else {
+ // Discount available of type fixed amount (not credit note)
+// print ' ';
+ $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $societe->id, $absolute_discount, $filterabsolutediscount, $resteapayer, ' (' . $addabsolutediscount . ')', 0, 1);
}
} else {
- // Discount available of type fixed amount (not credit note)
-// print ' ';
- $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $societe->id, $absolute_discount, $filterabsolutediscount, $resteapayer, ' (' . $addabsolutediscount . ')', 0, 1);
+ if ($absolute_creditnote > 0) // If not, link will be added later
+ {
+ if ($object->statut == FactureFournisseur::STATUS_DRAFT && $object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT)
+ print ' (' . $addabsolutediscount . ') ';
+// else
+// print '. ';
+ } else
+ print '. ';
}
- } else {
- if ($absolute_creditnote > 0) // If not, link will be added later
+ // Is there credit notes availables ?
+ if ($absolute_creditnote > 0)
{
+ // If validated, we show link "add credit note to payment"
+ if ($object->statut != FactureFournisseur::STATUS_VALIDATED || $object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
+ if ($object->statut == 0 && $object->type != FactureFournisseur::TYPE_DEPOSIT) {
+ $text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
+ print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
+ } else {
+ print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
+ }
+ } else { // We can add a credit note on a down payment or standard invoice or situation invoice
+ // There is credit notes discounts available
+// if (! $absolute_discount) print ' ';
+ // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $societe->id, $absolute_creditnote, $filtercreditnote, $resteapayer, '', 0, 1);
+ $more=' ('.$addcreditnote. (($addcreditnote && $viewabsolutediscount) ? ' - ' : '') . $viewabsolutediscount . ')';
+ $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $societe->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, 1); // We allow credit note even if amount is higher
+ }
+ }
+ if (! $absolute_discount && ! $absolute_creditnote) {
+ print $langs->trans("CompanyHasNoAbsoluteDiscount");
if ($object->statut == FactureFournisseur::STATUS_DRAFT && $object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT)
print ' (' . $addabsolutediscount . ') ';
-// else
-// print '. ';
- } else
- print '. ';
- }
- // Is there credit notes availables ?
- if ($absolute_creditnote > 0)
- {
- // If validated, we show link "add credit note to payment"
- if ($object->statut != FactureFournisseur::STATUS_VALIDATED || $object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
- if ($object->statut == 0 && $object->type != FactureFournisseur::TYPE_DEPOSIT) {
- $text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
- print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
- } else {
- print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
- }
- } else { // We can add a credit note on a down payment or standard invoice or situation invoice
- // There is credit notes discounts available
-// if (! $absolute_discount) print ' ';
- // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $societe->id, $absolute_creditnote, $filtercreditnote, $resteapayer, '', 0, 1);
- $more=' ('.$addcreditnote. (($addcreditnote && $viewabsolutediscount) ? ' - ' : '') . $viewabsolutediscount . ')';
- $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $societe->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, 1); // We allow credit note even if amount is higher
+ else
+ print '. ';
}
- }
- if (! $absolute_discount && ! $absolute_creditnote) {
- print $langs->trans("CompanyHasNoAbsoluteDiscount");
- if ($object->statut == FactureFournisseur::STATUS_DRAFT && $object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT)
- print ' (' . $addabsolutediscount . ') ';
- else
- print '. ';
- }
- // if ($object->statut == 0 && $object->type != 2 && $object->type != 3)
- // {
- // if (! $absolute_discount && ! $absolute_creditnote) print ' ';
- // print ' - ';
- // print $addabsolutediscount;
- // print ' - '.$addcreditnote; // We disbale link to credit note
- // }
- print ' |
';
-
+ // if ($object->statut == 0 && $object->type != 2 && $object->type != 3)
+ // {
+ // if (! $absolute_discount && ! $absolute_creditnote) print '
';
+ // print ' - ';
+ // print $addabsolutediscount;
+ // print ' - '.$addcreditnote; // We disbale link to credit note
+ // }
+ print '';
+ }
+
// Label
print '';
print '| '.$form->editfieldkey("Label",'label',$object->label,$object,($user->rights->fournisseur->facture->creer)).' | ';
@@ -2852,37 +2855,39 @@ else
$creditnoteamount = 0;
$depositamount = 0;
- $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
- $sql .= " re.description, re.fk_invoice_supplier_source";
- $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
- $sql .= " WHERE fk_invoice_supplier = " . $object->id;
- $resql = $db->query($sql);
- if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- $invoice = new FactureFournisseur($db);
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- $invoice->fetch($obj->fk_invoice_supplier_source);
- print '
| ';
- if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
- print $langs->trans("CreditNote") . ' ';
- if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
- print $langs->trans("Deposit") . ' ';
- print $invoice->getNomUrl(0);
- print ' : | ';
- print '' . price($obj->amount_ttc) . ' | ';
- print '';
- print 'id . '&action=unlinkdiscount&discountid=' . $obj->rowid . '">' . img_delete() . '';
- print ' |
';
- $i ++;
- if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
- $creditnoteamount += $obj->amount_ttc;
- if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
- $depositamount += $obj->amount_ttc;
+ if($conf->global->MAIN_FEATURES_LEVEL > 0) {
+ $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
+ $sql .= " re.description, re.fk_invoice_supplier_source";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
+ $sql .= " WHERE fk_invoice_supplier = " . $object->id;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ $invoice = new FactureFournisseur($db);
+ while ($i < $num) {
+ $obj = $db->fetch_object($resql);
+ $invoice->fetch($obj->fk_invoice_supplier_source);
+ print '| ';
+ if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
+ print $langs->trans("CreditNote") . ' ';
+ if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
+ print $langs->trans("Deposit") . ' ';
+ print $invoice->getNomUrl(0);
+ print ' : | ';
+ print '' . price($obj->amount_ttc) . ' | ';
+ print '';
+ print 'id . '&action=unlinkdiscount&discountid=' . $obj->rowid . '">' . img_delete() . '';
+ print ' |
';
+ $i ++;
+ if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
+ $creditnoteamount += $obj->amount_ttc;
+ if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
+ $depositamount += $obj->amount_ttc;
+ }
+ } else {
+ dol_print_error($db);
}
- } else {
- dol_print_error($db);
}
@@ -3097,7 +3102,7 @@ else
}
// Reverse back money or convert to reduction
- if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD) {
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0 && ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD)) {
// For credit note only
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0)
{
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index ba78c78dade..17e5a2be199 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1048,11 +1048,11 @@ if ($action == 'create')
}
print '' . "\n";
- if ($soc->id > 0)
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0 && $soc->id > 0)
{
-/* // TODO handle supplier relative discount
// Discounts for third party
- print '| ' . $langs->trans('Discounts') . ' | ';
+ print ' |
| ' . $langs->trans('Discounts') . ' | ';
+/* // TODO handle supplier relative discount
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", 'id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $soc->remise_percent . '');
else
@@ -1411,46 +1411,49 @@ 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)%'";
- }
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
- $addrelativediscount = 'id . '">' . $langs->trans("EditRelativeDiscounts") . '';
- $addabsolutediscount = 'id . '">' . $langs->trans("EditGlobalDiscounts") . '';
- $addcreditnote = 'id . '">' . $langs->trans("AddCreditNote") . '';
-
- print '| ' . $langs->trans('Discounts') . ' | ';
-/* // TODO handle supplier relative discount
- 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));
+ // 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 {
- // 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);
+ $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') . ' | ';
+/* // TODO handle supplier relative discount
+ 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 ' | ';
}
- 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 '| ';
| |