36require
'../../main.inc.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
50require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/bankcateg.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/paymentvat.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
63require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
64require_once DOL_DOCUMENT_ROOT.
'/don/class/paymentdonation.class.php';
65require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/paymentexpensereport.class.php';
66require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
67require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
68require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
71$langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"margins",
"salaries",
"loan",
"donations",
"trips",
"members",
"compta",
"accountancy"));
75$action =
GETPOST(
'action',
'aZ09');
76$cancel =
GETPOST(
'cancel',
'alpha');
77$confirm =
GETPOST(
'confirm',
'alpha');
78$contextpage =
'bankentrieslist';
79$massaction =
GETPOST(
'massaction',
'alpha');
80$optioncss =
GETPOST(
'optioncss',
'aZ09');
84$search_debit =
GETPOST(
"search_debit",
'alpha');
85$search_credit =
GETPOST(
"search_credit",
'alpha');
86$search_type =
GETPOST(
"search_type",
'alpha');
87$search_account =
GETPOST(
"search_account",
'int') ?
GETPOST(
"search_account",
'int') :
GETPOST(
"account",
'int');
88$search_accountancy_code =
GETPOST(
'search_accountancy_code',
'alpha') ?
GETPOST(
'search_accountancy_code',
'alpha') :
GETPOST(
'accountancy_code',
'alpha');
90$search_ref =
GETPOST(
'search_ref',
'alpha');
91$search_description =
GETPOST(
"search_description",
'alpha');
96$search_thirdparty_user =
GETPOST(
"search_thirdparty",
'alpha') ?
GETPOST(
"search_thirdparty",
'alpha') :
GETPOST(
"thirdparty",
'alpha');
97$search_req_nb =
GETPOST(
"req_nb",
'alpha');
98$search_num_releve =
GETPOST(
"search_num_releve",
'alpha');
99$search_conciliated =
GETPOST(
"search_conciliated",
'int');
100$search_fk_bordereau =
GETPOST(
"search_fk_bordereau",
'int');
101$optioncss =
GETPOST(
'optioncss',
'alpha');
102$toselect =
GETPOST(
'toselect',
'array:int');
103$num_releve =
GETPOST(
"num_releve",
"alpha");
109$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
110$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
112if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
116$offset = $limit * $page;
117$pageprev = $page - 1;
118$pagenext = $page + 1;
120 $sortorder =
'desc,desc,desc';
123 $sortfield =
'b.datev,b.dateo,b.rowid';
127if ($id > 0 || !empty($ref)) {
128 $result =
$object->fetch($id, $ref);
137$contextpage =
'banktransactionlist'.(empty(
$object->id) ?
'' :
'-'.$object->id);
139$mode_balance_ok =
false;
141if (($sortfield ==
'b.datev' || $sortfield ==
'b.datev,b.dateo,b.rowid')) {
142 $sortfield =
'b.datev,b.dateo,b.rowid';
143 if ($id > 0 || !empty($ref) || $search_account > 0) {
144 $mode_balance_ok =
true;
149$hookmanager->initHooks(array(
'banktransactionlist', $contextpage));
151$extrafieldsobjectkey =
'bank';
154$extrafields->fetch_name_optionals_label($extrafieldsobjectkey);
155$search_array_options = $extrafields->getOptionalsFromPost($extrafieldsobjectkey,
'',
'search_');
158 'b.rowid' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1',
'position' => 10),
159 'b.label' => array(
'label' => $langs->trans(
"Description"),
'checked' =>
'1',
'position' => 20),
160 'b.dateo' => array(
'label' => $langs->trans(
"DateOperationShort"),
'checked' =>
'-1',
'position' => 30),
161 'b.datev' => array(
'label' => $langs->trans(
"DateValueShort"),
'checked' =>
'1',
'position' => 40),
162 'type' => array(
'label' => $langs->trans(
"Type"),
'checked' =>
'1',
'position' => 50),
163 'b.num_chq' => array(
'label' => $langs->trans(
"Numero"),
'checked' =>
'0',
'position' => 60),
164 'b.fk_bordereau' => array(
'label' => $langs->trans(
"ChequeNumber"),
'checked' =>
'0',
'position' => 65),
165 'bu.label' => array(
'label' => $langs->trans(
"ThirdParty").
'/'.$langs->trans(
"User"),
'checked' =>
'1',
'position' => 70),
166 'ba.ref' => array(
'label' => $langs->trans(
"BankAccount"),
'checked' => (($id > 0 || !empty($ref)) ?
'0' :
'1'),
'position' => 80),
167 'b.debit' => array(
'label' => $langs->trans(
"Debit"),
'checked' =>
'1',
'position' => 90),
168 'b.credit' => array(
'label' => $langs->trans(
"Credit"),
'checked' =>
'1',
'position' => 100),
169 'balancebefore' => array(
'label' => $langs->trans(
"BalanceBefore"),
'checked' =>
'0',
'position' => 110),
170 'balance' => array(
'label' => $langs->trans(
"Balance"),
'checked' =>
'1',
'position' => 120),
171 'b.num_releve' => array(
'label' => $langs->trans(
"AccountStatement"),
'checked' =>
'1',
'position' => 130),
172 'b.conciliated' => array(
'label' => $langs->trans(
"BankLineReconciled"),
'enabled' => (string) (int)
$object->rappro,
'checked' => ($action ==
'reconcile' ?
'1' :
'0'),
'position' => 140),
175include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
177$parameters = array(
'arrayfields' => &$arrayfields);
178$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
184$fieldvalue = (!empty($id) ?
$id : (!empty($ref) ? $ref :
''));
185$fieldtype = (!empty($ref) ?
'ref' :
'rowid');
188 $socid = $user->socid;
190 $result =
restrictedArea($user,
'banque', $fieldvalue,
'bank_account&bank_account',
'',
'', $fieldtype);
193 $socid = $user->socid;
203if (
GETPOST(
'cancel',
'alpha')) {
207if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
211$parameters = array();
212$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
214 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
217include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
219if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
220 $search_dt_start =
'';
222 $search_dv_start =
'';
230 $search_description =
'';
231 $search_thirdparty_user =
'';
232 $search_num_releve =
'';
233 $search_conciliated =
'';
234 $search_fk_bordereau =
'';
237 $search_account =
"";
238 if ($id > 0 || !empty($ref)) {
243if (empty($reshook)) {
244 $objectclass =
'Account';
245 $objectlabel =
'BankTransaction';
246 $permissiontoread = $user->hasRight(
'banque',
'lire');
247 $permissiontodelete = $user->hasRight(
'banque',
'modifier');
248 $uploaddir =
$conf->bank->dir_output;
249 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
252$rowids =
GETPOST(
'rowid',
'array:int');
255if ((
GETPOST(
'confirm_savestatement',
'alpha') ||
GETPOST(
'confirm_reconcile',
'alpha'))
256 && (
GETPOST(
"num_releve",
"alpha") || !empty($rowids))
257 && $user->hasRight(
'banque',
'consolidate')
262 $num_releve =
GETPOST(
"num_releve",
"alpha");
267 $rowids =
GETPOST(
'rowid',
'array:int');
269 if (!empty($rowids) && is_array($rowids)) {
270 foreach ($rowids as $row) {
272 $result = $bankline->fetch($row);
273 $bankline->num_releve = $num_releve;
274 $result = $bankline->update_conciliation($user,
GETPOSTINT(
"cat"),
GETPOST(
'confirm_reconcile',
'alpha') ? 1 : 0);
276 setEventMessages($bankline->error, $bankline->errors,
'errors');
282 if (!$error && count($rowids) > 0) {
283 setEventMessages($langs->trans(
"XNewLinesConciliated", count($rowids)),
null);
287 $langs->load(
"errors");
288 setEventMessages($langs->trans(
"NoRecordSelected"),
null,
'errors');
292 $langs->load(
"errors");
293 setEventMessages($langs->trans(
"ErrorPleaseTypeBankTransactionReportName"),
null,
'errors');
297 $param =
'action=reconcile&contextpage=banktransactionlist&id='.((int)
$object->id).
'&search_account='.((int)
$object->id);
299 $param .=
'&page='.urlencode((
string) ($page));
302 $param .=
'&offset='.urlencode((
string) ($offset));
305 $param .=
'&limit='.((int) $limit);
307 if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
308 $param .=
'&search_conciliated='.urlencode((
string) ($search_conciliated));
310 if ($search_thirdparty_user) {
311 $param .=
'&search_thirdparty='.urlencode($search_thirdparty_user);
313 if ($search_num_releve) {
314 $param .=
'&search_num_releve='.urlencode($search_num_releve);
316 if ($search_description) {
317 $param .=
'&search_description='.urlencode($search_description);
320 $param .=
'&search_start_dtmonth='.GETPOSTINT(
'search_start_dtmonth').
'&search_start_dtday='.
GETPOSTINT(
'search_start_dtday').
'&search_start_dtyear='.
GETPOSTINT(
'search_start_dtyear');
323 $param .=
'&search_end_dtmonth='.GETPOSTINT(
'search_end_dtmonth').
'&search_end_dtday='.
GETPOSTINT(
'search_end_dtday').
'&search_end_dtyear='.
GETPOSTINT(
'search_end_dtyear');
326 $param .=
'&search_start_dvmonth='.GETPOSTINT(
'search_start_dvmonth').
'&search_start_dvday='.
GETPOSTINT(
'search_start_dvday').
'&search_start_dvyear='.
GETPOSTINT(
'search_start_dvyear');
329 $param .=
'&search_end_dvmonth='.GETPOSTINT(
'search_end_dvmonth').
'&search_end_dvday='.
GETPOSTINT(
'search_end_dvday').
'&search_end_dvyear='.
GETPOSTINT(
'search_end_dvyear');
332 $param .=
'&search_type='.urlencode($search_type);
335 $param .=
'&search_debit='.urlencode($search_debit);
337 if ($search_credit) {
338 $param .=
'&search_credit='.urlencode($search_credit);
340 $param .=
'&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder);
341 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.$param);
347if (
GETPOST(
'save') && !$cancel && $user->hasRight(
'banque',
'modifier')) {
356 $operation =
GETPOST(
"operation",
'alpha');
357 $num_chq =
GETPOST(
"num_chq",
'alpha');
358 $label =
GETPOST(
"label",
'alpha');
359 $cat1 =
GETPOST(
"cat1",
'alpha');
361 $bankaccountid =
$id;
367 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
371 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
375 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
379 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
381 if (!($bankaccountid > 0)) {
383 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankAccount")),
null,
'errors');
393 $objecttmp->fetch($bankaccountid);
394 $insertid = $objecttmp->addline((
int) $dateop, $operation, $label, (
float) $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user,
'',
'', $search_accountancy_code);
396 setEventMessages($langs->trans(
"RecordSaved"),
null,
'mesgs');
397 header(
"Location: ".$_SERVER[
'PHP_SELF'].($id ?
"?id=".$id :
''));
407if ($action ==
'confirm_deleteonreconcile' && $confirm ==
'yes' && $user->hasRight(
'banque',
'modifier')) {
409 $result = $accline->fetch(
GETPOSTINT(
"rowid"));
410 $result = $accline->delete($user);
412 setEventMessages($accline->error, $accline->errors,
'errors');
414 setEventMessages(
'RecordDeleted',
null,
'mesgs');
417 $action =
'reconcile';
420if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'banque',
'modifier')) {
422 $result = $accline->fetch(
GETPOSTINT(
"rowid"));
423 $result = $accline->delete($user);
425 setEventMessages($accline->error, $accline->errors,
'errors');
427 setEventMessages(
'RecordDeleted',
null,
'mesgs');
436$form =
new Form($db);
440$companystatic =
new Societe($db);
441$bankaccountstatic =
new Account($db);
442$userstatic =
new User($db);
445$societestatic =
new Societe($db);
446$userstatic =
new User($db);
448$loanstatic =
new Loan($db);
450$donstatic =
new Don($db);
467if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
468 $param .=
'&contextpage='.urlencode($contextpage);
470if ($limit > 0 && $limit !=
$conf->liste_limit) {
471 $param .=
'&limit='.((int) $limit);
474 $param .=
'&id='.urlencode((
string) (
$id));
477 $param .=
'&ref='.urlencode($ref);
479if (!empty($search_ref)) {
480 $param .=
'&search_ref='.urlencode($search_ref);
482if (!empty($search_description)) {
483 $param .=
'&search_description='.urlencode($search_description);
485if (!empty($search_type)) {
486 $param .=
'&type='.urlencode($search_type);
488if (!empty($search_thirdparty_user)) {
489 $param .=
'&search_thirdparty='.urlencode($search_thirdparty_user);
491if (!empty($search_debit)) {
492 $param .=
'&search_debit='.urlencode($search_debit);
494if (!empty($search_credit)) {
495 $param .=
'&search_credit='.urlencode($search_credit);
497if ($search_account > 0) {
498 $param .=
'&search_account='.((int) $search_account);
500if (!empty($search_num_releve)) {
501 $param .=
'&search_num_releve='.urlencode($search_num_releve);
503if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
504 $param .=
'&search_conciliated='.urlencode((
string) ($search_conciliated));
506if ($search_fk_bordereau > 0) {
507 $param .=
'$&search_fk_bordereau='.urlencode((
string) ($search_fk_bordereau));
509if ($search_bid > 0) {
510 $param .=
'&search_bid='.((int) $search_bid);
513 $param .=
'&search_start_dtmonth='.GETPOSTINT(
'search_start_dtmonth').
'&search_start_dtday='.
GETPOSTINT(
'search_start_dtday').
'&search_start_dtyear='.
GETPOSTINT(
'search_start_dtyear');
516 $param .=
'&search_end_dtmonth='.GETPOSTINT(
'search_end_dtmonth').
'&search_end_dtday='.
GETPOSTINT(
'search_end_dtday').
'&search_end_dtyear='.
GETPOSTINT(
'search_end_dtyear');
519 $param .=
'&search_start_dvmonth='.GETPOSTINT(
'search_start_dvmonth').
'&search_start_dvday='.
GETPOSTINT(
'search_start_dvday').
'&search_start_dvyear='.
GETPOSTINT(
'search_start_dvyear');
522 $param .=
'&search_end_dvmonth='.GETPOSTINT(
'search_end_dvmonth').
'&search_end_dvday='.
GETPOSTINT(
'search_end_dvday').
'&search_end_dvyear='.
GETPOSTINT(
'search_end_dvyear');
525 $param .=
'&req_nb='.urlencode($search_req_nb);
528 $param .=
'&thirdparty='.urlencode((
string) (
GETPOSTINT(
"search_thirdparty")));
530if ($optioncss !=
'') {
531 $param .=
'&optioncss='.urlencode($optioncss);
533if ($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile') {
534 $param .=
'&action=reconcile';
542include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
546$buttonreconcile =
'';
549if ($id > 0 || !empty($ref)) {
550 $title =
$object->ref.
' - '.$langs->trans(
"Transactions");
552 $title = $langs->trans(
"BankTransactions");
556llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $param);
559if ($id > 0 || !empty($ref)) {
561 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/bankcateg.class.php';
564 $arrayofbankcateg = $bankcateg->fetchAll();
565 foreach ($arrayofbankcateg as $bankcategory) {
566 $options[$bankcategory->id] = $bankcategory->label;
571 $activetab =
'journal';
572 if ($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile') {
573 $activetab =
'reconcile';
575 print
dol_get_fiche_head($head, $activetab, $langs->trans(
"FinancialAccount"), 0,
'account');
577 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
579 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
584$sql =
"SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.amount_main_currency, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
585$sql .=
" b.fk_account, b.fk_type, b.fk_bordereau,";
586$sql .=
" ba.rowid as bankid, ba.ref as bankref";
588if (!empty($extrafields->attributes[$extrafieldsobjectkey][
'label'])) {
589 foreach ($extrafields->attributes[$extrafieldsobjectkey][
'label'] as $key => $val) {
590 $sql .= ($extrafields->attributes[$extrafieldsobjectkey][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
594$parameters = array();
595$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
596$sql .= $hookmanager->resPrint;
598if ($search_bid > 0) {
599 $sql .= MAIN_DB_PREFIX.
"category_bankline as l,";
601$sql .=
" ".MAIN_DB_PREFIX.
"bank_account as ba,";
602$sql .=
" ".MAIN_DB_PREFIX.
"bank as b";
603if (!empty($extrafields->attributes[$extrafieldsobjectkey][
'label']) && is_array($extrafields->attributes[$extrafieldsobjectkey][
'label']) && count($extrafields->attributes[$extrafieldsobjectkey][
'label'])) {
604 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$extrafieldsobjectkey.
"_extrafields as ef on (b.rowid = ef.fk_object)";
608$parameters = array();
609$reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters, $object, $action);
610$sql .= $hookmanager->resPrint;
612$sql .=
" WHERE b.fk_account = ba.rowid";
613$sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
614if ($search_account > 0) {
615 $sql .=
" AND b.fk_account = ".((int) $search_account);
619 $sql .=
" AND b.dateo >= '".$db->idate($search_dt_start).
"'";
622 $sql .=
" AND b.dateo <= '".$db->idate($search_dt_end).
"'";
626 $sql .=
" AND b.datev >= '".$db->idate($search_dv_start).
"'";
629 $sql .=
" AND b.datev <= '".$db->idate($search_dv_end).
"'";
637if ($search_num_releve) {
640if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
641 $sql .=
" AND b.rappro = ".((int) $search_conciliated);
643if ($search_fk_bordereau > 0) {
644 $sql .=
" AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
646if ($search_thirdparty_user) {
647 $sql .=
" AND (b.rowid IN ";
648 $sql .=
" ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX.
"bank_url AS bu";
649 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bank AS b2 ON b2.rowid = bu.fk_bank";
650 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
651 $sql .=
" WHERE ".
natural_search(array(
"subUser.firstname",
"subUser.lastname"), $search_thirdparty_user, 0, 1).
")";
653 $sql .=
" OR b.rowid IN ";
654 $sql .=
" ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX.
"bank_url AS bu";
655 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bank AS b2 ON b2.rowid = bu.fk_bank";
656 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
657 $sql .=
" WHERE ".
natural_search(array(
"subSoc.nom"), $search_thirdparty_user, 0, 1);
660if ($search_description) {
661 $search_description_to_use = $search_description;
662 $arrayoffixedlabels = array(
664 'CustomerInvoicePayment',
665 'CustomerInvoicePaymentBack',
666 'SupplierInvoicePayment',
667 'SupplierInvoicePaymentBack',
669 'ExpenseReportPayment',
670 'SocialContributionPayment',
671 'SubscriptionPayment',
674 foreach ($arrayoffixedlabels as $keyforlabel) {
675 $translatedlabel = $langs->transnoentitiesnoconv($keyforlabel);
676 if (preg_match(
'/'.$search_description.
'/i', $translatedlabel)) {
677 $search_description_to_use .=
"|".$keyforlabel;
683if ($search_bid > 0) {
684 $sql .=
" AND b.rowid = l.lineid AND l.fk_categ = ".((int) $search_bid);
686if (!empty($search_type)) {
687 $sql .=
" AND b.fk_type = '".$db->escape($search_type).
"'";
692 $sql .=
' AND b.amount <= 0';
696 $sql .=
' AND b.amount >= 0';
699include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
702$parameters = array();
703$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
704$sql .= $hookmanager->resPrint;
706$sql .= $db->order($sortfield, $sortorder);
708$nbtotalofrecords =
'';
711 $result = $db->query($sql);
712 $nbtotalofrecords = $db->num_rows($result);
713 $nbtotalofpages = ceil($nbtotalofrecords / $limit);
716if ($page >= $nbtotalofpages) {
718 $page = ($nbtotalofpages - 1);
719 $offset = $limit * $page;
727if (empty($search_account)) {
728 $mode_balance_ok =
false;
731if (!empty($search_ref)) {
732 $mode_balance_ok =
false;
734if (!empty($search_description)) {
735 $mode_balance_ok =
false;
737if (!empty($search_type)) {
738 $mode_balance_ok =
false;
740if (!empty($search_debit)) {
741 $mode_balance_ok =
false;
743if (!empty($search_credit)) {
744 $mode_balance_ok =
false;
746if (!empty($search_thirdparty_user)) {
747 $mode_balance_ok =
false;
749if ($search_conciliated !=
'' && $search_conciliated !=
'-1') {
750 $mode_balance_ok =
false;
752if (!empty($search_num_releve)) {
753 $mode_balance_ok =
false;
755if (!empty($search_fk_bordereau)) {
756 $mode_balance_ok =
false;
759$sql .= $db->plimit($limit + 1, $offset);
761dol_syslog(
'compta/bank/bankentries_list.php', LOG_DEBUG);
762$resql = $db->query($sql);
764 $num = $db->num_rows($resql);
766 $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array();
769 $arrayofmassactions = array(
773 if (in_array($massaction, array(
'presend',
'predelete'))) {
774 $arrayofmassactions = array();
776 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
779 if ($action ==
'delete') {
780 $text = $langs->trans(
'ConfirmDeleteTransaction');
781 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&rowid='.
GETPOSTINT(
"rowid"), $langs->trans(
'DeleteTransaction'), $text,
'confirm_delete',
null,
'', 1);
785 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'" name="search_form" spellcheck="false">'.
"\n";
786 if ($optioncss !=
'') {
787 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
789 print
'<input type="hidden" name="token" value="'.newToken().
'">';
790 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
791 print
'<input type="hidden" name="action" value="'.($action !=
'delete' ? $action :
'search').
'">';
793 print
'<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).
'">';
795 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
796 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
797 print
'<input type="hidden" name="page" value="'.$page.
'">';
798 print
'<input type="hidden" name="id" value="'.$id.
'">';
799 print
'<input type="hidden" name="ref" value="'.$ref.
'">';
801 print
'<input type="hidden" name="bid" value="'.GETPOSTINT(
"bid").
'">';
805 if ($user->hasRight(
'banque',
'modifier') && $action ==
'addline' &&
getDolGlobalString(
'BANK_USE_OLD_VARIOUS_PAYMENT')) {
808 print
'<table class="noborder centpercent">';
810 print
'<tr class="liste_titre">';
811 print
'<td>'.$langs->trans(
"Description").
'</td>';
812 print
'<td>'.$langs->trans(
"Date").
'</td>';
813 print
'<td> </td>';
814 print
'<td>'.$langs->trans(
"Type").
'</td>';
815 print
'<td>'.$langs->trans(
"Numero").
'</td>';
816 print
'<td class=right>'.$langs->trans(
"BankAccount").
'</td>';
817 print
'<td class=right>'.$langs->trans(
"Debit").
'</td>';
818 print
'<td class=right>'.$langs->trans(
"Credit").
'</td>';
825 print
'<td class="center"> </td>';
830 print
'<input name="label" class="flat minwidth200" type="text" value="'.GETPOST(
"label",
"alpha").
'">';
831 if (is_array($options) && count($options)) {
832 print
'<br>'.$langs->trans(
"Rubrique").
': ';
836 print
'<td class="nowrap">';
837 print $form->selectDate(empty($dateop) ? -1 : $dateop,
'op', 0, 0, 0,
'transaction');
839 print
'<td> </td>';
840 print
'<td class="nowrap">';
841 print $form->select_types_paiements((
GETPOST(
'operation') ?
GETPOST(
'operation') : (
$object->
type ==
Account::TYPE_CASH ?
'LIQ' :
'')),
'operation',
'1,2', 2, 1, 0, 0, 1,
'', 1);
844 print
'<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST(
"num_chq",
"alpha").
'">';
848 print
'<td class=right>';
849 print $form->select_comptes(
GETPOSTINT(
'add_account') ?
GETPOSTINT(
'add_account') : $search_account,
'add_account', 0,
'', 1, (
$id > 0 || !empty($ref) ?
' disabled="disabled"' :
''), 0,
'', 1);
852 print
'<td class="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST(
"adddebit",
"alpha").
'"></td>';
853 print
'<td class="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST(
"addcredit",
"alpha").
'"></td>';
860 print
'<td class="center">';
861 print
'<input type="submit" name="save" class="button buttongen marginbottomonly button-add" value="'.$langs->trans(
"Add").
'"><br>';
862 print
'<input type="submit" name="cancel" class="button buttongen marginbottomonly button-cancel" value="'.$langs->trans(
"Cancel").
'">';
870 $urlajax = DOL_URL_ROOT.
'/core/ajax/bankconciliate.php?format=dayreduceformat&token='.
currentToken();
872 <script type="text/javascript">
874 $("a.ajaxforbankoperationchange").each(function(){
875 var current = $(this);
876 current.click(function()
878 var url = "'.$urlajax.
'&"+current.attr("href").split("?")[1];
879 console.log("We click on ajaxforbankoperationchange url="+url);
880 $.get(url, function(data)
883 current.parent().parent().find(".spanforajaxedit").replaceWith(data);
898 if ($action !=
'addline') {
900 if (
$object->status == $object::STATUS_CLOSED) {
901 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddBankRecord'),
'Bank account is closed',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?action=addline&token='.
newToken().
'&page='.$page.$param,
'', -2);
904 $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->hasRight(
'banque',
'modifier'));
906 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddBankRecord'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?action=addline&token='.
newToken().
'&page='.$page.$param,
'', $user->hasRight(
'banque',
'modifier'));
910 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddBankRecord'),
'Direct input in bank lines has been disabled by option BANK_DISABLE_DIRECT_INPUT',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?action=addline&token='.
newToken().
'&page='.$page.$param,
'', -2);
916 if ($action !=
'addline' && $action !=
'reconcile' && $action !=
'confirm_deleteonreconcile') {
917 $morehtml .= $buttonreconcile;
920 $morehtmlright =
'<!-- Add New button -->'.$newcardbutton;
922 $picto =
'bank_account';
923 if ($id > 0 || !empty($ref)) {
928 print_barre_liste($langs->trans(
"BankTransactions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton.$morehtml, $num, $nbtotalofrecords, $picto, 0, $morehtmlright,
'', $limit, 0, 0, 1);
931 if ($user->hasRight(
'banque',
'consolidate') && ($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile')) {
934 $listoflastreceipts =
'';
935 $sql =
"SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX.
"bank";
936 $sql .=
" WHERE fk_account = ".((int)
$object->id).
" AND num_releve IS NOT NULL";
937 $sql .= $db->order(
"num_releve",
"DESC");
938 $sql .= $db->plimit($nbmax + 1);
940 $last_receipts = array();
945 $resqlr = $db->query($sql);
948 $numr = $db->num_rows($resqlr);
949 while (($i < $numr) && ($i < $nbmax)) {
950 $objr = $db->fetch_object($resqlr);
952 $last_receipts[] = $objr->num_releve;
954 $last_releve = $objr->num_releve;
962 print
'<!-- form with reconciliation input -->'.
"\n";
963 print
'<div class="valignmiddle inline-block" style="padding-right: 20px;">';
965 print
'<strong>'.$langs->trans(
"InputReceiptNumber").
'</strong>: ';
966 print
'<input class="flat width100 center" id="num_releve" list="num_releve_list" name="num_releve" type="text" value="'.(GETPOST(
'num_releve') ?
GETPOST(
'num_releve') :
'').
'">';
968 $texttoshow = $langs->trans(
"InputReceiptNumber").
': ';
969 $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);
970 $mm =
dol_substr($langs->transnoentitiesnoconv(
"Month"), 0, 1).substr($langs->transnoentitiesnoconv(
"Month"), 0, 1);
971 $dd =
dol_substr($langs->transnoentitiesnoconv(
"Day"), 0, 1).substr($langs->transnoentitiesnoconv(
"Day"), 0, 1);
972 $placeholder = $yyyy.$mm;
973 $placeholder2 = $yyyy.$mm;
974 $placeholder2 .=
' '.$langs->trans(
"or").
' ';
975 $placeholder2 .= $yyyy.$mm.$dd;
977 $texttoshow .= $langs->trans(
"InputReceiptNumberBis");
980 print
'<input class="flat width100 center" pattern="[0-9]+" title="'.dol_escape_htmltag($texttoshow.
': '.$placeholder2).
'" id="num_releve" list="num_releve_list" name="num_releve" placeholder="'.
dol_escape_htmltag($placeholder).
'" type="text" value="'.(
GETPOSTINT(
'num_releve') ?
GETPOSTINT(
'num_releve') :
'').
'">';
984 if (!empty($last_receipts)) {
985 print
'<datalist id="num_releve_list">';
986 foreach ($last_receipts as $num_releve) {
987 print
'<option value="'.$num_releve.
'"></option>';
993 if (is_array($options) && count($options)) {
994 print $langs->trans(
"EventualyAddCategory").
': ';
997 print
'<br><div style="margin-top: 5px;"><span class="opacitymedium">'.$langs->trans(
"ThenCheckLinesAndConciliate").
'</span> ';
998 print
'<input type="submit" class="button" name="confirm_reconcile" value="'.$langs->trans(
"Conciliate").
'">';
999 print
' <span class="opacitymedium">'.$langs->trans(
"otherwise").
'</span> ';
1000 print
'<input type="submit" class="button small" name="confirm_savestatement" value="'.$langs->trans(
"SaveStatementOnly").
'">';
1006 print
'<!-- Last bank statements -->'.
"\n";
1007 print $langs->trans(
"LastAccountStatements").
' : ';
1009 foreach ($last_receipts as $num_releve) {
1010 $newentreyinlist =
'<a target="_blank" href="'.DOL_URL_ROOT.
'/compta/bank/releve.php?account='.((int) $id).
'&num='.urlencode($num_releve).
'">';
1011 $newentreyinlist .= img_picto($num_releve,
'generic',
'class="paddingright"');
1013 $listoflastreceipts = $newentreyinlist.$listoflastreceipts;
1015 if ($numr >= $nbmax) {
1016 $listoflastreceipts =
"... ".$listoflastreceipts;
1018 print $listoflastreceipts;
1020 print
'<b>'.$langs->trans(
"None").
'</b>';
1026 <script type="text/javascript">
1027 $("#num_releve").val("' . $last_releve.
'");
1036 $param .=
'&page='.urlencode((
string) ($page));
1039 $moreforfilter =
'';
1040 $moreforfilter .=
'<div class="divsearchfield">';
1041 $moreforfilter .= $langs->trans(
'DateOperationShort');
1042 $moreforfilter .= (
$conf->browser->layout ==
'phone' ?
'<br>' :
' ');
1043 $moreforfilter .=
'<div class="nowrap inline-block">';
1044 $moreforfilter .= $form->selectDate($search_dt_start,
'search_start_dt', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1045 $moreforfilter .=
'</div>';
1046 $moreforfilter .= (
$conf->browser->layout ==
'phone' ?
'' :
' ');
1047 $moreforfilter .=
'<div class="nowrap inline-block">';
1048 $moreforfilter .= $form->selectDate($search_dt_end,
'search_end_dt', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1049 $moreforfilter .=
'</div>';
1050 $moreforfilter .=
'</div>';
1052 $moreforfilter .=
'<div class="divsearchfield">';
1053 $moreforfilter .= $langs->trans(
'DateValueShort');
1054 $moreforfilter .= (
$conf->browser->layout ==
'phone' ?
'<br>' :
' ');
1055 $moreforfilter .=
'<div class="nowrap inline-block">';
1056 $moreforfilter .= $form->selectDate($search_dv_start,
'search_start_dv', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1057 $moreforfilter .=
'</div>';
1058 $moreforfilter .= (
$conf->browser->layout ==
'phone' ?
'' :
' ');
1059 $moreforfilter .=
'<div class="nowrap inline-block">';
1060 $moreforfilter .= $form->selectDate($search_dv_end,
'search_end_dv', 0, 0, 1,
"search_form", 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1061 $moreforfilter .=
'</div>';
1062 $moreforfilter .=
'</div>';
1066 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1067 $langs->load(
'categories');
1070 $moreforfilter .=
'<div class="divsearchfield">';
1071 $tmptitle = $langs->trans(
'RubriquesTransactions');
1072 $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid,
'parent', 0, 0, 1);
1073 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1074 $moreforfilter .=
'</div>';
1078 $parameters = array();
1079 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1080 if (empty($reshook)) {
1081 $moreforfilter .= $hookmanager->resPrint;
1083 $moreforfilter = $hookmanager->resPrint;
1086 if ($moreforfilter) {
1087 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1088 print $moreforfilter;
1089 print
'</div>'.
"\n";
1092 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1093 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1094 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1095 $selectedfields .= (($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1098 if ($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile') {
1099 $arrayfields[
'b.num_releve'][
'checked'] = 1;
1102 print
'<div class="div-table-responsive">';
1103 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1107 print
'<tr class="liste_titre_filter">';
1109 if (
$conf->main_checkbox_left_column) {
1110 print
'<td class="liste_titre valignmiddle center">';
1111 $searchpicto = $form->showFilterButtons(
'left');
1117 if (!empty($arrayfields[
'b.rowid'][
'checked'])) {
1118 print
'<td class="liste_titre">';
1119 print
'<input type="text" class="flat" name="search_ref" size="2" value="'.dol_escape_htmltag($search_ref).
'">';
1122 if (!empty($arrayfields[
'b.label'][
'checked'])) {
1123 print
'<td class="liste_titre">';
1124 print
'<input type="text" class="flat maxwidth100" name="search_description" value="'.dol_escape_htmltag($search_description).
'">';
1127 if (!empty($arrayfields[
'b.dateo'][
'checked'])) {
1128 print
'<td class="liste_titre"> </td>';
1130 if (!empty($arrayfields[
'b.datev'][
'checked'])) {
1131 print
'<td class="liste_titre"> </td>';
1134 if (!empty($arrayfields[
'type'][
'checked'])) {
1135 print
'<td class="liste_titre">';
1136 print $form->select_types_paiements(empty($search_type) ?
'' : $search_type,
'search_type',
'', 2, 1, 1, 0, 1,
'maxwidth100', 1);
1140 if (!empty($arrayfields[
'b.num_chq'][
'checked'])) {
1141 print
'<td class="liste_titre center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).
'" size="2"></td>';
1144 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1145 print
'<td class="liste_titre center"><input type="text" class="flat width50" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).
'"></td>';
1148 if (!empty($arrayfields[
'bu.label'][
'checked'])) {
1149 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).
'"></td>';
1152 if (!empty($arrayfields[
'ba.ref'][
'checked'])) {
1153 print
'<td class="liste_titre">';
1154 $form->select_comptes($search_account,
'search_account', 0,
'', 1, ($id > 0 || !empty($ref) ?
' disabled="disabled"' :
''), 0,
'maxwidth100');
1158 if (!empty($arrayfields[
'b.debit'][
'checked'])) {
1159 print
'<td class="liste_titre right">';
1160 print
'<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).
'">';
1164 if (!empty($arrayfields[
'b.credit'][
'checked'])) {
1165 print
'<td class="liste_titre right">';
1166 print
'<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).
'">';
1170 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1171 print
'<td class="liste_titre right">';
1172 $htmltext = $langs->trans(
"BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv(
"DateValue"));
1173 print $form->textwithpicto(
'', $htmltext, 1);
1177 if (!empty($arrayfields[
'balance'][
'checked'])) {
1178 print
'<td class="liste_titre right">';
1179 $htmltext = $langs->trans(
"BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv(
"DateValue"));
1180 print $form->textwithpicto(
'', $htmltext, 1);
1184 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1186 print
'<td class="liste_titre center"><input type="text" class="flat width50" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).
'"></td>';
1189 if (!empty($arrayfields[
'b.conciliated'][
'checked'])) {
1190 print
'<td class="liste_titre center parentonrightofpage">';
1191 print $form->selectyesno(
'search_conciliated', $search_conciliated, 1,
false, 1, 1,
'search_status onrightofpage width75');
1195 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1197 print
'<td class="nowraponall center"></td>';
1200 if (!
$conf->main_checkbox_left_column) {
1201 print
'<td class="liste_titre valignmiddle center">';
1204 $searchpicto = $form->showFilterButtons();
1210 $totalarray = array();
1211 $totalarray[
'nbfield'] = 0;
1214 print
'<tr class="liste_titre">';
1216 if (
$conf->main_checkbox_left_column) {
1217 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1218 $totalarray[
'nbfield']++;
1220 if (!empty($arrayfields[
'b.rowid'][
'checked'])) {
1221 print_liste_field_titre($arrayfields[
'b.rowid'][
'label'], $_SERVER[
'PHP_SELF'],
'b.rowid',
'', $param,
'', $sortfield, $sortorder);
1222 $totalarray[
'nbfield']++;
1224 if (!empty($arrayfields[
'b.label'][
'checked'])) {
1225 print_liste_field_titre($arrayfields[
'b.label'][
'label'], $_SERVER[
'PHP_SELF'],
'b.label',
'', $param,
'', $sortfield, $sortorder);
1226 $totalarray[
'nbfield']++;
1228 if (!empty($arrayfields[
'b.dateo'][
'checked'])) {
1229 print_liste_field_titre($arrayfields[
'b.dateo'][
'label'], $_SERVER[
'PHP_SELF'],
'b.dateo',
'', $param,
'', $sortfield, $sortorder,
"center ");
1230 $totalarray[
'nbfield']++;
1232 if (!empty($arrayfields[
'b.datev'][
'checked'])) {
1233 print_liste_field_titre($arrayfields[
'b.datev'][
'label'], $_SERVER[
'PHP_SELF'],
'b.datev,b.dateo,b.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1234 $totalarray[
'nbfield']++;
1236 if (!empty($arrayfields[
'type'][
'checked'])) {
1237 print_liste_field_titre($arrayfields[
'type'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1238 $totalarray[
'nbfield']++;
1240 if (!empty($arrayfields[
'b.num_chq'][
'checked'])) {
1241 print_liste_field_titre($arrayfields[
'b.num_chq'][
'label'], $_SERVER[
'PHP_SELF'],
'b.num_chq',
'', $param,
'', $sortfield, $sortorder,
"center ");
1242 $totalarray[
'nbfield']++;
1244 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1245 print_liste_field_titre($arrayfields[
'b.fk_bordereau'][
'label'], $_SERVER[
'PHP_SELF'],
'b.fk_bordereau',
'', $param,
'', $sortfield, $sortorder,
"center ");
1246 $totalarray[
'nbfield']++;
1248 if (!empty($arrayfields[
'bu.label'][
'checked'])) {
1249 print_liste_field_titre($arrayfields[
'bu.label'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1250 $totalarray[
'nbfield']++;
1252 if (!empty($arrayfields[
'ba.ref'][
'checked'])) {
1253 print_liste_field_titre($arrayfields[
'ba.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'ba.ref',
'', $param,
'', $sortfield, $sortorder);
1254 $totalarray[
'nbfield']++;
1256 if (!empty($arrayfields[
'b.debit'][
'checked'])) {
1257 print_liste_field_titre($arrayfields[
'b.debit'][
'label'], $_SERVER[
'PHP_SELF'],
'b.amount',
'', $param,
'', $sortfield, $sortorder,
"right ");
1258 $totalarray[
'nbfield']++;
1260 if (!empty($arrayfields[
'b.credit'][
'checked'])) {
1261 print_liste_field_titre($arrayfields[
'b.credit'][
'label'], $_SERVER[
'PHP_SELF'],
'b.amount',
'', $param,
'', $sortfield, $sortorder,
"right ");
1262 $totalarray[
'nbfield']++;
1264 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1265 print_liste_field_titre($arrayfields[
'balancebefore'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
"right ");
1266 $totalarray[
'nbfield']++;
1268 if (!empty($arrayfields[
'balance'][
'checked'])) {
1269 print_liste_field_titre($arrayfields[
'balance'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
"right ");
1270 $totalarray[
'nbfield']++;
1272 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1274 print_liste_field_titre($arrayfields[
'b.num_releve'][
'label'], $_SERVER[
'PHP_SELF'],
'b.num_releve',
'', $param,
'', $sortfield, $sortorder,
"center ");
1275 $totalarray[
'nbfield']++;
1277 if (!empty($arrayfields[
'b.conciliated'][
'checked'])) {
1278 print_liste_field_titre($arrayfields[
'b.conciliated'][
'label'], $_SERVER[
'PHP_SELF'],
'b.rappro',
'', $param,
'', $sortfield, $sortorder,
"center ");
1279 $totalarray[
'nbfield']++;
1283 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1285 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1286 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1287 print $hookmanager->resPrint;
1289 print
'<td class="nowraponall center"></td>';
1290 $totalarray[
'nbfield']++;
1292 if (!
$conf->main_checkbox_left_column) {
1294 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1295 $totalarray[
'nbfield']++;
1301 $balancecalculated =
false;
1302 $posconciliatecol = 0;
1303 $cachebankaccount = array();
1309 $savnbfield = $totalarray[
'nbfield'];
1310 $totalarray = array();
1311 $totalarray[
'nbfield'] = 0;
1312 $totalarray[
'totaldeb'] = 0;
1313 $totalarray[
'totalcred'] = 0;
1315 $imaxinloop = ($limit ? min($num, $limit) : $num);
1316 while ($i < $imaxinloop) {
1317 $objp = $db->fetch_object($resql);
1318 $links = $bankaccountstatic->get_url($objp->rowid);
1320 if (!$balancecalculated && (!empty($arrayfields[
'balancebefore'][
'checked']) || !empty($arrayfields[
'balance'][
'checked'])) && ($mode_balance_ok || $search_conciliated ===
'0')) {
1321 if (!$search_account) {
1322 dol_print_error(
null,
'account is not defined but $mode_balance_ok is true');
1329 $sqlforbalance =
'SELECT SUM(b.amount) as previoustotal';
1330 $sqlforbalance .=
" FROM ";
1331 $sqlforbalance .=
" ".MAIN_DB_PREFIX.
"bank_account as ba,";
1332 $sqlforbalance .=
" ".MAIN_DB_PREFIX.
"bank as b";
1333 $sqlforbalance .=
" WHERE b.fk_account = ba.rowid";
1334 $sqlforbalance .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
1335 $sqlforbalance .=
" AND b.fk_account = ".((int) $search_account);
1337 $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 < ".((
int) $objp->rowid).
"))))";
1338 $resqlforbalance = $db->query($sqlforbalance);
1341 if ($resqlforbalance) {
1342 $objforbalance = $db->fetch_object($resqlforbalance);
1343 if ($objforbalance) {
1345 if ($sortfield ==
'b.datev,b.dateo,b.rowid' && ($sortorder ==
'desc' || $sortorder ==
'desc,desc' || $sortorder ==
'desc,desc,desc')) {
1346 $balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
1349 $balance = $objforbalance->previoustotal;
1353 dol_print_error($db);
1356 $balancecalculated =
true;
1359 if ($user->hasRight(
'banque',
'consolidate') && ($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile')) {
1360 $tmpnbfieldbeforebalance = 0;
1361 $tmpnbfieldafterbalance = 0;
1362 $balancefieldfound = 0;
1363 foreach ($arrayfields as $key => $val) {
1364 if ($key ==
'balancebefore' || $key ==
'balance') {
1365 $balancefieldfound++;
1368 if (!empty($arrayfields[$key][
'checked'])) {
1369 if (!$balancefieldfound) {
1370 $tmpnbfieldbeforebalance++;
1372 $tmpnbfieldafterbalance++;
1377 $element = $extrafieldsobjectkey;
1378 if (!empty($extrafields->attributes[$element][
'label']) && is_array($extrafields->attributes[$element][
'label']) && count($extrafields->attributes[$element][
'label'])) {
1379 foreach ($extrafields->attributes[$element][
'label'] as $key => $val) {
1380 if (!empty($arrayfields[
"ef.".$key][
'checked'])) {
1381 if (!empty($arrayfields[$key][
'checked'])) {
1382 if (!$balancefieldfound) {
1383 $tmpnbfieldbeforebalance++;
1385 $tmpnbfieldafterbalance++;
1392 print
'<tr class="oddeven trforbreak">';
1394 if (
$conf->main_checkbox_left_column) {
1397 if ($tmpnbfieldbeforebalance) {
1398 print
'<td colspan="'.$tmpnbfieldbeforebalance.
'">';
1403 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1404 print
'<td class="right">';
1405 if ($search_conciliated !==
'0') {
1406 if ($sortfield ==
'b.datev,b.dateo,b.rowid' && ($sortorder ==
'desc' || $sortorder ==
'desc,desc' || $sortorder ==
'desc,desc,desc')) {
1414 if (!empty($arrayfields[
'balance'][
'checked'])) {
1415 print
'<td class="right">';
1416 if ($search_conciliated !==
'0') {
1417 if ($sortfield ==
'b.datev,b.dateo,b.rowid' && ($sortorder ==
'desc' || $sortorder ==
'desc,desc' || $sortorder ==
'desc,desc,desc')) {
1426 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1431 print
'<td colspan="'.($tmpnbfieldafterbalance).
'">';
1436 if (!
$conf->main_checkbox_left_column) {
1444 if ($sortfield ==
'b.datev,b.dateo,b.rowid' && ($sortorder ==
'desc' || $sortorder ==
'desc,desc' || $sortorder ==
'desc,desc,desc')) {
1445 $balance =
price2num($balancebefore,
'MT');
1446 $balancebefore =
price2num($balancebefore - ($sign * $objp->amount),
'MT');
1448 $balancebefore =
price2num($balance,
'MT');
1449 $balance =
price2num($balance + ($sign * $objp->amount),
'MT');
1452 if (empty($cachebankaccount[$objp->bankid])) {
1453 $bankaccounttmp =
new Account($db);
1454 $bankaccounttmp->fetch($objp->bankid);
1455 $cachebankaccount[$objp->bankid] = $bankaccounttmp;
1456 $bankaccount = $bankaccounttmp;
1458 $bankaccount = $cachebankaccount[$objp->bankid];
1462 $backgroundcolor =
"class='oddeven'";
1464 if ($objp->amount < 0) {
1466 $backgroundcolor =
'style="background: '.$color.
';"';
1469 $backgroundcolor =
'style="background: '.$color.
';"';
1473 $banklinestatic->id = $objp->rowid;
1474 $banklinestatic->ref = (string) $objp->rowid;
1475 $banklinestatic->amount = $objp->amount;
1478 $lineselectable = (!$objp->conciliated && ($action ==
'reconcile' || $action ==
'confirm_deleteonreconcile'));
1480 print
'<tr class="oddeven'.($lineselectable ?
' row-with-select' :
'').
'" '.$backgroundcolor.
'>';
1483 if (
$conf->main_checkbox_left_column) {
1484 print
'<td class="center">';
1485 if ($lineselectable) {
1486 print
'<input class="flat checkforselect" name="rowid['.$objp->rowid.
']" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'" size="1"'.(in_array($objp->rowid, $rowids) ?
' checked' :
'').
'>';
1490 $totalarray[
'nbfield']++;
1495 if (!empty($arrayfields[
'b.rowid'][
'checked'])) {
1496 print
'<td class="nowrap left">';
1497 print $banklinestatic->getNomUrl(1);
1500 $totalarray[
'nbfield']++;
1505 if (!empty($arrayfields[
'b.label'][
'checked'])) {
1509 preg_match(
'/\((.+)\)/i', $objp->label, $reg);
1510 if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
1512 $labeltoshow = $langs->trans($reg[1]);
1514 if ($objp->label ==
'(payment_salary)') {
1515 $labeltoshow = $langs->trans(
"SalaryPayment");
1518 $titletoshow = $objp->label;
1523 print
'<td class="tdoverflowmax250"'.($titletoshow ?
' title="'.dol_escape_htmltag($titletoshow).
'"' :
'').
'>';
1526 $cachebankaccount = array();
1527 foreach ($links as $key => $val) {
1528 print
'<!-- '.$links[$key][
'type'].
' -->';
1529 if ($links[$key][
'type'] ==
'withdraw') {
1530 $banktransferstatic->id = $links[$key][
'url_id'];
1531 $banktransferstatic->ref = $links[$key][
'label'];
1532 print $banktransferstatic->getNomUrl(0).($labeltoshow ?
' ' :
'');
1533 } elseif ($links[$key][
'type'] ==
'payment') {
1534 $paymentstatic->id = $links[$key][
'url_id'];
1535 $paymentstatic->ref = (string) $links[$key][
'url_id'];
1536 $paymentstatic->date = $db->jdate($objp->do);
1537 print $paymentstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1538 } elseif ($links[$key][
'type'] ==
'payment_supplier') {
1539 $paymentsupplierstatic->id = $links[$key][
'url_id'];
1540 $paymentsupplierstatic->ref = (string) $links[$key][
'url_id'];
1541 print $paymentsupplierstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1542 } elseif ($links[$key][
'type'] ==
'payment_sc') {
1543 $paymentscstatic->id = $links[$key][
'url_id'];
1544 $paymentscstatic->ref = (string) $links[$key][
'url_id'];
1545 $paymentscstatic->label = $links[$key][
'label'];
1546 print $paymentscstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1547 } elseif ($links[$key][
'type'] ==
'payment_vat') {
1548 $paymentvatstatic->id = $links[$key][
'url_id'];
1549 $paymentvatstatic->ref = (string) $links[$key][
'url_id'];
1550 print $paymentvatstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1551 } elseif ($links[$key][
'type'] ==
'payment_salary') {
1552 $paymentsalstatic->id = $links[$key][
'url_id'];
1553 $paymentsalstatic->ref = (string) $links[$key][
'url_id'];
1554 $paymentsalstatic->label = $links[$key][
'label'];
1555 print $paymentsalstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1556 } elseif ($links[$key][
'type'] ==
'payment_loan') {
1557 print
'<a href="'.DOL_URL_ROOT.
'/loan/payment/card.php?id='.$links[$key][
'url_id'].
'">';
1558 print
' '.img_object($langs->trans(
'ShowPayment'),
'payment').
' ';
1559 print
'</a>'.($labeltoshow ?
' ' :
'');
1560 } elseif ($links[$key][
'type'] ==
'payment_donation') {
1561 $paymentdonationstatic->id = $links[$key][
'url_id'];
1562 $paymentdonationstatic->ref = (string) $links[$key][
'url_id'];
1563 print $paymentdonationstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1564 } elseif ($links[$key][
'type'] ==
'payment_expensereport') {
1565 $paymentexpensereportstatic->id = $links[$key][
'url_id'];
1566 $paymentexpensereportstatic->ref = (string) $links[$key][
'url_id'];
1567 print $paymentexpensereportstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1568 } elseif ($links[$key][
'type'] ==
'payment_various') {
1569 $paymentvariousstatic->id = $links[$key][
'url_id'];
1570 $paymentvariousstatic->ref = (string) $links[$key][
'url_id'];
1571 print $paymentvariousstatic->getNomUrl(2).($labeltoshow ?
' ' :
'');
1572 } elseif ($links[$key][
'type'] ==
'banktransfert') {
1574 if ($objp->amount > 0) {
1575 $banklinestatic->fetch($links[$key][
'url_id']);
1576 $bankstatic->id = $banklinestatic->fk_account;
1577 $bankstatic->label = $banklinestatic->bank_account_ref;
1578 print $langs->trans(
"TransferFrom").
' ';
1579 print $bankstatic->getNomUrl(1,
'transactions');
1580 print
' '.$langs->trans(
"toward").
' ';
1581 $bankstatic->id = $objp->bankid;
1582 $bankstatic->label = $objp->bankref;
1583 print $bankstatic->getNomUrl(1,
'');
1584 print($labeltoshow ?
' - ' :
'');
1586 $bankstatic->id = $objp->bankid;
1587 $bankstatic->label = $objp->bankref;
1588 print $langs->trans(
"TransferFrom").
' ';
1589 print $bankstatic->getNomUrl(1,
'');
1590 print
' '.$langs->trans(
"toward").
' ';
1591 $banklinestatic->fetch($links[$key][
'url_id']);
1592 $bankstatic->id = $banklinestatic->fk_account;
1593 $bankstatic->label = $banklinestatic->bank_account_ref;
1594 print $bankstatic->getNomUrl(1,
'transactions');
1595 print($labeltoshow ?
' - ' :
'');
1598 } elseif ($links[$key][
'type'] ==
'company') {
1599 } elseif ($links[$key][
'type'] ==
'user') {
1600 } elseif ($links[$key][
'type'] ==
'member') {
1601 } elseif ($links[$key][
'type'] ==
'sc') {
1602 } elseif ($links[$key][
'type'] ==
'vat') {
1603 } elseif ($links[$key][
'type'] ==
'salary') {
1607 print
'<a href="'.$links[$key][
'url'].$links[$key][
'url_id'].
'">';
1608 if (preg_match(
'/^\((.*)\)$/i', $links[$key][
'label'], $reg)) {
1610 if ($reg[1] ==
'paiement') {
1611 $reg[1] =
'Payment';
1613 print $langs->trans($reg[1]);
1615 print $links[$key][
'label'];
1617 print
'</a>'.($labeltoshow ?
' - ' :
'');
1625 $totalarray[
'nbfield']++;
1630 if (!empty($arrayfields[
'b.dateo'][
'checked'])) {
1631 print
'<td class="nowraponall center">';
1632 print
'<span class="spanforajaxedit" id="dateoperation_'.$objp->rowid.
'" title="'.
dol_print_date($db->jdate($objp->do),
"day").
'">';
1636 print
'<span class="inline-block">';
1637 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=doprev&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1638 print img_edit_remove().
"</a> ";
1639 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=donext&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1640 print img_edit_add().
"</a>";
1644 $totalarray[
'nbfield']++;
1649 if (!empty($arrayfields[
'b.datev'][
'checked'])) {
1650 print
'<td class="nowraponall center">';
1651 print
'<span class="spanforajaxedit" id="datevalue_'.$objp->rowid.
'" title="'.
dol_print_date($db->jdate($objp->dv),
"day").
'">';
1655 print
'<span class="inline-block">';
1656 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=dvprev&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1657 print img_edit_remove().
"</a> ";
1658 print
'<a class="ajaxforbankoperationchange" href="'.$_SERVER[
'PHP_SELF'].
'?action=dvnext&account='.$objp->bankid.
'&rowid='.$objp->rowid.
'">';
1659 print img_edit_add().
"</a>";
1663 $totalarray[
'nbfield']++;
1668 if (!empty($arrayfields[
'type'][
'checked'])) {
1669 $labeltype = ($langs->transnoentitiesnoconv(
"PaymentTypeShort".$objp->fk_type) !=
"PaymentTypeShort".$objp->fk_type) ? $langs->transnoentitiesnoconv(
"PaymentTypeShort".$objp->fk_type) : $langs->getLabelFromKey($db, $objp->fk_type,
'c_paiement',
'code',
'libelle',
'', 1);
1670 if (empty($arrayfields[
'b.num_chq'][
'checked'])) {
1671 $labeltype .= ($objp->num_chq ?
' <span class="opacitymedium">- '.$objp->num_chq.
'</span>' :
'');
1673 print
'<td class="tdoverflowmax100" title="'.dolPrintLabel($labeltype).
'">';
1674 if ($labeltype ==
'SOLD') {
1677 print dolPrintHTML($labeltype);
1681 $totalarray[
'nbfield']++;
1686 if (!empty($arrayfields[
'b.num_chq'][
'checked'])) {
1687 print
'<td class="tdoverflowmax100 center" title="'.($objp->num_chq ? dolPrintLabel($objp->num_chq) :
"").
'">'.($objp->num_chq ? dolPrintLabel($objp->num_chq) :
"").
"</td>\n";
1689 $totalarray[
'nbfield']++;
1694 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1695 print
'<td class="nowraponall center">';
1696 if ($objp->fk_bordereau > 0) {
1697 $bordereaustatic->fetch($objp->fk_bordereau);
1698 print $bordereaustatic->getNomUrl();
1702 $totalarray[
'nbfield']++;
1707 if (!empty($arrayfields[
'bu.label'][
'checked'])) {
1708 print
'<td class="tdoverflowmax125">';
1710 $companylinked_id = 0;
1716 foreach ($links as $key => $value) {
1717 if ($links[$key][
'type'] ==
'payment_sc') {
1718 $type_link =
'payment_sc';
1720 if ($links[$key][
'type'] ==
'payment_salary') {
1721 $type_link =
'payment_salary';
1723 if ($links[$key][
'type'] ==
'payment_donation') {
1724 $paymentdonationstatic->fetch($links[$key][
'url_id']);
1725 $donstatic->fetch($paymentdonationstatic->fk_donation);
1726 $companylinked_id = $donstatic->socid;
1727 if (!$companylinked_id) {
1728 $thirdstr = ($donstatic->societe !==
"" ?
1729 $donstatic->societe :
1730 $donstatic->firstname.
" ".$donstatic->lastname);
1733 if ($links[$key][
'type'] ==
'payment_expensereport') {
1734 $type_link =
'payment_expensereport';
1737 if ($links[$key][
'type'] ==
'company') {
1738 $companylinked_id = $links[$key][
'url_id'];
1740 if ($links[$key][
'type'] ==
'user') {
1741 $userlinked_id = $links[$key][
'url_id'];
1746 if ($companylinked_id) {
1748 $companystatic->fetch($companylinked_id);
1749 print $companystatic->getNomUrl(1);
1750 } elseif ($userlinked_id &&
1751 (($type_link ==
'payment_salary' && $user->hasRight(
'salaries',
'read'))
1752 || ($type_link ==
'payment_sc' && $user->hasRight(
'tax',
'charges',
'lire'))
1753 || ($type_link ==
'payment_expensereport' && $user->hasRight(
'expensereport',
'lire')))) {
1755 if (!empty(
$conf->cache[
'user'][$userlinked_id])) {
1756 $tmpuser =
$conf->cache[
'user'][$userlinked_id];
1758 $tmpuser =
new User($db);
1759 $tmpuser->fetch($userlinked_id);
1760 $conf->cache[
'user'][$userlinked_id] = $tmpuser;
1762 print $tmpuser->getNomUrl(-1);
1763 } elseif ($thirdstr) {
1771 $totalarray[
'nbfield']++;
1776 if (!empty($arrayfields[
'ba.ref'][
'checked'])) {
1777 print
'<td class="nowrap">';
1778 print $bankaccount->getNomUrl(1);
1781 $totalarray[
'nbfield']++;
1785 $currencykey = $bankaccount->currency_code;
1786 if (!isset($totalarray[
'totalpercurrency'][$currencykey])) {
1787 $totalarray[
'totalpercurrency'][$currencykey] = array(
'deb' => 0,
'cred' => 0);
1789 $amountmaincurrency = empty($objp->amount_main_currency) ? $objp->amount : $objp->amount_main_currency;
1792 if (!empty($arrayfields[
'b.debit'][
'checked'])) {
1793 print
'<td class="nowraponall right"><span class="amount">';
1794 if ($objp->amount < 0) {
1795 print
price($objp->amount * -1);
1796 $totalarray[
'totaldeb'] += $amountmaincurrency;
1797 $totalarray[
'totalpercurrency'][$currencykey][
'deb'] += $objp->amount;
1799 print
"</span></td>\n";
1801 $totalarray[
'nbfield']++;
1804 $totalarray[
'totaldebfield'] = $totalarray[
'nbfield'];
1809 if (!empty($arrayfields[
'b.credit'][
'checked'])) {
1810 print
'<td class="nowraponall right"><span class="amount">';
1811 if ($objp->amount > 0) {
1812 print
price($objp->amount);
1813 $totalarray[
'totalcred'] += $amountmaincurrency;
1814 $totalarray[
'totalpercurrency'][$currencykey][
'cred'] += $objp->amount;
1816 print
"</span></td>\n";
1818 $totalarray[
'nbfield']++;
1821 $totalarray[
'totalcredfield'] = $totalarray[
'nbfield'];
1826 if (!empty($arrayfields[
'balancebefore'][
'checked'])) {
1827 if ($mode_balance_ok) {
1828 if ($balancebefore >= 0) {
1829 print
'<td class="nowrap right"> '.price($balancebefore).
'</td>';
1831 print
'<td class="error nowrap right"> '.price($balancebefore).
'</td>';
1834 print
'<td class="right">-</td>';
1837 $totalarray[
'nbfield']++;
1842 if (!empty($arrayfields[
'balance'][
'checked'])) {
1843 if ($mode_balance_ok) {
1844 if ($balance >= 0) {
1845 print
'<td class="nowrap right"> '.price($balance).
'</td>';
1847 print
'<td class="error nowrap right"> '.price($balance).
'</td>';
1850 print
'<td class="right">-</td>';
1853 $totalarray[
'nbfield']++;
1857 if (!empty($arrayfields[
'b.num_releve'][
'checked'])) {
1858 print
'<td class="nowraponall center">';
1860 if ($bankaccount->canBeConciliated() > 0) {
1861 if ($objp->num_releve) {
1862 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>';
1867 $totalarray[
'nbfield']++;
1868 $posconciliatecol = $totalarray[
'nbfield'];
1873 if (!empty($arrayfields[
'b.conciliated'][
'checked'])) {
1874 print
'<td class="nowraponall center">';
1875 print yn($objp->conciliated);
1878 $totalarray[
'nbfield']++;
1882 if (!empty($arrayfields[
'b.fk_bordereau'][
'checked'])) {
1883 print
'<td class="nowraponall center">';
1884 if ($objp->fk_bordereau > 0) {
1885 $bordereaustatic->fetch($objp->fk_bordereau);
1886 print $bordereaustatic->getNomUrl();
1890 $totalarray[
'nbfield']++;
1896 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1898 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $objp,
'i' => $i,
'totalarray' => &$totalarray);
1899 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1900 print $hookmanager->resPrint;
1903 print
'<td class="nowraponall center">';
1905 if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) {
1906 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.
'">';
1910 if ($user->hasRight(
'banque',
'modifier') || $user->hasRight(
'banque',
'consolidate')) {
1911 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.
'">';
1915 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.
'">';
1919 if ($bankaccount->canBeConciliated() > 0 && empty($objp->conciliated)) {
1920 if ($db->jdate($objp->dv) < ($now -
$conf->bank->rappro->warning_delay)) {
1921 print
' '.img_warning($langs->trans(
"ReconciliationLate"));
1924 if ($user->hasRight(
'banque',
'modifier')) {
1927 $parambis = preg_replace(
'/&?action=(reconcile|confirm_deleteonreconcile)(&|$)/',
'\2', $param);
1928 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action='.($action ==
'reconcile' ?
'confirm_deleteonreconcile&confirm=yes' :
'delete').
'&token='.
newToken().
'&rowid='.$objp->rowid.
'&page='.$page.$parambis.($sortfield ?
'&sortfield='.$sortfield :
'').($sortorder ?
'&sortorder='.$sortorder :
'').
'">';
1929 print img_delete(
'',
'class="marginleftonly"');
1935 $totalarray[
'nbfield']++;
1939 if (!
$conf->main_checkbox_left_column) {
1940 print
'<td class="center">';
1941 if ($lineselectable) {
1942 print
'<input class="flat checkforselect" name="rowid['.$objp->rowid.
']" type="checkbox" value="'.$objp->rowid.
'" size="1"'.(in_array($objp->rowid, $rowids) ?
' checked' :
'').
'>';
1946 $totalarray[
'nbfield']++;
1956 if (isset($totalarray[
'totaldebfield']) || isset($totalarray[
'totalcredfield'])) {
1957 print
'<tr class="liste_total">';
1959 while ($i < $totalarray[
'nbfield']) {
1962 if ($num < $limit && empty($offset)) {
1963 print
'<td class="left">'.$langs->trans(
"Total").
'</td>';
1965 print
'<td class="left tdoverflowmax50" title="'.$langs->trans(
"Totalforthispage").
'">'.$langs->trans(
"Totalforthispage").
'</td>';
1967 } elseif ($totalarray[
'totaldebfield'] == $i) {
1968 print
'<td class="right"><span class="amount">'.price(-1 * $totalarray[
'totaldeb']).
'</span></td>';
1969 } elseif ($totalarray[
'totalcredfield'] == $i) {
1970 print
'<td class="right"><span class="amount">'.price($totalarray[
'totalcred']).
'</span></td>';
1971 } elseif ($i == $posconciliatecol) {
1972 print
'<td class="center">';
1981 if (count($totalarray[
'totalpercurrency']) > 1) {
1982 foreach ($totalarray[
'totalpercurrency'] as $currencycode => $totalpercurrency) {
1983 print
'<tr class="liste_total">';
1985 while ($i < $totalarray[
'nbfield']) {
1988 print
'<td class="left">'.$langs->trans(
"Total").
' '.
dol_escape_htmltag($currencycode).
'</td>';
1989 } elseif (isset($totalarray[
'totaldebfield']) && $totalarray[
'totaldebfield'] == $i) {
1990 print
'<td class="right"><span class="amount">'.price(-1 * $totalpercurrency[
'deb']).
'</span></td>';
1991 } elseif (isset($totalarray[
'totalcredfield']) && $totalarray[
'totalcredfield'] == $i) {
1992 print
'<td class="right"><span class="amount">'.price($totalpercurrency[
'cred']).
'</span></td>';
2005 foreach ($arrayfields as $key => $val) {
2006 if (!empty($val[
'checked'])) {
2010 print
'<tr><td colspan="'.($colspan + 1).
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2019 dol_print_error($db);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
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.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Class to manage bank accounts.
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.
dol_now($mode='gmt')
Return date for now.
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
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...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
currentToken()
Return the value of token currently saved into session with name 'token'.
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.
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.