28print
'<!-- BEGIN object_discounts.tpl.php -->'.
"\n";
30$objclassname = get_class(
$object);
31$isInvoice = in_array(
$object->element, array(
'facture',
'invoice',
'facture_fourn',
'invoice_supplier'));
35if (empty($absolute_discount)) {
36 $absolute_discount = 0;
38if (empty($absolute_creditnote)) {
39 $absolute_creditnote = 0;
44$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>';
45$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>';
46$viewabsolutediscount =
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.((int) $thirdparty->id).
'&backtopage='.urlencode($backtopage).
'">'.$langs->trans(
"ViewAvailableGlobalDiscounts").
'</a>';
48$fixedDiscount = $thirdparty->remise_percent;
49if (!empty($discount_type)) {
50 $fixedDiscount = $thirdparty->remise_supplier_percent;
53if ($fixedDiscount > 0) {
54 $translationKey = (empty($discount_type)) ?
'CompanyHasRelativeDiscount' :
'HasRelativeDiscountFromSupplier';
55 print $langs->trans($translationKey, $fixedDiscount);
57 if ($conf->dol_optimize_smallscreen) {
58 $translationKey =
'RelativeDiscount';
60 $translationKey = (empty($discount_type)) ?
'CompanyHasNoRelativeDiscount' :
'HasNoRelativeDiscountFromSupplier';
62 print
'<span class="opacitymedium">'.$langs->trans($translationKey).
'</span>';
65print
' '.$addrelativediscount;
69if ($absolute_discount > 0) {
70 print
'<!-- absolute_discount -->';
71 if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject ||
$object->statut > $objclassname::STATUS_DRAFT ||
$object->type == $objclassname::TYPE_CREDIT_NOTE ||
$object->type == $objclassname::TYPE_DEPOSIT) {
72 $translationKey = empty($discount_type) ?
'CompanyHasDownPaymentOrCommercialDiscount' :
'HasDownPaymentOrCommercialDiscountFromSupplier';
73 $text = $langs->trans($translationKey,
price($absolute_discount, 0, $langs, 1, -1, -1, $conf->currency)).
'.';
75 if ($isInvoice && !$isNewObject &&
$object->statut > $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_CREDIT_NOTE &&
$object->type != $objclassname::TYPE_DEPOSIT) {
76 $text = $form->textwithpicto($text, $langs->trans(
'AbsoluteDiscountUse'));
80 $text .=
' '.$addabsolutediscount;
86 print
'<div class="inline-block clearboth">'.$text.
'</div>';
90 $more = $addabsolutediscount;
91 $form->form_remise_dispo($_SERVER[
"PHP_SELF"].
'?facid='.
$object->id,
GETPOST(
'discountid'),
'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
97if ($absolute_creditnote > 0) {
98 print
'<!-- absolute_creditnote -->';
100 if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject ||
$object->statut != $objclassname::STATUS_VALIDATED ||
$object->type == $objclassname::TYPE_CREDIT_NOTE) {
101 $translationKey = empty($discount_type) ?
'CompanyHasCreditNote' :
'HasCreditNoteFromSupplier';
102 $text = $langs->trans($translationKey,
price($absolute_creditnote, 0, $langs, 1, -1, -1, $conf->currency));
104 if ($isInvoice && !$isNewObject &&
$object->statut == $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_DEPOSIT) {
105 $text = $form->textwithpicto($text, $langs->trans(
'CreditNoteDepositUse'));
108 if ($absolute_discount <= 0 || $isNewObject) {
109 $text .=
' '.$addabsolutediscount;
115 print
'<div class="inline-block clearboth">'.$text.
'</div>';
119 $more = $isInvoice && !$isNewObject ?
' ('.$viewabsolutediscount.
')' :
'';
120 $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);
124if ($absolute_discount <= 0 && $absolute_creditnote <= 0) {
125 if ($conf->dol_optimize_smallscreen) {
126 $translationKey =
'AbsoluteDiscount';
128 $translationKey = !empty($discount_type) ?
'HasNoAbsoluteDiscountFromSupplier' :
'CompanyHasNoAbsoluteDiscount';
130 print
'<br><span class="opacitymedium">'.$langs->trans($translationKey).
'</span>';
132 if ($isInvoice &&
$object->statut == $objclassname::STATUS_DRAFT &&
$object->type != $objclassname::TYPE_CREDIT_NOTE &&
$object->type != $objclassname::TYPE_DEPOSIT) {
133 print
' '.$addabsolutediscount;
137print
'<!-- 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.