37print
'<!-- BEGIN object_discounts.tpl.php -->'.
"\n";
40@phan-var-force Propal|Commande|CommandeFournisseur|Facture|FactureFournisseur $object
41@phan-var-force Societe $thirdparty
42@phan-var-force string $backtopage
43@phan-var-force string $filtercreditnote
44@phan-var-force string $filterabsolutediscount
45@phan-var-force int<0,1> $discount_type
46@phan-var-force int $resteapayer
49$objclassname = get_class(
$object);
50$isInvoice = in_array(
$object->element, array(
'facture',
'invoice',
'facture_fourn',
'invoice_supplier'));
54if (empty($absolute_discount)) {
55 $absolute_discount = 0;
57if (empty($absolute_creditnote)) {
58 $absolute_creditnote = 0;
63$addrelativediscount =
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.((int) $thirdparty->id).
'&backtopage='.urlencode($backtopage).
'&action=create&token='.
newToken().(!empty($discount_type) ?
'&discount_type=1' :
'').
'">'.
img_edit($langs->trans(
"EditRelativeDiscount")).
'</a>';
64$addabsolutediscount =
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.((int) $thirdparty->id).
'&backtopage='.urlencode($backtopage).
'&action=create&token='.
newToken().
'">'.
img_edit($langs->trans(
"EditGlobalDiscounts")).
'</a>';
65$viewabsolutediscount =
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.((int) $thirdparty->id).
'&backtopage='.urlencode($backtopage).
'">'.$langs->trans(
"ViewAvailableGlobalDiscounts").
'</a>';
67$fixedDiscount = $thirdparty->remise_percent;
68if (!empty($discount_type)) {
69 $fixedDiscount = $thirdparty->remise_supplier_percent;
72if ($fixedDiscount > 0) {
73 $translationKey = (empty($discount_type)) ?
'CompanyHasRelativeDiscount' :
'HasRelativeDiscountFromSupplier';
74 print $langs->trans($translationKey, $fixedDiscount);
76 if (
$conf->dol_optimize_smallscreen) {
77 $translationKey =
'RelativeDiscount';
79 $translationKey = (empty($discount_type)) ?
'CompanyHasNoRelativeDiscount' :
'HasNoRelativeDiscountFromSupplier';
81 print
'<span class="opacitymedium">'.$langs->trans($translationKey).
'</span>';
84print
' '.$addrelativediscount;
88if ($absolute_discount > 0) {
89 print
'<!-- absolute_discount -->';
90 if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject ||
$object->statut > $objclassname::STATUS_DRAFT ||
$object->type == $objclassname::TYPE_CREDIT_NOTE ||
$object->type == $objclassname::TYPE_DEPOSIT) {
91 $translationKey = empty($discount_type) ?
'CompanyHasDownPaymentOrCommercialDiscount' :
'HasDownPaymentOrCommercialDiscountFromSupplier';
92 $text = $langs->trans($translationKey,
price($absolute_discount, 0, $langs, 1, -1, -1,
$conf->currency));
94 if ($isInvoice && !$isNewObject &&
$object->statut > $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_CREDIT_NOTE &&
$object->type != $objclassname::TYPE_DEPOSIT) {
95 $text = $form->textwithpicto($text, $langs->trans(
'AbsoluteDiscountUse'));
98 $text .=
' '.$addabsolutediscount;
104 print
'<div class="inline-block clearboth">'.$text.
'</div>';
108 $more = $addabsolutediscount;
110 $form->form_remise_dispo($_SERVER[
"PHP_SELF"].
'?facid='.
$object->id,
GETPOSTINT(
'discountid'),
'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
116if ($absolute_creditnote > 0) {
117 print
'<!-- absolute_creditnote -->';
119 if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject ||
$object->statut != $objclassname::STATUS_VALIDATED ||
$object->type == $objclassname::TYPE_CREDIT_NOTE) {
120 $translationKey = empty($discount_type) ?
'CompanyHasCreditNote' :
'HasCreditNoteFromSupplier';
121 $text = $langs->trans($translationKey,
price($absolute_creditnote, 0, $langs, 1, -1, -1,
$conf->currency));
123 if ($isInvoice && !$isNewObject &&
$object->statut == $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_DEPOSIT) {
124 $text = $form->textwithpicto($text, $langs->trans(
'CreditNoteDepositUse'));
127 if ($absolute_discount <= 0 || $isNewObject) {
128 $text .=
' '.$addabsolutediscount;
134 print
'<div class="inline-block clearboth">'.$text.
'</div>';
138 $more = $isInvoice && !$isNewObject ?
' ('.$viewabsolutediscount.
')' :
'';
139 $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);
143if ($absolute_discount <= 0 && $absolute_creditnote <= 0) {
144 if (
$conf->dol_optimize_smallscreen) {
145 $translationKey =
'AbsoluteDiscount';
147 $translationKey = !empty($discount_type) ?
'HasNoAbsoluteDiscountFromSupplier' :
'CompanyHasNoAbsoluteDiscount';
149 print
'<br><span class="opacitymedium">'.$langs->trans($translationKey).
'</span>';
151 if ($isInvoice &&
$object->statut == $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_CREDIT_NOTE &&
$object->type != $objclassname::TYPE_DEPOSIT) {
152 print
' '.$addabsolutediscount;
156print
'<!-- END template -->';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...