29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
50$langs->loadLangs(array(
"bills",
"compta",
"accountancy",
"productbatch",
"products"));
53$optioncss =
GETPOST(
'optioncss',
'aZ');
55$account_parent =
GETPOST(
'account_parent');
56$changeaccount =
GETPOST(
'changeaccount',
'array');
58$search_societe =
GETPOST(
'search_societe',
'alpha');
59$search_lineid =
GETPOST(
'search_lineid',
'alpha');
60$search_ref =
GETPOST(
'search_ref',
'alpha');
61$search_invoice =
GETPOST(
'search_invoice',
'alpha');
62$search_label =
GETPOST(
'search_label',
'alpha');
63$search_desc =
GETPOST(
'search_desc',
'alpha');
64$search_amount =
GETPOST(
'search_amount',
'alpha');
65$search_account =
GETPOST(
'search_account',
'alpha');
66$search_vat =
GETPOST(
'search_vat',
'alpha');
67$search_date_startday =
GETPOSTINT(
'search_date_startday');
68$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
69$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
70$search_date_endday =
GETPOSTINT(
'search_date_endday');
71$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
72$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
73$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
74$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
75$search_country =
GETPOST(
'search_country',
'aZ09');
76$search_tvaintra =
GETPOST(
'search_tvaintra',
'alpha');
80$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
83if (empty($page) || $page < 0) {
86$offset = $limit * $page;
90 $sortfield =
"f.datef, f.ref, fd.rowid";
104if ($user->socid > 0) {
107if (!$user->hasRight(
'accounting',
'bind',
'write')) {
112$contextpage =
'accountancycustomerlines';
113$hookmanager->initHooks([$contextpage ]);
119 'fd.rowid' => array(
'label' =>
"LineId",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
120 'f.ref' => array(
'label' =>
"Invoice",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
121 'f.datef' => array(
'label' =>
"Date",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
122 'p.ref' => array(
'label' =>
"ProductRef",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
123 'fd.description' => array(
'label' =>
"ProductDescription",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
124 'fd.total_ht' => array(
'label' =>
"Amount",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
125 'fd.tva_tx' => array(
'label' =>
"VATRate",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
126 's.nom' => array(
'label' =>
"ThirdParty",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
127 'co.label' => array(
'label' =>
"Country",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
128 's.tva_intra' => array(
'label' =>
"VATIntra",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
129 'aa.account_number' => array(
'label' =>
"AccountAccounting",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
139$parameters = array(
'arrayfields' => &$arrayfields);
140$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
145if (empty($reshook)) {
147 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
150 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
151 $search_societe =
'';
154 $search_invoice =
'';
158 $search_account =
'';
160 $search_date_startday =
'';
161 $search_date_startmonth =
'';
162 $search_date_startyear =
'';
163 $search_date_endday =
'';
164 $search_date_endmonth =
'';
165 $search_date_endyear =
'';
166 $search_date_start =
'';
167 $search_date_end =
'';
168 $search_country =
'';
169 $search_tvaintra =
'';
172 if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight(
'accounting',
'bind',
'write')) {
177 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Account")),
null,
'errors');
183 $sql1 =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet";
184 $sql1 .=
" SET fk_code_ventilation = ".(GETPOSTINT(
'account_parent') > 0 ?
GETPOSTINT(
'account_parent') : 0);
185 $sql1 .=
' WHERE rowid IN ('.$db->sanitize(implode(
',', $changeaccount)).
')';
187 dol_syslog(
'accountancy/customer/lines.php::changeaccount sql= '.$sql1);
188 $resql1 = $db->query($sql1);
201 $account_parent =
'';
206if (
GETPOST(
'sortfield') ==
'f.datef, f.ref, fd.rowid') {
207 $value = (
GETPOST(
'sortorder') ==
'asc,asc,asc' ? 0 : 1);
208 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
209 $res =
dolibarr_set_const($db,
"ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value,
'yesno', 0,
'', $conf->entity);
216$form =
new Form($db);
219$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
221llxHeader(
'', $langs->trans(
"CustomersVentilation").
' - '.$langs->trans(
"Dispatched"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-customer page-lines');
223print
'<script type="text/javascript">
225 $(\'#select-all\').click(function(event) {
226 // Iterate each checkbox
227 $(\':checkbox\').each(function() {
231 $(\'#unselect-all\').click(function(event) {
232 // Iterate each checkbox
233 $(\':checkbox\').each(function() {
234 this.checked = false;
243$sql =
"SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.situation_cycle_ref, f.datef, f.ref_client,";
244$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, fd.situation_percent,";
245$sql .=
" s.rowid as socid, s.nom as name, s.code_client,";
247 $sql .=
" spe.accountancy_code_customer as code_compta_client,";
248 $sql .=
" spe.accountancy_code_supplier as code_compta_fournisseur,";
250 $sql .=
" s.code_compta as code_compta_client,";
251 $sql .=
" s.code_compta_fournisseur,";
253$sql .=
" p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
255 $sql .=
" ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
257 $sql .=
" p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
259$sql .=
" aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,";
260$sql .=
" fd.situation_percent,";
261$sql .=
" co.code as country_code, co.label as country,";
262$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";
263$parameters = array();
264$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
265$sql .= $hookmanager->resPrint;
266$sql .=
" FROM ".MAIN_DB_PREFIX.
"facturedet as fd";
267$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON p.rowid = fd.fk_product";
269 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
271$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
272$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"facture as f ON f.rowid = fd.fk_facture";
273$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = f.fk_soc";
275 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
277$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = s.fk_pays ";
279$parameters = array();
280$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
281$sql .= $hookmanager->resPrint;
282$sql .=
" WHERE fd.fk_code_ventilation > 0";
283$sql .=
" AND f.entity IN (".getEntity(
'invoice', 0).
")";
284$sql .=
" AND f.fk_statut > 0";
291if ($search_societe) {
297if (strlen(trim($search_invoice))) {
300if (strlen(trim($search_ref))) {
303if (strlen(trim($search_label))) {
306if (strlen(trim($search_desc))) {
309if (strlen(trim($search_amount))) {
312if (strlen(trim($search_account))) {
315if (strlen(trim($search_vat))) {
318if ($search_date_start) {
319 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
321if ($search_date_end) {
322 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
324if (strlen(trim($search_country))) {
326 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
327 foreach ($arrayofcode as $key => $value) {
328 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
329 if ($value !=
$mysoc->country_code) {
330 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
333 if ($search_country ==
'special_allnotme') {
334 $sql .=
" AND co.code <> '".$db->escape(
$mysoc->country_code).
"'";
335 } elseif ($search_country ==
'special_eec') {
336 $sql .=
" AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
337 } elseif ($search_country ==
'special_eecnotme') {
338 $sql .=
" AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
339 } elseif ($search_country ==
'special_noteec') {
340 $sql .=
" AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
345if (strlen(trim($search_tvaintra))) {
348$sql .=
" AND f.entity IN (".getEntity(
'invoice', 0).
")";
350$parameters = array();
351$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
352$sql .= $hookmanager->resPrint;
354$sql .= $db->order($sortfield, $sortorder);
357$nbtotalofrecords =
'';
359 $result = $db->query($sql);
360 $nbtotalofrecords = $db->num_rows($result);
361 if (($page * $limit) > (
int) $nbtotalofrecords) {
367$sql .= $db->plimit($limit + 1, $offset);
369dol_syslog(
"/accountancy/customer/lines.php", LOG_DEBUG);
370$result = $db->query($sql);
372 $num_lines = $db->num_rows($result);
376 if ($contextpage != $_SERVER[
"PHP_SELF"]) {
377 $param .=
'&contextpage='.urlencode($contextpage);
379 if ($limit > 0 && $limit != $conf->liste_limit) {
380 $param .=
'&limit='.((int) $limit);
382 if ($search_societe) {
383 $param .=
"&search_societe=".urlencode($search_societe);
385 if ($search_invoice) {
386 $param .=
"&search_invoice=".urlencode($search_invoice);
389 $param .=
"&search_ref=".urlencode($search_ref);
392 $param .=
"&search_label=".urlencode($search_label);
395 $param .=
"&search_desc=".urlencode($search_desc);
397 if ($search_account) {
398 $param .=
"&search_account=".urlencode($search_account);
401 $param .=
"&search_vat=".urlencode($search_vat);
403 if ($search_date_startday) {
404 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
406 if ($search_date_startmonth) {
407 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
409 if ($search_date_startyear) {
410 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
412 if ($search_date_endday) {
413 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
415 if ($search_date_endmonth) {
416 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
418 if ($search_date_endyear) {
419 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
421 if ($search_country) {
422 $param .=
"&search_country=".urlencode($search_country);
424 if ($search_tvaintra) {
425 $param .=
"&search_tvaintra=".urlencode($search_tvaintra);
428 $parameters = array(
'param' => &$param);
429 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
430 $param .= $hookmanager->resPrint;
432 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
433 print
'<input type="hidden" name="action" value="ventil">';
434 if ($optioncss !=
'') {
435 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
437 print
'<input type="hidden" name="token" value="'.newToken().
'">';
438 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
439 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
440 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
441 print
'<input type="hidden" name="page" value="'.$page.
'">';
444 print_barre_liste($langs->trans(
"InvoiceLinesDone").
'<br><span class="opacitymedium small">'.$langs->trans(
"DescVentilDoneCustomer").
'</span>', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num_lines, $nbtotalofrecords,
'title_accountancy', 0,
'',
'', $limit, 0, 0, 1);
446 print
'<br>'.$langs->trans(
"ChangeAccount").
' <div class="inline-block paddingbottom marginbottomonly">';
447 print $formaccounting->select_account($account_parent,
'account_parent', 2, array(), 0, 0,
'maxwidth300 maxwidthonsmartphone valignmiddle');
448 print
'<input type="submit" class="button small smallpaddingimp valignmiddle" value="'.$langs->trans(
"ChangeBinding").
'"/></div>';
452 $varpage = $contextpage;
453 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);
454 $selectedfields = $htmlofselectarray;
455 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
457 print
'<div class="div-table-responsive">';
458 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
460 print
'<tr class="liste_titre_filter">';
462 if ($conf->main_checkbox_left_column) {
463 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
464 $searchpicto = $form->showFilterButtons(
'left');
469 if (!empty($arrayfields[
'fd.rowid'][
'checked'])) {
470 print
'<td class="liste_titre" data-key="lineid">';
471 print
'<input type="text" class="flat maxwidth40" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).
'">';
475 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
476 print
'<td class="liste_titre" data-key="invoice">';
477 print
'<input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).
'">';
481 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
482 print
'<td class="liste_titre center">';
483 print
'<div class="nowrapfordate">';
484 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
486 print
'<div class="nowrapfordate">';
487 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
492 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
493 print
'<td class="liste_titre" data-key="ref">';
494 print
'<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
499 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
500 print
'<td class="liste_titre" data-key="desc">';
501 print
'<input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).
'">';
505 if (!empty($arrayfields[
'fd.total_ht'][
'checked'])) {
506 print
'<td class="liste_titre" data-key="amount">';
507 print
'<input type="text" class="right flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
511 if (!empty($arrayfields[
'fd.tva_tx'][
'checked'])) {
512 print
'<td class="liste_titre" data-key="vat">';
513 print
'<input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="'.dol_escape_htmltag($search_vat).
'">';
517 if (!empty($arrayfields[
's.nom'][
'checked'])) {
518 print
'<td class="liste_titre" data-key="societe">';
519 print
'<input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
523 if (!empty($arrayfields[
'co.label'][
'checked'])) {
524 print
'<td class="liste_titre" data-key="country">';
525 print $form->select_country($search_country,
'search_country',
'', 0,
'maxwidth125',
'code2', 1, 0, 1);
530 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
531 print
'<td class="liste_titre">';
532 print
'<input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).
'">';
536 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
537 print
'<td class="liste_titre">';
538 print
'<input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).
'">';
542 $parameters = array(
'arrayfields' => $arrayfields);
543 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
544 print $hookmanager->resPrint;
546 if (!$conf->main_checkbox_left_column) {
547 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
548 $searchpicto = $form->showFilterButtons();
560 print
'<tr class="liste_titre">';
562 if ($conf->main_checkbox_left_column) {
563 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
567 if (!empty($arrayfields[
'fd.rowid'][
'checked'])) {
568 print_liste_field_titre($arrayfields[
'fd.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.rowid",
"", $param,
'', $sortfield, $sortorder);
572 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
573 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
577 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
578 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datef, f.ref, fd.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
582 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
583 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
588 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
589 print_liste_field_titre($arrayfields[
'fd.description'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.description",
"", $param,
'', $sortfield, $sortorder);
593 if (!empty($arrayfields[
'fd.total_ht'][
'checked'])) {
594 print_liste_field_titre($arrayfields[
'fd.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
598 if (!empty($arrayfields[
'fd.tva_tx'][
'checked'])) {
599 print_liste_field_titre($arrayfields[
'fd.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.tva_tx",
"", $param,
'', $sortfield, $sortorder,
'right ');
603 if (!empty($arrayfields[
's.nom'][
'checked'])) {
604 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
608 if (!empty($arrayfields[
'co.label'][
'checked'])) {
609 print_liste_field_titre($arrayfields[
'co.label'][
'label'], $_SERVER[
"PHP_SELF"],
"co.label",
"", $param,
'', $sortfield, $sortorder);
613 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
614 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder);
618 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
619 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
623 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
624 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
625 print $hookmanager->resPrint;
627 if (!$conf->main_checkbox_left_column) {
628 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
633 $thirdpartystatic =
new Societe($db);
634 $facturestatic =
new Facture($db);
635 $productstatic =
new Product($db);
641 while ($i < min($num_lines, $limit)) {
642 $objp = $db->fetch_object($result);
644 $facturestatic->ref = $objp->ref;
645 $facturestatic->id = $objp->facid;
646 $facturestatic->type = $objp->ftype;
648 $thirdpartystatic->id = $objp->socid;
649 $thirdpartystatic->name = $objp->name;
650 $thirdpartystatic->client = $objp->client;
651 $thirdpartystatic->fournisseur = $objp->fournisseur;
652 $thirdpartystatic->code_client = $objp->code_client;
653 $thirdpartystatic->code_compta_client = $objp->code_compta_client;
654 $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
655 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
656 $thirdpartystatic->email = $objp->email;
657 $thirdpartystatic->country_code = $objp->country_code;
659 $productstatic->ref = $objp->product_ref;
660 $productstatic->id = $objp->product_id;
661 $productstatic->label = $objp->product_label;
662 $productstatic->type = $objp->line_type;
663 $productstatic->status = $objp->tosell;
664 $productstatic->status_buy = $objp->tobuy;
665 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
666 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
667 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
669 $accountingaccountstatic->rowid = $objp->fk_compte;
670 $accountingaccountstatic->label = $objp->label_account;
671 $accountingaccountstatic->labelshort = $objp->labelshort_account;
672 $accountingaccountstatic->account_number = $objp->account_number;
674 print
'<tr class="oddeven">';
677 if ($conf->main_checkbox_left_column) {
678 print
'<td class="nowrap center actioncolumn">';
679 $selected = in_array($objp->rowid, $changeaccount);
680 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect checkforaction" type="checkbox" name="changeaccount[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
687 if (!empty($arrayfields[
'fd.rowid'][
'checked'])) {
688 print
'<td>'.$objp->rowid.
'</td>';
692 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
693 print
'<td class="nowraponall tdoverflowmax125">'.$facturestatic->getNomUrl(1).
'</td>';
697 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
698 print
'<td class="center">'.dol_print_date($db->jdate($objp->datef),
'day').
'</td>';
702 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
703 print
'<td class="tdoverflowmax100">';
704 if ($productstatic->id > 0) {
705 print $productstatic->getNomUrl(1);
712 if ($objp->product_label) {
713 print
'<span class="opacitymedium">'.$objp->product_label.
'</span>';
721 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
723 print
'<td class="tdoverflowmax200 small" title="'.dol_escape_htmltag($text).
'">';
725 print $form->textwithtooltip(
dol_trunc($text, $trunclength), $objp->description);
730 if (!empty($arrayfields[
'fd.total_ht'][
'checked'])) {
731 print
'<td class="right nowraponall amount">';
734 $situation_ratio = 1;
736 if ($objp->situation_cycle_ref) {
738 if ($objp->situation_percent == 0) {
739 $situation_ratio = 0;
742 $line->fetch($objp->rowid);
745 $prev_progress = $line->get_prev_progress($objp->facid);
747 $situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
750 print
price($objp->total_ht * $situation_ratio);
752 print
price($objp->total_ht);
758 if (!empty($arrayfields[
'fd.tva_tx'][
'checked'])) {
759 print
'<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ?
' ('.$objp->vat_src_code.
')' :
'')).
'</td>';
763 if (!empty($arrayfields[
's.nom'][
'checked'])) {
764 print
'<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1,
'customer').
'</td>';
768 if (!empty($arrayfields[
'co.label'][
'checked'])) {
769 print
'<td class="tdoverflowmax125" title="'.dolPrintHTML($langs->trans(
"Country".$objp->country_code).
' ('.$objp->country_code.
')').
'">';
770 if ($objp->country_code) {
771 print $langs->trans(
"Country".$objp->country_code).
' ('.$objp->country_code.
')';
777 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
778 print
'<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).
'">'.
dol_escape_htmltag($objp->tva_intra).
'</td>';
782 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
783 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($accountingaccountstatic->label).
'">';
784 print
'<a class="editfielda" href="./card.php?id='.$objp->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($param ?
'?'.$param :
'')).
'">';
787 print $accountingaccountstatic->getNomUrl(0, 1, 1,
'', 1);
793 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $objp,
'i' => $i,
'totalarray' => &
$totalarray);
794 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
795 print $hookmanager->resPrint;
798 if (!$conf->main_checkbox_left_column) {
799 print
'<td class="nowrap center actioncolumn">';
800 $selected = in_array($objp->rowid, $changeaccount);
801 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect checkforaction" type="checkbox" name="changeaccount[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
811 if ($num_lines == 0) {
813 foreach ($arrayfields as $key => $val) {
814 if (!empty($val[
'checked'])) {
818 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
821 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
822 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
823 print $hookmanager->resPrint;
828 if ($nbtotalofrecords > $limit) {
829 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num_lines, $nbtotalofrecords,
'', 0,
'',
'', $limit, 1);
834 print $db->lasterror();
if(! $sortfield) if(! $sortorder) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage accounting accounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const TYPE_SITUATION
Situation invoice.
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage invoice lines.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.