dolibarr 23.0.3
subtotal_expedition_view.tpl.php
1<?php
2
11'
12@phan-var-force CommonObjectLine|CommonOrderLine|ExpeditionLigne $line
13@phan-var-force Commande|Expedition $object
14';
15
16if (!empty($line->origin_line_id)) {
17 print '<!-- subtotal origin line id = ' . $line->origin_line_id . ' -->'; // id of order line
18 $id = $line->id;
19 $element = $line->element;
20 $desc = $line->desc;
21 $line_options = $line->extraparams["subtotal"] ?? array();
22 $buttons = $object->status == Expedition::STATUS_DRAFT;
23} else {
24 print '<!-- subtotal commande line id = ' . $line->rowid . ' -->'; // id of order line
25 $id = $line->rowid;
26 $element = "commande";
27 $desc = $line->description;
28 $extraparams = (array) json_decode($line->extraparams, true);
29 $line_options = $extraparams["subtotal"] ?? array();
30}
31
32$langs->load('subtotals');
33
34$line_color = $object->getSubtotalColors((int) $line->qty);
35$colspan = 7;
36
37if (isModEnabled('productbatch')) {
38 $colspan++;
39}
40if (isModEnabled('stock')) {
41 $colspan++;
42}
43
44print '<tr id="row-' . $id . '" data-id="' . $id . '" data-element="' . $element . '" style="background:#' . $line_color . '" >';
45
46if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
47 print '<td class="center linecolnum">' . ($i + 1) . '</td>';
48}
49
50if ($line->qty > 0) { ?>
51 <td class="linecollabel" colspan="<?php echo $colspan ?>" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?>><?php echo str_repeat('&nbsp;', (int) ($line->qty - 1) * 8); ?>
52 <?php
53 echo $desc;
54 if (array_key_exists('titleshowuponpdf', $line_options)) {
55 echo '&nbsp;' . img_picto($langs->trans("ShowUPOnPDF"), 'invoicing');
56 }
57 if (array_key_exists('titleshowtotalexludingvatonpdf', $line_options)) {
58 echo '&nbsp; <span title="' . $langs->trans("ShowTotalExludingVATOnPDF") . '">%</span>';
59 }
60 if (array_key_exists('titleforcepagebreak', $line_options)) {
61 echo '&nbsp;' . img_picto($langs->trans("ForcePageBreak"), 'file');
62 }
63 ?>
64 </td>
65<?php } elseif ($line->qty < 0) { ?>
66<td class="linecollabel nowrap right" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?> colspan="<?php echo $colspan ?>">
67 <?php
68 echo $desc;
69 if (array_key_exists('subtotalshowtotalexludingvatonpdf', $line_options)) {
70 echo '&nbsp; <span title="' . $langs->trans("ShowTotalExludingVATOnPDF") . '">%</span>';
71 }
72 ?>
73</td>
74<?php }
75
76if (isset($buttons) && $buttons) {
77 // Delete picto
78 echo '<td class="linecoldelete center">';
79 echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=ask_subtotal_deleteline&token=' . newToken() . '&lineid=' . $id;
80 if ($line->qty > 0) {
81 echo '&type=title';
82 }
83 echo '">';
84 if (!colorIsLight($line_color)) {
85 echo img_delete('default', 'class="pictodelete" style="color: white"');
86 } else {
87 echo img_delete('default', 'class="pictodelete" style="color: #666"');
88 }
89 echo '</a> </td>';
90}
91
92print "</tr>";
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
const STATUS_DRAFT
Draft status.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
colorIsLight($stringcolor)
Return true if the color is light.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.