2004-10-19 22:35:36 +02:00
|
|
|
<?php
|
2006-12-19 12:06:47 +01:00
|
|
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-04-23 20:44:41 +02:00
|
|
|
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
|
2017-04-07 16:44:43 +02:00
|
|
|
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
2004-09-27 10:16:22 +02:00
|
|
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
2019-01-28 21:39:22 +01:00
|
|
|
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
2015-04-18 23:11:17 +02:00
|
|
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
2016-03-05 15:49:48 +01:00
|
|
|
* Copyright (C) 2016 Marcos GarcÃa <marcosgdf@gmail.com>
|
2018-09-09 09:56:33 +02:00
|
|
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
2021-01-18 17:08:17 +01:00
|
|
|
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
2002-09-26 18:23:33 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-09-26 18:23:33 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2003-03-18 19:36:42 +01:00
|
|
|
*/
|
2008-10-11 00:48:47 +02:00
|
|
|
|
2005-01-31 19:05:14 +01:00
|
|
|
/**
|
2019-07-19 23:19:06 +02:00
|
|
|
* \file htdocs/compta/bank/line.php
|
2015-03-29 21:04:20 +02:00
|
|
|
* \ingroup bank
|
2009-01-09 20:53:26 +01:00
|
|
|
* \brief Page to edit a bank transaction record
|
2008-10-11 00:48:47 +02:00
|
|
|
*/
|
2004-11-23 21:44:19 +01:00
|
|
|
|
2018-07-26 11:57:25 +02:00
|
|
|
require '../../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
2017-04-07 16:44:43 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
2020-09-29 02:26:18 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
2002-08-25 17:18:01 +02:00
|
|
|
|
2018-05-27 09:40:17 +02:00
|
|
|
// Load translation files required by the page
|
2018-07-25 15:25:23 +02:00
|
|
|
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other'));
|
2022-08-29 11:57:30 +02:00
|
|
|
if (isModEnabled('adherent')) {
|
2021-02-23 21:09:01 +01:00
|
|
|
$langs->load("members");
|
|
|
|
|
}
|
2022-08-29 11:57:30 +02:00
|
|
|
if (isModEnabled('don')) {
|
2021-02-23 21:09:01 +01:00
|
|
|
$langs->load("donations");
|
|
|
|
|
}
|
2022-08-29 11:57:30 +02:00
|
|
|
if (isModEnabled('loan')) {
|
2021-02-23 21:09:01 +01:00
|
|
|
$langs->load("loan");
|
|
|
|
|
}
|
2022-08-29 11:57:30 +02:00
|
|
|
if (isModEnabled('salaries')) {
|
2021-02-23 21:09:01 +01:00
|
|
|
$langs->load("salaries");
|
|
|
|
|
}
|
2005-01-31 19:05:14 +01:00
|
|
|
|
2012-02-13 15:18:23 +01:00
|
|
|
|
2022-01-03 22:01:08 +01:00
|
|
|
$id = GETPOST('rowid', 'int');
|
2022-05-10 15:27:43 +02:00
|
|
|
$rowid = GETPOST("rowid", 'int');
|
|
|
|
|
$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id
|
|
|
|
|
$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id
|
2019-01-27 11:55:16 +01:00
|
|
|
$ref = GETPOST('ref', 'alpha');
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2020-04-10 10:59:32 +02:00
|
|
|
$confirm = GETPOST('confirm', 'alpha');
|
|
|
|
|
$orig_account = GETPOST("orig_account");
|
|
|
|
|
$backtopage = GETPOST('backtopage', 'alpha');
|
|
|
|
|
$cancel = GETPOST('cancel', 'alpha');
|
2004-09-27 10:06:18 +02:00
|
|
|
|
2012-02-13 15:18:23 +01:00
|
|
|
// Security check
|
2020-04-10 10:59:32 +02:00
|
|
|
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
|
|
|
|
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
2021-10-24 16:47:01 +02:00
|
|
|
$socid = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->socid) {
|
|
|
|
|
$socid = $user->socid;
|
|
|
|
|
}
|
2021-12-13 16:53:34 +01:00
|
|
|
|
2022-05-10 15:27:43 +02:00
|
|
|
$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account');
|
2022-01-04 09:45:31 +01:00
|
|
|
if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
|
2021-02-23 21:09:01 +01:00
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2004-09-27 10:06:18 +02:00
|
|
|
|
2021-01-06 14:26:40 +01:00
|
|
|
$hookmanager->initHooks(array('bankline'));
|
|
|
|
|
|
2005-01-31 19:05:14 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2022-01-03 22:01:08 +01:00
|
|
|
|
2021-01-06 14:26:40 +01:00
|
|
|
$parameters = array('socid' => $socid);
|
|
|
|
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($reshook < 0) {
|
|
|
|
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
|
|
}
|
|
|
|
|
if ($cancel) {
|
|
|
|
|
if ($backtopage) {
|
2020-10-31 14:32:18 +01:00
|
|
|
header("Location: ".$backtopage);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2017-04-07 16:44:43 +02:00
|
|
|
}
|
2005-09-17 02:14:36 +02:00
|
|
|
|
2017-07-29 15:07:27 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->consolidate && $action == 'donext') {
|
2020-10-31 14:32:18 +01:00
|
|
|
$al = new AccountLine($db);
|
2021-03-19 12:08:40 +01:00
|
|
|
$al->dateo_next(GETPOST("rowid", 'int'));
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($user->rights->banque->consolidate && $action == 'doprev') {
|
2020-10-31 14:32:18 +01:00
|
|
|
$al = new AccountLine($db);
|
2021-03-19 12:08:40 +01:00
|
|
|
$al->dateo_previous(GETPOST("rowid", 'int'));
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($user->rights->banque->consolidate && $action == 'dvnext') {
|
2020-10-31 14:32:18 +01:00
|
|
|
$al = new AccountLine($db);
|
2021-03-19 12:08:40 +01:00
|
|
|
$al->datev_next(GETPOST("rowid", 'int'));
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($user->rights->banque->consolidate && $action == 'dvprev') {
|
2020-10-31 14:32:18 +01:00
|
|
|
$al = new AccountLine($db);
|
2021-03-19 12:08:40 +01:00
|
|
|
$al->datev_previous(GETPOST("rowid", 'int'));
|
2004-04-06 10:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$cat1 = GETPOST("cat1", 'int');
|
2018-01-08 20:54:40 +01:00
|
|
|
if (!empty($rowid) && !empty($cat1)) {
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid)." AND fk_categ = ".((int) $cat1);
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$db->query($sql)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2018-07-24 18:28:56 +02:00
|
|
|
setEventMessages($langs->trans("MissingIds"), null, 'errors');
|
2018-01-08 20:54:40 +01:00
|
|
|
}
|
2003-10-21 19:06:53 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier && $action == "update") {
|
2020-04-10 10:59:32 +02:00
|
|
|
$error = 0;
|
2012-02-15 12:22:18 +01:00
|
|
|
|
2018-02-12 02:05:14 +01:00
|
|
|
$acline = new AccountLine($db);
|
2022-05-12 10:48:34 +02:00
|
|
|
$result = $acline->fetch($rowid);
|
|
|
|
|
if ($result <= 0) {
|
|
|
|
|
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.
|
|
|
|
|
$acline->id = $rowid;
|
|
|
|
|
}
|
2018-02-12 02:05:14 +01:00
|
|
|
|
|
|
|
|
$acsource = new Account($db);
|
2022-05-10 15:27:43 +02:00
|
|
|
$acsource->fetch($accountoldid);
|
2018-02-12 02:05:14 +01:00
|
|
|
|
|
|
|
|
$actarget = new Account($db);
|
2021-02-23 21:09:01 +01:00
|
|
|
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
|
2019-01-27 11:55:16 +01:00
|
|
|
$actarget->fetch(GETPOST('accountid', 'int'));
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2022-05-10 15:27:43 +02:00
|
|
|
$actarget->fetch($accountoldid);
|
2018-02-12 02:05:14 +01:00
|
|
|
}
|
2012-02-15 12:22:18 +01:00
|
|
|
|
2022-05-10 15:27:43 +02:00
|
|
|
if (!($actarget->id > 0)) {
|
|
|
|
|
setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors');
|
|
|
|
|
$error++;
|
|
|
|
|
}
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') {
|
2015-11-11 12:27:09 +01:00
|
|
|
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
|
2012-02-13 15:18:23 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2012-02-15 12:22:18 +01:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2012-02-13 15:18:23 +01:00
|
|
|
$db->begin();
|
2012-02-15 12:22:18 +01:00
|
|
|
|
2021-03-25 16:59:47 +01:00
|
|
|
$amount = price2num(GETPOST('amount'));
|
|
|
|
|
$dateop = dol_mktime(12, 0, 0, GETPOST("dateomonth"), GETPOST("dateoday"), GETPOST("dateoyear"));
|
|
|
|
|
$dateval = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
2012-02-13 15:18:23 +01:00
|
|
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= " SET ";
|
2012-02-13 15:18:23 +01:00
|
|
|
// Always opened
|
2021-02-23 21:09:01 +01:00
|
|
|
if (GETPOSTISSET('value')) {
|
|
|
|
|
$sql .= " fk_type='".$db->escape(GETPOST('value'))."',";
|
|
|
|
|
}
|
|
|
|
|
if (GETPOSTISSET('num_chq')) {
|
|
|
|
|
$sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',";
|
|
|
|
|
}
|
|
|
|
|
if (GETPOSTISSET('banque')) {
|
|
|
|
|
$sql .= " banque='".$db->escape(GETPOST("banque"))."',";
|
|
|
|
|
}
|
|
|
|
|
if (GETPOSTISSET('emetteur')) {
|
|
|
|
|
$sql .= " emetteur='".$db->escape(GETPOST("emetteur"))."',";
|
|
|
|
|
}
|
2012-02-13 15:18:23 +01:00
|
|
|
// Blocked when conciliated
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$acline->rappro) {
|
|
|
|
|
if (GETPOSTISSET('label')) {
|
|
|
|
|
$sql .= " label = '".$db->escape(GETPOST("label"))."',";
|
|
|
|
|
}
|
|
|
|
|
if (GETPOSTISSET('amount')) {
|
|
|
|
|
$sql .= " amount= '".$db->escape($amount)."',";
|
|
|
|
|
}
|
|
|
|
|
if (GETPOSTISSET('dateomonth')) {
|
|
|
|
|
$sql .= " dateo = '".$db->idate($dateop)."',";
|
|
|
|
|
}
|
|
|
|
|
if (GETPOSTISSET('datevmonth')) {
|
|
|
|
|
$sql .= " datev = '".$db->idate($dateval)."',";
|
|
|
|
|
}
|
2012-02-13 15:18:23 +01:00
|
|
|
}
|
2021-06-09 15:36:47 +02:00
|
|
|
$sql .= " fk_account = ".((int) $actarget->id);
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql .= " WHERE rowid = ".((int) $acline->id);
|
2012-02-15 12:22:18 +01:00
|
|
|
|
2012-02-13 15:18:23 +01:00
|
|
|
$result = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$result) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$error++;
|
2017-04-07 16:44:43 +02:00
|
|
|
}
|
2017-10-03 16:00:52 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$arrayofcategs = GETPOST('custcats', 'array');
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid);
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$db->query($sql)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$error++;
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
2021-02-23 21:09:01 +01:00
|
|
|
if (count($arrayofcategs)) {
|
|
|
|
|
foreach ($arrayofcategs as $val) {
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".((int) $rowid).", ".((int) $val).")";
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$db->query($sql)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$error++;
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// $arrayselected will be loaded after in page output
|
|
|
|
|
}
|
2017-10-03 16:00:52 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2015-11-11 12:27:09 +01:00
|
|
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
2012-02-13 15:18:23 +01:00
|
|
|
$db->commit();
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2012-02-13 15:18:23 +01:00
|
|
|
$db->rollback();
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-05-11 20:53:13 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-28 00:40:32 +01:00
|
|
|
// Reconcile
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == 'setreconcile')) {
|
2021-03-25 16:59:47 +01:00
|
|
|
$num_rel = trim(GETPOST("num_rel"));
|
|
|
|
|
$rappro = GETPOST('reconciled') ? 1 : 0;
|
2020-10-31 14:32:18 +01:00
|
|
|
|
|
|
|
|
// Check parameters
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($rappro && empty($num_rel)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountStatement")), null, 'errors');
|
|
|
|
|
$error++;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$db->begin();
|
|
|
|
|
|
|
|
|
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
2022-05-10 15:27:43 +02:00
|
|
|
$sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
2021-02-23 21:09:01 +01:00
|
|
|
if (empty($num_rel)) {
|
|
|
|
|
$sql .= ", rappro = 0";
|
|
|
|
|
} else {
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql .= ", rappro = ".((int) $rappro);
|
2021-02-23 21:09:01 +01:00
|
|
|
}
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql .= " WHERE rowid = ".((int) $rowid);
|
2020-10-31 14:32:18 +01:00
|
|
|
|
|
|
|
|
dol_syslog("line.php", LOG_DEBUG);
|
|
|
|
|
$result = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($result) {
|
2020-10-31 14:32:18 +01:00
|
|
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
|
|
|
|
$db->commit();
|
|
|
|
|
} else {
|
|
|
|
|
$db->rollback();
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-10-09 00:34:59 +02:00
|
|
|
}
|
|
|
|
|
|
2005-01-31 19:05:14 +01:00
|
|
|
|
2010-12-28 00:40:32 +01:00
|
|
|
|
2005-09-17 02:14:36 +02:00
|
|
|
/*
|
2009-12-31 00:37:51 +01:00
|
|
|
* View
|
2005-09-17 02:14:36 +02:00
|
|
|
*/
|
2008-10-11 00:48:47 +02:00
|
|
|
|
2012-02-15 12:22:18 +01:00
|
|
|
$form = new Form($db);
|
|
|
|
|
|
2017-04-07 16:44:43 +02:00
|
|
|
llxHeader('', $langs->trans("BankTransaction"));
|
2005-09-17 02:14:36 +02:00
|
|
|
|
2021-12-21 15:01:41 +01:00
|
|
|
$arrayselected = array();
|
|
|
|
|
|
2017-04-07 16:44:43 +02:00
|
|
|
$c = new Categorie($db);
|
|
|
|
|
$cats = $c->containing($rowid, Categorie::TYPE_BANK_LINE);
|
2021-12-21 15:01:41 +01:00
|
|
|
if (is_array($cats)) {
|
|
|
|
|
foreach ($cats as $cat) {
|
|
|
|
|
$arrayselected[] = $cat->id;
|
|
|
|
|
}
|
2002-05-11 20:53:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-29 02:26:18 +02:00
|
|
|
$head = bankline_prepare_head($rowid);
|
2012-08-23 09:43:13 +02:00
|
|
|
|
2004-11-23 21:44:19 +01:00
|
|
|
|
2022-01-03 22:01:08 +01:00
|
|
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro,";
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
|
|
|
|
|
$sql .= " b.emetteur,b.banque";
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
2021-04-24 20:18:11 +02:00
|
|
|
$sql .= " WHERE rowid=".((int) $rowid);
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= " ORDER BY dateo ASC";
|
2002-05-11 20:53:13 +02:00
|
|
|
$result = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($result) {
|
2021-03-01 20:37:16 +01:00
|
|
|
$i = 0;
|
|
|
|
|
$total = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($db->num_rows($result)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$objp = $db->fetch_object($result);
|
2011-06-11 18:10:52 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$total = $total + $objp->amount;
|
2008-10-11 00:48:47 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$acct = new Account($db);
|
|
|
|
|
$acct->fetch($objp->fk_account);
|
|
|
|
|
$account = $acct->id;
|
2008-10-11 00:48:47 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$bankline = new AccountLine($db);
|
|
|
|
|
$bankline->fetch($rowid, $ref);
|
2010-08-22 15:40:44 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$links = $acct->get_url($rowid);
|
|
|
|
|
$bankline->load_previous_next_ref('', 'rowid');
|
2008-10-11 00:48:47 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
// Confirmations
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($action == 'delete_categ') {
|
2021-04-25 15:55:36 +02:00
|
|
|
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".urlencode($rowid)."&cat1=".urlencode(GETPOST("fk_categ", 'int'))."&orig_account=".urlencode($orig_account), $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1);
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
2011-06-11 18:10:52 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<form name="update" method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'">';
|
|
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
|
|
print '<input type="hidden" name="action" value="update">';
|
|
|
|
|
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
2022-01-03 22:01:08 +01:00
|
|
|
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
2011-06-11 18:10:52 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
|
2012-07-28 21:49:47 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
2017-10-03 16:00:52 +02:00
|
|
|
|
|
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
dol_banner_tab($bankline, 'rowid', $linkback);
|
2017-04-05 14:48:24 +02:00
|
|
|
|
2020-04-02 15:11:46 +02:00
|
|
|
print '<div class="fichecenter2">';
|
2017-10-03 16:00:52 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
|
|
|
|
print '<table class="border centpercent tableforfield">';
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
|
|
|
|
// Bank account
|
2021-03-03 21:18:14 +01:00
|
|
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
2022-05-12 11:06:22 +02:00
|
|
|
// $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it.
|
|
|
|
|
if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print $acct->getNomUrl(1, 'transactions', 'reflabel');
|
2022-05-12 11:06:22 +02:00
|
|
|
} else {
|
|
|
|
|
print img_picto('', 'bank_account', 'class="paddingright"');
|
|
|
|
|
print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1);
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Show links of bank transactions
|
2021-02-23 21:09:01 +01:00
|
|
|
if (count($links)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<tr><td class="tdtop">'.$langs->trans("Links").'</td>';
|
|
|
|
|
print '<td>';
|
2021-02-23 21:09:01 +01:00
|
|
|
foreach ($links as $key => $val) {
|
|
|
|
|
if ($key) {
|
|
|
|
|
print '<br>';
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
if ($links[$key]['type'] == 'payment') {
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|
|
|
|
$paymenttmp = new Paiement($db);
|
|
|
|
|
$paymenttmp->fetch($links[$key]['url_id']);
|
|
|
|
|
$paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
|
|
|
|
|
/*print '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$links[$key]['url_id'].'">';
|
2021-02-23 21:09:01 +01:00
|
|
|
print img_object($langs->trans('Payment'),'payment').' ';
|
|
|
|
|
print $langs->trans("Payment");
|
|
|
|
|
print '</a>';*/
|
2020-10-31 14:32:18 +01:00
|
|
|
print $paymenttmp->getNomUrl(1);
|
|
|
|
|
} elseif ($links[$key]['type'] == 'payment_supplier') {
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
|
|
|
|
$paymenttmp = new PaiementFourn($db);
|
|
|
|
|
$paymenttmp->fetch($links[$key]['url_id']);
|
|
|
|
|
$paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
|
|
|
|
|
/*print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$links[$key]['url_id'].'">';
|
2021-02-23 21:09:01 +01:00
|
|
|
print img_object($langs->trans('Payment'),'payment').' ';
|
|
|
|
|
print $langs->trans("Payment");
|
|
|
|
|
print '</a>';*/
|
2020-10-31 14:32:18 +01:00
|
|
|
print $paymenttmp->getNomUrl(1);
|
|
|
|
|
} elseif ($links[$key]['type'] == 'company') {
|
|
|
|
|
$societe = new Societe($db);
|
|
|
|
|
$societe->fetch($links[$key]['url_id']);
|
|
|
|
|
print $societe->getNomUrl(1);
|
|
|
|
|
} elseif ($links[$key]['type'] == 'sc') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('SocialContribution'), 'bill').' ';
|
|
|
|
|
print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : '');
|
|
|
|
|
print '</a>';
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'vat') {
|
2021-01-18 17:08:17 +01:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('VATDeclaration'), 'bill').' ';
|
|
|
|
|
print $langs->trans("VATDeclaration").($links[$key]['label'] ? ' '.$links[$key]['label'] : '');
|
|
|
|
|
print '</a>';
|
2021-02-26 11:50:18 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'salary') {
|
2021-02-04 17:21:08 +01:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('Salary'), 'bill').' ';
|
|
|
|
|
print $langs->trans("Salary").($links[$key]['label'] ? ' - '.$links[$key]['label'] : '');
|
|
|
|
|
print '</a>';
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_sc') {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('Payment'), 'payment').' ';
|
|
|
|
|
print $langs->trans("SocialContributionPayment");
|
|
|
|
|
print '</a>';
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_vat') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('VATPayment'), 'payment').' ';
|
2020-10-31 14:32:18 +01:00
|
|
|
print $langs->trans("VATPayment");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'payment_salary') {
|
2021-02-05 09:29:20 +01:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$links[$key]['url_id'].'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print img_object($langs->trans('PaymentSalary'), 'payment').' ';
|
|
|
|
|
print $langs->trans("SalaryPayment");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'payment_loan') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('LoanPayment'), 'payment').' ';
|
|
|
|
|
print $langs->trans("PaymentLoan");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'loan') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('Loan'), 'bill').' ';
|
|
|
|
|
print $langs->trans("Loan");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'member') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('Member'), 'user').' ';
|
|
|
|
|
print $links[$key]['label'];
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'payment_donation') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('Donation'), 'payment').' ';
|
|
|
|
|
print $langs->trans("DonationPayment");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'banktransfert') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('Transaction'), 'payment').' ';
|
|
|
|
|
print $langs->trans("TransactionOnTheOtherAccount");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'user') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('User'), 'user').' ';
|
|
|
|
|
print $langs->trans("User");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} elseif ($links[$key]['type'] == 'payment_various') {
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object($langs->trans('VariousPayment'), 'payment').' ';
|
|
|
|
|
print $langs->trans("VariousPayment");
|
|
|
|
|
print '</a>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
|
|
|
|
print img_object('', 'generic').' ';
|
|
|
|
|
print $links[$key]['label'];
|
|
|
|
|
print '</a>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//$user->rights->banque->modifier=false;
|
|
|
|
|
//$user->rights->banque->consolidate=true;
|
|
|
|
|
|
|
|
|
|
// Type of payment / Number
|
|
|
|
|
print "<tr><td>".$langs->trans("Type")." / ".$langs->trans("Numero");
|
|
|
|
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
|
|
|
|
print "</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
|
|
|
|
$form->select_types_paiements($objp->fk_type, "value", '', 2);
|
|
|
|
|
print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($objp->receiptid) {
|
2020-10-31 14:32:18 +01:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
|
|
|
|
$receipt = new RemiseCheque($db);
|
|
|
|
|
$receipt->fetch($objp->receiptid);
|
|
|
|
|
print ' '.$langs->trans("CheckReceipt").': '.$receipt->getNomUrl(2);
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
2021-04-25 19:31:19 +02:00
|
|
|
print '<td>'.$objp->fk_type.' '.dol_escape_htmltag($objp->num_chq).'</td>';
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
|
|
// Transmitter
|
|
|
|
|
print "<tr><td>".$langs->trans("CheckTransmitter");
|
|
|
|
|
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
|
|
|
|
|
print "</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
2021-04-25 19:31:19 +02:00
|
|
|
print '<input type="text" class="flat minwidth200" name="emetteur" value="'.(empty($objp->emetteur) ? '' : dol_escape_htmltag($objp->emetteur)).'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>'.$objp->emetteur.'</td>';
|
|
|
|
|
}
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
|
|
// Bank of cheque
|
|
|
|
|
print "<tr><td>".$langs->trans("Bank");
|
|
|
|
|
print ' <em>('.$langs->trans("ChequeBank").')</em>';
|
|
|
|
|
print "</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
2021-04-25 19:31:19 +02:00
|
|
|
print '<input type="text" class="flat minwidth200" name="banque" value="'.(empty($objp->banque) ? '' : dol_escape_htmltag($objp->banque)).'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
2021-04-25 19:31:19 +02:00
|
|
|
print '<td>'.dol_escape_htmltag($objp->banque).'</td>';
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
|
|
// Date ope
|
|
|
|
|
print '<tr><td>'.$langs->trans("DateOperation").'</td>';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
|
|
|
|
print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$objp->rappro) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print ' ';
|
2022-01-03 22:01:08 +01:00
|
|
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print img_edit_remove()."</a> ";
|
2022-01-03 22:01:08 +01:00
|
|
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=donext&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print img_edit_add()."</a>";
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
|
|
|
|
print dol_print_date($db->jdate($objp->do), "day");
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Value date
|
|
|
|
|
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
|
|
|
|
print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$objp->rappro) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print ' ';
|
2022-01-03 22:01:08 +01:00
|
|
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print img_edit_remove()."</a> ";
|
2022-01-03 22:01:08 +01:00
|
|
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print img_edit_add()."</a>";
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
|
|
|
|
print dol_print_date($db->jdate($objp->dv), "day");
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
|
|
// Description
|
2021-04-25 19:31:19 +02:00
|
|
|
$reg = array();
|
2020-10-31 14:32:18 +01:00
|
|
|
print "<tr><td>".$langs->trans("Label")."</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
|
|
|
|
print '<input name="label" class="flat minwidth300" '.($objp->rappro ? ' disabled' : '').' value="';
|
2021-02-23 21:09:01 +01:00
|
|
|
if (preg_match('/^\((.*)\)$/i', $objp->label, $reg)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
// Label generique car entre parentheses. On l'affiche en le traduisant
|
|
|
|
|
print $langs->trans($reg[1]);
|
|
|
|
|
} else {
|
2021-04-25 19:31:19 +02:00
|
|
|
print dol_escape_htmltag($objp->label);
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print '">';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
2021-02-23 21:09:01 +01:00
|
|
|
if (preg_match('/^\((.*)\)$/i', $objp->label, $reg)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
// Label generique car entre parentheses. On l'affiche en le traduisant
|
|
|
|
|
print $langs->trans($reg[1]);
|
|
|
|
|
} else {
|
2021-04-25 19:31:19 +02:00
|
|
|
print dol_escape_htmltag($objp->label);
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Amount
|
|
|
|
|
print "<tr><td>".$langs->trans("Amount")."</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
|
|
|
|
print '<input name="amount" class="flat maxwidth100" '.($objp->rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
|
|
|
|
print price($objp->amount);
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
|
|
// Categories
|
2022-08-29 11:57:30 +02:00
|
|
|
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$langs->load('categories');
|
|
|
|
|
|
|
|
|
|
// Bank line
|
|
|
|
|
print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>';
|
|
|
|
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
|
2021-12-21 15:01:41 +01:00
|
|
|
|
2021-10-24 16:47:01 +02:00
|
|
|
$arrayselected = array();
|
2021-12-21 15:01:41 +01:00
|
|
|
|
2021-10-24 17:06:37 +02:00
|
|
|
$c = new Categorie($db);
|
|
|
|
|
$cats = $c->containing($bankline->id, Categorie::TYPE_BANK_LINE);
|
2021-12-21 15:01:41 +01:00
|
|
|
if (is_array($cats)) {
|
|
|
|
|
foreach ($cats as $cat) {
|
|
|
|
|
$arrayselected[] = $cat->id;
|
|
|
|
|
}
|
2021-10-24 17:06:37 +02:00
|
|
|
}
|
2021-03-03 21:18:14 +01:00
|
|
|
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
|
2020-10-31 14:32:18 +01:00
|
|
|
print "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</table>";
|
|
|
|
|
|
2021-03-19 12:08:40 +01:00
|
|
|
// Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page
|
|
|
|
|
/* Not yet ready. We must manage inline replacemet of input date field
|
|
|
|
|
$urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?token='.currentToken();
|
|
|
|
|
print '
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(function() {
|
|
|
|
|
$("a.ajaxforbankoperationchange").each(function(){
|
|
|
|
|
var current = $(this);
|
|
|
|
|
current.click(function()
|
|
|
|
|
{
|
|
|
|
|
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
|
|
|
|
|
$.get(url, function(data)
|
|
|
|
|
{
|
|
|
|
|
console.log(url)
|
|
|
|
|
console.log(data)
|
|
|
|
|
current.parent().prev().replaceWith(data);
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
';
|
|
|
|
|
*/
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print dol_get_fiche_end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
|
|
|
|
|
|
|
|
|
|
print "</form>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Releve rappro
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($acct->canBeConciliated() > 0) { // Si compte rapprochable
|
2020-10-31 14:32:18 +01:00
|
|
|
print load_fiche_titre($langs->trans("Reconciliation"), '', 'bank_account');
|
|
|
|
|
print '<hr>'."\n";
|
|
|
|
|
|
|
|
|
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$objp->rowid.'">';
|
|
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
|
|
print '<input type="hidden" name="action" value="setreconcile">';
|
|
|
|
|
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
|
|
|
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
|
|
|
|
|
|
|
|
print '<div class="fichecenter">';
|
|
|
|
|
|
|
|
|
|
print '<table class="border centpercent">';
|
|
|
|
|
|
2021-08-03 17:03:34 +02:00
|
|
|
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("AccountStatement"), $langs->trans("InputReceiptNumber"))."</td>";
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($objp->rappro) {
|
2021-08-03 17:03:34 +02:00
|
|
|
print '<input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<input name="num_rel" type="hidden" value="'.$objp->num_releve.'">';
|
|
|
|
|
} else {
|
2021-08-03 17:03:34 +02:00
|
|
|
print '<input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($objp->num_releve) {
|
|
|
|
|
print ' (<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?num='.$objp->num_releve.'&account='.$acct->id.'">'.$langs->trans("AccountStatement").' '.$objp->num_releve.')</a>';
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
2021-08-03 17:03:34 +02:00
|
|
|
print '<td>'.$objp->num_releve.'</td>';
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
2022-01-04 09:33:52 +01:00
|
|
|
print '<tr><td><label for="reconciled">'.$langs->trans("BankLineConciliated").'</label></td>';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->consolidate) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td>';
|
2022-01-04 09:33:52 +01:00
|
|
|
print '<input type="checkbox" id="reconciled" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>'.yn($objp->rappro).'</td>';
|
|
|
|
|
}
|
|
|
|
|
print '</tr>';
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '<div class="center">';
|
|
|
|
|
|
|
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($backtopage) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print ' ';
|
2020-11-23 15:12:52 +01:00
|
|
|
print '<input type="submit" name="cancel" class="button button-cancel" value="'.$langs->trans("Cancel").'">';
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
print '</div>';
|
2010-12-28 00:40:32 +01:00
|
|
|
|
2016-12-10 20:59:25 +01:00
|
|
|
print '</form>';
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-12-28 00:40:32 +01:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$db->free($result);
|
2021-02-23 21:09:01 +01:00
|
|
|
} else {
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
2002-05-11 20:53:13 +02:00
|
|
|
|
2018-07-29 19:16:28 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-02-13 15:18:23 +01:00
|
|
|
$db->close();
|