43 if (empty($object) || !is_object($object)) {
44 print
"Error, template page can't be called as URL";
49 global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
52 if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array(
'facture',
'facturerec',
'propal',
'commande'))) {
56 if (empty($dateSelector)) {
59 if (empty($forceall)) {
62 if (empty($senderissupplier)) {
63 $senderissupplier = 0;
65 if (empty($inputalsopricewithtax)) {
66 $inputalsopricewithtax = 0;
68 if (empty($outputalsopricetotalwithtax)) {
69 $outputalsopricetotalwithtax = 0;
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.
'"';
79 if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && in_array($object->element, array(
'facture',
'invoice_supplier')) && $object->type == $object::TYPE_CREDIT_NOTE) {
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 (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
89 <td
class=
"linecolnum center"><span
class=
"opacitymedium"><?php $coldisplay++; ?><?php print ($i + 1); ?></span></td>
91 <td
class=
"linecoldescription minwidth300imp"><?php $coldisplay++; ?><div
id=
"line_<?php print $line->id; ?>"></div>
93 if (($line->info_bits & 2) == 2) {
94 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$this->socid.
'">';
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");
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';
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';
116 $discount->fetch($line->fk_remise_except);
117 print ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
119 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
120 print
' ('.dol_print_date($discount->datec).
')';
122 } elseif ($line->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
123 include_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
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';
130 $discount->fetch($line->fk_remise_except);
131 print ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
133 print ($txt ?
' - ' :
'').dol_htmlentitiesbr($line->description);
137 $format = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ?
'dayhour' :
'day');
139 if ($line->fk_product > 0) {
140 print
$form->textwithtooltip($text, $description, 3, 0,
'', $i, 0, (!empty($line->fk_parent_line) ?
img_picto(
'',
'rightarrow') :
''));
142 $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type);
144 $text =
img_object($langs->trans(
'Service'),
'service');
146 $text =
img_object($langs->trans(
'Product'),
'product');
149 if (!empty($line->label)) {
150 $text .=
' <strong>'.$line->label.
'</strong>';
151 print
$form->textwithtooltip($text,
dol_htmlentitiesbr($line->description), 3, 0,
'', $i, 0, (!empty($line->fk_parent_line) ?
img_picto(
'',
'rightarrow') :
''));
153 if (!empty($line->fk_parent_line)) {
156 if (preg_match(
'/^\(DEPOSIT\)/', $line->description)) {
157 $newdesc = preg_replace(
'/^\(DEPOSIT\)/', $langs->trans(
"Deposit"), $line->description);
166 if ($line->element ==
'facturedetrec' || $line->element ==
'invoice_supplier_det_rec') {
168 $line->date_start_fill = $line->date_start;
169 $line->date_end_fill = $line->date_end;
171 if ($line->date_start_fill || $line->date_end_fill) {
172 print
'<div class="clearboth nowraponall daterangeofline-facturedetrec">';
174 if ($line->date_start_fill) {
175 print
'<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans(
"AutoFillDateFrom")).
'">'.$langs->trans(
'AutoFillDateFromShort').
':</span> '.
yn($line->date_start_fill);
177 if ($line->date_start_fill && $line->date_end_fill) {
180 if ($line->date_end_fill) {
181 print
'<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans(
"AutoFillDateTo")).
'">'.$langs->trans(
'AutoFillDateToShort').
':</span> '.
yn($line->date_end_fill);
183 if ($line->date_start_fill || $line->date_end_fill) {
187 if ($line->date_start || $line->date_end) {
188 print
'<div class="clearboth nowraponall opacitymedium daterangeofline">'.get_date_range($line->date_start, $line->date_end, $format).
'</div>';
191 if (!$line->date_start || !$line->date_end) {
194 if ($object->element ==
'propal' || $object->element ==
'order' || $object->element ==
'facture' || $object->element ==
'propal_supplier' || $object->element ==
'supplier_proposal' || $object->element ==
'commande') {
195 $res = $line->fetch_product();
197 if ($line->product->isService() && $line->product->isMandatoryPeriod()) {
198 print
'<div><span class="clearboth nowraponall warning">'.$langs->trans(
"mandatoryPeriodNeedTobeSet").
'</span></div>';
205 if (basename($_SERVER[
"PHP_SELF"]) ==
'card-rec.php') {
206 $default_start_fill =
getDolGlobalInt(
'INVOICEREC_SET_AUTOFILL_DATE_START');
207 $default_end_fill =
getDolGlobalInt(
'INVOICEREC_SET_AUTOFILL_DATE_END');
208 print
'<div class="clearboth nowraponall daterangeofline-facturedetrec">';
209 print
'<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans(
"AutoFillDateFrom")).
'">'.$langs->trans(
'AutoFillDateFromShort').
':</span> '.
yn($default_start_fill);
211 print
'<span class="opacitymedium" title="'.dol_escape_htmltag($langs->trans(
"AutoFillDateTo")).
'">'.$langs->trans(
'AutoFillDateToShort').
':</span> '.
yn($default_end_fill);
217 if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) {
218 if ($line->element ==
'facturedetrec') {
219 print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ?
'' :
'<br>').
'<br>'.
dol_htmlentitiesbr($line->description) :
'';
220 } elseif ($line->element ==
'invoice_supplier_det_rec') {
221 print (!empty($line->description) && $line->description != $line->label) ? (($line->date_start || $line->date_end) ?
'' :
'<br>').
'<br>'.
dol_htmlentitiesbr($line->description) :
'';
223 print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ?
'' :
'<br>').
'<br>'.
dol_htmlentitiesbr($line->description) :
'';
228 if (!empty($extrafields)) {
229 $temps = $line->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
230 if (!empty($temps)) {
231 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
238 if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0 && empty($conf->global->SUPPLIER_HIDE_SUPPLIER_OBJECTLINES)) {
239 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
241 $productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
242 print
'<div class="clearboth"></div>';
243 print
'<span class="opacitymedium">'.$langs->trans(
'Supplier').
' : </span>'.$productfourn->getSocNomUrl(1,
'supplier').
' - <span class="opacitymedium">'.$langs->trans(
'Ref').
' : </span>';
245 if ($user->rights->produit->creer || $user->rights->service->creer) {
246 print $productfourn->getNomUrl();
248 print $productfourn->ref_supplier;
252 if (!empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) {
254 $accountingaccount->fetch($line->fk_accounting_account);
255 print
'<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans(
'AccountingAffectation').
' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);
260 if ($object->element ==
'supplier_proposal' || $object->element ==
'order_supplier' || $object->element ==
'invoice_supplier' || $object->element ==
'invoice_supplier_rec') {
261 print
'<td class="linecolrefsupplier">';
262 print ($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier);
266 $tooltiponprice =
'';
267 $tooltiponpriceend =
'';
268 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
269 $tooltiponprice = $langs->transcountry(
"TotalHT", $mysoc->country_code).
'='.
price($line->total_ht);
270 $tooltiponprice .=
'<br>'.$langs->transcountry(
"TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).
'='.
price($line->total_tva);
271 $seller = ($senderissupplier ? (is_object($object->thirdparty) ? $object->thirdparty :
null) : $mysoc);
273 if ($seller->useLocalTax(1)) {
274 if (($mysoc->country_code == $object->thirdparty->country_code) || $seller->useLocalTax(1)) {
275 $tooltiponprice .=
'<br>'.$langs->transcountry(
"TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).
'='.
price($line->total_localtax1);
277 $tooltiponprice .=
'<br>'.$langs->transcountry(
"TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).
'=<span class="opacitymedium">'.$langs->trans(
"NotUsedForThis".($senderissupplier ?
"Vendor" :
"Customer")).
'</span>';
280 if ($seller->useLocalTax(2)) {
281 if (($mysoc->country_code == $object->thirdparty->country_code) || $seller->useLocalTax(2)) {
282 $tooltiponprice .=
'<br>'.$langs->transcountry(
"TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).
'='.
price($line->total_localtax2);
284 $tooltiponprice .=
'<br>'.$langs->transcountry(
"TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).
'=<span class="opacitymedium">'.$langs->trans(
"NotUsedForThis".($senderissupplier ?
"Vendor" :
"Customer")).
'</span>';
288 $tooltiponprice .=
'<br>'.$langs->transcountry(
"TotalTTC", $mysoc->country_code).
'='.
price($line->total_ttc);
289 $tooltiponprice =
'<span class="classfortooltip" title="'.dol_escape_htmltag($tooltiponprice).
'">';
290 $tooltiponpriceend =
'</span>';
294 print
'<td class="linecolvat nowrap right">';
298 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->tva_tx);
301 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->localtax1_tx);
304 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->localtax2_tx);
306 if (empty($positiverates)) {
307 $positiverates =
'0';
309 print $tooltiponprice;
310 print
vatrate($positiverates.($line->vat_src_code ?
' ('.$line->vat_src_code.
')' :
''),
'%', $line->info_bits);
311 print $tooltiponpriceend;
314 <td
class=
"linecoluht nowrap right"><?php $coldisplay++; ?><?php print
price($sign * $line->subprice); ?></td>
316 <?php
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
317 <td
class=
"linecoluht_currency nowrap right"><?php $coldisplay++; ?><?php print
price($sign * $line->multicurrency_subprice); ?></td>
320 if ($inputalsopricewithtax) { ?>
321 <td
class=
"linecoluttc nowrap right"><?php $coldisplay++; ?><?php print (isset($line->pu_ttc) ?
price($sign * $line->pu_ttc) :
price($sign * $line->subprice)); ?></td>
324 <td
class=
"linecolqty nowrap right"><?php $coldisplay++; ?>
326 if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
331 print
price($line->qty, 0,
'', 0, 0);
337 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
338 print
'<td class="linecoluseunit nowrap left">';
339 $label = $line->getLabelOfUnit(
'short');
341 print $langs->trans($label);
345 if (!empty($line->remise_percent) && $line->special_code != 3) {
346 print
'<td class="linecoldiscount right">';
348 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
352 print
'<td class="linecoldiscount"> </td>';
357 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
358 include_once DOL_DOCUMENT_ROOT.
'/core/lib/price.lib.php';
360 print
'<td class="linecolcycleref nowrap right">'.$line->situation_percent.
'%</td>';
362 $locataxes_array =
getLocalTaxesFromRate($line->tva.($line->vat_src_code ?
' ('.$line->vat_src_code.
')' :
''), 0, ($senderissupplier ? $mysoc : $object->thirdparty), ($senderissupplier ? $object->thirdparty : $mysoc));
363 $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);
364 print
'<td align="right" class="linecolcycleref2 nowrap">'.price($sign * $tmp[0]).
'</td>';
367 if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) {
368 if (!empty($user->rights->margins->creer)) { ?>
369 <td
class=
"linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php print
price($line->pa_ht); ?></td>
371 if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
372 <td
class=
"linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print (($line->pa_ht == 0) ?
'n/a' :
price(
price2num($line->marge_tx,
'MT')).
'%'); ?></td>
374 if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
375 <td
class=
"linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print
price(
price2num($line->marque_tx,
'MT')).
'%'; ?></td>
380 if ($line->special_code == 3) { ?>
381 <td
class=
"linecoloption nowrap right"><?php $coldisplay++; ?><?php print $langs->trans(
'Option'); ?></td>
383 print
'<td class="linecolht nowrap right">';
385 print $tooltiponprice;
386 print
price($sign * $line->total_ht);
387 print $tooltiponpriceend;
389 if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
390 print
'<td class="linecolutotalht_currency nowrap right">'.price($sign * $line->multicurrency_total_ht).
'</td>';
396 if ($outputalsopricetotalwithtax) {
397 print
'<td class="linecolht nowrap right">'.price($sign * $line->total_ttc).
'</td>';
401 if ($this->statut == 0 && !empty($object_rights->creer) && $action !=
'selectlines') {
402 $situationinvoicelinewithparent = 0;
403 if ($line->fk_prev_id !=
null && in_array($object->element, array(
'facture',
'facturedet'))) {
404 if ($object->type == $object::TYPE_SITUATION) {
406 $situationinvoicelinewithparent = 1;
411 if (!empty($conf->asset->enabled) && $object->element ==
'invoice_supplier') {
412 print
'<td class="linecolasset center">';
414 if (!empty($product_static->accountancy_code_buy) ||
415 !empty($product_static->accountancy_code_buy_intra) ||
416 !empty($product_static->accountancy_code_buy_export)
418 $accountancy_category_asset = $conf->global->ASSET_ACCOUNTANCY_CATEGORY;
420 if (!empty($product_static->accountancy_code_buy)) $filters[] =
"account_number = '" . $this->
db->escape($product_static->accountancy_code_buy) .
"'";
421 if (!empty($product_static->accountancy_code_buy_intra)) $filters[] =
"account_number = '" . $this->
db->escape($product_static->accountancy_code_buy_intra) .
"'";
422 if (!empty($product_static->accountancy_code_buy_export)) $filters[] =
"account_number = '" . $this->
db->escape($product_static->accountancy_code_buy_export) .
"'";
423 $sql =
"SELECT COUNT(*) AS found";
424 $sql .=
" FROM " . MAIN_DB_PREFIX .
"accounting_account";
425 $sql .=
" WHERE pcg_type = '" . $this->
db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) .
"'";
426 $sql .=
" AND (" . implode(
' OR ', $filters).
")";
427 $resql_asset = $this->
db->query($sql);
429 print
'Error SQL: ' . $this->
db->lasterror();
430 } elseif ($obj = $this->
db->fetch_object($resql_asset)) {
431 if (!empty($obj->found)) {
432 print
'<a class="reposition" href="' . DOL_URL_ROOT .
'/asset/card.php?action=create&supplier_invoice_id=' . $object->id .
'&token=' .
newToken() .
'">';
441 print
'<td class="linecoledit center">';
443 if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
445 <a
class=
"editfielda reposition" href=
"<?php print $_SERVER["PHP_SELF
"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id.'#line_'.$line->id; ?>">
451 print
'<td class="linecoldelete center">';
453 if (!$situationinvoicelinewithparent && empty($disableremove)) {
454 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$this->
id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$line->id.
'">';
461 if ($num > 1 && $conf->browser->layout !=
'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) {
462 print
'<td class="linecolmove tdlineupdown center">';
465 <a
class=
"lineupdown" href=
"<?php print $_SERVER["PHP_SELF
"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id; ?>">
466 <?php print
img_up(
'default', 0,
'imgupforline'); ?>
469 if ($i < $num - 1) { ?>
470 <a
class=
"lineupdown" href=
"<?php print $_SERVER["PHP_SELF
"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id; ?>">
471 <?php print
img_down(
'default', 0,
'imgdownforline'); ?>
476 print
'<td '.(($conf->browser->layout !=
'phone' && empty($disablemove)) ?
' class="linecolmove tdlineupdown center"' :
' class="linecolmove center"').
'></td>';
480 print
'<td colspan="3"></td>';
481 $coldisplay = $coldisplay + 3;
484 if ($action ==
'selectlines') { ?>
485 <td
class=
"linecolcheck center"><input
type=
"checkbox" class=
"linecheckbox" name=
"line_checkbox[<?php print $i + 1; ?>]" value=
"<?php print $line->id; ?>" ></td>
490 print
"<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";