dolibarr 20.0.0
objectline_view.tpl.php
1<?php
2/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
5 * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
6 * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
8 * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
10 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
11 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 *
26 * Need to have following variables defined:
27 * $object (invoice, order, ...)
28 * $conf
29 * $langs
30 * $dateSelector
31 * $forceall (0 by default, 1 for supplier invoices/orders)
32 * $element (used to test $user->rights->$element->creer)
33 * $permtoedit (used to replace test $user->rights->$element->creer)
34 * $senderissupplier (0 by default, 1 for supplier invoices/orders)
35 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
36 * $outputalsopricetotalwithtax
37 * $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
38 * $object_rights->creer initialized from = $object->getRights()
39 * $disableedit, $disablemove, $disableremove
40 *
41 * $text, $description, $line
42 */
43// Protection to avoid direct call of template
44if (empty($object) || !is_object($object)) {
45 print "Error, template page can't be called as URL";
46 exit(1);
47}
48
49'@phan-var-force CommonObject $this
50 @phan-var-force CommonObject $object
51 @phan-var-force 0|1 $forceall
52';
53
54global $mysoc;
55global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
56
57$usemargins = 0;
58if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
59 $usemargins = 1;
60}
61
62if (empty($dateSelector)) {
63 $dateSelector = 0;
64}
65if (empty($forceall)) {
66 $forceall = 0;
67}
68if (empty($senderissupplier)) {
69 $senderissupplier = 0;
70}
71if (empty($inputalsopricewithtax)) {
72 $inputalsopricewithtax = 0;
73}
74if (empty($outputalsopricetotalwithtax)) {
75 $outputalsopricetotalwithtax = 0;
76}
77
78// add html5 elements
79$domData = ' data-element="'.$line->element.'"';
80$domData .= ' data-id="'.$line->id.'"';
81$domData .= ' data-qty="'.$line->qty.'"';
82$domData .= ' data-product_type="'.$line->product_type.'"';
83
84$sign = 1;
85// @phan-suppress-next-line PhanUndeclaredConstantOfClass
86if (getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE_SCREEN') && in_array($object->element, array('facture', 'invoice_supplier')) && $object->type == $object::TYPE_CREDIT_NOTE) {
87 $sign = -1;
88}
89
90
91$coldisplay = 0;
92?>
93<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
94<tr id="row-<?php print $line->id?>" class="drag drop oddeven" <?php print $domData; ?> >
95<?php if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { ?>
96 <td class="linecolnum center"><span class="opacitymedium"><?php $coldisplay++; ?><?php print($i + 1); ?></span></td>
97<?php } ?>
98 <td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php print $line->id; ?>"></div>
99<?php
100if (($line->info_bits & 2) == 2) {
101 print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid.'">';
102 $txt = '';
103 print img_object($langs->trans("ShowReduc"), 'reduc').' ';
104 if ($line->description == '(DEPOSIT)') {
105 $txt = $langs->trans("Deposit");
106 } elseif ($line->description == '(EXCESS RECEIVED)') {
107 $txt = $langs->trans("ExcessReceived");
108 } elseif ($line->description == '(EXCESS PAID)') {
109 $txt = $langs->trans("ExcessPaid");
110 }
111 //else $txt=$langs->trans("Discount");
112 print $txt;
113 print '</a>';
114 if ($line->description) {
115 if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) {
116 include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
117 $discount = new DiscountAbsolute($this->db);
118 $discount->fetch($line->fk_remise_except);
119 print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
120 } elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) {
121 include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
122 $discount = new DiscountAbsolute($this->db);
123 $discount->fetch($line->fk_remise_except);
124 print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
125 // Add date of deposit
126 if (getDolGlobalString('INVOICE_ADD_DEPOSIT_DATE')) {
127 print ' ('.dol_print_date($discount->datec).')';
128 }
129 } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
130 include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
131 $discount = new DiscountAbsolute($this->db);
132 $discount->fetch($line->fk_remise_except);
133 print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
134 } elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) {
135 include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
136 $discount = new DiscountAbsolute($this->db);
137 $discount->fetch($line->fk_remise_except);
138 print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));
139 } else {
140 print($txt ? ' - ' : '').dol_htmlentitiesbr($line->description);
141 }
142 }
143} else {
144 $format = (getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 'dayhour' : 'day');
145
146 if ($line->fk_product > 0) {
147 if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
148 print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '') . $text;
149 if (!getDolGlobalInt('PRODUIT_DESC_IN_FORM')) {
150 print $form->textwithpicto('', $description);
151 }
152 } else {
153 print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
154 }
155 } else {
156 $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type);
157 if ($type == 1) {
158 $text = img_object($langs->trans('Service'), 'service');
159 } else {
160 $text = img_object($langs->trans('Product'), 'product');
161 }
162
163 if (!empty($line->label)) {
164 $text .= ' <strong>'.$line->label.'</strong>';
165 print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
166 } else {
167 if (!empty($line->fk_parent_line)) {
168 print img_picto('', 'rightarrow');
169 }
170 if (preg_match('/^\‍(DEPOSIT\‍)/', $line->description)) {
171 $newdesc = preg_replace('/^\‍(DEPOSIT\‍)/', $langs->trans("Deposit"), $line->description);
172 print $text.' '.dol_htmlentitiesbr($newdesc);
173 } else {
174 print $text.' '.dol_htmlentitiesbr($line->description);
175 }
176 }
177 }
178
179 // Show date range
180 if ($line->element == 'facturedetrec' || $line->element == 'invoice_supplier_det_rec') {
181 if ($line->element == 'invoice_supplier_det_rec' && $line->product_type != Product::TYPE_PRODUCT) {
182 $line->date_start_fill = $line->date_start;
183 $line->date_end_fill = $line->date_end;
184 }
185 if ($line->date_start_fill || $line->date_end_fill) {
186 print '<div class="clearboth nowraponall daterangeofline-facturedetrec">';
187 }
188 if ($line->date_start_fill) {
189 print '<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans("AutoFillDateFrom")).'">'.$langs->trans('AutoFillDateFromShort').':</span> '.yn($line->date_start_fill);
190 }
191 if ($line->date_start_fill && $line->date_end_fill) {
192 print ' - ';
193 }
194 if ($line->date_end_fill) {
195 print '<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans("AutoFillDateTo")).'">'.$langs->trans('AutoFillDateToShort').':</span> '.yn($line->date_end_fill);
196 }
197 if ($line->date_start_fill || $line->date_end_fill) {
198 print '</div>';
199 }
200 } else {
201 if ($line->date_start || $line->date_end) {
202 print '<div class="clearboth nowraponall opacitymedium daterangeofline">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
203 }
204
205 if (!$line->date_start || !$line->date_end) {
206 // show warning under line
207 // we need to fetch product associated to line for some test
208 if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') {
209 $res = $line->fetch_product();
210 if ($res > 0) {
211 if ($line->product->isService() && $line->product->isMandatoryPeriod()) {
212 print '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSet").'</span></div>';
213 }
214 }
215 }
216 }
217
218 // If we show the lines in a context to create a recurring sale invoice
219 if (basename($_SERVER["PHP_SELF"]) == 'card-rec.php') {
220 $default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START');
221 $default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END');
222 print '<div class="clearboth nowraponall daterangeofline-facturedetrec">';
223 print '<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans("AutoFillDateFrom")).'">'.$langs->trans('AutoFillDateFromShort').':</span> '.yn($default_start_fill);
224 print ' - ';
225 print '<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans("AutoFillDateTo")).'">'.$langs->trans('AutoFillDateToShort').':</span> '.yn($default_end_fill);
226 print '</div>';
227 }
228 }
229
230 // Add description in form
231 if ($line->fk_product > 0 && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
232 if ($line->element == 'facturedetrec') {
233 print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
234 } elseif ($line->element == 'invoice_supplier_det_rec') {
235 print (!empty($line->description) && $line->description != $line->label) ? (($line->date_start || $line->date_end) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
236 } else {
237 print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
238 }
239 }
240
241 // Line extrafield
242 if (!empty($extrafields)) {
243 $temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line');
244 if (!empty($temps)) {
245 print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
246 print $temps;
247 print '</div>';
248 }
249 }
250}
251
252if ($user->hasRight('fournisseur', 'lire') && isset($line->fk_fournprice) && $line->fk_fournprice > 0 && !getDolGlobalString('SUPPLIER_HIDE_SUPPLIER_OBJECTLINES')) {
253 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
254 $productfourn = new ProductFournisseur($this->db);
255 $productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
256 print '<div class="clearboth"></div>';
257 print '<span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
258 // Supplier ref
259 if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { // change required right here
260 print $productfourn->getNomUrl();
261 } else {
262 print $productfourn->ref_supplier;
263 }
264}
265
266if (isModEnabled('accounting') && !empty($line->fk_accounting_account) && $line->fk_accounting_account > 0) {
267 $accountingaccount = new AccountingAccount($this->db);
268 $accountingaccount->fetch($line->fk_accounting_account);
269 print '<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans('AccountingAffectation').' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);
270}
271
272print '</td>';
273
274// Vendor price ref
275if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines
276 print '<td class="linecolrefsupplier">';
277 print($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier);
278 print '</td>';
279}
280
281$tooltiponprice = '';
282$tooltiponpriceend = '';
283if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
284 $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht);
285 $tooltiponprice .= '<br>'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva);
286 if (is_object($object->thirdparty)) {
287 if ($senderissupplier) {
288 $seller = $object->thirdparty;
289 $buyer = $mysoc;
290 } else {
291 $seller = $mysoc;
292 $buyer = $object->thirdparty;
293 }
294
295 if ($mysoc->useLocalTax(1)) {
296 if (($seller->country_code == $buyer->country_code) || $line->total_localtax1 || $seller->useLocalTax(1)) {
297 $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", $seller->country_code).'='.price($line->total_localtax1);
298 } else {
299 $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", $seller->country_code).'=<span class="opacitymedium">'.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").'</span>';
300 }
301 }
302 if ($mysoc->useLocalTax(2)) {
303 if ((isset($seller->country_code) && isset($buyer->thirdparty->country_code) && $seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) {
304 $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->total_localtax2);
305 } else {
306 $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", $seller->country_code).'=<span class="opacitymedium">'.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").'</span>';
307 }
308 }
309 }
310 $tooltiponprice .= '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc);
311
312 $tooltiponprice = '<span class="classfortooltip" title="'.dol_escape_htmltag($tooltiponprice).'">';
313 $tooltiponpriceend = '</span>';
314}
315
316// VAT Rate
317print '<td class="linecolvat nowrap right">';
318$coldisplay++;
319$positiverates = '';
320if (price2num($line->tva_tx)) {
321 $positiverates .= ($positiverates ? '/' : '').price2num($line->tva_tx);
322}
323if (price2num($line->total_localtax1)) {
324 $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx);
325}
326if (price2num($line->total_localtax2)) {
327 $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx);
328}
329if (empty($positiverates)) {
330 $positiverates = '0';
331}
332print $tooltiponprice;
333print vatrate($positiverates.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), '%', $line->info_bits);
334print $tooltiponpriceend;
335?></td>
336
337 <td class="linecoluht nowraponall right"><?php $coldisplay++; ?><?php print price($sign * $line->subprice); ?></td>
338
339<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
340 <td class="linecoluht_currency nowraponall right"><?php $coldisplay++; ?><?php print price($sign * $line->multicurrency_subprice); ?></td>
341<?php }
342
343if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
344 <td class="linecoluttc nowraponall right"><?php $coldisplay++; ?><?php
345 $upinctax = isset($line->pu_ttc) ? $line->pu_ttc : null;
346 if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) {
347 $upinctax = price2num($line->total_ttc / (float) $line->qty, 'MU');
348 }
349 print(isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice));
350 ?></td>
351<?php } ?>
352
353 <td class="linecolqty nowraponall right"><?php $coldisplay++; ?>
354<?php
355if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
356 // I comment this because it shows info even when not required
357 // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
358 // must also not be output for most entities (proposal, intervention, ...)
359 //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
360 print price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formatting role of function price
361} else {
362 print '&nbsp;';
363}
364print '</td>';
365
366if (getDolGlobalString('PRODUCT_USE_UNITS')) {
367 print '<td class="linecoluseunit nowrap left">';
368 $label = $line->getLabelOfUnit('short');
369 if ($label !== '') {
370 print $langs->trans($label);
371 }
372 print '</td>';
373}
374if (!empty($line->remise_percent) && $line->special_code != 3) {
375 print '<td class="linecoldiscount right">';
376 $coldisplay++;
377 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
378 print dol_print_reduction($line->remise_percent, $langs);
379 print '</td>';
380} else {
381 print '<td class="linecoldiscount">&nbsp;</td>';
382 $coldisplay++;
383}
384
385// Fields for situation invoices
386if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
387 include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
388 $coldisplay++;
389 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
390 $previous_progress = $line->get_allprev_progress($object->id);
391 $current_progress = $previous_progress + floatval($line->situation_percent);
392 print '<td class="linecolcycleref nowrap right">'.$current_progress.'%</td>';
393 $coldisplay++;
394 print '<td class="nowrap right">'.$line->situation_percent.'%</td>';
395 $coldisplay++;
396 $locataxes_array = getLocalTaxesFromRate($line->tva.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), 0, ($senderissupplier ? $mysoc : $object->thirdparty), ($senderissupplier ? $object->thirdparty : $mysoc));
397 $tmp = calcul_price_total($line->qty, $line->pu, $line->remise_percent, $line->txtva, -1, -1, 0, 'HT', $line->info_bits, $line->type, ($senderissupplier ? $object->thirdparty : $mysoc), $locataxes_array, 100, $object->multicurrency_tx, $line->multicurrency_subprice);
398 print '<td class="linecolcycleref2 right nowrap">'.price($sign * $tmp[0]).'</td>';
399 } else {
400 print '<td class="linecolcycleref nowrap right">'.$line->situation_percent.'%</td>';
401 $coldisplay++;
402 $locataxes_array = getLocalTaxesFromRate($line->tva.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), 0, ($senderissupplier ? $mysoc : $object->thirdparty), ($senderissupplier ? $object->thirdparty : $mysoc));
403 $tmp = calcul_price_total($line->qty, $line->pu, $line->remise_percent, $line->txtva, -1, -1, 0, 'HT', $line->info_bits, $line->type, ($senderissupplier ? $object->thirdparty : $mysoc), $locataxes_array, 100, $object->multicurrency_tx, $line->multicurrency_subprice);
404 print '<td class="linecolcycleref2 right nowrap">'.price($sign * $tmp[0]).'</td>';
405 }
406}
407
408if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
409 if ($user->hasRight('margins', 'creer')) { ?>
410 <td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php print price($line->pa_ht); ?></td>
411 <?php }
412 if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) { ?>
413 <td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print(($line->pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
414 <?php }
415 if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) {?>
416 <td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
417 <?php }
418}
419
420// Price total without tax
421if ($line->special_code == 3) {
422 $coldisplay++;
423 $colspanOptions = '';
424 if (!empty($conf->multicurrency->enabled) && $object->multicurrency_code != $conf->currency) {
425 $coldisplay++;
426 $colspanOptions = ' colspan="2"';
427 }
428 print '<td class="linecoloption nowrap right"'.$colspanOptions.'>'.$langs->trans('Option').'</td>';
429} else {
430 print '<td class="linecolht nowrap right">';
431 $coldisplay++;
432 print $tooltiponprice;
433 print price($sign * $line->total_ht);
434 print $tooltiponpriceend;
435 print '</td>';
436 if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
437 print '<td class="linecolutotalht_currency nowrap right">'.price($sign * $line->multicurrency_total_ht).'</td>';
438 $coldisplay++;
439 }
440}
441
442// Price inc tax
443if ($outputalsopricetotalwithtax) {
444 print '<td class="linecolht nowrap right">'.price($sign * $line->total_ttc).'</td>';
445 $coldisplay++;
446}
447
448if ($this->status == 0 && !empty($object_rights->creer) && $action != 'selectlines') {
449 $situationinvoicelinewithparent = 0;
450 if (isset($line->fk_prev_id) && in_array($object->element, array('facture', 'facturedet'))) {
451 // @phan-suppress-next-line PhanUndeclaredConstantOfClass
452 if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
453 // Set constant to disallow editing during a situation cycle
454 $situationinvoicelinewithparent = 1;
455 }
456 }
457
458 // Asset info
459 if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
460 print '<td class="linecolasset center">';
461 $coldisplay++;
462 if (!empty($product_static->accountancy_code_buy) ||
463 !empty($product_static->accountancy_code_buy_intra) ||
464 !empty($product_static->accountancy_code_buy_export)
465 ) {
466 $accountancy_category_asset = getDolGlobalString('ASSET_ACCOUNTANCY_CATEGORY');
467 $filters = array();
468 if (!empty($product_static->accountancy_code_buy)) {
469 $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'";
470 }
471 if (!empty($product_static->accountancy_code_buy_intra)) {
472 $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'";
473 }
474 if (!empty($product_static->accountancy_code_buy_export)) {
475 $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'";
476 }
477 $sql = "SELECT COUNT(*) AS found";
478 $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account";
479 $sql .= " WHERE pcg_type = '" . $this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) . "'";
480 $sql .= " AND (" . implode(' OR ', $filters). ")";
481 $resql_asset = $this->db->query($sql);
482 if (!$resql_asset) {
483 print 'Error SQL: ' . $this->db->lasterror();
484 } elseif ($obj = $this->db->fetch_object($resql_asset)) {
485 if (!empty($obj->found)) {
486 print '<a class="reposition" href="' . DOL_URL_ROOT . '/asset/card.php?action=create&token='.newToken().'&supplier_invoice_id='.$object->id.'">';
487 print img_edit_add() . '</a>';
488 }
489 }
490 }
491 print '</td>';
492 }
493
494 // Edit picto
495 print '<td class="linecoledit center">';
496 $coldisplay++;
497 if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
498 } else { ?>
499 <a class="editfielda reposition" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id; ?>">
500 <?php print img_edit().'</a>';
501 }
502 print '</td>';
503
504 // Delete picto
505 print '<td class="linecoldelete center">';
506 $coldisplay++;
507 if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company.
508 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&token='.newToken().'&lineid='.$line->id.'">';
509 print img_delete();
510 print '</a>';
511 }
512 print '</td>';
513
514 // Move up-down picto
515 if ($num > 1 && $conf->browser->layout != 'phone' && ((property_exists($this, 'situation_counter') && $this->situation_counter == 1) || empty($this->situation_cycle_ref)) && empty($disablemove)) {
516 print '<td class="linecolmove tdlineupdown center">';
517 $coldisplay++;
518 if ($i > 0) { ?>
519 <a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id; ?>">
520 <?php print img_up('default', 0, 'imgupforline'); ?>
521 </a>
522 <?php }
523 if ($i < $num - 1) { ?>
524 <a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id; ?>">
525 <?php print img_down('default', 0, 'imgdownforline'); ?>
526 </a>
527 <?php }
528 print '</td>';
529 } else {
530 print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'></td>';
531 $coldisplay++;
532 }
533} else {
534 $colspan = 3;
535 if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
536 $colspan++;
537 }
538 print '<td colspan="'.$colspan.'"></td>';
539 $coldisplay = $coldisplay + $colspan;
540}
541
542if ($action == 'selectlines') { ?>
543 <td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php print $i + 1; ?>]" value="<?php print $line->id; ?>" ></td>
544<?php }
545
546print "</tr>\n";
547
548print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition security.php:636
Class to manage accounting accounts.
Class to manage absolute discounts.
Class to manage predefined suppliers products.
const TYPE_PRODUCT
Regular product.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_reduction($reduction, $langs)
Returns formatted reduction.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
img_edit_add($titlealt='default', $other='')
Show logo +.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller='', $localtaxes_array=[], $progress=100, $multicurrency_tx=1, $pu_devise=0, $multicurrency_code='')
Calculate totals (net, vat, ...) of a line.
Definition price.lib.php:88
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:139
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142