dolibarr 24.0.0-beta
facture.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2026 Jon Bendtsen <jon.bendtsen.github@jonb.dk>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
41require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
44
45// Load translation files required by the page
46$langs->loadLangs(array('companies', 'bills', 'products', 'supplier_proposal'));
47
48$action = GETPOST('action', 'aZ');
49
50$id = GETPOSTINT('id');
51$ref = GETPOST('ref', 'alpha');
52
53// Security check
54$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
55$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
56$socid = '';
57if (!empty($user->socid)) {
58 $socid = $user->socid;
59}
60
61// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
62$hookmanager->initHooks(array('productstatsinvoice'));
63$extrafields = new ExtraFields($db);
64
65// Fetch optionals attributes and labels
66$extrafields->fetch_name_optionals_label('facture');
67
68$search_array_options = $extrafields->getOptionalsFromPost('facture', '', 'search_');
69
70$showmessage = GETPOST('showmessage');
71
72// Load variable for pagination
73$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
74$sortfield = GETPOST('sortfield', 'aZ09comma');
75$sortorder = GETPOST('sortorder', 'aZ09comma');
76$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
77if (empty($page) || $page == -1) {
78 $page = 0;
79} // If $page is not defined, or '' or -1
80$offset = $limit * $page;
81$pageprev = $page - 1;
82$pagenext = $page + 1;
83if (!$sortorder) {
84 $sortorder = "DESC";
85}
86if (!$sortfield) {
87 $sortfield = "f.datef";
88}
89
90$option = '';
91
92$search_date_startday = GETPOSTINT('search_date_startday');
93if (!empty($search_date_startday)) {
94 $option .= '&search_date_startday='.$search_date_startday;
95}
96$search_date_startmonth = GETPOSTINT('search_date_startmonth');
97if (!empty($search_date_startmonth)) {
98 $option .= '&search_date_startmonth='.$search_date_startmonth;
99}
100$search_date_startyear = GETPOSTINT('search_date_startyear');
101if (!empty($search_date_startyear)) {
102 $option .= '&search_date_startyear='.$search_date_startyear;
103}
104$search_date_endday = GETPOSTINT('search_date_endday');
105if (!empty($search_date_endday)) {
106 $option .= '&search_date_endday='.$search_date_endday;
107}
108$search_date_endmonth = GETPOSTINT('search_date_endmonth');
109if (!empty($search_date_endmonth)) {
110 $option .= '&search_date_endmonth='.$search_date_endmonth;
111}
112$search_date_endyear = GETPOSTINT('search_date_endyear');
113if (!empty($search_date_endyear)) {
114 $option .= '&search_date_endyear='.$search_date_endyear;
115}
116$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
117$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
118
119if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
120 $search_date_startday = '';
121 $search_date_startmonth = '';
122 $search_date_startyear = '';
123 $search_date_endday = '';
124 $search_date_endmonth = '';
125 $search_date_endyear = '';
126 $search_date_start = '';
127 $search_date_end = '';
128}
129
130$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
131
132
133/*
134 * Actions
135 */
136
137$toselect = GETPOST('toselect', 'array:int');
138$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicelist';
139$massaction = GETPOST('massaction', 'alpha');
140$diroutputmassaction = $conf->invoice->dir_output.'/temp/massgeneration/'.$user->id;
141
142if (GETPOST('cancel', 'alpha')) {
143 $action = 'list';
144 $massaction = '';
145}
146if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
147 $massaction = '';
148}
149$arrayfields = array(
150 'f.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 5),
151 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 50),
152 's.code_client' => array('label' => "CustomerCodeShort", 'checked' => '-1', 'position' => 52),
153 'f.datef' => array('label' => "DateInvoice", 'checked' => '1', 'position' => 60),
154 'd.qty' => array('label' => "Qty", 'checked' => '1', 'position' => 65),
155 'd.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 70),
156 'f.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000),
157);
158
159$invoicestatic = new Facture($db);
160$societestatic = new Societe($db);
161
162$form = new Form($db);
163$formother = new FormOther($db);
164
165
166
167$arrayofmassactions = array(
168 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
169);
170$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
171$arrayofselected = is_array($toselect) ? $toselect : array();
172$selectedfields = (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
173
174
175$totalarray = array();
176$totalarray['nbfield'] = 0;
177
178$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
179$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
180if ($reshook < 0) {
181 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
182}
183if (empty($reshook)) {
184 $objectclass = 'Facture';
185 $objectlabel = 'Invoices';
186 $permissiontoread = $user->hasRight("facture", "lire");
187 $permissiontoadd = $user->hasRight("facture", "creer");
188 $permissiontodelete = $user->hasRight("facture", "supprimer");
189 $uploaddir = $conf->invoice->dir_output;
190
191 if (isset($_POST['massaction'])) {
192 $massaction = $_POST['massaction'];
193 }
194
195 if (isset($_POST['confirmmassaction']) && isset($_POST['massaction']) && $_POST['massaction'] == 'presend') {
196 global $arrayofselected;
197
198 $toselect = is_array($_POST['toselect']) ? $_POST['toselect'] : array();
199 $arrayofselected = array();
200
201 // Store only VALID IDs (those with emails)
202 foreach ($toselect as $invoice_id) {
203 $objecttmp = new Facture($db);
204 if ($objecttmp->fetch((int) $invoice_id) > 0) {
205 // Force loading the thirdparty object
206 if (empty($objecttmp->thirdparty) || !is_object($objecttmp->thirdparty)) {
207 $objecttmp->fetch_thirdparty();
208 }
209
210 // Only add to array if email exists
211 if (!empty($objecttmp->thirdparty->email)) {
212 // Store just the ID, not the object
213 $arrayofselected[] = $invoice_id;
214 }
215 }
216 }
217
218 if (empty($arrayofselected)) {
219 setEventMessages($langs->trans("DefaultStatusEmptyMandatory").' '.$langs->trans("Select"), null, 'errors');
220 header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
221 exit;
222 }
223 } else {
224 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
225 }
226}
227
228
229/*
230 * View
231 */
232
233if ($id > 0 || !empty($ref)) {
234 $product = new Product($db);
235 $result = $product->fetch($id, $ref);
236
237 $object = $product;
238
239 $parameters = array('id' => $id);
240 $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
241 if ($reshook < 0) {
242 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
243 }
244
245 $title = $langs->trans('ProductServiceCard');
246 $helpurl = '';
247 $shortlabel = dol_trunc($object->label, 16);
248 if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
249 $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers');
250 $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
251 }
252 if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
253 $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers');
254 $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
255 }
256
257 llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'mod-product page-stats_facture');
258
259 if ($result > 0) {
260 $head = product_prepare_head($product);
261 $titre = $langs->trans("CardProduct".$product->type);
262 $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
263 print dol_get_fiche_head($head, 'referers', $titre, -1, $picto);
264
265 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
266 print $hookmanager->resPrint;
267 if ($reshook < 0) {
268 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
269 }
270
271 $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
272 $object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
273
274 $shownav = 1;
275 if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {
276 $shownav = 0;
277 }
278
279 dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
280
281 print '<div class="fichecenter">';
282
283 print '<div class="clearboth"></div>';
284 print '<table class="noborder tableforfield centpercent">';
285
286 $nboflines = show_stats_for_company($product, $socid);
287
288 print "</table>";
289
290 print '</div>';
291 print '<div class="clearboth"></div>';
292
293 print dol_get_fiche_end();
294
295 if ($showmessage && $nboflines > 1) {
296 // Nothing shown
297 } elseif ($user->hasRight('facture', 'lire')) {
298 $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
299 $sql .= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
300 $sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
301 if (!$user->hasRight('societe', 'client', 'voir')) {
302 $sql .= ", sc.fk_soc, sc.fk_user ";
303 }
304 // Add fields from extrafields
305 if (!empty($extrafields->attributes['facture']['label'])) {
306 foreach ($extrafields->attributes['facture']['label'] as $key => $val) {
307 $sql .= ($extrafields->attributes['facture']['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
308 }
309 }
310 // Add fields from hooks
311 $parameters = array();
312 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
313 $sql .= $hookmanager->resPrint;
314 $sql = preg_replace('/,\s*$/', '', $sql);
315
316 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
317 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
318 if (isset($extrafields->attributes['facture']['label']) && is_array($extrafields->attributes['facture']['label']) && count($extrafields->attributes['facture']['label'])) {
319 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.'facture'."_extrafields as ef on (f.rowid = ef.fk_object)";
320 }
321 $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
322 if (!$user->hasRight('societe', 'client', 'voir')) {
323 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
324 }
325 // Add table from hooks
326 $parameters = array();
327 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
328 $sql .= $hookmanager->resPrint;
329
330 $sql .= " WHERE f.fk_soc = s.rowid";
331 $sql .= " AND f.entity IN (".getEntity('invoice').")";
332 $sql .= " AND d.fk_facture = f.rowid";
333 $sql .= " AND d.fk_product = ".((int) $product->id);
334 if ($search_date_start) {
335 $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
336 }
337 if ($search_date_end) {
338 $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
339 }
340 if (!$user->hasRight('societe', 'client', 'voir')) {
341 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
342 }
343 if ($socid) {
344 $sql .= " AND f.fk_soc = ".((int) $socid);
345 }
346 // Add where from extra fields
347 $extrafieldsobjectkey = 'facture';
348 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
349 // Add where from hooks
350 $parameters = array();
351 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
352 $sql .= $hookmanager->resPrint;
353
354 // Add HAVING from hooks
355 $parameters = array();
356 $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
357 if (empty($reshook)) {
358 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
359 } else {
360 $sql = $hookmanager->resPrint;
361 }
362
363 $sql .= $db->order($sortfield, $sortorder);
364
365 // Calcul total qty and amount for global if full scan list
366 $total_ht = 0;
367 $total_qty = 0;
368
369 // Count total nb of records
370 $totalofrecords = '';
371 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
372 $result = $db->query($sql);
373 $totalofrecords = $db->num_rows($result);
374 }
375
376 $sql .= $db->plimit($limit + 1, $offset);
377
378 $result = $db->query($sql);
379 if ($result) {
380 $num = $db->num_rows($result);
381 // I am saving the result here, because some hooks a little later will change $result such that I can not get the contents
382 $all_rows = array();
383 $num = $db->num_rows($result);
384 while ($row = $db->fetch_object($result)) {
385 $all_rows[] = $row;
386 }
387 $db->free($result); // Free immediately
388 $result = null; // Clear the variable
389
390 $option .= '&id='.$product->id;
391
392 if ($limit > 0 && $limit != $conf->liste_limit) {
393 $option .= '&limit='.((int) $limit);
394 }
395
396 // Add $param from extra fields
397 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
398 // Add $param from hooks
399 '@phan-var-force string $param';
401 $parameters = array('param' => &$param);
402 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
403 $option .= $hookmanager->resPrint;
404
405 print '<span id="anchorundermenu" class="anchorundermenu"></span>';
406 print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
407 print '<input type="hidden" name="token" value="'.newToken().'">';
408 print '<input type="hidden" name="page_y" value="">';
409 if (!empty($sortfield)) {
410 print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
411 }
412 if (!empty($sortorder)) {
413 print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
414 }
415
416 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
417 print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, $massactionbutton, $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1);
418
419 if ($massaction == 'presend' && !empty($arrayofselected)) {
420 // Set variables expected by the template
421 $topicmail = "SendBillRef";
422 $modelmail = "facture_send";
423 $objecttmp = new Facture($db);
424 $trackid = 'inv'.$id;
425
426 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
427 }
428
429 if (!empty($page)) {
430 $option .= '&page='.urlencode((string) ($page));
431 }
432
433 print '<div class="liste_titre liste_titre_bydiv centpercent">';
434 print '<div class="divsearchfield">';
435 print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';
436 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
437 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
438 $parameters = array();
439 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
440 print $hookmanager->resPrint;
441
442 print '<div style="vertical-align: middle; display: inline-block">';
443 print '<input type="image" class="liste_titre reposition" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', 0, 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
444 print '<input type="image" class="liste_titre reposition" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', 0, 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
445 print '</div>';
446 print '</div>';
447 print '</div>';
448
449 $i = 0;
450 print '<div class="div-table-responsive">';
451 print '<table class="tagtable liste listwithfilterbefore" width="100%">';
452 print '<tr class="liste_titre">';
453 // Action column
454 if ($conf->main_checkbox_left_column) {
455 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
456 }
457 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder);
458 print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder);
459 print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder);
460 print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder);
461 print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
462 print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
463 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
464 // Hook fields
465 $parameters = array('param' => $option, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
466 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
467 print $hookmanager->resPrint;
468 // Action column
469 if (!$conf->main_checkbox_left_column) {
470 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
471 }
472 print "</tr>\n";
473
474 if ($num > 0) {
475 while ($i < min($num, $limit)) {
476 $objp = $all_rows[$i];
477 if ($objp->type == Facture::TYPE_CREDIT_NOTE) {
478 $objp->qty = -($objp->qty);
479 }
480
481 $total_ht += $objp->total_ht;
482 $total_qty += $objp->qty;
483
484 $invoicestatic->id = $objp->facid;
485 $invoicestatic->ref = $objp->ref;
486 $societestatic->fetch($objp->socid);
487 $paiement = $invoicestatic->getSommePaiement();
488
489 print '<tr data-row-id="'.$invoicestatic->id.'" class="oddeven row-with-select status2">';
490
491 // Action column
492 if ($conf->main_checkbox_left_column) {
493 print '<td class="nowrap center">';
494 if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
495 $selected = 0;
496 if (in_array($invoicestatic->id, $arrayofselected)) {
497 $selected = 1;
498 }
499 print '<input id="cb'.$invoicestatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$invoicestatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
500 }
501 print '</td>';
502 if (!$i) {
503 $totalarray['nbfield']++;
504 }
505 }
506
507 print '<td class="tdoverflowmax150">';
508 print $invoicestatic->getNomUrl(1);
509 print "</td>\n";
510 print '<td class="tdoverflowmax125">'.$societestatic->getNomUrl(1).'</td>';
511 print '<td class="tdoverflowmax125">'.dolPrintHTML($objp->code_client)."</td>\n";
512 print '<td class="center">';
513 print dol_print_date($db->jdate($objp->datef), 'dayhour')."</td>";
514 print '<td class="center">'.dolPrintHTML($objp->qty)."</td>\n";
515 print '<td class="right">'.price($objp->total_ht)."</td>\n";
516 print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5, $paiement, $objp->type).'</td>';
517 // Fields from hook
518 $parameters = array();
519 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
520 print $hookmanager->resPrint;
521
522 // Action column
523 if (!$conf->main_checkbox_left_column) {
524 print '<td class="nowrap center">';
525 if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
526 $selected = 0;
527 if (in_array($invoicestatic->id, $arrayofselected)) {
528 $selected = 1;
529 }
530 print '<input id="cb'.$invoicestatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$invoicestatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
531 }
532 print '</td>';
533 if (!$i) {
534 $totalarray['nbfield']++;
535 }
536 }
537
538 print "</tr>\n";
539 $i++;
540 }
541 }
542
543 // Total line
544 print '<tr class="liste_total">';
545 if ($num < $limit && empty($offset)) {
546 print '<td>'.$langs->trans("Total").'</td>';
547 } else {
548 print '<td>'.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'</td>';
549 }
550 print '<td colspan="3"></td>';
551 print '<td class="center">'.$total_qty.'</td>';
552 print '<td class="right">'.price($total_ht).'</td>';
553 print '<td></td>';
554 print "</table>";
555 print '</div>';
556 print '</form>';
557 } else {
559 }
560 }
561 }
562} else {
564}
565
566// End of page
567llxFooter();
568$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:497
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage standard extra fields.
Class to manage invoices.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage third parties objects (customers, suppliers, prospects...)
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
product_prepare_head($object)
Prepare array with list of tabs.
show_stats_for_company($product, $socid)
Show stats for a product.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.