Fix: Navigation in bank account statement
This commit is contained in:
parent
b302cf0edc
commit
c03fe82b09
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -15,16 +15,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/bank/releve.php
|
* \file htdocs/compta/bank/releve.php
|
||||||
\ingroup banque
|
* \ingroup banque
|
||||||
\brief Page d'affichage d'un relev<EFBFBD>
|
* \brief Page d'affichage d'un releve
|
||||||
\version $Revision$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php");
|
||||||
@ -34,19 +32,19 @@ $langs->load("banks");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
if (!$user->rights->banque->lire)
|
if (!$user->rights->banque->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
if ($_GET["action"] == 'dvnext')
|
if ($_GET["action"] == 'dvnext')
|
||||||
{
|
{
|
||||||
$ac = new Account($db);
|
$ac = new Account($db);
|
||||||
$ac->datev_next($_GET["dvid"]);
|
$ac->datev_next($_GET["dvid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'dvprev')
|
if ($_GET["action"] == 'dvprev')
|
||||||
{
|
{
|
||||||
$ac = new Account($db);
|
$ac = new Account($db);
|
||||||
$ac->datev_previous($_GET["dvid"]);
|
$ac->datev_previous($_GET["dvid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,12 +60,16 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
// R<EFBFBD>cup<EFBFBD>re info du compte
|
// Load account
|
||||||
$acct = new Account($db);
|
$acct = new Account($db);
|
||||||
if ($_GET["account"])
|
if ($_GET["account"])
|
||||||
{
|
{
|
||||||
@ -82,8 +84,8 @@ if ($_GET["ref"])
|
|||||||
if (! isset($_GET["num"]))
|
if (! isset($_GET["num"]))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Vue liste tous relev<EFBFBD>s confondus
|
* Vue liste tous releves confondus
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT distinct(b.num_releve) as numr";
|
$sql = "SELECT distinct(b.num_releve) as numr";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql.= " WHERE fk_account = ".$_GET["account"];
|
$sql.= " WHERE fk_account = ".$_GET["account"];
|
||||||
@ -152,25 +154,28 @@ if (! isset($_GET["num"]))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Affiche liste ecritures d'un releve
|
* Affiche liste ecritures d'un releve
|
||||||
*/
|
*/
|
||||||
|
$ve=$_GET["ve"];
|
||||||
|
|
||||||
|
$found=false;
|
||||||
if ($_GET["rel"] == 'prev')
|
if ($_GET["rel"] == 'prev')
|
||||||
{
|
{
|
||||||
// Recherche valeur pour num = num<75>ro relev<65> pr<70>c<EFBFBD>dent
|
// Recherche valeur pour num = num<75>ro relev<65> pr<70>c<EFBFBD>dent
|
||||||
$sql = "SELECT distinct(num_releve) as num";
|
$sql = "SELECT distinct(num_releve) as num";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||||
$sql.= " WHERE num_releve < ".$_GET["num"]." AND fk_account = ".$_GET["account"];
|
$sql.= " WHERE num_releve < '".$_GET["num"]."' AND fk_account = ".$_GET["account"];
|
||||||
$sql.= " ORDER BY num_releve DESC";
|
$sql.= " ORDER BY num_releve DESC";
|
||||||
$result = $db->query($sql);
|
dol_syslog("htdocs/compta/bank/releve.php sql=".$sql);
|
||||||
if ($result)
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$var=True;
|
$numrows = $db->num_rows($resql);
|
||||||
$numrows = $db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
if ($numrows > 0)
|
if ($numrows > 0)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
$num = $obj->num;
|
$num = $obj->num;
|
||||||
|
$found=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,27 +184,27 @@ else
|
|||||||
// Recherche valeur pour num = num<75>ro relev<65> pr<70>c<EFBFBD>dent
|
// Recherche valeur pour num = num<75>ro relev<65> pr<70>c<EFBFBD>dent
|
||||||
$sql = "SELECT distinct(num_releve) as num";
|
$sql = "SELECT distinct(num_releve) as num";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||||
$sql.= " WHERE num_releve > ".$_GET["num"]." AND fk_account = ".$_GET["account"];
|
$sql.= " WHERE num_releve > '".$_GET["num"]."' AND fk_account = ".$_GET["account"];
|
||||||
$sql.= " ORDER BY num_releve ASC";
|
$sql.= " ORDER BY num_releve ASC";
|
||||||
$result = $db->query($sql);
|
dol_syslog("htdocs/compta/bank/releve.php sql=".$sql);
|
||||||
if ($result)
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$var=True;
|
$numrows = $db->num_rows($resql);
|
||||||
$numrows = $db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
if ($numrows > 0)
|
if ($numrows > 0)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
$num = $obj->num;
|
$num = $obj->num;
|
||||||
|
$found=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// On veut le relev<EFBFBD> num
|
// On veut le releve num
|
||||||
$num=$_GET["num"];
|
$num=$_GET["num"];
|
||||||
|
$found=true;
|
||||||
}
|
}
|
||||||
$ve=$_GET["ve"];
|
if (! $found) $num=$_GET["num"];
|
||||||
|
|
||||||
|
|
||||||
$mesprevnext ="<a href=\"releve.php?rel=prev&num=$num&ve=$ve&account=$acct->id\">".img_previous()."</a> ";
|
$mesprevnext ="<a href=\"releve.php?rel=prev&num=$num&ve=$ve&account=$acct->id\">".img_previous()."</a> ";
|
||||||
$mesprevnext.= $langs->trans("AccountStatement")." $num";
|
$mesprevnext.= $langs->trans("AccountStatement")." $num";
|
||||||
@ -222,9 +227,9 @@ else
|
|||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Calcul du solde de d<EFBFBD>part du relev
|
// Calcul du solde de depart du relev
|
||||||
$sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank";
|
$sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank";
|
||||||
$sql.= " WHERE num_releve < ".$num." AND fk_account = ".$acct->id;
|
$sql.= " WHERE num_releve < '".$num."' AND fk_account = ".$acct->id;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -251,7 +256,7 @@ else
|
|||||||
$numrows = $db->num_rows($result);
|
$numrows = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// Ligne Solde d<EFBFBD>but releve
|
// Ligne Solde debut releve
|
||||||
print "<tr><td colspan=\"4\"><a href=\"releve.php?num=$num&ve=1&rel=$rel&account=".$acct->id."\"> </a></td>";
|
print "<tr><td colspan=\"4\"><a href=\"releve.php?num=$num&ve=1&rel=$rel&account=".$acct->id."\"> </a></td>";
|
||||||
print "<td align=\"right\" colspan=\"2\"><b>".$langs->trans("InitialBankBalance")." :</b></td><td align=\"right\"><b>".price($total)."</b></td><td> </td></tr>\n";
|
print "<td align=\"right\" colspan=\"2\"><b>".$langs->trans("InitialBankBalance")." :</b></td><td align=\"right\"><b>".price($total)."</b></td><td> </td></tr>\n";
|
||||||
|
|
||||||
@ -287,8 +292,8 @@ else
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout les liens (societe, company...)
|
* Ajout les liens (societe, company...)
|
||||||
*/
|
*/
|
||||||
$newline=1;
|
$newline=1;
|
||||||
$links = $acct->get_url($objp->rowid);
|
$links = $acct->get_url($objp->rowid);
|
||||||
foreach($links as $key=>$val)
|
foreach($links as $key=>$val)
|
||||||
@ -339,12 +344,12 @@ else
|
|||||||
$newline=0;
|
$newline=0;
|
||||||
}
|
}
|
||||||
else if ($links[$key]['type']=='banktransfert') {
|
else if ($links[$key]['type']=='banktransfert') {
|
||||||
/* print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
|
/* print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
|
||||||
print img_object($langs->trans('ShowTransaction'),'payment').' ';
|
print img_object($langs->trans('ShowTransaction'),'payment').' ';
|
||||||
print $langs->trans("TransactionOnTheOtherAccount");
|
print $langs->trans("TransactionOnTheOtherAccount");
|
||||||
print '</a>';
|
print '</a>';
|
||||||
$newline=0;
|
$newline=0;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||||
@ -354,7 +359,7 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cat<EFBFBD>gories
|
// Categories
|
||||||
if ($ve)
|
if ($ve)
|
||||||
{
|
{
|
||||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl";
|
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user