35 require
'../../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/bankcateg.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/paymentvat.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/don/class/paymentdonation.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/paymentexpensereport.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
59 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
62 $langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"margins",
"salaries",
"loan",
"donations",
"trips",
"members",
"compta",
"accountancy"));
66 $action =
GETPOST(
'action',
'aZ09');
67 $cancel =
GETPOST(
'cancel',
'alpha');
68 $confirm =
GETPOST(
'confirm',
'alpha');
69 $contextpage =
'bankentrieslist';
70 $massaction =
GETPOST(
'massaction',
'alpha');
71 $optioncss =
GETPOST(
'optioncss',
'aZ09');
75 $search_debit =
GETPOST(
"search_debit",
'alpha');
76 $search_credit =
GETPOST(
"search_credit",
'alpha');
77 $search_type =
GETPOST(
"search_type",
'alpha');
78 $search_account =
GETPOST(
"search_account",
'int') ?
GETPOST(
"search_account",
'int') :
GETPOST(
"account",
'int');
79 $search_accountancy_code =
GETPOST(
'search_accountancy_code',
'alpha') ?
GETPOST(
'search_accountancy_code',
'alpha') :
GETPOST(
'accountancy_code',
'alpha');
81 $search_ref =
GETPOST(
'search_ref',
'alpha');
82 $search_description =
GETPOST(
"search_description",
'alpha');
87 $search_thirdparty_user =
GETPOST(
"search_thirdparty",
'alpha') ?
GETPOST(
"search_thirdparty",
'alpha') :
GETPOST(
"thirdparty",
'alpha');
88 $search_req_nb =
GETPOST(
"req_nb",
'alpha');
89 $search_num_releve =
GETPOST(
"search_num_releve",
'alpha');
90 $search_conciliated =
GETPOST(
"search_conciliated",
'int');
91 $search_fk_bordereau =
GETPOST(
"search_fk_bordereau",
'int');
92 $optioncss =
GETPOST(
'optioncss',
'alpha');
93 $toselect =
GETPOST(
'toselect',
'array');
94 $num_releve =
GETPOST(
"num_releve",
"alpha");
100 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
101 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
105 $page = $pageplusone - 1;
107 if (empty($page) || $page == -1) {
110 $offset = $limit * $page;
111 $pageprev = $page - 1;
112 $pagenext = $page + 1;
114 $sortorder =
'desc,desc,desc';
117 $sortfield =
'b.datev,b.dateo,b.rowid';
121 if ($id > 0 || !empty($ref)) {
122 $result =
$object->fetch($id, $ref);
126 $langs->load(
"errors");
127 print($langs->trans(
'ErrorRecordNotFound'));
133 $contextpage =
'banktransactionlist'.(empty(
$object->id) ?
'' :
'-'.$object->id);
135 $mode_balance_ok =
false;
137 if (($sortfield ==
'b.datev' || $sortfield ==
'b.datev,b.dateo,b.rowid')) {
138 $sortfield =
'b.datev,b.dateo,b.rowid';
139 if ($id > 0 || !empty($ref) || $search_account > 0) {
140 $mode_balance_ok =
true;
145 $hookmanager->initHooks(array(
'banktransactionlist', $contextpage));
149 $extrafields->fetch_name_optionals_label(
'banktransaction');
150 $search_array_options = $extrafields->getOptionalsFromPost(
'banktransaction',
'',
'search_');
152 $arrayfields = array(
153 'b.rowid' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1,
'position' => 10),
154 'b.label' => array(
'label' => $langs->trans(
"Description"),
'checked' => 1,
'position' => 20),
155 'b.dateo' => array(
'label' => $langs->trans(
"DateOperationShort"),
'checked' => -1,
'position' => 30),
156 'b.datev' => array(
'label' => $langs->trans(
"DateValueShort"),
'checked' => 1,
'position' => 40),
157 'type' => array(
'label' => $langs->trans(
"Type"),
'checked' => 1,
'position' => 50),
158 'b.num_chq' => array(
'label' => $langs->trans(
"Numero"),
'checked' => 1,
'position' => 60),
159 'bu.label' => array(
'label' => $langs->trans(
"ThirdParty").
'/'.$langs->trans(
"User"),
'checked' => 1,
'position' => 70),
160 'ba.ref' => array(
'label' => $langs->trans(
"BankAccount"),
'checked' => (($id > 0 || !empty($ref)) ? 0 : 1),
'position' => 80),
161 'b.debit' => array(
'label' => $langs->trans(
"Debit"),
'checked' => 1,
'position' => 90),
162 'b.credit' => array(
'label' => $langs->trans(
"Credit"),
'checked' => 1,
'position' => 100),
163 'balancebefore' => array(
'label' => $langs->trans(
"BalanceBefore"),
'checked' => 0,
'position' => 110),
164 'balance' => array(
'label' => $langs->trans(
"Balance"),
'checked' => 1,
'position' => 120),
165 'b.num_releve' => array(
'label' => $langs->trans(
"AccountStatement"),
'checked' => 1,
'position' => 130),
166 'b.conciliated' => array(
'label' => $langs->trans(
"BankLineReconciled"),
'enabled' =>
$object->rappro,
'checked' => ($action ==
'reconcile' ? 1 : 0),
'position' => 140),
167 'b.fk_bordereau' => array(
'label' => $langs->trans(
"ChequeNumber"),
'checked' => 0,
'position' => 150),
170 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
176 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref :
''));
177 $fieldtype = (!empty($ref) ?
'ref' :
'rowid');
180 $socid = $user->socid;
182 $result =
restrictedArea($user,
'banque', $fieldvalue,
'bank_account&bank_account',
'',
'', $fieldtype);
185 $socid = $user->socid;
195 if (
GETPOST(
'cancel',
'alpha')) {
199 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
203 $parameters = array();
204 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
209 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
211 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
212 $search_dt_start =
'';
214 $search_dv_start =
'';
222 $search_description =
'';
223 $search_thirdparty_user =
'';
224 $search_num_releve =
'';
225 $search_conciliated =
'';
226 $search_fk_bordereau =
'';
229 $search_account =
"";
230 if ($id > 0 || !empty($ref)) {
235 if (empty($reshook)) {
236 $objectclass =
'Account';
237 $objectlabel =
'BankTransaction';
238 $permissiontoread = $user->hasRight(
'banque',
'lire');
239 $permissiontodelete = $user->hasRight(
'banque',
'modifier');
240 $uploaddir = $conf->bank->dir_output;
241 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
244 $rowids =
GETPOST(
'rowid',
'array');
247 if ((
GETPOST(
'confirm_savestatement',
'alpha') ||
GETPOST(
'confirm_reconcile',
'alpha'))
248 && (
GETPOST(
"num_releve",
"alpha") || !empty($rowids))
249 && $user->hasRight(
'banque',
'consolidate')
254 $num_releve =
GETPOST(
"num_releve",
"alpha");
259 $rowids =
GETPOST(
'rowid',
'array');
261 if (!empty($rowids) && is_array($rowids)) {
262 foreach ($rowids as $row) {
264 $result = $bankline->fetch($row);
265 $bankline->num_releve = $num_releve;
266 $result = $bankline->update_conciliation($user,
GETPOST(
"cat"),
GETPOST(
'confirm_reconcile',
'alpha') ? 1 : 0);
274 if (!$error && count($rowids) > 0) {
275 setEventMessages($langs->trans(
"XNewLinesConciliated", count($rowids)),
null);
279 $langs->load(
"errors");
284 $langs->load(
"errors");
285 setEventMessages($langs->trans(
"ErrorPleaseTypeBankTransactionReportName"),
null,
'errors');
289 $param =
'action=reconcile&contextpage=banktransactionlist&id='.((int)
$object->id).
'&search_account='.((int)
$object->id);
291 $param .=
'&page='.urlencode((
string) ($page));
294 $param .=
'&offset='.urlencode((
string) ($offset));
297 $param .=
'&limit='.((int) $limit);
299 if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
300 $param .=
'&search_conciliated='.urlencode((
string) ($search_conciliated));
302 if ($search_thirdparty_user) {
303 $param .=
'&search_thirdparty='.urlencode($search_thirdparty_user);
305 if ($search_num_releve) {
306 $param .=
'&search_num_releve='.urlencode($search_num_releve);
308 if ($search_description) {
309 $param .=
'&search_description='.urlencode($search_description);
312 $param .=
'&search_start_dtmonth='.GETPOSTINT(
'search_start_dtmonth').
'&search_start_dtday='.
GETPOSTINT(
'search_start_dtday').
'&search_start_dtyear='.
GETPOSTINT(
'search_start_dtyear');
315 $param .=
'&search_end_dtmonth='.GETPOSTINT(
'search_end_dtmonth').
'&search_end_dtday='.
GETPOSTINT(
'search_end_dtday').
'&search_end_dtyear='.
GETPOSTINT(
'search_end_dtyear');
318 $param .=
'&search_start_dvmonth='.GETPOSTINT(
'search_start_dvmonth').
'&search_start_dvday='.
GETPOSTINT(
'search_start_dvday').
'&search_start_dvyear='.
GETPOSTINT(
'search_start_dvyear');
321 $param .=
'&search_end_dvmonth='.GETPOSTINT(
'search_end_dvmonth').
'&search_end_dvday='.
GETPOSTINT(
'search_end_dvday').
'&search_end_dvyear='.
GETPOSTINT(
'search_end_dvyear');
324 $param .=
'&search_type='.urlencode($search_type);
327 $param .=
'&search_debit='.urlencode($search_debit);
329 if ($search_credit) {
330 $param .=
'&search_credit='.urlencode($search_credit);
332 $param .=
'&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder);
333 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.$param);
339 if (
GETPOST(
'save') && !$cancel && $user->hasRight(
'banque',
'modifier')) {
348 $operation =
GETPOST(
"operation",
'alpha');
349 $num_chq =
GETPOST(
"num_chq",
'alpha');
350 $label =
GETPOST(
"label",
'alpha');
351 $cat1 =
GETPOST(
"cat1",
'alpha');
353 $bankaccountid = $id;
359 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
363 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
367 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
371 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
373 if (!($bankaccountid > 0)) {
375 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankAccount")),
null,
'errors');
385 $objecttmp->fetch($bankaccountid);
386 $insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user,
'',
'', $search_accountancy_code);
389 header(
"Location: ".$_SERVER[
'PHP_SELF'].($id ?
"?id=".$id :
''));
399 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'banque',
'modifier')) {
401 $result = $accline->fetch(
GETPOSTINT(
"rowid"));
402 $result = $accline->delete($user);
414 $form =
new Form($db);
418 $companystatic =
new Societe($db);
419 $bankaccountstatic =
new Account($db);
420 $userstatic =
new User($db);
423 $societestatic =
new Societe($db);
424 $userstatic =
new User($db);
426 $loanstatic =
new Loan($db);
428 $donstatic =
new Don($db);
437 $bankstatic =
new Account($db);
445 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
446 $param .=
'&contextpage='.urlencode($contextpage);
448 if ($limit > 0 && $limit != $conf->liste_limit) {
449 $param .=
'&limit='.((int) $limit);
452 $param .=
'&id='.urlencode((
string) ($id));
455 $param .=
'&ref='.urlencode($ref);
457 if (!empty($search_ref)) {
458 $param .=
'&search_ref='.urlencode($search_ref);
460 if (!empty($search_description)) {
461 $param .=
'&search_description='.urlencode($search_description);
463 if (!empty($search_type)) {
464 $param .=
'&type='.urlencode($search_type);
466 if (!empty($search_thirdparty_user)) {
467 $param .=
'&search_thirdparty='.urlencode($search_thirdparty_user);
469 if (!empty($search_debit)) {
470 $param .=
'&search_debit='.urlencode($search_debit);
472 if (!empty($search_credit)) {
473 $param .=
'&search_credit='.urlencode($search_credit);
475 if ($search_account > 0) {
476 $param .=
'&search_account='.((int) $search_account);
478 if (!empty($search_num_releve)) {
479 $param .=
'&search_num_releve='.urlencode($search_num_releve);
481 if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
482 $param .=
'&search_conciliated='.urlencode((
string) ($search_conciliated));
484 if ($search_fk_bordereau > 0) {
485 $param .=
'$&search_fk_bordereau='.urlencode((
string) ($search_fk_bordereau));
487 if ($search_bid > 0) {
488 $param .=
'&search_bid='.((int) $search_bid);
491 $param .=
'&search_start_dtmonth='.GETPOSTINT(
'search_start_dtmonth').
'&search_start_dtday='.
GETPOSTINT(
'search_start_dtday').
'&search_start_dtyear='.
GETPOSTINT(
'search_start_dtyear');
494 $param .=
'&search_end_dtmonth='.GETPOSTINT(
'search_end_dtmonth').
'&search_end_dtday='.
GETPOSTINT(
'search_end_dtday').
'&search_end_dtyear='.
GETPOSTINT(
'search_end_dtyear');
497 $param .=
'&search_start_dvmonth='.GETPOSTINT(
'search_start_dvmonth').
'&search_start_dvday='.
GETPOSTINT(
'search_start_dvday').
'&search_start_dvyear='.
GETPOSTINT(
'search_start_dvyear');
500 $param .=
'&search_end_dvmonth='.GETPOSTINT(
'search_end_dvmonth').
'&search_end_dvday='.
GETPOSTINT(
'search_end_dvday').
'&search_end_dvyear='.
GETPOSTINT(
'search_end_dvyear');
502 if ($search_req_nb) {
503 $param .=
'&req_nb='.urlencode($search_req_nb);
506 $param .=
'&thirdparty='.urlencode((
string) (
GETPOSTINT(
"search_thirdparty")));
508 if ($optioncss !=
'') {
509 $param .=
'&optioncss='.urlencode($optioncss);
511 if ($action ==
'reconcile') {
512 $param .=
'&action=reconcile';
520 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
524 $buttonreconcile =
'';
527 if ($id > 0 || !empty($ref)) {
528 $title =
$object->ref.
' - '.$langs->trans(
"Transactions");
530 $title = $langs->trans(
"BankTransactions");
534 llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $param);
537 if ($id > 0 || !empty($ref)) {
539 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/bankcateg.class.php';
542 $arrayofbankcateg = $bankcateg->fetchAll();
543 foreach ($arrayofbankcateg as $bankcategory) {
544 $options[$bankcategory->id] = $bankcategory->label;
549 print
dol_get_fiche_head($head,
'journal', $langs->trans(
"FinancialAccount"), 0,
'account');
551 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
553 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
562 if ($action !=
'reconcile') {
563 if (
$object->canBeConciliated() > 0) {
564 $allowautomaticconciliation =
false;
565 $titletoconciliatemanual = $langs->trans(
"Conciliate");
566 $titletoconciliateauto = $langs->trans(
"Conciliate");
567 if ($allowautomaticconciliation) {
568 $titletoconciliatemanual .=
' ('.$langs->trans(
"Manual").
')';
569 $titletoconciliateauto .=
' ('.$langs->trans(
"Auto").
')';
573 if ($user->hasRight(
'banque',
'consolidate')) {
575 $newparam = preg_replace(
'/search_conciliated=\d+/i',
'', $newparam);
576 $buttonreconcile =
'<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.
'">'.$titletoconciliatemanual.
'</a>';
578 $buttonreconcile =
'<a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans(
"NotEnoughPermissions").
'" href="#">'.$titletoconciliatemanual.
'</a>';
581 if ($allowautomaticconciliation) {
583 if ($user->hasRight(
'banque',
'consolidate')) {
585 $newparam = preg_replace(
'/search_conciliated=\d+/i',
'', $newparam);
586 $buttonreconcile .=
' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.
'">'.$titletoconciliateauto.
'</a>';
588 $buttonreconcile .=
' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans(
"NotEnoughPermissions").
'" href="#">'.$titletoconciliateauto.
'</a>';
595 $sql =
"SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
596 $sql .=
" b.fk_account, b.fk_type, b.fk_bordereau,";
597 $sql .=
" ba.rowid as bankid, ba.ref as bankref";
599 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
600 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
601 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
605 $parameters = array();
606 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
607 $sql .= $hookmanager->resPrint;
609 if ($search_bid > 0) {
610 $sql .= MAIN_DB_PREFIX.
"bank_class as l,";
612 $sql .=
" ".MAIN_DB_PREFIX.
"bank_account as ba,";
613 $sql .=
" ".MAIN_DB_PREFIX.
"bank as b";
614 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
615 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (b.rowid = ef.fk_object)";
619 $parameters = array();
620 $reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters);
621 $sql .= $hookmanager->resPrint;
623 $sql .=
" WHERE b.fk_account = ba.rowid";
624 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
625 if ($search_account > 0) {
626 $sql .=
" AND b.fk_account = ".((int) $search_account);
630 $sql .=
" AND b.dateo >= '".$db->idate($search_dt_start).
"'";
633 $sql .=
" AND b.dateo <= '".$db->idate($search_dt_end).
"'";
637 $sql .=
" AND b.datev >= '".$db->idate($search_dv_start).
"'";
640 $sql .=
" AND b.datev <= '".$db->idate($search_dv_end).
"'";
645 if ($search_req_nb) {
648 if ($search_num_releve) {
651 if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
652 $sql .=
" AND b.rappro = ".((int) $search_conciliated);
654 if ($search_fk_bordereau > 0) {
655 $sql .=
" AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
657 if ($search_thirdparty_user) {
658 $sql .=
" AND (b.rowid IN ";
659 $sql .=
" ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX.
"bank_url AS bu";
660 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bank AS b2 ON b2.rowid = bu.fk_bank";
661 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
662 $sql .=
" WHERE ".
natural_search(array(
"subUser.firstname",
"subUser.lastname"), $search_thirdparty_user,
'', 1).
")";
664 $sql .=
" OR b.rowid IN ";
665 $sql .=
" ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX.
"bank_url AS bu";
666 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bank AS b2 ON b2.rowid = bu.fk_bank";
667 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
668 $sql .=
" WHERE ".
natural_search(array(
"subSoc.nom"), $search_thirdparty_user,
'', 1);
671 if ($search_description) {
672 $search_description_to_use = $search_description;
673 $arrayoffixedlabels = array(
675 'CustomerInvoicePayment',
'CustomerInvoicePaymentBack',
676 'SupplierInvoicePayment',
'SupplierInvoicePaymentBack',
678 'ExpenseReportPayment',
679 'SocialContributionPayment',
680 'SubscriptionPayment',
683 foreach ($arrayoffixedlabels as $keyforlabel) {
684 $translatedlabel = $langs->transnoentitiesnoconv($keyforlabel);
685 if (preg_match(
'/'.$search_description.
'/i', $translatedlabel)) {
686 $search_description_to_use .=
"|".$keyforlabel;
692 if ($search_bid > 0) {
693 $sql .=
" AND b.rowid = l.lineid AND l.fk_categ = ".((int) $search_bid);
695 if (!empty($search_type)) {
696 $sql .=
" AND b.fk_type = '".$db->escape($search_type).
"'";
701 $sql .=
' AND b.amount <= 0';
703 if ($search_credit) {
705 $sql .=
' AND b.amount >= 0';
708 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
711 $parameters = array();
712 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
713 $sql .= $hookmanager->resPrint;
715 $sql .= $db->order($sortfield, $sortorder);
717 $nbtotalofrecords =
'';
720 $result = $db->query(
$sql);
721 $nbtotalofrecords = $db->num_rows($result);
722 $nbtotalofpages = ceil($nbtotalofrecords / $limit);
725 if (($id > 0 || !empty($ref)) && ((
string) $page ==
'')) {
728 $page = ($nbtotalofpages - 1);
729 $offset = $limit * $page;
734 if ($page >= $nbtotalofpages) {
736 $page = ($nbtotalofpages - 1);
737 $offset = $limit * $page;
745 if (empty($search_account)) {
746 $mode_balance_ok =
false;
749 if (!empty($search_ref)) {
750 $mode_balance_ok =
false;
752 if (!empty($search_description)) {
753 $mode_balance_ok =
false;
755 if (!empty($search_type)) {
756 $mode_balance_ok =
false;
758 if (!empty($search_debit)) {
759 $mode_balance_ok =
false;
761 if (!empty($search_credit)) {
762 $mode_balance_ok =
false;
764 if (!empty($search_thirdparty_user)) {
765 $mode_balance_ok =
false;
767 if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
768 $mode_balance_ok =
false;
770 if (!empty($search_num_releve)) {
771 $mode_balance_ok =
false;
773 if (!empty($search_fk_bordereau)) {
774 $mode_balance_ok =
false;
777 $sql .= $db->plimit($limit + 1, $offset);
779 dol_syslog(
'compta/bank/bankentries_list.php', LOG_DEBUG);
780 $resql = $db->query(
$sql);
782 $num = $db->num_rows($resql);
784 $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array();
787 $arrayofmassactions = array(
791 if (in_array($massaction, array(
'presend',
'predelete'))) {
792 $arrayofmassactions = array();
794 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
797 if ($action ==
'delete') {
798 $text = $langs->trans(
'ConfirmDeleteTransaction');
799 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&rowid='.
GETPOSTINT(
"rowid"), $langs->trans(
'DeleteTransaction'), $text,
'confirm_delete',
null,
'', 1);
803 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'" name="search_form">'.
"\n";
804 if ($optioncss !=
'') {
805 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
807 print
'<input type="hidden" name="token" value="'.newToken().
'">';
808 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
809 print
'<input type="hidden" name="action" value="'.($action !=
'delete' ? $action :
'search').
'">';
811 print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
813 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
814 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
815 print
'<input type="hidden" name="page" value="'.$page.
'">';
816 print
'<input type="hidden" name="id" value="'.$id.
'">';
817 print
'<input type="hidden" name="ref" value="'.$ref.
'">';
819 print
'<input type="hidden" name="bid" value="'.GETPOSTINT(
"bid").
'">';
823 if ($user->hasRight(
'banque',
'modifier') && $action ==
'addline' &&
getDolGlobalString(
'BANK_USE_OLD_VARIOUS_PAYMENT')) {
826 print
'<table class="noborder centpercent">';
828 print
'<tr class="liste_titre">';
829 print
'<td>'.$langs->trans(
"Description").
'</td>';
830 print
'<td>'.$langs->trans(
"Date").
'</td>';
831 print
'<td> </td>';
832 print
'<td>'.$langs->trans(
"Type").
'</td>';
833 print
'<td>'.$langs->trans(
"Numero").
'</td>';
834 print
'<td class=right>'.$langs->trans(
"BankAccount").
'</td>';
835 print
'<td class=right>'.$langs->trans(
"Debit").
'</td>';
836 print
'<td class=right>'.$langs->trans(
"Credit").
'</td>';
843 print
'<td align="center"> </td>';
848 print
'<input name="label" class="flat minwidth200" type="text" value="'.GETPOST(
"label",
"alpha").
'">';
849 if (is_array($options) && count($options)) {
850 print
'<br>'.$langs->trans(
"Rubrique").
': ';
854 print
'<td class="nowrap">';
855 print $form->selectDate(empty($dateop) ? -1 : $dateop,
'op', 0, 0, 0,
'transaction');
857 print
'<td> </td>';
858 print
'<td class="nowrap">';
862 print
'<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST(
"num_chq",
"alpha").
'">';
866 print
'<td class=right>';
867 $form->select_comptes(
GETPOSTINT(
'add_account') ?
GETPOSTINT(
'add_account') : $search_account,
'add_account', 0,
'', 1, ($id > 0 || !empty($ref) ?
' disabled="disabled"' :
''));
870 print
'<td class="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST(
"adddebit",
"alpha").
'"></td>';
871 print
'<td class="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST(
"addcredit",
"alpha").
'"></td>';
878 print
'<td class="center">';
879 print
'<input type="submit" name="save" class="button buttongen marginbottomonly button-add" value="'.$langs->trans(
"Add").
'"><br>';
880 print
'<input type="submit" name="cancel" class="button buttongen marginbottomonly button-cancel" value="'.$langs->trans(
"Cancel").
'">';
888 $urlajax = DOL_URL_ROOT.
'/core/ajax/bankconciliate.php?token='.
currentToken();
890 <script type="text/javascript">
892 $("a.ajaxforbankoperationchange").each(function(){
893 var current = $(this);
894 current.click(function()
896 var url = "'.$urlajax.
'&"+current.attr("href").split("?")[1];
897 $.get(url, function(data)
901 current.parent().parent().find(".spanforajaxedit").replaceWith(data);
916 if ($action !=
'addline') {
919 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddBankRecord'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&accountid='.urlencode($search_account).
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.urlencode($search_account)),
'', $user->rights->banque->modifier);
921 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddBankRecord'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?action=addline&token='.
newToken().
'&page='.$page.$param,
'', $user->rights->banque->modifier);
924 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddBankRecord'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?action=addline&token='.
newToken().
'&page='.$page.$param,
'', -1);
936 if ($action !=
'addline' && $action !=
'reconcile') {
937 $morehtml .= $buttonreconcile;
940 $morehtmlright =
'<!-- Add New button -->'.$newcardbutton;
942 $picto =
'bank_account';
943 if ($id > 0 || !empty($ref)) {
948 print_barre_liste($langs->trans(
"BankTransactions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton.$morehtml, $num, $nbtotalofrecords, $picto, 0, $morehtmlright,
'', $limit, 0, 0, 1);
951 if ($user->hasRight(
'banque',
'consolidate') && $action ==
'reconcile') {
952 print
'<!-- form with reconciliation input -->'.
"\n";
953 print
'<div class="valignmiddle inline-block" style="padding-right: 20px;">';
955 print
'<strong>'.$langs->trans(
"InputReceiptNumber").
'</strong>: ';
956 print
'<input class="flat width175" id="num_releve" name="num_releve" type="text" value="'.(GETPOST(
'num_releve') ?
GETPOST(
'num_releve') :
'').
'">';
958 $texttoshow = $langs->trans(
"InputReceiptNumber").
': ';
959 $yyyy =
dol_substr($langs->transnoentitiesnoconv(
"Year"), 0, 1).substr($langs->transnoentitiesnoconv(
"Year"), 0, 1).substr($langs->transnoentitiesnoconv(
"Year"), 0, 1).substr($langs->transnoentitiesnoconv(
"Year"), 0, 1);
960 $mm =
dol_substr($langs->transnoentitiesnoconv(
"Month"), 0, 1).substr($langs->transnoentitiesnoconv(
"Month"), 0, 1);
961 $dd =
dol_substr($langs->transnoentitiesnoconv(
"Day"), 0, 1).substr($langs->transnoentitiesnoconv(
"Day"), 0, 1);
962 $placeholder = $yyyy.$mm;
963 $placeholder .=
' '.$langs->trans(
"or").
' ';
964 $placeholder .= $yyyy.$mm.$dd;
966 $texttoshow .= $langs->trans(
"InputReceiptNumberBis");
969 print
'<input class="flat width175" pattern="[0-9]+" title="'.dol_escape_htmltag($texttoshow.($placeholder ?
': '.$placeholder :
'')).
'" id="num_releve" name="num_releve" placeholder="'.
dol_escape_htmltag($placeholder).
'" type="text" value="'.(
GETPOSTINT(
'num_releve') ?
GETPOSTINT(
'num_releve') :
'').
'">';
972 if (is_array($options) && count($options)) {
973 print $langs->trans(
"EventualyAddCategory").
': ';
976 print
'<br><div style="margin-top: 5px;"><span class="opacitymedium">'.$langs->trans(
"ThenCheckLinesAndConciliate").
'</span> ';
977 print
'<input class="button" name="confirm_savestatement" type="submit" value="'.$langs->trans(
"SaveStatementOnly").
'">';
978 print
' '.$langs->trans(
"or").
' ';
979 print
'<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans(
"Conciliate").
'">';
980 print
' '.$langs->trans(
"or").
' ';
981 print
'<input type="submit" name="cancel" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'">';
987 $sql =
"SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX.
"bank";
988 $sql .=
" WHERE fk_account = ".((int)
$object->id).
" AND num_releve IS NOT NULL";
989 $sql .= $db->order(
"num_releve",
"DESC");
990 $sql .= $db->plimit($nbmax + 1);
992 print $langs->trans(
"LastAccountStatements").
' : ';
993 $resqlr = $db->query(
$sql);
995 $numr = $db->num_rows($resqlr);
998 while (($i < $numr) && ($i < $nbmax)) {
999 $objr = $db->fetch_object($resqlr);
1001 $last_releve = $objr->num_releve;
1005 $liste =
'<a target="_blank" href="'.DOL_URL_ROOT.
'/compta/bank/releve.php?account='.((int) $id).
'&num='.urlencode($objr->num_releve).
'">'.
dol_escape_htmltag($objr->num_releve).
'</a> '.$liste;
1007 if ($numr >= $nbmax) {
1008 $liste =
"... ".$liste;
1012 print
'<b>'.$langs->trans(
"None").
'</b>';
1021 <script type="text/javascript">
1022 $("#num_releve").val("' . $last_releve.
'");
1031 $param .=
'&page='.urlencode((
string) ($page));
1034 $moreforfilter =
'';
1035 $moreforfilter .=
'<div class="divsearchfield">';
1036 $moreforfilter .= $langs->trans(
'DateOperationShort');
1037 $moreforfilter .= ($conf->browser->layout ==
'phone' ?
'<br>' :
' ');
1038 $moreforfilter .=
'<div class="nowrap inline-block">';
1039 $moreforfilter .= $form->selectDate($search_dt_start,
'search_start_dt', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1040 $moreforfilter .=
'</div>';
1041 $moreforfilter .= ($conf->browser->layout ==
'phone' ?
'' :
' ');
1042 $moreforfilter .=
'<div class="nowrap inline-block">';
1043 $moreforfilter .= $form->selectDate($search_dt_end,
'search_end_dt', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1044 $moreforfilter .=
'</div>';
1045 $moreforfilter .=
'</div>';
1047 $moreforfilter .=
'<div class="divsearchfield">';
1048 $moreforfilter .= $langs->trans(
'DateValueShort');
1049 $moreforfilter .= ($conf->browser->layout ==
'phone' ?
'<br>' :
' ');
1050 $moreforfilter .=
'<div class="nowrap inline-block">';
1051 $moreforfilter .= $form->selectDate($search_dv_start,
'search_start_dv', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1052 $moreforfilter .=
'</div>';
1053 $moreforfilter .= ($conf->browser->layout ==
'phone' ?
'' :
' ');
1054 $moreforfilter .=
'<div class="nowrap inline-block">';
1055 $moreforfilter .= $form->selectDate($search_dv_end,
'search_end_dv', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1056 $moreforfilter .=
'</div>';
1057 $moreforfilter .=
'</div>';
1061 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1062 $langs->load(
'categories');
1065 $moreforfilter .=
'<div class="divsearchfield">';
1066 $tmptitle = $langs->trans(
'RubriquesTransactions');
1067 $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid,
'parent',
null,
null, 1);
1068 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1069 $moreforfilter .=
'</div>';
1073 $parameters = array();
1074 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
1075 if (empty($reshook)) {
1076 $moreforfilter .= $hookmanager->resPrint;
1078 $moreforfilter = $hookmanager->resPrint;
1081 if ($moreforfilter) {
1082 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1083 print $moreforfilter;
1084 print
'</div>'.
"\n";
1087 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1088 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1089 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1090 $selectedfields .= ($action ==
'reconcile' ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1093 if ($action ==
'reconcile') {
1094 $arrayfields[
'b.num_releve'][
'checked'] = 1;
1097 print
'<div class="div-table-responsive">';
1098 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1102 print
'<tr class="liste_titre_filter">';
1105 print
'<td class="liste_titre valignmiddle center">';
1106 $searchpicto = $form->showFilterButtons(
'left');
1112 if (!empty($arrayfields[
'b.rowid'][
'checked'])) {
1113 print
'<td class="liste_titre">';
1114 print
'<input type="text" class="flat" name="search_ref" size="2" value="'.dol_escape_htmltag($search_ref).
'">';
1117 if (!empty($arrayfields[
'b.label'][
'checked'])) {
1118 print
'<td class="liste_titre">';
1119 print
'<input type="text" class="flat maxwidth100" name="search_description" value="'.dol_escape_htmltag($search_description).
'">';
1122 if (!empty($arrayfields[
'b.dateo'][
'checked'])) {
1123 print
'<td class="liste_titre"> </td>';
1125 if (!empty($arrayfields[
'b.datev'][
'checked'])) {
1126 print
'<td class="liste_titre"> </td>';
1128 if (!empty($arrayfields[
'type'][
'checked'])) {
1129 print
'<td class="liste_titre" align="center">';
1130 print $form->select_types_paiements(empty($search_type) ?
'' : $search_type,
'search_type',
'', 2, 1, 1, 0, 1,
'maxwidth100', 1);
1134 if (!empty($arrayfields[
'b.num_chq'][
'checked'])) {
1135 print
'<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).
'" size="2"></td>';
1138 if (!empty($arrayfields[
'bu.label'][
'checked'])) {
1139 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).
'"></td>';
1142 if (!empty($arrayfields[
'ba.ref'][
'checked'])) {
1143 print
'<td class="liste_titre">';
1144 $form->select_comptes($search_account,
'search_account', 0,
'', 1, ($id > 0 || !empty($ref) ?
' disabled="disabled"' :
''), 0,
'maxwidth100');
1148 if (!empty($arrayfields[
'b.debit'][
'checked'])) {
1149 print
'<td class="liste_titre right">';
1150 print
'<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).
'">';
1154 if (!empty($arrayfields[
'b.credit'][
'checked'])) {
1155 print
'<td class="liste_titre right">';
1156 print
'<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).
'">';
1160 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1161 print
'<td class="liste_titre right">';
1162 $htmltext = $langs->trans(
"BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv(
"DateValue"));
1163 print $form->textwithpicto(
'', $htmltext, 1);
1167 if (!empty($arrayfields[
'balance'][
'checked'])) {
1168 print
'<td class="liste_titre right">';
1169 $htmltext = $langs->trans(
"BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv(
"DateValue"));
1170 print $form->textwithpicto(
'', $htmltext, 1);
1174 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1175 print
'<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).
'" size="3"></td>';
1178 if (!empty($arrayfields[
'b.conciliated'][
'checked'])) {
1179 print
'<td class="liste_titre center parentonrightofpage">';
1180 print $form->selectyesno(
'search_conciliated', $search_conciliated, 1,
false, 1, 1,
'search_status onrightofpage maxwidth75');
1184 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1185 print
'<td class="liste_titre" align="center"><input type="text" class="flat" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).
'" size="3"></td>';
1188 print
'<td class="nowraponall" align="center"></td>';
1192 print
'<td class="liste_titre valignmiddle center">';
1195 $searchpicto = $form->showFilterButtons();
1201 $totalarray = array();
1202 $totalarray[
'nbfield'] = 0;
1205 print
'<tr class="liste_titre">';
1208 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1209 $totalarray[
'nbfield']++;
1211 if (!empty($arrayfields[
'b.rowid'][
'checked'])) {
1212 print_liste_field_titre($arrayfields[
'b.rowid'][
'label'], $_SERVER[
'PHP_SELF'],
'b.rowid',
'', $param,
'', $sortfield, $sortorder);
1213 $totalarray[
'nbfield']++;
1215 if (!empty($arrayfields[
'b.label'][
'checked'])) {
1216 print_liste_field_titre($arrayfields[
'b.label'][
'label'], $_SERVER[
'PHP_SELF'],
'b.label',
'', $param,
'', $sortfield, $sortorder);
1217 $totalarray[
'nbfield']++;
1219 if (!empty($arrayfields[
'b.dateo'][
'checked'])) {
1220 print_liste_field_titre($arrayfields[
'b.dateo'][
'label'], $_SERVER[
'PHP_SELF'],
'b.dateo',
'', $param,
'', $sortfield, $sortorder,
"center ");
1221 $totalarray[
'nbfield']++;
1223 if (!empty($arrayfields[
'b.datev'][
'checked'])) {
1224 print_liste_field_titre($arrayfields[
'b.datev'][
'label'], $_SERVER[
'PHP_SELF'],
'b.datev,b.dateo,b.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1225 $totalarray[
'nbfield']++;
1227 if (!empty($arrayfields[
'type'][
'checked'])) {
1228 print_liste_field_titre($arrayfields[
'type'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1229 $totalarray[
'nbfield']++;
1231 if (!empty($arrayfields[
'b.num_chq'][
'checked'])) {
1232 print_liste_field_titre($arrayfields[
'b.num_chq'][
'label'], $_SERVER[
'PHP_SELF'],
'b.num_chq',
'', $param,
'', $sortfield, $sortorder,
"center ");
1233 $totalarray[
'nbfield']++;
1235 if (!empty($arrayfields[
'bu.label'][
'checked'])) {
1236 print_liste_field_titre($arrayfields[
'bu.label'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1237 $totalarray[
'nbfield']++;
1239 if (!empty($arrayfields[
'ba.ref'][
'checked'])) {
1240 print_liste_field_titre($arrayfields[
'ba.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'ba.ref',
'', $param,
'', $sortfield, $sortorder);
1241 $totalarray[
'nbfield']++;
1243 if (!empty($arrayfields[
'b.debit'][
'checked'])) {
1244 print_liste_field_titre($arrayfields[
'b.debit'][
'label'], $_SERVER[
'PHP_SELF'],
'b.amount',
'', $param,
'', $sortfield, $sortorder,
"right ");
1245 $totalarray[
'nbfield']++;
1247 if (!empty($arrayfields[
'b.credit'][
'checked'])) {
1248 print_liste_field_titre($arrayfields[
'b.credit'][
'label'], $_SERVER[
'PHP_SELF'],
'b.amount',
'', $param,
'', $sortfield, $sortorder,
"right ");
1249 $totalarray[
'nbfield']++;
1251 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1252 print_liste_field_titre($arrayfields[
'balancebefore'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
"right ");
1253 $totalarray[
'nbfield']++;
1255 if (!empty($arrayfields[
'balance'][
'checked'])) {
1256 print_liste_field_titre($arrayfields[
'balance'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
"right ");
1257 $totalarray[
'nbfield']++;
1259 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1260 print_liste_field_titre($arrayfields[
'b.num_releve'][
'label'], $_SERVER[
'PHP_SELF'],
'b.num_releve',
'', $param,
'', $sortfield, $sortorder,
"center ");
1261 $totalarray[
'nbfield']++;
1263 if (!empty($arrayfields[
'b.conciliated'][
'checked'])) {
1264 print_liste_field_titre($arrayfields[
'b.conciliated'][
'label'], $_SERVER[
'PHP_SELF'],
'b.rappro',
'', $param,
'', $sortfield, $sortorder,
"center ");
1265 $totalarray[
'nbfield']++;
1267 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1268 print_liste_field_titre($arrayfields[
'b.fk_bordereau'][
'label'], $_SERVER[
'PHP_SELF'],
'b.fk_bordereau',
'', $param,
'', $sortfield, $sortorder,
"center ");
1269 $totalarray[
'nbfield']++;
1273 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1275 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1276 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1277 print $hookmanager->resPrint;
1279 print
'<td class="nowraponall" align="center"></td>';
1280 $totalarray[
'nbfield']++;
1284 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1285 $totalarray[
'nbfield']++;
1291 $balancecalculated =
false;
1292 $posconciliatecol = 0;
1293 $cachebankaccount = array();
1299 $savnbfield = $totalarray[
'nbfield'];
1300 $totalarray = array();
1301 $totalarray[
'nbfield'] = 0;
1302 $totalarray[
'totaldeb'] = 0;
1303 $totalarray[
'totalcred'] = 0;
1305 $imaxinloop = ($limit ? min($num, $limit) : $num);
1306 while ($i < $imaxinloop) {
1307 $objp = $db->fetch_object($resql);
1308 $links = $bankaccountstatic->get_url($objp->rowid);
1311 if (!$balancecalculated && (!empty($arrayfields[
'balancebefore'][
'checked']) || !empty($arrayfields[
'balance'][
'checked'])) && ($mode_balance_ok || $search_conciliated ===
'0')) {
1312 if (!$search_account) {
1313 dol_print_error(
null,
'account is not defined but $mode_balance_ok is true');
1320 $sqlforbalance =
'SELECT SUM(b.amount) as previoustotal';
1321 $sqlforbalance .=
" FROM ";
1322 $sqlforbalance .=
" ".MAIN_DB_PREFIX.
"bank_account as ba,";
1323 $sqlforbalance .=
" ".MAIN_DB_PREFIX.
"bank as b";
1324 $sqlforbalance .=
" WHERE b.fk_account = ba.rowid";
1325 $sqlforbalance .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
1326 $sqlforbalance .=
" AND b.fk_account = ".((int) $search_account);
1327 $sqlforbalance .=
" AND (b.datev < '".$db->idate($db->jdate($objp->dv)).
"' OR (b.datev = '".$db->idate($db->jdate($objp->dv)).
"' AND (b.dateo < '".$db->idate($db->jdate($objp->do)).
"' OR (b.dateo = '".$db->idate($db->jdate($objp->do)).
"' AND b.rowid < ".$objp->rowid.
"))))";
1328 $resqlforbalance = $db->query($sqlforbalance);
1330 if ($resqlforbalance) {
1331 $objforbalance = $db->fetch_object($resqlforbalance);
1332 if ($objforbalance) {
1334 if ($sortfield ==
'b.datev,b.dateo,b.rowid' && ($sortorder ==
'desc' || $sortorder ==
'desc,desc' || $sortorder ==
'desc,desc,desc')) {
1335 $balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
1338 $balance = $objforbalance->previoustotal;
1345 $balancecalculated =
true;
1348 if ($user->hasRight(
'banque',
'consolidate') && $action ==
'reconcile') {
1349 $tmpnbfieldbeforebalance = 0;
1350 $tmpnbfieldafterbalance = 0;
1351 $balancefieldfound = 0;
1352 foreach ($arrayfields as $key => $val) {
1353 if ($key ==
'balancebefore' || $key ==
'balance') {
1354 $balancefieldfound++;
1357 if (!empty($arrayfields[$key][
'checked'])) {
1358 if (!$balancefieldfound) {
1359 $tmpnbfieldbeforebalance++;
1361 $tmpnbfieldafterbalance++;
1366 $element =
'banktransaction';
1367 if (!empty($extrafields->attributes[$element][
'label']) && is_array($extrafields->attributes[$element][
'label']) && count($extrafields->attributes[$element][
'label'])) {
1368 foreach ($extrafields->attributes[$element][
'label'] as $key => $val) {
1369 if (!empty($arrayfields[
"ef.".$key][
'checked'])) {
1370 if (!empty($arrayfields[$key][
'checked'])) {
1371 if (!$balancefieldfound) {
1372 $tmpnbfieldbeforebalance++;
1374 $tmpnbfieldafterbalance++;
1381 print
'<tr class="oddeven trforbreak">';
1386 if ($tmpnbfieldbeforebalance) {
1387 print
'<td colspan="'.$tmpnbfieldbeforebalance.
'">';
1392 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1393 print
'<td class="right">';
1394 if ($search_conciliated !==
'0') {
1399 if (!empty($arrayfields[
'balance'][
'checked'])) {
1400 print
'<td class="right">';
1401 if ($search_conciliated !==
'0') {
1406 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1411 print
'<td colspan="'.($tmpnbfieldafterbalance).
'">';
1424 if ($sortfield ==
'b.datev,b.dateo,b.rowid' && ($sortorder ==
'desc' || $sortorder ==
'desc,desc' || $sortorder ==
'desc,desc,desc')) {
1425 $balance =
price2num($balancebefore,
'MT');
1426 $balancebefore =
price2num($balancebefore - ($sign * $objp->amount),
'MT');
1428 $balancebefore =
price2num($balance,
'MT');
1429 $balance =
price2num($balance + ($sign * $objp->amount),
'MT');
1432 if (empty($cachebankaccount[$objp->bankid])) {
1433 $bankaccounttmp =
new Account($db);
1434 $bankaccounttmp->fetch($objp->bankid);
1435 $cachebankaccount[$objp->bankid] = $bankaccounttmp;
1436 $bankaccount = $bankaccounttmp;
1438 $bankaccount = $cachebankaccount[$objp->bankid];
1442 $backgroundcolor =
"class='oddeven'";
1444 if ($objp->amount < 0) {
1446 $backgroundcolor =
'style="background: '.$color.
';"';
1449 $backgroundcolor =
'style="background: '.$color.
';"';
1453 $banklinestatic->id = $objp->rowid;
1454 $banklinestatic->ref = $objp->rowid;
1456 print
'<tr class="oddeven" '.$backgroundcolor.
'>';
1460 print
'<td class="center">';
1461 if (!$objp->conciliated && $action ==
'reconcile') {
1462 print
'<input class="flat checkforselect" name="rowid['.$objp->rowid.
']" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'" size="1"'.(!empty($tmparray[$objp->rowid]) ?
' checked' :
'').
'>';
1466 $totalarray[
'nbfield']++;
1471 if (!empty($arrayfields[
'b.rowid'][
'checked'])) {
1472 print
'<td class="nowrap left">';
1473 print $banklinestatic->getNomUrl(1);
1476 $totalarray[
'nbfield']++;
1481 if (!empty($arrayfields[
'b.label'][
'checked'])) {
1485 preg_match(
'/\((.+)\)/i', $objp->label, $reg);
1486 if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
1488 $labeltoshow = $langs->trans($reg[1]);
1490 if ($objp->label ==
'(payment_salary)') {
1491 $labeltoshow = $langs->trans(
"SalaryPayment");
1494 $titletoshow = $objp->label;
1499 print
'<td class="tdoverflowmax250"'.($titletoshow ?
' title="'.dol_escape_htmltag($titletoshow).
'"' :
'').
'>';
1502 $cachebankaccount = array();
1503 foreach ($links as $key => $val) {
1504 print
'<!-- '.$links[$key][
'type'].
' -->';
1505 if ($links[$key][
'type'] ==
'withdraw') {
1506 $banktransferstatic->id = $links[$key][
'url_id'];
1507 $banktransferstatic->ref = $links[$key][
'label'];
1508 print $banktransferstatic->getNomUrl(0).($labeltoshow ?
' ' :
'');
1509 } elseif ($links[$key][
'type'] ==
'payment') {
1510 $paymentstatic->id = $links[$key][
'url_id'];
1511 $paymentstatic->ref = $links[$key][
'url_id'];
1512 $paymentstatic->date = $db->jdate($objp->do);
1513 print $paymentstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1514 } elseif ($links[$key][
'type'] ==
'payment_supplier') {
1515 $paymentsupplierstatic->id = $links[$key][
'url_id'];
1516 $paymentsupplierstatic->ref = $links[$key][
'url_id'];
1517 print $paymentsupplierstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1518 } elseif ($links[$key][
'type'] ==
'payment_sc') {
1519 $paymentscstatic->id = $links[$key][
'url_id'];
1520 $paymentscstatic->ref = $links[$key][
'url_id'];
1521 $paymentscstatic->label = $links[$key][
'label'];
1522 print $paymentscstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1523 } elseif ($links[$key][
'type'] ==
'payment_vat') {
1524 $paymentvatstatic->id = $links[$key][
'url_id'];
1525 $paymentvatstatic->ref = $links[$key][
'url_id'];
1526 print $paymentvatstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1527 } elseif ($links[$key][
'type'] ==
'payment_salary') {
1528 $paymentsalstatic->id = $links[$key][
'url_id'];
1529 $paymentsalstatic->ref = $links[$key][
'url_id'];
1530 $paymentsalstatic->label = $links[$key][
'label'];
1531 print $paymentsalstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1532 } elseif ($links[$key][
'type'] ==
'payment_loan') {
1533 print
'<a href="'.DOL_URL_ROOT.
'/loan/payment/card.php?id='.$links[$key][
'url_id'].
'">';
1534 print
' '.img_object($langs->trans(
'ShowPayment'),
'payment').
' ';
1535 print
'</a>'.($labeltoshow ?
' ' :
'');
1536 } elseif ($links[$key][
'type'] ==
'payment_donation') {
1537 $paymentdonationstatic->id = $links[$key][
'url_id'];
1538 $paymentdonationstatic->ref = $links[$key][
'url_id'];
1539 print $paymentdonationstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1540 } elseif ($links[$key][
'type'] ==
'payment_expensereport') {
1541 $paymentexpensereportstatic->id = $links[$key][
'url_id'];
1542 $paymentexpensereportstatic->ref = $links[$key][
'url_id'];
1543 print $paymentexpensereportstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1544 } elseif ($links[$key][
'type'] ==
'payment_various') {
1545 $paymentvariousstatic->id = $links[$key][
'url_id'];
1546 $paymentvariousstatic->ref = $links[$key][
'url_id'];
1547 print $paymentvariousstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1548 } elseif ($links[$key][
'type'] ==
'banktransfert') {
1550 if ($objp->amount > 0) {
1551 $banklinestatic->fetch($links[$key][
'url_id']);
1552 $bankstatic->id = $banklinestatic->fk_account;
1553 $bankstatic->label = $banklinestatic->bank_account_ref;
1554 print $langs->trans(
"TransferFrom").
' ';
1555 print $bankstatic->getNomUrl(1,
'transactions');
1556 print
' '.$langs->trans(
"toward").
' ';
1557 $bankstatic->id = $objp->bankid;
1558 $bankstatic->label = $objp->bankref;
1559 print $bankstatic->getNomUrl(1,
'');
1560 print($labeltoshow ?
' - ' :
'');
1562 $bankstatic->id = $objp->bankid;
1563 $bankstatic->label = $objp->bankref;
1564 print $langs->trans(
"TransferFrom").
' ';
1565 print $bankstatic->getNomUrl(1,
'');
1566 print
' '.$langs->trans(
"toward").
' ';
1567 $banklinestatic->fetch($links[$key][
'url_id']);
1568 $bankstatic->id = $banklinestatic->fk_account;
1569 $bankstatic->label = $banklinestatic->bank_account_ref;
1570 print $bankstatic->getNomUrl(1,
'transactions');
1571 print($labeltoshow ?
' - ' :
'');
1574 } elseif ($links[$key][
'type'] ==
'company') {
1575 } elseif ($links[$key][
'type'] ==
'user') {
1576 } elseif ($links[$key][
'type'] ==
'member') {
1577 } elseif ($links[$key][
'type'] ==
'sc') {
1578 } elseif ($links[$key][
'type'] ==
'vat') {
1579 } elseif ($links[$key][
'type'] ==
'salary') {
1583 print
'<a href="'.$links[$key][
'url'].$links[$key][
'url_id'].
'">';
1584 if (preg_match(
'/^\((.*)\)$/i', $links[$key][
'label'], $reg)) {
1586 if ($reg[1] ==
'paiement') {
1587 $reg[1] =
'Payment';
1589 print $langs->trans($reg[1]);
1591 print $links[$key][
'label'];
1593 print
'</a>'.($labeltoshow ?
' - ' :
'');
1601 $totalarray[
'nbfield']++;
1606 if (!empty($arrayfields[
'b.dateo'][
'checked'])) {
1607 print
'<td align="center" class="nowrap">';
1608 print
'<span class="spanforajaxedit" id="dateoperation_'.$objp->rowid.
'">'.
dol_print_date($db->jdate($objp->do),
"day").
"</span>";
1610 print
'<span class="inline-block">';
1611 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=doprev&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1613 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=donext&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1618 $totalarray[
'nbfield']++;
1623 if (!empty($arrayfields[
'b.datev'][
'checked'])) {
1624 print
'<td align="center" class="nowrap">';
1625 print
'<span class="spanforajaxedit" id="datevalue_'.$objp->rowid.
'">'.
dol_print_date($db->jdate($objp->dv),
"day").
"</span>";
1627 print
'<span class="inline-block">';
1628 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=dvprev&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1630 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=dvnext&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1635 $totalarray[
'nbfield']++;
1640 if (!empty($arrayfields[
'type'][
'checked'])) {
1641 print
'<td class="tdoverflowmax100">';
1642 $labeltype = ($langs->trans(
"PaymentTypeShort".$objp->fk_type) !=
"PaymentTypeShort".$objp->fk_type) ? $langs->trans(
"PaymentTypeShort".$objp->fk_type) : $langs->getLabelFromKey($db, $objp->fk_type,
'c_paiement',
'code',
'libelle',
'', 1);
1643 if ($labeltype ==
'SOLD') {
1650 $totalarray[
'nbfield']++;
1655 if (!empty($arrayfields[
'b.num_chq'][
'checked'])) {
1656 print
'<td class="nowrap" align="center">'.($objp->num_chq ?
dol_escape_htmltag($objp->num_chq) :
"").
"</td>\n";
1658 $totalarray[
'nbfield']++;
1663 if (!empty($arrayfields[
'bu.label'][
'checked'])) {
1664 print
'<td class="tdoverflowmax150">';
1666 $companylinked_id = 0;
1671 foreach ($links as $key => $value) {
1672 if ($links[$key][
'type'] ==
'payment_sc') {
1673 $type_link =
'payment_sc';
1675 if ($links[$key][
'type'] ==
'payment_salary') {
1676 $type_link =
'payment_salary';
1679 if ($links[$key][
'type'] ==
'company') {
1680 $companylinked_id = $links[$key][
'url_id'];
1682 if ($links[$key][
'type'] ==
'user') {
1683 $userlinked_id = $links[$key][
'url_id'];
1687 if ($companylinked_id) {
1689 $companystatic->fetch($companylinked_id);
1690 print $companystatic->getNomUrl(1);
1691 } elseif ($userlinked_id &&
1692 (($type_link ==
'payment_salary' && $user->hasRight(
'salaries',
'read'))
1693 || ($type_link ==
'payment_sc' && $user->hasRight(
'tax',
'charges',
'lire')))) {
1695 if (!empty($conf->cache[
'user'][$userlinked_id])) {
1696 $tmpuser = $conf->cache[
'user'][$userlinked_id];
1698 $tmpuser =
new User($db);
1699 $tmpuser->fetch($userlinked_id);
1700 $conf->cache[
'user'][$userlinked_id] = $tmpuser;
1702 print $tmpuser->getNomUrl(-1);
1709 $totalarray[
'nbfield']++;
1714 if (!empty($arrayfields[
'ba.ref'][
'checked'])) {
1715 print
'<td class="nowrap">';
1716 print $bankaccount->getNomUrl(1);
1719 $totalarray[
'nbfield']++;
1724 if (!empty($arrayfields[
'b.debit'][
'checked'])) {
1725 print
'<td class="nowrap right"><span class="amount">';
1726 if ($objp->amount < 0) {
1727 print
price($objp->amount * -1);
1728 $totalarray[
'totaldeb'] += $objp->amount;
1730 print
"</span></td>\n";
1732 $totalarray[
'nbfield']++;
1735 $totalarray[
'totaldebfield'] = $totalarray[
'nbfield'];
1740 if (!empty($arrayfields[
'b.credit'][
'checked'])) {
1741 print
'<td class="nowrap right"><span class="amount">';
1742 if ($objp->amount > 0) {
1743 print
price($objp->amount);
1744 $totalarray[
'totalcred'] += $objp->amount;
1746 print
"</span></td>\n";
1748 $totalarray[
'nbfield']++;
1751 $totalarray[
'totalcredfield'] = $totalarray[
'nbfield'];
1756 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1757 if ($mode_balance_ok) {
1758 if ($balancebefore >= 0) {
1759 print
'<td class="nowrap right"> '.price($balancebefore).
'</td>';
1761 print
'<td class="error nowrap right"> '.price($balancebefore).
'</td>';
1764 print
'<td class="right">-</td>';
1767 $totalarray[
'nbfield']++;
1772 if (!empty($arrayfields[
'balance'][
'checked'])) {
1773 if ($mode_balance_ok) {
1774 if ($balance >= 0) {
1775 print
'<td class="nowrap right"> '.price($balance).
'</td>';
1777 print
'<td class="error nowrap right"> '.price($balance).
'</td>';
1780 print
'<td class="right">-</td>';
1783 $totalarray[
'nbfield']++;
1787 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1788 print
'<td class="nowraponall" align="center">';
1790 if ($bankaccount->canBeConciliated() > 0) {
1791 if ($objp->num_releve) {
1792 print
'<a href="releve.php?num='.urlencode($objp->num_releve).
'&account='.urlencode($objp->bankid).
'&save_lastsearch_values=1">'.
dol_escape_htmltag($objp->num_releve).
'</a>';
1797 $totalarray[
'nbfield']++;
1798 $posconciliatecol = $totalarray[
'nbfield'];
1802 if (!empty($arrayfields[
'b.conciliated'][
'checked'])) {
1803 print
'<td class="nowraponall" align="center">';
1804 print
yn($objp->conciliated);
1807 $totalarray[
'nbfield']++;
1811 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1812 $bordereaustatic->fetch($objp->fk_bordereau);
1813 print
'<td class="nowraponall" align="center">';
1814 print $bordereaustatic->getNomUrl();
1817 $totalarray[
'nbfield']++;
1822 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $objp,
'i' => $i,
'totalarray' => &$totalarray);
1823 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $objecttmp);
1824 print $hookmanager->resPrint;
1827 print
'<td class="nowraponall" align="center">';
1829 if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) {
1830 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ?
'&account='.$object->id :
'').
'&page='.$page.
'">';
1834 if ($user->hasRight(
'banque',
'modifier') || $user->hasRight(
'banque',
'consolidate')) {
1835 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ?
'&account='.$object->id :
'').
'&page='.$page.
'">';
1839 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ?
'&account='.$object->id :
'').
'&page='.$page.
'">';
1843 if ($bankaccount->canBeConciliated() > 0 && empty($objp->conciliated)) {
1844 if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay)) {
1845 print
' '.img_warning($langs->trans(
"ReconciliationLate"));
1848 if ($user->hasRight(
'banque',
'modifier')) {
1849 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&rowid='.$objp->rowid.
'&page='.$page.$param.($sortfield ?
'&sortfield='.$sortfield :
'').($sortorder ?
'&sortorder='.$sortorder :
'').
'">';
1850 print
img_delete(
'',
'class="marginleftonly"');
1856 $totalarray[
'nbfield']++;
1861 print
'<td class="center">';
1862 if (!$objp->conciliated && $action ==
'reconcile') {
1863 print
'<input class="flat checkforselect" name="rowid['.$objp->rowid.
']" type="checkbox" value="'.$objp->rowid.
'" size="1"'.(!empty($tmparray[$objp->rowid]) ?
' checked' :
'').
'>';
1867 $totalarray[
'nbfield']++;
1877 if (isset($totalarray[
'totaldebfield']) || isset($totalarray[
'totalcredfield'])) {
1878 print
'<tr class="liste_total">';
1880 while ($i < $totalarray[
'nbfield']) {
1883 if ($num < $limit && empty($offset)) {
1884 print
'<td class="left">'.$langs->trans(
"Total").
'</td>';
1886 print
'<td class="left tdoverflowmax50" title="'.$langs->trans(
"Totalforthispage").
'">'.$langs->trans(
"Totalforthispage").
'</td>';
1888 } elseif ($totalarray[
'totaldebfield'] == $i) {
1889 print
'<td class="right"><span class="amount">'.price(-1 * $totalarray[
'totaldeb']).
'</span></td>';
1890 } elseif ($totalarray[
'totalcredfield'] == $i) {
1891 print
'<td class="right"><span class="amount">'.price($totalarray[
'totalcred']).
'</span></td>';
1892 } elseif ($i == $posconciliatecol) {
1893 print
'<td class="center">';
1894 if ($user->hasRight(
'banque',
'consolidate') && $action ==
'reconcile') {
1895 print
'<input class="button smallpaddingimp" name="confirm_reconcile" type="submit" value="'.$langs->trans(
"Conciliate").
'">';
1908 foreach ($arrayfields as $key => $val) {
1909 if (!empty($val[
'checked'])) {
1913 print
'<tr><td colspan="'.($colspan + 1).
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Class to manage bank accounts.
const TYPE_CASH
Cash account.
Class to manage bank transaction lines.
Class to manage members of a foundation.
Class to manage bank categories.
Class to manage withdrawal receipts.
Class for managing the social charges.
Class to manage donations.
Class to manage payments for supplier invoices.
Class to manage payments of customer invoices.
Class to manage payments of donations.
Class to manage payments of expense report.
Class to manage payments of salaries.
Class to manage payments of social contributions.
Class to manage payments of social contributions.
Class to manage various payments.
Class to manage cheque delivery receipts.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_view($titlealt='default', $float=0, $other='class="valignmiddle"')
Show logo view card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
img_edit_add($titlealt='default', $other='')
Show logo +.
getDolGlobalString($key, $default='')
Return 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.
img_edit_remove($titlealt='default', $other='')
Show logo -.
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...
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.