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