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