dolibarr 23.0.3
subtotal_view.tpl.php
1<?php
2/* Copyright (C) 2014-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * or see https://www.gnu.org/
20 */
21
37'
38@phan-var-force CommonObjectLine|CommonInvoiceLine|CommonOrderLine|ExpeditionLigne|PropaleLigne $line
39@phan-var-force Propal|Contrat|Commande|Facture|Expedition|Delivery|CommandeFournisseur|FactureFournisseur|SupplierProposal $this
40@phan-var-force Propal|Contrat|Commande|Facture|Expedition|Delivery|CommandeFournisseur|FactureFournisseur|SupplierProposal $object
41@phan-var-force int $num
42';
43
44global $inputalsopricewithtax;
45
46if (empty($inputalsopricewithtax)) {
47 $inputalsopricewithtax = 0;
48}
49
50echo "<!-- BEGIN PHP TEMPLATE subtotal_view.tpl.php -->\n";
51
52$langs->load('subtotals');
53
54$line_options = $line->extraparams["subtotal"] ?? array();
55
56$line_color = $this->getSubtotalColors($line->qty);
57
58echo '<tr data-level="' . $line->qty . '" data-desc="' . $line->desc . '" data-rang="' . $line->rang . '" id="row-' . $line->id . '" class="drag drop" style="background:#' . $line_color . '">';
59
60// Showing line number if conf is enabled
61if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
62 echo '<td class="linecolnum center"><span class="opacitymedium">' . ($i + 1) . '</span></td>';
63}
64
65if ($line->qty > 0) { ?>
66 <td class="linecollabel" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?>><?php echo str_repeat('&nbsp;', (int) ($line->qty - 1) * 8); ?>
67 <?php
68 echo $line->desc;
69 if (array_key_exists('titleshowuponpdf', $line_options)) {
70 echo '&nbsp;' . img_picto($langs->trans("ShowUPOnPDF"), 'invoicing');
71 }
72 if (array_key_exists('titleshowtotalexludingvatonpdf', $line_options)) {
73 echo '&nbsp; <span title="' . $langs->trans("ShowTotalExludingVATOnPDF") . '">%</span>';
74 }
75 if (array_key_exists('titleforcepagebreak', $line_options)) {
76 echo '&nbsp;' . img_picto($langs->trans("ForcePageBreak"), 'file');
77 }
78 ?>
79 </td>
80 <td class="linecolvat nowrap right">
81 <?php
82 if ($this->status == 0 && $object->element != 'facturerec') {
83 if (GETPOST('mode', 'aZ09') == 'vatforblocklines' && GETPOSTINT('lineid') == $line->id) {
84 $type_tva = $type_tva ?? 0;
85 print '<div class="inline-block nowraponall">';
86 print $form->load_tva('vatforblocklines', '', $mysoc, $object->thirdparty, 0, (int) $line->info_bits, $line->product_type, false, 1, $type_tva);
87 print '<input type="hidden" name="lineid" value="' . $line->id . '">';
88 print '<input class="inline-block button smallpaddingimp" type="submit" name="updateallvatlinesblock" value="' . $langs->trans("Update") . '">';
89 print '</div>';
90 } else {
91 print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&mode=vatforblocklines&lineid=' . $line->id . '">';
92 if (!colorIsLight($line_color)) {
93 echo img_edit($langs->trans("ApplyVATForBlock"), 0, 'style="color: white"');
94 } else {
95 echo img_edit($langs->trans("ApplyVATForBlock"), 0, 'style="color: #666"');
96 }
97 echo '</a>';
98 }
99 }
100 ?>
101 </td>
102 <td class="linecoluht"></td>
103 <?php
104 if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
105 print '<td class="linecoluht_currency"></td>';
106 }
107 // Handling colspan if MAIN_NO_INPUT_PRICE_WITH_TAX conf is enabled
108 if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
109 print '<td class="linecoluttc"></td>';
110 }
111 if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
112 print '<td class="linecoluttc_currency"></td>';
113 }
114
115 print '<td class="linecolqty"></td>';
116
117 // Handling colspan if PRODUCT_USE_UNITS conf is enabled
118 if (getDolGlobalString('PRODUCT_USE_UNITS')) {
119 print '<td class="linecoluseunit"></td>';
120 }
121 ?>
122 <td class="linecoldiscount right">
123 <?php
124 if ($this->status == 0 && $object->element != 'facturerec') {
125 if (GETPOST('mode', 'aZ09') == 'discountforblocklines' && GETPOSTINT('lineid') == $line->id) {
126 print '<div class="inline-block nowraponall">';
127 print '<input type="text" class="flat right width40" name="discountforblocklines" id="discountforblocklines" value="0"><span class="hideonsmartphone"';
128 if (!colorIsLight($line_color)) {
129 print 'style="color: white"';
130 } else {
131 print 'style="color: black"';
132 }
133 print '>%</span>';
134 print '<input type="hidden" name="lineid" value="' . $line->id . '">';
135 print '<input class="inline-block button smallpaddingimp" type="submit" name="updatealldiscountlinesblock" value="' . $langs->trans("Update") . '">';
136 print '</div>';
137 } else {
138 print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&mode=discountforblocklines&lineid=' . $line->id . '">';
139 if (!colorIsLight($line_color)) {
140 echo img_edit($langs->trans("ApplyDiscountForBlock"), 0, 'style="color: white"');
141 } else {
142 echo img_edit($langs->trans("ApplyDiscountForBlock"), 0, 'style="color: #666"');
143 }
144 echo '</a>';
145 }
146 }
147 ?>
148 </td>
149 <?php
150 // Handling if situation invoices conf is enabled
151 if (property_exists($this, 'situation_cycle_ref') && isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
152 print '<td class="linecolcycleref nowrap right"></td>';
153 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
154 print '<td class="nowrap right"></td>';
155 }
156 print '<td class="linecolcycleref2 right nowrap"></td>';
157 }
158
159 // Handling colspan if margin module is enabled
160 if (!empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande')) && isModEnabled('margin') && empty($user->socid)) {
161 if ($user->hasRight('margins', 'creer')) {
162 print '<td class="linecolmargin1 nowrap margininfos right"></td>';
163 }
164 if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) {
165 print '<td class="linecolmargin2 nowrap margininfos right"></td>';
166 }
167 if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) {
168 print '<td class="linecolmark1 nowrap margininfos right"></td>';
169 }
170 }
171 ?>
172 <td class="linecolht"></td>
173 <?php if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) { ?>
174 <td class="linecoltotalht_currency"></td>
175 <?php } ?>
176<?php } elseif ($line->qty < 0) {
177 // Base colspan if there is no module activated to display line correctly
178 $colspan = 3; // linecoldescription, linecolvat, linecoluht
179
180 if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
181 $colspan++;
182 }
183 // Handling colspan if MAIN_NO_INPUT_PRICE_WITH_TAX conf is enabled
184 if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
185 $colspan++;
186 }
187 if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
188 $colspan++;
189 }
190
191 if (property_exists($this, 'situation_cycle_ref') && isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
192 $colspan += 2;
193 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
194 $colspan += 1;
195 }
196 }
197
198 // Handling colspan if margin module is enabled
199 if (!empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande')) && isModEnabled('margin') && empty($user->socid)) {
200 if ($user->hasRight('margins', 'creer')) {
201 $colspan += 1;
202 }
203 if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) {
204 $colspan += 1;
205 }
206 if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) {
207 $colspan += 1;
208 }
209 }
210
211 // Handling colspan if PRODUCT_USE_UNITS conf is enabled
212 if (getDolGlobalString('PRODUCT_USE_UNITS')) {
213 $colspan += 1;
214 }
215 ?>
216 <td class="linecollabel nowrap right" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?> colspan="<?php echo $colspan + 2 ?>">
217 <?php
218 echo $line->desc;
219 if (array_key_exists('subtotalshowtotalexludingvatonpdf', $line_options)) {
220 echo '&nbsp; <span title="' . $langs->trans("ShowTotalExludingVATOnPDF") . '">%</span>';
221 }
222 echo ' :';
223 ?>
224 </td>
225 <td class="linecolamount nowrap right" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?>>
226 <?php
227 echo $this->getSubtotalLineAmount($line);
228 ?>
229 </td>
230 <?php
231 if (isModEnabled('multicurrency') && $object->multicurrency_code != $conf->currency) {
232 echo '<td class="linecolamount nowrap right"';
233 echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"';
234 echo '>';
235 echo $this->getSubtotalLineMulticurrencyAmount($line);
236 echo '</td>';
237 }
238 ?>
239<?php }
240
241if ($this->status == 0) {
242 // Edit picto
243 echo '<td class="linecoledit center">';
244 echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=editline&token=' . newToken() . '&lineid=' . $line->id . '">';
245 if (!colorIsLight($line_color)) {
246 echo img_edit('default', 0, 'style="color: white"');
247 } else {
248 echo img_edit('default', 0, 'style="color: #666"');
249 }
250 echo '</a> </td>';
251
252 // Delete picto
253 echo '<td class="linecoldelete center">';
254 echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=ask_subtotal_deleteline&token=' . newToken() . '&lineid=' . $line->id;
255 if ($line->qty > 0) {
256 echo '&type=title';
257 }
258 echo '">';
259 if (!colorIsLight($line_color)) {
260 echo img_delete('default', 'class="pictodelete" style="color: white"');
261 } else {
262 echo img_delete('default', 'class="pictodelete" style="color: #666"');
263 }
264 echo '</a> </td>';
265
266 // Move up-down picto
267 if ($num > 1 && $conf->browser->layout != 'phone' && ((property_exists($this, 'situation_counter') && $this->situation_counter == 1) || (property_exists($this, 'situation_cycle_ref') && empty($this->situation_cycle_ref))) && empty($disablemove)) {
268 echo '<td class="linecolmove tdlineupdown center"';
269 if (!colorIsLight($line_color)) {
270 echo 'data-gripimg="grip_title.png"';
271 }
272 echo '>';
273 if ($i > 0) {
274 echo '<a class="lineupdown" href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=up&token=' . newToken() . '&rowid=' . $line->id . '">';
275 echo img_up('default', 0, 'imgupforline');
276 echo '</a>';
277 }
278 if ($i < $num - 1) {
279 echo '<a class="lineupdown" href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=down&token=' . newToken() . '&rowid=' . $line->id . '">';
280 echo img_down('default', 0, 'imgdownforline');
281 echo '</a>';
282 }
283 echo '</td>';
284 } else {
285 echo '<td ' . (($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"') . '></td>';
286 }
287} else {
288 $colspan = 3;
289 if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
290 $colspan++;
291 }
292 print '<td colspan="' . $colspan . '"></td>';
293}
294
295if ($action == 'selectlines') { ?>
296 <td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php print $i + 1; ?>]" value="<?php print $line->id; ?>" ></td>
297<?php }
298
299echo '</tr>';
300echo '<!-- END PHP TEMPLATE subtotal_view.tpl.php -->';
301?>
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition index.php:171
global $mysoc
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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
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.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition repair.php:125
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128