27 $objclassname = get_class($object);
28 $isInvoice = in_array($object->element, array(
'facture',
'invoice',
'facture_fourn',
'invoice_supplier'));
29 $isNewObject = empty($object->id) && empty($object->rowid);
32 $addrelativediscount =
'<a href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.$thirdparty->id.
'&backtopage='.$backtopage.
'">'.$langs->trans(
"EditRelativeDiscount").
'</a>';
33 $addabsolutediscount =
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$thirdparty->id.
'&backtopage='.$backtopage.
'">'.$langs->trans(
"EditGlobalDiscounts").
'</a>';
34 $viewabsolutediscount =
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$thirdparty->id.
'&backtopage='.$backtopage.
'">'.$langs->trans(
"ViewAvailableGlobalDiscounts").
'</a>';
36 $fixedDiscount = $thirdparty->remise_percent;
37 if (!empty($discount_type)) {
38 $fixedDiscount = $thirdparty->remise_supplier_percent;
41 if ($fixedDiscount > 0)
43 $translationKey = (!empty($discount_type)) ?
'HasRelativeDiscountFromSupplier' :
'CompanyHasRelativeDiscount';
44 print $langs->trans($translationKey, $fixedDiscount).
'.';
46 $translationKey = (!empty($discount_type)) ?
'HasNoRelativeDiscountFromSupplier' :
'CompanyHasNoRelativeDiscount';
47 print '<span class="opacitymedium">'.$langs->trans($translationKey).
'.</span>';
49 if ($isNewObject)
print ' ('.$addrelativediscount.
')';
52 if ($absolute_discount > 0) {
53 if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
54 $translationKey = !empty($discount_type) ?
'HasAbsoluteDiscountFromSupplier' :
'CompanyHasAbsoluteDiscount';
55 $text = $langs->trans($translationKey,
price($absolute_discount), $langs->transnoentities(
"Currency".$conf->currency)).
'.';
57 if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
58 $text = $form->textwithpicto($text, $langs->trans(
'AbsoluteDiscountUse'));
62 $text .=
' ('.$addabsolutediscount.
')';
68 print '<div class="inline-block clearboth">'.$text.
'</div>';
72 $more =
'('.$addabsolutediscount.
')';
73 $form->form_remise_dispo(
$_SERVER[
"PHP_SELF"].
'?facid='.$object->id,
GETPOST(
'discountid'),
'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
78 if ($absolute_creditnote > 0) {
80 if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
81 $translationKey = !empty($discount_type) ?
'HasCreditNoteFromSupplier' :
'CompanyHasCreditNote';
82 $text = $langs->trans($translationKey,
price($absolute_creditnote), $langs->transnoentities(
"Currency".$conf->currency)).
'.';
84 if ($isInvoice && !$isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) {
85 $text = $form->textwithpicto($text, $langs->trans(
'CreditNoteDepositUse'));
88 if ($absolute_discount <= 0 || $isNewObject) {
89 $text .=
'('.$addabsolutediscount.
')';
95 print '<div class="inline-block clearboth">'.$text.
'</div>';
99 $more = $isInvoice && !$isNewObject ?
' ('.$viewabsolutediscount.
')' :
'';
100 $form->form_remise_dispo(
$_SERVER[
"PHP_SELF"].
'?facid='.$object->id, 0,
'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type);
104 if ($absolute_discount <= 0 && $absolute_creditnote <= 0) {
105 $translationKey = !empty($discount_type) ?
'HasNoAbsoluteDiscountFromSupplier' :
'CompanyHasNoAbsoluteDiscount';
106 print '<br><span class="opacitymedium">'.$langs->trans($translationKey).
'.</span>';
108 if ($isInvoice && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
109 print ' ('.$addabsolutediscount.
')';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.