diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 35b1521c6f0..1d2e8430399 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -24,15 +24,16 @@ require("./pre.inc.php"); -if(isset($_GET["account"])) - $HTTP_POST_VARS["account"] = $_GET["account"]; -if(isset($_GET["vline"])) - $HTTP_POST_VARS["vline"] = $_GET["vline"]; - if (!$user->rights->banque->lire) accessforbidden(); -if ($HTTP_POST_VARS["action"] == 'add' && $HTTP_POST_VARS["account"]) + +$account=isset($_GET["account"])?isset($_GET["account"]):$HTTP_POST_VARS["account"]; +$vline=isset($_GET["vline"])?isset($_GET["vline"]):$HTTP_POST_VARS["vline"]; +$action=isset($_GET["action"])?isset($_GET["action"]):$HTTP_POST_VARS["action"]; + + +if ($action == 'add' && $account) { if ($credit > 0) { @@ -44,7 +45,7 @@ if ($HTTP_POST_VARS["action"] == 'add' && $HTTP_POST_VARS["account"]) } $dateop = "$dateoy" . "$dateo"; - $acct=new Account($db,$HTTP_POST_VARS["account"]); + $acct=new Account($db,$account); $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq,$cat1); @@ -100,9 +101,10 @@ if ($action == 'del' && $account && $user->rights->banque->modifier) */ llxHeader(); -print "

Account: " . $HTTP_POST_VARS["account"] . "o" . $HTTP_POST_VARS["account"] . "

\n"; -if ($HTTP_POST_VARS["account"] > 0) +//print "

Account: " . $account . "o" . $account . "

\n"; + +if ($account > 0) { if ($vline) { @@ -113,29 +115,10 @@ if ($HTTP_POST_VARS["account"] > 0) $viewline = 20; } $acct = new Account($db); - $acct->fetch($HTTP_POST_VARS["account"]); - - $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ;"; - $result = $db->query($sql); - if ($result) - { - $var=True; - $num = $db->num_rows(); - $i = 0; - $options = ""; - while ($i < $num) - { - $obj = $db->fetch_object($i); - $options .= "\n"; $i++; - } - $db->free(); - } - - + $acct->fetch($account); print_titre("Compte : " .$acct->label); - /* - * - */ + + // Chargement des categories dans $options $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ;"; $result = $db->query($sql); if ($result) @@ -151,6 +134,7 @@ if ($HTTP_POST_VARS["account"] > 0) } $db->free(); } + /* * * @@ -165,7 +149,7 @@ if ($HTTP_POST_VARS["account"] > 0) * */ $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."bank as b WHERE 1=1"; - $sql .= " AND b.dateo <= now()"; +// $sql .= " AND b.dateo <= now()"; $sql .= " AND b.fk_account=".$acct->id; $sql .= $sql_rech; @@ -199,6 +183,7 @@ if ($HTTP_POST_VARS["account"] > 0) $page = 0; $limitsql = $nbline; } + //print "$viewline $nbline $limitsql"; /* * Formulaire de recherche @@ -208,7 +193,7 @@ if ($HTTP_POST_VARS["account"] > 0) print ''; print ''; print ''; - print ""; + print ""; print '\n"; @@ -316,7 +301,9 @@ if ($HTTP_POST_VARS["account"] > 0) print ''; print ''; print ''; - print ""; + print ""; print ''; print ''; print ''; @@ -337,10 +324,12 @@ else $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); + + /* * */ -Function _print_lines($db,$sql, $acct) +Function _print_lines($db,$sql,$acct) { global $bc, $nbline, $viewline, $user; $var=True; @@ -353,7 +342,7 @@ Function _print_lines($db,$sql, $acct) $objp = $db->fetch_object( $i); $total = $total + $objp->amount; $time = time(); - if ($i > ($nbline - $viewline)) + if ($i >= ($nbline - $viewline)) { $var=!$var; @@ -363,25 +352,7 @@ Function _print_lines($db,$sql, $acct) print ""; print ""; print ""; - print ''; - print ''; - print ''; - print '"; - print ""; - print ""; - print ""; - print ""; - print ''; + print ''; } print "";
'; if ($limitsql > $viewline) { @@ -281,7 +266,7 @@ if ($HTTP_POST_VARS["account"] > 0) } } - $sql .= " AND b.dateo <= now()"; +// $sql .= " AND b.dateo <= now()"; $sql .= " ORDER BY b.dateo ASC"; $sql .= $db->plimit($limitsql, 0); @@ -291,11 +276,11 @@ if ($HTTP_POST_VARS["account"] > 0) { _print_lines($db, $sql, $acct); } + /* - * Opérations futures + * Opérations hors factures * */ - if ($user->rights->banque->modifier) { print "
 
"; + print ""; + print "
YYYY MMDD Description0000.000000.00
 ".price($total - $objp->amount)." 
'; - print ''; - print ' -'; - print "
YYYYMMDD0000.00