2004-10-19 22:35:36 +02:00
|
|
|
<?php
|
2022-06-13 04:38:16 +02:00
|
|
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
|
|
|
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
|
|
|
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
|
|
|
|
|
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
|
|
|
|
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
2002-06-18 19:18:44 +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-06-18 19:18:44 +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 16:22:05 +01:00
|
|
|
*/
|
2009-04-09 20:49:17 +02:00
|
|
|
|
2005-01-31 15:49:39 +01:00
|
|
|
/**
|
2009-04-09 20:49:17 +02:00
|
|
|
* \file htdocs/compta/bank/releve.php
|
|
|
|
|
* \ingroup banque
|
2016-10-23 23:13:03 +02:00
|
|
|
* \brief Page to show a bank statement report
|
2009-04-09 20:49:17 +02:00
|
|
|
*/
|
2004-10-10 17:04:56 +02: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.'/core/lib/bank.lib.php';
|
2013-06-05 16:24:32 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
2016-02-14 22:53:00 +01:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
2017-04-08 14:03:38 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
2020-01-03 16:35:02 +01:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
2017-04-05 20:50:18 +02:00
|
|
|
//show files
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
2013-06-05 16:24:32 +02:00
|
|
|
|
2018-05-27 09:40:17 +02:00
|
|
|
// Load translation files required by the page
|
2021-11-13 15:19:03 +01:00
|
|
|
$langs->loadLangs(array("banks", "categories", "companies", "bills", "trips", "donations", "loan", "salaries"));
|
2019-11-12 00:15:34 +01:00
|
|
|
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2020-02-24 00:41:25 +01:00
|
|
|
$id = GETPOST('account', 'int') ? GETPOST('account', 'int') : GETPOST('id', 'int');
|
2019-11-12 00:15:34 +01:00
|
|
|
$ref = GETPOST('ref', 'alpha');
|
|
|
|
|
$dvid = GETPOST('dvid', 'alpha');
|
|
|
|
|
$numref = GETPOST('num', 'alpha');
|
|
|
|
|
$ve = GETPOST("ve", 'alpha');
|
|
|
|
|
$brref = GETPOST('brref', 'alpha');
|
|
|
|
|
$oldbankreceipt = GETPOST('oldbankreceipt', 'alpha');
|
|
|
|
|
$newbankreceipt = GETPOST('newbankreceipt', 'alpha');
|
2022-06-13 04:38:16 +02:00
|
|
|
$rel = GETPOST("rel", 'alphanohtml');
|
|
|
|
|
$backtopage = GETPOST('backtopage', 'alpha');
|
2012-10-13 10:39:16 +02:00
|
|
|
|
2009-05-05 14:43:51 +02:00
|
|
|
// Security check
|
2019-11-12 00:15:34 +01:00
|
|
|
$fieldid = (!empty($ref) ? $ref : $id);
|
2022-03-12 18:20:15 +01:00
|
|
|
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->socid) {
|
|
|
|
|
$socid = $user->socid;
|
|
|
|
|
}
|
2022-03-12 18:20:15 +01:00
|
|
|
|
2019-11-12 00:15:34 +01:00
|
|
|
$result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname);
|
2004-10-10 17:04:56 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) {
|
2012-02-15 12:16:33 +01:00
|
|
|
$al = new AccountLine($db);
|
2012-10-13 10:39:16 +02:00
|
|
|
$al->datev_next($dvid);
|
2004-04-06 09:21:07 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->consolidate && $action == 'dvprev' && !empty($dvid)) {
|
2012-02-15 12:16:33 +01:00
|
|
|
$al = new AccountLine($db);
|
2012-10-13 10:39:16 +02:00
|
|
|
$al->datev_previous($dvid);
|
2004-04-06 09:21:07 +02:00
|
|
|
}
|
|
|
|
|
|
2004-01-18 21:29:34 +01:00
|
|
|
|
2019-11-12 00:15:34 +01:00
|
|
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
2022-01-13 11:09:37 +01:00
|
|
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
|
|
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
2020-03-13 13:07:11 +01:00
|
|
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
2019-01-27 11:55:16 +01:00
|
|
|
$pageplusone = GETPOST("pageplusone", 'int');
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($pageplusone) {
|
|
|
|
|
$page = $pageplusone - 1;
|
|
|
|
|
}
|
|
|
|
|
if (empty($page) || $page == -1) {
|
|
|
|
|
$page = 0;
|
|
|
|
|
} // If $page is not defined, or '' or -1
|
2016-10-29 17:46:11 +02:00
|
|
|
$offset = $limit * $page;
|
|
|
|
|
$pageprev = $page - 1;
|
|
|
|
|
$pagenext = $page + 1;
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$sortorder) {
|
|
|
|
|
$sortorder = "ASC";
|
|
|
|
|
}
|
|
|
|
|
if (!$sortfield) {
|
|
|
|
|
$sortfield = "s.nom";
|
|
|
|
|
}
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2016-10-29 17:46:11 +02:00
|
|
|
$object = new Account($db);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($id > 0 || !empty($ref)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = $object->fetch($id, $ref);
|
|
|
|
|
$account = $object->id; // Force the search field on id of account
|
2016-10-29 17:46:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize technical object to manage context to save list fields
|
2019-11-12 00:15:34 +01:00
|
|
|
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
|
2017-04-06 23:28:06 +02:00
|
|
|
|
2017-10-13 21:25:27 +02:00
|
|
|
|
|
|
|
|
// Define number of receipt to show (current, previous or next one ?)
|
2019-11-12 00:15:34 +01:00
|
|
|
$found = false;
|
2022-06-13 04:38:16 +02:00
|
|
|
if ($rel == 'prev') {
|
2017-10-13 21:25:27 +02:00
|
|
|
// Recherche valeur pour num = numero releve precedent
|
|
|
|
|
$sql = "SELECT DISTINCT(b.num_releve) as num";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
|
|
|
|
$sql .= " WHERE b.num_releve < '".$db->escape($numref)."'";
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND b.fk_account = ".((int) $object->id);
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " ORDER BY b.num_releve DESC";
|
2017-10-13 21:25:27 +02:00
|
|
|
|
|
|
|
|
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
|
|
|
|
|
$resql = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resql) {
|
2017-10-13 21:25:27 +02:00
|
|
|
$numrows = $db->num_rows($resql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($numrows > 0) {
|
2017-10-13 21:25:27 +02:00
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
$numref = $obj->num;
|
2019-11-12 00:15:34 +01:00
|
|
|
$found = true;
|
2017-10-13 21:25:27 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-06-13 04:38:16 +02:00
|
|
|
} elseif ($rel == 'next') {
|
2017-10-13 21:25:27 +02:00
|
|
|
// Recherche valeur pour num = numero releve precedent
|
|
|
|
|
$sql = "SELECT DISTINCT(b.num_releve) as num";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
|
|
|
|
$sql .= " WHERE b.num_releve > '".$db->escape($numref)."'";
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND b.fk_account = ".((int) $object->id);
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " ORDER BY b.num_releve ASC";
|
2017-10-13 21:25:27 +02:00
|
|
|
|
|
|
|
|
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
|
|
|
|
|
$resql = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resql) {
|
2017-10-13 21:25:27 +02:00
|
|
|
$numrows = $db->num_rows($resql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($numrows > 0) {
|
2017-10-13 21:25:27 +02:00
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
$numref = $obj->num;
|
2019-11-12 00:15:34 +01:00
|
|
|
$found = true;
|
2017-10-13 21:25:27 +02:00
|
|
|
}
|
|
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2017-10-13 21:25:27 +02:00
|
|
|
// On veut le releve num
|
2019-11-12 00:15:34 +01:00
|
|
|
$found = true;
|
2017-10-13 21:25:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-04-08 14:03:38 +02:00
|
|
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
|
|
|
|
$sql .= " b.fk_bordereau,";
|
|
|
|
|
$sql .= " bc.ref,";
|
|
|
|
|
$sql .= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
|
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."bank as b";
|
|
|
|
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau';
|
|
|
|
|
$sql .= " WHERE b.num_releve='".$db->escape($numref)."'";
|
2021-02-23 21:09:01 +01:00
|
|
|
if (empty($numref)) {
|
|
|
|
|
$sql .= " OR b.num_releve is null";
|
|
|
|
|
}
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND b.fk_account = ".((int) $object->id);
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " AND b.fk_account = ba.rowid";
|
|
|
|
|
$sql .= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
2017-04-08 14:03:38 +02:00
|
|
|
|
|
|
|
|
$sqlrequestforbankline = $sql;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2017-04-06 23:28:06 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($newbankreceipt)) {
|
2017-10-13 23:38:57 +02:00
|
|
|
// TODO Add a test to check newbankreceipt does not exists yet
|
2021-05-03 19:36:49 +02:00
|
|
|
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."bank SET num_releve = '".$db->escape($newbankreceipt)."'";
|
|
|
|
|
$sqlupdate .= " WHERE num_releve = '".$db->escape($oldbankreceipt)."' AND fk_account = ".((int) $id);
|
2017-10-13 23:38:57 +02:00
|
|
|
$result = $db->query($sqlupdate);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($result < 0) {
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
2017-10-13 23:38:57 +02:00
|
|
|
|
2019-11-12 00:15:34 +01:00
|
|
|
$action = 'view';
|
2017-10-13 23:38:57 +02:00
|
|
|
}
|
|
|
|
|
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2009-04-09 20:49:17 +02:00
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2016-08-29 21:49:34 +02:00
|
|
|
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements");
|
|
|
|
|
$helpurl = "";
|
2019-01-27 11:55:16 +01:00
|
|
|
llxHeader('', $title, $helpurl);
|
2003-08-26 12:10:42 +02:00
|
|
|
|
2011-11-08 10:18:45 +01:00
|
|
|
$form = new Form($db);
|
2019-11-12 00:15:34 +01:00
|
|
|
$societestatic = new Societe($db);
|
|
|
|
|
$chargestatic = new ChargeSociales($db);
|
|
|
|
|
$memberstatic = new Adherent($db);
|
|
|
|
|
$paymentstatic = new Paiement($db);
|
|
|
|
|
$paymentsupplierstatic = new PaiementFourn($db);
|
2021-01-23 20:59:23 +01:00
|
|
|
$paymentvatstatic = new Tva($db);
|
2019-11-12 00:15:34 +01:00
|
|
|
$bankstatic = new Account($db);
|
|
|
|
|
$banklinestatic = new AccountLine($db);
|
2016-02-14 22:53:00 +01:00
|
|
|
$remisestatic = new RemiseCheque($db);
|
2020-04-10 10:59:32 +02:00
|
|
|
$paymentdonationstatic = new PaymentDonation($db);
|
|
|
|
|
$paymentloanstatic = new PaymentLoan($db);
|
|
|
|
|
$paymentvariousstatic = new PaymentVarious($db);
|
2004-02-07 02:10:54 +01:00
|
|
|
|
2016-10-29 17:46:11 +02:00
|
|
|
// Must be before button action
|
2019-11-12 00:15:34 +01:00
|
|
|
$param = '';
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
|
|
$param .= '&contextpage='.$contextpage;
|
|
|
|
|
}
|
|
|
|
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
|
|
$param .= '&limit='.$limit;
|
|
|
|
|
}
|
|
|
|
|
if ($id > 0) {
|
|
|
|
|
$param .= '&id='.urlencode($id);
|
|
|
|
|
}
|
2016-10-29 17:46:11 +02:00
|
|
|
|
2004-02-07 02:10:54 +01:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (empty($numref)) {
|
2019-11-12 00:15:34 +01:00
|
|
|
$sortfield = 'numr';
|
|
|
|
|
$sortorder = 'DESC';
|
2017-12-10 15:46:35 +01:00
|
|
|
|
2017-04-06 23:28:06 +02:00
|
|
|
// List of all standing receipts
|
2009-05-05 14:43:51 +02:00
|
|
|
$sql = "SELECT DISTINCT(b.num_releve) as numr";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql .= " WHERE b.fk_account = ".((int) $object->id);
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= $db->order($sortfield, $sortorder);
|
2017-12-10 15:46:35 +01:00
|
|
|
|
|
|
|
|
// Count total nb of records
|
2022-06-13 04:38:16 +02:00
|
|
|
$totalnboflines = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
2017-12-10 15:46:35 +01:00
|
|
|
$result = $db->query($sql);
|
2022-06-13 04:38:16 +02:00
|
|
|
$totalnboflines = $db->num_rows($result);
|
2017-12-10 15:46:35 +01:00
|
|
|
}
|
2009-08-07 20:39:01 +02:00
|
|
|
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
2006-08-13 02:34:16 +02:00
|
|
|
|
|
|
|
|
$result = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($result) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$numrows = $db->num_rows($result);
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
|
|
// Onglets
|
2019-11-12 00:15:34 +01:00
|
|
|
$head = bank_prepare_head($object);
|
2020-10-22 22:50:03 +02:00
|
|
|
print dol_get_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account');
|
2002-05-11 20:53:13 +02:00
|
|
|
|
2017-10-03 16:00:52 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2020-07-10 13:40:33 +02:00
|
|
|
$morehtmlref = '';
|
|
|
|
|
|
2016-10-22 13:20:14 +02:00
|
|
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2020-10-27 18:19:31 +01:00
|
|
|
print dol_get_fiche_end();
|
2009-04-09 20:49:17 +02:00
|
|
|
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2015-08-28 20:11:16 +02:00
|
|
|
print '<div class="tabsAction">';
|
2016-03-05 14:05:00 +01:00
|
|
|
|
|
|
|
|
if ($object->canBeConciliated() > 0) {
|
2021-02-08 22:42:21 +01:00
|
|
|
$allowautomaticconciliation = false; // TODO
|
|
|
|
|
$titletoconciliatemanual = $langs->trans("Conciliate");
|
|
|
|
|
$titletoconciliateauto = $langs->trans("Conciliate");
|
|
|
|
|
if ($allowautomaticconciliation) {
|
|
|
|
|
$titletoconciliatemanual .= ' ('.$langs->trans("Manual").')';
|
|
|
|
|
$titletoconciliateauto .= ' ('.$langs->trans("Auto").')';
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-28 20:11:16 +02:00
|
|
|
// If not cash account and can be reconciliate
|
2016-03-05 14:05:00 +01:00
|
|
|
if ($user->rights->banque->consolidate) {
|
2022-06-02 13:02:06 +02:00
|
|
|
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
|
2016-03-05 14:05:00 +01:00
|
|
|
} else {
|
2021-02-08 22:42:21 +01:00
|
|
|
$buttonreconcile = '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($allowautomaticconciliation) {
|
|
|
|
|
// If not cash account and can be reconciliate
|
|
|
|
|
if ($user->rights->banque->consolidate) {
|
|
|
|
|
$newparam = $param;
|
|
|
|
|
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
|
2022-06-02 13:02:06 +02:00
|
|
|
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
|
2021-02-08 22:42:21 +01:00
|
|
|
} else {
|
|
|
|
|
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
|
|
|
|
|
}
|
2015-08-28 20:11:16 +02:00
|
|
|
}
|
2021-02-08 22:42:21 +01:00
|
|
|
|
|
|
|
|
print $buttonreconcile;
|
2015-08-28 20:11:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2009-04-09 20:49:17 +02:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$object->id, $sortfield, $sortorder, '', $numrows, $totalnboflines, '');
|
2006-08-13 17:20:25 +02:00
|
|
|
|
2019-10-08 15:47:47 +02:00
|
|
|
print '<form name="aaa" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2017-10-13 23:38:57 +02:00
|
|
|
print '<input type="hidden" name="action" value="confirm_editbankreceipt">';
|
|
|
|
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
|
|
|
print '<input type="hidden" name="account" value="'.$object->id.'">';
|
2019-10-08 15:47:47 +02:00
|
|
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
2017-10-13 23:38:57 +02:00
|
|
|
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2013-05-12 20:10:16 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2017-12-10 15:46:35 +01:00
|
|
|
print '<td>'.$langs->trans("Ref").'</td>';
|
2019-01-24 10:02:06 +01:00
|
|
|
print '<td class="right">'.$langs->trans("InitialBankBalance").'</td>';
|
|
|
|
|
print '<td class="right">'.$langs->trans("EndBankBalance").'</td>';
|
2017-10-13 23:38:57 +02:00
|
|
|
print '<td></td>';
|
2015-02-07 23:32:46 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
|
2019-11-12 00:15:34 +01:00
|
|
|
$balancestart = array();
|
|
|
|
|
$content = array();
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
while ($i < min($numrows, $conf->liste_limit)) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$objp = $db->fetch_object($result);
|
2017-04-06 22:31:45 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!isset($objp->numr)) {
|
2006-08-13 02:34:16 +02:00
|
|
|
//
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2017-10-13 23:38:57 +02:00
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
print '<td>';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($action != 'editbankreceipt' || $objp->numr != $brref) {
|
2017-10-13 23:38:57 +02:00
|
|
|
print '<a href="releve.php?num='.$objp->numr.'&account='.$object->id.'">'.$objp->numr.'</a>';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2017-10-13 23:38:57 +02:00
|
|
|
print '<input type="hidden" name="oldbankreceipt" value="'.$objp->numr.'">';
|
|
|
|
|
print '<input type="text" name="newbankreceipt" value="'.$objp->numr.'">';
|
2022-01-04 09:33:52 +01:00
|
|
|
print '<input type="submit" class="button small" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
|
|
|
|
|
print '<input type="submit" class="button button-cancel small" name="cancel" value="'.$langs->trans("Cancel").'">';
|
2017-10-13 23:38:57 +02:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
2015-02-07 23:32:46 +01:00
|
|
|
|
|
|
|
|
// Calculate start amount
|
|
|
|
|
$sql = "SELECT sum(b.amount) as amount";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
|
|
|
|
$sql .= " WHERE b.num_releve < '".$db->escape($objp->numr)."'";
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND b.fk_account = ".((int) $object->id);
|
2019-11-12 00:15:34 +01:00
|
|
|
$resql = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resql) {
|
2019-11-12 00:15:34 +01:00
|
|
|
$obj = $db->fetch_object($resql);
|
2015-02-07 23:32:46 +01:00
|
|
|
$balancestart[$objp->numr] = $obj->amount;
|
|
|
|
|
$db->free($resql);
|
|
|
|
|
}
|
2021-12-28 10:12:12 +01:00
|
|
|
print '<td class="right"><span class="amount">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).'</span></td>';
|
2015-02-07 23:32:46 +01:00
|
|
|
|
|
|
|
|
// Calculate end amount
|
|
|
|
|
$sql = "SELECT sum(b.amount) as amount";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
|
|
|
|
$sql .= " WHERE b.num_releve = '".$db->escape($objp->numr)."'";
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND b.fk_account = ".((int) $object->id);
|
2019-11-12 00:15:34 +01:00
|
|
|
$resql = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resql) {
|
2019-11-12 00:15:34 +01:00
|
|
|
$obj = $db->fetch_object($resql);
|
2015-02-07 23:32:46 +01:00
|
|
|
$content[$objp->numr] = $obj->amount;
|
|
|
|
|
$db->free($resql);
|
|
|
|
|
}
|
2021-12-28 10:12:12 +01:00
|
|
|
print '<td class="right"><span class="amount">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).'</span></td>';
|
2015-02-07 23:32:46 +01:00
|
|
|
|
2019-02-23 22:56:38 +01:00
|
|
|
print '<td class="center">';
|
2017-10-13 23:38:57 +02:00
|
|
|
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
2022-01-04 09:45:31 +01:00
|
|
|
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'</a>';
|
2017-10-13 23:38:57 +02:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
2015-02-07 23:32:46 +01:00
|
|
|
print '</tr>'."\n";
|
2006-08-13 02:34:16 +02:00
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
print "</table>\n";
|
2017-10-13 23:38:57 +02:00
|
|
|
print '</form>';
|
2009-04-09 20:49:17 +02:00
|
|
|
|
2006-08-13 02:34:16 +02:00
|
|
|
print "\n</div>\n";
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_print_error($db);
|
2006-08-13 02:34:16 +02:00
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2006-08-13 02:34:16 +02:00
|
|
|
/**
|
2020-01-19 20:33:55 +01:00
|
|
|
* Show list of record into a bank statement
|
2009-04-09 20:49:17 +02:00
|
|
|
*/
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2019-11-05 13:51:52 +01:00
|
|
|
// Onglets
|
2019-11-12 00:15:34 +01:00
|
|
|
$head = account_statement_prepare_head($object, $numref);
|
2020-10-22 22:50:03 +02:00
|
|
|
print dol_get_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account');
|
2019-11-05 13:51:52 +01:00
|
|
|
|
|
|
|
|
|
2020-07-10 13:40:33 +02:00
|
|
|
$morehtmlright = '';
|
|
|
|
|
$morehtmlright .= '<div class="pagination"><ul>';
|
|
|
|
|
$morehtmlright .= '<li class="pagination"><a class="paginationnext" href="'.$_SERVER["PHP_SELF"].'?rel=prev&num='.$numref.'&ve='.$ve.'&account='.$object->id.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>';
|
|
|
|
|
$morehtmlright .= '<li class="pagination"><span class="active">'.$langs->trans("AccountStatement")." ".$numref.'</span></li>';
|
|
|
|
|
$morehtmlright .= '<li class="pagination"><a class="paginationnext" href="'.$_SERVER["PHP_SELF"].'?rel=next&num='.$numref.'&ve='.$ve.'&account='.$object->id.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
|
|
|
|
|
$morehtmlright .= '</ul></div>';
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$title = $langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
|
|
|
|
print load_fiche_titre($title, $morehtmlright, '');
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2022-06-13 04:38:16 +02:00
|
|
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2018-04-09 00:03:13 +02:00
|
|
|
print '<input type="hidden" name="action" value="add">';
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<div class="div-table-responsive">';
|
2019-02-23 22:56:38 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2006-08-13 02:34:16 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2019-02-23 22:56:38 +01:00
|
|
|
print '<td class="center">'.$langs->trans("DateOperationShort").'</td>';
|
|
|
|
|
print '<td class="center">'.$langs->trans("DateValueShort").'</td>';
|
2006-08-13 02:34:16 +02:00
|
|
|
print '<td>'.$langs->trans("Type").'</td>';
|
|
|
|
|
print '<td>'.$langs->trans("Description").'</td>';
|
2019-01-24 10:02:06 +01:00
|
|
|
print '<td class="right" width="60">'.$langs->trans("Debit").'</td>';
|
|
|
|
|
print '<td class="right" width="60">'.$langs->trans("Credit").'</td>';
|
|
|
|
|
print '<td class="right">'.$langs->trans("Balance").'</td>';
|
2006-08-13 02:34:16 +02:00
|
|
|
print '<td> </td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2009-05-05 14:43:51 +02:00
|
|
|
// Calcul du solde de depart du releve
|
|
|
|
|
$sql = "SELECT sum(b.amount) as amount";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
|
|
|
|
$sql .= " WHERE b.num_releve < '".$db->escape($numref)."'";
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND b.fk_account = ".((int) $object->id);
|
2009-08-07 20:39:01 +02:00
|
|
|
|
2019-11-12 00:15:34 +01:00
|
|
|
$resql = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resql) {
|
2019-11-12 00:15:34 +01:00
|
|
|
$obj = $db->fetch_object($resql);
|
2006-08-13 02:34:16 +02:00
|
|
|
$total = $obj->amount;
|
|
|
|
|
$db->free($resql);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-05 14:43:51 +02:00
|
|
|
// Recherche les ecritures pour le releve
|
2020-10-31 14:32:18 +01:00
|
|
|
$sql = $sqlrequestforbankline;
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2006-08-13 02:34:16 +02:00
|
|
|
$result = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($result) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$numrows = $db->num_rows($result);
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
2009-04-09 20:49:17 +02:00
|
|
|
// Ligne Solde debut releve
|
2017-04-08 14:03:38 +02:00
|
|
|
print '<tr class="oddeven"><td colspan="3"></td>';
|
|
|
|
|
print '<td colspan="3"><b>'.$langs->trans("InitialBankBalance")." :</b></td>";
|
|
|
|
|
print '<td class="right"><b>'.price($total).'</b></td><td> </td>';
|
2017-01-18 15:23:37 +01:00
|
|
|
print "</tr>\n";
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
while ($i < $numrows) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$objp = $db->fetch_object($result);
|
|
|
|
|
$total = $total + $objp->amount;
|
|
|
|
|
|
2017-04-07 16:44:43 +02:00
|
|
|
print '<tr class="oddeven">';
|
2006-08-13 02:34:16 +02:00
|
|
|
|
|
|
|
|
// Date operation
|
2019-02-23 22:56:38 +01:00
|
|
|
print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->do), "day").'</td>';
|
2006-08-13 02:34:16 +02:00
|
|
|
|
|
|
|
|
// Date de valeur
|
2019-02-23 22:56:38 +01:00
|
|
|
print '<td valign="center" class="center nowrap">';
|
2021-03-19 12:08:40 +01:00
|
|
|
print '<span class="spanforajaxedit">'.dol_print_date($db->jdate($objp->dv), "day").'</span>';
|
|
|
|
|
print ' ';
|
|
|
|
|
print '<span class="inline-block">';
|
|
|
|
|
print '<a class="ajaxforbankoperationchange reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&num='.$numref.'&account='.$object->id.'&rowid='.$objp->rowid.'&dvid='.$objp->rowid.'">';
|
2019-11-12 00:15:34 +01:00
|
|
|
print img_edit_remove()."</a> ";
|
2021-03-19 12:08:40 +01:00
|
|
|
print '<a class="ajaxforbankoperationchange reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&num='.$numref.'&account='.$object->id.'&rowid='.$objp->rowid.'&dvid='.$objp->rowid.'">';
|
2019-11-12 00:15:34 +01:00
|
|
|
print img_edit_add()."</a>";
|
2021-03-19 12:08:40 +01:00
|
|
|
print '</span>';
|
2006-08-13 02:34:16 +02:00
|
|
|
print "</td>\n";
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2013-07-13 17:25:10 +02:00
|
|
|
// Type and num
|
2020-10-31 14:32:18 +01:00
|
|
|
if ($objp->fk_type == 'SOLD') {
|
|
|
|
|
$type_label = ' ';
|
|
|
|
|
} else {
|
|
|
|
|
$type_label = ($langs->trans("PaymentTypeShort".$objp->fk_type) != "PaymentTypeShort".$objp->fk_type) ? $langs->trans("PaymentTypeShort".$objp->fk_type) : $objp->fk_type;
|
|
|
|
|
}
|
|
|
|
|
$link = '';
|
|
|
|
|
if ($objp->fk_bordereau > 0) {
|
|
|
|
|
$remisestatic->id = $objp->fk_bordereau;
|
|
|
|
|
$remisestatic->ref = $objp->ref;
|
|
|
|
|
$link = ' '.$remisestatic->getNomUrl(1);
|
|
|
|
|
}
|
2019-11-12 00:15:34 +01:00
|
|
|
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq ? $objp->num_chq : '').$link.'</td>';
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2013-07-13 17:25:10 +02:00
|
|
|
// Description
|
2020-01-19 19:33:57 +01:00
|
|
|
print '<td valign="center">';
|
2021-11-13 15:19:03 +01:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
2019-11-12 00:15:34 +01:00
|
|
|
$reg = array();
|
|
|
|
|
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) {
|
|
|
|
|
print $langs->trans($reg[1]);
|
|
|
|
|
} else {
|
|
|
|
|
print $objp->label;
|
|
|
|
|
}
|
2006-08-13 02:34:16 +02:00
|
|
|
print '</a>';
|
|
|
|
|
|
|
|
|
|
/*
|
2021-11-13 15:19:03 +01:00
|
|
|
* Add links under the label (link to payment, company, user, social contribution...)
|
2009-04-09 20:49:17 +02:00
|
|
|
*/
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 1;
|
2015-08-28 20:11:16 +02:00
|
|
|
$links = $object->get_url($objp->rowid);
|
2021-02-23 21:09:01 +01:00
|
|
|
foreach ($links as $key => $val) {
|
|
|
|
|
if (!$newline) {
|
|
|
|
|
print ' - ';
|
|
|
|
|
} else {
|
|
|
|
|
print '<br>';
|
|
|
|
|
}
|
|
|
|
|
if ($links[$key]['type'] == 'payment') {
|
2019-11-12 00:15:34 +01:00
|
|
|
$paymentstatic->id = $links[$key]['url_id'];
|
|
|
|
|
$paymentstatic->ref = $langs->trans("Payment");
|
2013-05-12 20:10:16 +02:00
|
|
|
print ' '.$paymentstatic->getNomUrl(1);
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_supplier') {
|
2019-11-12 00:15:34 +01:00
|
|
|
$paymentsupplierstatic->id = $links[$key]['url_id'];
|
|
|
|
|
$paymentsupplierstatic->ref = $langs->trans("Payment");
|
2013-05-12 20:10:16 +02:00
|
|
|
print ' '.$paymentsupplierstatic->getNomUrl(1);
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_sc') {
|
2014-09-18 21:18:25 +02:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print ' '.img_object($langs->trans('ShowPayment'), 'payment').' ';
|
2013-06-05 16:24:32 +02:00
|
|
|
print $langs->trans("SocialContributionPayment");
|
|
|
|
|
print '</a>';
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_vat') {
|
2019-11-12 00:15:34 +01:00
|
|
|
$paymentvatstatic->id = $links[$key]['url_id'];
|
|
|
|
|
$paymentvatstatic->ref = $langs->trans("Payment");
|
2013-07-13 17:25:10 +02:00
|
|
|
print ' '.$paymentvatstatic->getNomUrl(1);
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_salary') {
|
2019-07-19 23:08:24 +02:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print ' '.img_object($langs->trans('ShowPayment'), 'payment').' ';
|
2017-04-06 23:28:06 +02:00
|
|
|
print $langs->trans("Payment");
|
|
|
|
|
print '</a>';
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_donation') {
|
2020-04-10 10:59:32 +02:00
|
|
|
$paymentdonationstatic->id = $links[$key]['url_id'];
|
|
|
|
|
$paymentdonationstatic->ref = $langs->trans("Payment");
|
2020-01-03 16:35:02 +01:00
|
|
|
print ' '.$paymentdonationstatic->getNomUrl(1);
|
|
|
|
|
$newline = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_loan') {
|
2020-04-10 10:59:32 +02:00
|
|
|
$paymentloanstatic->id = $links[$key]['url_id'];
|
|
|
|
|
$paymentloanstatic->ref = $langs->trans("Payment");
|
2020-01-03 16:35:02 +01:00
|
|
|
print ' '.$paymentloanstatic->getNomUrl(1);
|
|
|
|
|
$newline = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
} elseif ($links[$key]['type'] == 'payment_various') {
|
2020-04-10 10:59:32 +02:00
|
|
|
$paymentvariousstatic->id = $links[$key]['url_id'];
|
|
|
|
|
$paymentvariousstatic->ref = $langs->trans("Payment");
|
2020-01-03 16:35:02 +01:00
|
|
|
print ' '.$paymentvariousstatic->getNomUrl(1);
|
|
|
|
|
$newline = 0;
|
2020-05-21 15:05:19 +02:00
|
|
|
} elseif ($links[$key]['type'] == 'banktransfert') {
|
2013-06-05 16:24:32 +02:00
|
|
|
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($objp->amount > 0) {
|
2013-06-05 16:24:32 +02:00
|
|
|
$banklinestatic->fetch($links[$key]['url_id']);
|
2019-11-12 00:15:34 +01:00
|
|
|
$bankstatic->id = $banklinestatic->fk_account;
|
|
|
|
|
$bankstatic->label = $banklinestatic->bank_account_label;
|
2013-06-05 16:24:32 +02:00
|
|
|
print ' ('.$langs->trans("from").' ';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $bankstatic->getNomUrl(1, 'transactions');
|
2013-06-05 16:24:32 +02:00
|
|
|
print ' '.$langs->trans("toward").' ';
|
2019-11-12 00:15:34 +01:00
|
|
|
$bankstatic->id = $objp->bankid;
|
|
|
|
|
$bankstatic->label = $objp->bankref;
|
2019-01-27 11:55:16 +01:00
|
|
|
print $bankstatic->getNomUrl(1, '');
|
2013-06-05 16:24:32 +02:00
|
|
|
print ')';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2019-11-12 00:15:34 +01:00
|
|
|
$bankstatic->id = $objp->bankid;
|
|
|
|
|
$bankstatic->label = $objp->bankref;
|
2013-06-05 16:24:32 +02:00
|
|
|
print ' ('.$langs->trans("from").' ';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $bankstatic->getNomUrl(1, '');
|
2013-06-05 16:24:32 +02:00
|
|
|
print ' '.$langs->trans("toward").' ';
|
|
|
|
|
$banklinestatic->fetch($links[$key]['url_id']);
|
2019-11-12 00:15:34 +01:00
|
|
|
$bankstatic->id = $banklinestatic->fk_account;
|
|
|
|
|
$bankstatic->label = $banklinestatic->bank_account_label;
|
2019-01-27 11:55:16 +01:00
|
|
|
print $bankstatic->getNomUrl(1, 'transactions');
|
2013-06-05 16:24:32 +02:00
|
|
|
print ')';
|
|
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} elseif ($links[$key]['type'] == 'company') {
|
2020-10-31 14:32:18 +01:00
|
|
|
$societestatic->id = $links[$key]['url_id'];
|
|
|
|
|
$societestatic->name = $links[$key]['label'];
|
|
|
|
|
print $societestatic->getNomUrl(1, 'company', 24);
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2020-05-21 15:05:19 +02:00
|
|
|
} elseif ($links[$key]['type'] == 'member') {
|
2014-09-18 21:18:25 +02:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print img_object($langs->trans('ShowMember'), 'user').' ';
|
2007-11-05 00:08:52 +01:00
|
|
|
print $links[$key]['label'];
|
|
|
|
|
print '</a>';
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2020-05-21 15:05:19 +02:00
|
|
|
} elseif ($links[$key]['type'] == 'user') {
|
2017-11-24 14:23:25 +01:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print img_object($langs->trans('ShowUser'), 'user').' ';
|
2017-04-06 23:28:06 +02:00
|
|
|
print $links[$key]['label'];
|
|
|
|
|
print '</a>';
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2020-05-21 15:05:19 +02:00
|
|
|
} elseif ($links[$key]['type'] == 'sc') {
|
2016-08-22 13:43:49 +02:00
|
|
|
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print img_object($langs->trans('ShowBill'), 'bill').' ';
|
2013-05-12 20:10:16 +02:00
|
|
|
print $langs->trans("SocialContribution");
|
|
|
|
|
print '</a>';
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2006-08-13 02:34:16 +02:00
|
|
|
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
|
|
|
|
print $links[$key]['label'];
|
|
|
|
|
print '</a>';
|
2019-11-12 00:15:34 +01:00
|
|
|
$newline = 0;
|
2006-08-13 02:34:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-09 20:49:17 +02:00
|
|
|
// Categories
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($ve) {
|
2009-05-05 14:43:51 +02:00
|
|
|
$sql = "SELECT label";
|
2019-11-12 00:15:34 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as ct";
|
|
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."bank_class as cl";
|
|
|
|
|
$sql .= " WHERE ct.rowid = cl.fk_categ";
|
2021-08-23 17:41:11 +02:00
|
|
|
$sql .= " AND ct.entity = ".((int) $conf->entity);
|
2021-06-09 15:36:47 +02:00
|
|
|
$sql .= " AND cl.lineid = ".((int) $objp->rowid);
|
2009-08-07 20:39:01 +02:00
|
|
|
|
2006-08-13 02:34:16 +02:00
|
|
|
$resc = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resc) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$numc = $db->num_rows($resc);
|
|
|
|
|
$ii = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($numc && !$newline) {
|
|
|
|
|
print '<br>';
|
|
|
|
|
}
|
|
|
|
|
while ($ii < $numc) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$objc = $db->fetch_object($resc);
|
2018-04-09 00:01:15 +02:00
|
|
|
print "<br>- <i>".$objc->label."</i>";
|
2006-08-13 02:34:16 +02:00
|
|
|
$ii++;
|
|
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_print_error($db);
|
2006-08-13 02:34:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
2017-10-13 21:25:27 +02:00
|
|
|
|
2006-08-13 02:34:16 +02:00
|
|
|
print "</td>";
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($objp->amount < 0) {
|
2006-08-13 02:34:16 +02:00
|
|
|
$totald = $totald + abs($objp->amount);
|
2019-02-04 13:44:02 +01:00
|
|
|
print '<td class="nowrap right">'.price($objp->amount * -1)."</td><td> </td>\n";
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2006-08-13 02:34:16 +02:00
|
|
|
$totalc = $totalc + abs($objp->amount);
|
2019-02-04 13:44:02 +01:00
|
|
|
print '<td> </td><td class="nowrap right">'.price($objp->amount)."</td>\n";
|
2006-08-13 02:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
2019-02-04 13:44:02 +01:00
|
|
|
print '<td class="nowrap right">'.price(price2num($total, 'MT'))."</td>\n";
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
2020-07-10 13:59:54 +02:00
|
|
|
print '<td class="center"><a class="editfielda reposition" href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?account='.$object->id.'&num='.$numref).'">';
|
2006-08-13 02:34:16 +02:00
|
|
|
print img_edit();
|
|
|
|
|
print "</a></td>";
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2019-02-23 22:56:38 +01:00
|
|
|
print "<td class=\"center\"> </td>";
|
2006-08-13 02:34:16 +02:00
|
|
|
}
|
|
|
|
|
print "</tr>";
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free($result);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-17 17:13:10 +02:00
|
|
|
// Line Total
|
2019-02-23 22:56:38 +01:00
|
|
|
print "\n".'<tr class="liste_total"><td class="right" colspan="4">'.$langs->trans("Total")." :</td><td class=\"right\">".price($totald)."</td><td class=\"right\">".price($totalc)."</td><td> </td><td> </td></tr>";
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2011-04-17 17:13:10 +02:00
|
|
|
// Line Balance
|
2018-04-09 00:01:15 +02:00
|
|
|
print "\n<tr>";
|
2019-02-23 22:56:38 +01:00
|
|
|
print "<td class=\"right\" colspan=\"3\"> </td><td colspan=\"3\"><b>".$langs->trans("EndBankBalance")." :</b></td>";
|
2018-04-09 00:01:15 +02:00
|
|
|
print '<td class="right"><b>'.price(price2num($total, 'MT'))."</b></td><td> </td>";
|
2017-01-18 15:23:37 +01:00
|
|
|
print "</tr>\n";
|
2017-01-18 15:49:12 +01:00
|
|
|
print "</table>";
|
2019-10-02 18:14:41 +02:00
|
|
|
|
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
|
|
|
|
|
$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()
|
|
|
|
|
{
|
2022-01-04 09:33:52 +01:00
|
|
|
console.log("We click on ajaxforbankoperationchange");
|
2021-03-19 12:08:40 +01:00
|
|
|
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
|
|
|
|
|
$.get(url, function(data)
|
|
|
|
|
{
|
|
|
|
|
console.log(url)
|
|
|
|
|
console.log(data)
|
|
|
|
|
current.parent().parent().find(".spanforajaxedit").replaceWith(data);
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
';
|
|
|
|
|
|
2017-01-18 15:49:12 +01:00
|
|
|
print "</div>";
|
2017-07-15 21:19:39 +02:00
|
|
|
|
2017-01-18 15:49:12 +01:00
|
|
|
print "</form>\n";
|
2002-05-11 20:53:13 +02:00
|
|
|
}
|
2006-08-13 02:34:16 +02:00
|
|
|
|
2018-07-29 19:16:28 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2015-08-28 20:11:16 +02:00
|
|
|
$db->close();
|