dolibarr  16.0.5
lines.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
3  * Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
4  * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
5  * Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
6  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
27 require '../../main.inc.php';
28 
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
38 
39 // Load translation files required by the page
40 $langs->loadLangs(array("bills", "compta", "accountancy", "productbatch", "products"));
41 
42 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
43 
44 $account_parent = GETPOST('account_parent');
45 $changeaccount = GETPOST('changeaccount');
46 // Search Getpost
47 $search_societe = GETPOST('search_societe', 'alpha');
48 $search_lineid = GETPOST('search_lineid', 'int');
49 $search_ref = GETPOST('search_ref', 'alpha');
50 $search_invoice = GETPOST('search_invoice', 'alpha');
51 $search_label = GETPOST('search_label', 'alpha');
52 $search_desc = GETPOST('search_desc', 'alpha');
53 $search_amount = GETPOST('search_amount', 'alpha');
54 $search_account = GETPOST('search_account', 'alpha');
55 $search_vat = GETPOST('search_vat', 'alpha');
56 $search_date_startday = GETPOST('search_date_startday', 'int');
57 $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
58 $search_date_startyear = GETPOST('search_date_startyear', 'int');
59 $search_date_endday = GETPOST('search_date_endday', 'int');
60 $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
61 $search_date_endyear = GETPOST('search_date_endyear', 'int');
62 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
63 $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
64 $search_country = GETPOST('search_country', 'alpha');
65 $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
66 
67 // Load variable for pagination
68 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
69 $sortfield = GETPOST('sortfield', 'aZ09comma');
70 $sortorder = GETPOST('sortorder', 'aZ09comma');
71 $page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
72 if (empty($page) || $page < 0) {
73  $page = 0;
74 }
75 $offset = $limit * $page;
76 $pageprev = $page - 1;
77 $pagenext = $page + 1;
78 if (!$sortfield) {
79  $sortfield = "f.datef, f.ref, fd.rowid";
80 }
81 if (!$sortorder) {
82  if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
83  $sortorder = "DESC";
84  }
85 }
86 
87 // Security check
88 if (!isModEnabled('accounting')) {
90 }
91 if ($user->socid > 0) {
93 }
94 if (empty($user->rights->accounting->mouvements->lire)) {
96 }
97 
98 
99 $formaccounting = new FormAccounting($db);
100 
101 
102 /*
103  * Actions
104  */
105 
106 // Purge search criteria
107 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
108  $search_societe = '';
109  $search_lineid = '';
110  $search_ref = '';
111  $search_invoice = '';
112  $search_label = '';
113  $search_desc = '';
114  $search_amount = '';
115  $search_account = '';
116  $search_vat = '';
117  $search_date_startday = '';
118  $search_date_startmonth = '';
119  $search_date_startyear = '';
120  $search_date_endday = '';
121  $search_date_endmonth = '';
122  $search_date_endyear = '';
123  $search_date_start = '';
124  $search_date_end = '';
125  $search_country = '';
126  $search_tvaintra = '';
127 }
128 
129 if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
130  $error = 0;
131 
132  if (!(GETPOST('account_parent', 'int') >= 0)) {
133  $error++;
134  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
135  }
136 
137  if (!$error) {
138  $db->begin();
139 
140  $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
141  $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
142  $sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
143 
144  dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
145  $resql1 = $db->query($sql1);
146  if (!$resql1) {
147  $error++;
148  setEventMessages($db->lasterror(), null, 'errors');
149  }
150  if (!$error) {
151  $db->commit();
152  setEventMessages($langs->trans("Save"), null, 'mesgs');
153  } else {
154  $db->rollback();
155  setEventMessages($db->lasterror(), null, 'errors');
156  }
157 
158  $account_parent = ''; // Protection to avoid to mass apply it a second time
159  }
160 }
161 
162 
163 /*
164  * View
165  */
166 
167 $form = new Form($db);
168 $formother = new FormOther($db);
169 
170 llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"));
171 
172 print '<script type="text/javascript">
173  $(function () {
174  $(\'#select-all\').click(function(event) {
175  // Iterate each checkbox
176  $(\':checkbox\').each(function() {
177  this.checked = true;
178  });
179  });
180  $(\'#unselect-all\').click(function(event) {
181  // Iterate each checkbox
182  $(\':checkbox\').each(function() {
183  this.checked = false;
184  });
185  });
186  });
187  </script>';
188 
189 /*
190  * Customer Invoice lines
191  */
192 $sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
193 $sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
194 $sql .= " s.rowid as socid, s.nom as name, s.code_client,";
195 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
196  $sql .= " spe.accountancy_code_customer as code_compta_client,";
197  $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
198 } else {
199  $sql .= " s.code_compta as code_compta_client,";
200  $sql .= " s.code_compta_fournisseur,";
201 }
202 $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
203 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
204  $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
205 } else {
206  $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
207 }
208 $sql .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,";
209 $sql .= " fd.situation_percent,";
210 $sql .= " co.code as country_code, co.label as country,";
211 $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
212 $parameters = array();
213 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
214 $sql .= $hookmanager->resPrint;
215 $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
216 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
217 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
218  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
219 }
220 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
221 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
222 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
223 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
224  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
225 }
226 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
227 $sql .= " WHERE fd.fk_code_ventilation > 0";
228 $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
229 $sql .= " AND f.fk_statut > 0";
230 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
231  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
232 } else {
233  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
234 }
235 // Add search filter like
236 if ($search_societe) {
237  $sql .= natural_search('s.nom', $search_societe);
238 }
239 if ($search_lineid) {
240  $sql .= natural_search("fd.rowid", $search_lineid, 1);
241 }
242 if (strlen(trim($search_invoice))) {
243  $sql .= natural_search("f.ref", $search_invoice);
244 }
245 if (strlen(trim($search_ref))) {
246  $sql .= natural_search("p.ref", $search_ref);
247 }
248 if (strlen(trim($search_label))) {
249  $sql .= natural_search("p.label", $search_label);
250 }
251 if (strlen(trim($search_desc))) {
252  $sql .= natural_search("fd.description", $search_desc);
253 }
254 if (strlen(trim($search_amount))) {
255  $sql .= natural_search("fd.total_ht", $search_amount, 1);
256 }
257 if (strlen(trim($search_account))) {
258  $sql .= natural_search("aa.account_number", $search_account);
259 }
260 if (strlen(trim($search_vat))) {
261  $sql .= natural_search("fd.tva_tx", price2num($search_vat), 1);
262 }
263 if ($search_date_start) {
264  $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
265 }
266 if ($search_date_end) {
267  $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
268 }
269 if (strlen(trim($search_country))) {
270  $arrayofcode = getCountriesInEEC();
271  $country_code_in_EEC = $country_code_in_EEC_without_me = '';
272  foreach ($arrayofcode as $key => $value) {
273  $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'";
274  if ($value != $mysoc->country_code) {
275  $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
276  }
277  }
278  if ($search_country == 'special_allnotme') {
279  $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
280  } elseif ($search_country == 'special_eec') {
281  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).")";
282  } elseif ($search_country == 'special_eecnotme') {
283  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")";
284  } elseif ($search_country == 'special_noteec') {
285  $sql .= " AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")";
286  } else {
287  $sql .= natural_search("co.code", $search_country);
288  }
289 }
290 if (strlen(trim($search_tvaintra))) {
291  $sql .= natural_search("s.tva_intra", $search_tvaintra);
292 }
293 $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
294 $sql .= $db->order($sortfield, $sortorder);
295 
296 // Count total nb of records
297 $nbtotalofrecords = '';
298 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
299  $result = $db->query($sql);
300  $nbtotalofrecords = $db->num_rows($result);
301  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
302  $page = 0;
303  $offset = 0;
304  }
305 }
306 
307 $sql .= $db->plimit($limit + 1, $offset);
308 
309 dol_syslog("/accountancy/customer/lines.php", LOG_DEBUG);
310 $result = $db->query($sql);
311 if ($result) {
312  $num_lines = $db->num_rows($result);
313  $i = 0;
314 
315  $param = '';
316  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
317  $param .= '&contextpage='.urlencode($contextpage);
318  }
319  if ($limit > 0 && $limit != $conf->liste_limit) {
320  $param .= '&limit='.urlencode($limit);
321  }
322  if ($search_societe) {
323  $param .= "&search_societe=".urlencode($search_societe);
324  }
325  if ($search_invoice) {
326  $param .= "&search_invoice=".urlencode($search_invoice);
327  }
328  if ($search_ref) {
329  $param .= "&search_ref=".urlencode($search_ref);
330  }
331  if ($search_label) {
332  $param .= "&search_label=".urlencode($search_label);
333  }
334  if ($search_desc) {
335  $param .= "&search_desc=".urlencode($search_desc);
336  }
337  if ($search_account) {
338  $param .= "&search_account=".urlencode($search_account);
339  }
340  if ($search_vat) {
341  $param .= "&search_vat=".urlencode($search_vat);
342  }
343  if ($search_date_startday) {
344  $param .= '&search_date_startday='.urlencode($search_date_startday);
345  }
346  if ($search_date_startmonth) {
347  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
348  }
349  if ($search_date_startyear) {
350  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
351  }
352  if ($search_date_endday) {
353  $param .= '&search_date_endday='.urlencode($search_date_endday);
354  }
355  if ($search_date_endmonth) {
356  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
357  }
358  if ($search_date_endyear) {
359  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
360  }
361  if ($search_country) {
362  $param .= "&search_country=".urlencode($search_country);
363  }
364  if ($search_tvaintra) {
365  $param .= "&search_tvaintra=".urlencode($search_tvaintra);
366  }
367 
368  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
369  print '<input type="hidden" name="action" value="ventil">';
370  if ($optioncss != '') {
371  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
372  }
373  print '<input type="hidden" name="token" value="'.newToken().'">';
374  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
375  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
376  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
377  print '<input type="hidden" name="page" value="'.$page.'">';
378 
379  print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
380  print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneCustomer").'</span><br>';
381 
382  print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' ';
383  print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
384  print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
385 
386  $moreforfilter = '';
387 
388  print '<div class="div-table-responsive">';
389  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
390 
391  print '<tr class="liste_titre_filter">';
392  print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
393  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
394  print '<td class="liste_titre center">';
395  print '<div class="nowrap">';
396  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
397  print '</div>';
398  print '<div class="nowrap">';
399  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
400  print '</div>';
401  print '</td>';
402  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
403  //print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
404  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
405  print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
406  print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
407  print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
408  print '<td class="liste_titre">';
409  print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
410  //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
411  print '</td>';
412  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
413  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
414  print '<td class="liste_titre center">';
415  $searchpicto = $form->showFilterButtons();
416  print $searchpicto;
417  print "</td></tr>\n";
418 
419  print '<tr class="liste_titre">';
420  print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
421  print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
422  print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
423  print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
424  //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
425  print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
426  print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
427  print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
428  print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
429  print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
430  print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
431  print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
432  $checkpicto = $form->showCheckAddButtons();
433  print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
434  print "</tr>\n";
435 
436  $thirdpartystatic = new Societe($db);
437  $facturestatic = new Facture($db);
438  $productstatic = new Product($db);
439  $accountingaccountstatic = new AccountingAccount($db);
440 
441  $i = 0;
442  while ($i < min($num_lines, $limit)) {
443  $objp = $db->fetch_object($result);
444 
445  $facturestatic->ref = $objp->ref;
446  $facturestatic->id = $objp->facid;
447  $facturestatic->type = $objp->ftype;
448 
449  $thirdpartystatic->id = $objp->socid;
450  $thirdpartystatic->name = $objp->name;
451  $thirdpartystatic->client = $objp->client;
452  $thirdpartystatic->fournisseur = $objp->fournisseur;
453  $thirdpartystatic->code_client = $objp->code_client;
454  $thirdpartystatic->code_compta_client = $objp->code_compta_client;
455  $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
456  $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
457  $thirdpartystatic->email = $objp->email;
458  $thirdpartystatic->country_code = $objp->country_code;
459 
460  $productstatic->ref = $objp->product_ref;
461  $productstatic->id = $objp->product_id;
462  $productstatic->label = $objp->product_label;
463  $productstatic->type = $objp->line_type;
464  $productstatic->status = $objp->tosell;
465  $productstatic->status_buy = $objp->tobuy;
466  $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
467  $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
468  $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
469 
470  $accountingaccountstatic->rowid = $objp->fk_compte;
471  $accountingaccountstatic->label = $objp->label_account;
472  $accountingaccountstatic->labelshort = $objp->labelshort_account;
473  $accountingaccountstatic->account_number = $objp->account_number;
474 
475  print '<tr class="oddeven">';
476 
477  // Line id
478  print '<td>'.$objp->rowid.'</td>';
479 
480  // Ref Invoice
481  print '<td class="nowraponall">'.$facturestatic->getNomUrl(1).'</td>';
482 
483  // Date invoice
484  print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
485 
486  // Ref Product
487  print '<td class="tdoverflowmax100">';
488  if ($productstatic->id > 0) {
489  print $productstatic->getNomUrl(1);
490  }
491  if ($productstatic->id > 0 && $objp->product_label) {
492  print '<br>';
493  }
494  if ($objp->product_label) {
495  print '<span class="opacitymedium">'.$objp->product_label.'</span>';
496  }
497  print '</td>';
498 
499  print '<td class="tdoverflowonsmartphone small">';
500  $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
501  $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
502  print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
503  print '</td>';
504 
505  print '<td class="right nowraponall amount">'.price($objp->total_ht).'</td>';
506 
507  print '<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
508 
509  // Thirdparty
510  print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'customer').'</td>';
511 
512  // Country
513  print '<td>';
514  if ($objp->country_code) {
515  print $langs->trans("Country".$objp->country_code).' ('.$objp->country_code.')';
516  }
517  print '</td>';
518 
519  print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
520 
521  print '<td>';
522  print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
523  print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
524  print img_edit();
525  print '</a></td>';
526 
527  print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
528 
529  print '</tr>';
530  $i++;
531  }
532  print '</table>';
533  print "</div>";
534 
535  if ($nbtotalofrecords > $limit) {
536  print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
537  }
538 
539  print '</form>';
540 } else {
541  print $db->lasterror();
542 }
543 
544 // End of page
545 llxFooter();
546 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
dol_trunc
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.
Definition: functions.lib.php:3805
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
Facture
Class to manage invoices.
Definition: facture.class.php:60
img_edit
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
Definition: functions.lib.php:4389
FormAccounting
Class to manage generation of HTML components for accounting management.
Definition: html.formaccounting.class.php:33
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
Facture\TYPE_DEPOSIT
const TYPE_DEPOSIT
Deposit invoice.
Definition: facture.class.php:397
getCountriesInEEC
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
Definition: company.lib.php:716
Facture\TYPE_REPLACEMENT
const TYPE_REPLACEMENT
Replacement invoice.
Definition: facture.class.php:387
dol_string_nohtmltag
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
Definition: functions.lib.php:6694
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
print_barre_liste
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
Definition: functions.lib.php:5257
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
Facture\TYPE_CREDIT_NOTE
const TYPE_CREDIT_NOTE
Credit note invoice.
Definition: facture.class.php:392
AccountingAccount
Class to manage accounting accounts.
Definition: accountingaccount.class.php:36
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5026
natural_search
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
Definition: functions.lib.php:9420
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
dolGetFirstLineOfText
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
Definition: functions.lib.php:6907
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2757
Facture\TYPE_SITUATION
const TYPE_SITUATION
Situation invoice.
Definition: facture.class.php:407
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25