31print
'<!-- BEGIN object_discounts.tpl.php -->'.
"\n";
33$objclassname = get_class(
$object);
34$isInvoice = in_array(
$object->element, array(
'facture',
'invoice',
'facture_fourn',
'invoice_supplier'));
38if (empty($absolute_discount)) {
39 $absolute_discount = 0;
41if (empty($absolute_creditnote)) {
42 $absolute_creditnote = 0;
47$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>';
48$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>';
49$viewabsolutediscount =
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.((int) $thirdparty->id).
'&backtopage='.urlencode($backtopage).
'">'.$langs->trans(
"ViewAvailableGlobalDiscounts").
'</a>';
51$fixedDiscount = $thirdparty->remise_percent;
52if (!empty($discount_type)) {
53 $fixedDiscount = $thirdparty->remise_supplier_percent;
56if ($fixedDiscount > 0) {
57 $translationKey = (empty($discount_type)) ?
'CompanyHasRelativeDiscount' :
'HasRelativeDiscountFromSupplier';
58 print $langs->trans($translationKey, $fixedDiscount);
60 if (
$conf->dol_optimize_smallscreen) {
61 $translationKey =
'RelativeDiscount';
63 $translationKey = (empty($discount_type)) ?
'CompanyHasNoRelativeDiscount' :
'HasNoRelativeDiscountFromSupplier';
65 print
'<span class="opacitymedium">'.$langs->trans($translationKey).
'</span>';
68print
' '.$addrelativediscount;
72if ($absolute_discount > 0) {
73 print
'<!-- absolute_discount -->';
74 if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject ||
$object->statut > $objclassname::STATUS_DRAFT ||
$object->type == $objclassname::TYPE_CREDIT_NOTE ||
$object->type == $objclassname::TYPE_DEPOSIT) {
75 $translationKey = empty($discount_type) ?
'CompanyHasDownPaymentOrCommercialDiscount' :
'HasDownPaymentOrCommercialDiscountFromSupplier';
76 $text = $langs->trans($translationKey,
price($absolute_discount, 0, $langs, 1, -1, -1,
$conf->currency)).
'.';
78 if ($isInvoice && !$isNewObject &&
$object->statut > $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_CREDIT_NOTE &&
$object->type != $objclassname::TYPE_DEPOSIT) {
79 $text = $form->textwithpicto($text, $langs->trans(
'AbsoluteDiscountUse'));
83 $text .=
' '.$addabsolutediscount;
89 print
'<div class="inline-block clearboth">'.$text.
'</div>';
93 $more = $addabsolutediscount;
94 $form->form_remise_dispo($_SERVER[
"PHP_SELF"].
'?facid='.
$object->id,
GETPOST(
'discountid'),
'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
100if ($absolute_creditnote > 0) {
101 print
'<!-- absolute_creditnote -->';
103 if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject ||
$object->statut != $objclassname::STATUS_VALIDATED ||
$object->type == $objclassname::TYPE_CREDIT_NOTE) {
104 $translationKey = empty($discount_type) ?
'CompanyHasCreditNote' :
'HasCreditNoteFromSupplier';
105 $text = $langs->trans($translationKey,
price($absolute_creditnote, 0, $langs, 1, -1, -1,
$conf->currency));
107 if ($isInvoice && !$isNewObject &&
$object->statut == $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_DEPOSIT) {
108 $text = $form->textwithpicto($text, $langs->trans(
'CreditNoteDepositUse'));
111 if ($absolute_discount <= 0 || $isNewObject) {
112 $text .=
' '.$addabsolutediscount;
118 print
'<div class="inline-block clearboth">'.$text.
'</div>';
122 $more = $isInvoice && !$isNewObject ?
' ('.$viewabsolutediscount.
')' :
'';
123 $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);
127if ($absolute_discount <= 0 && $absolute_creditnote <= 0) {
128 if (
$conf->dol_optimize_smallscreen) {
129 $translationKey =
'AbsoluteDiscount';
131 $translationKey = !empty($discount_type) ?
'HasNoAbsoluteDiscountFromSupplier' :
'CompanyHasNoAbsoluteDiscount';
133 print
'<br><span class="opacitymedium">'.$langs->trans($translationKey).
'</span>';
135 if ($isInvoice &&
$object->statut == $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_CREDIT_NOTE &&
$object->type != $objclassname::TYPE_DEPOSIT) {
136 print
' '.$addabsolutediscount;
140print
'<!-- END template -->';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...