From 5d3f986ca3ff12dc2a3f90647cc8113948f1994e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 25 Aug 2002 16:03:15 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/compta/bank/pre.inc.php3 | 1 + htdocs/compta/bank/search.php3 | 200 ++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 htdocs/compta/bank/search.php3 diff --git a/htdocs/compta/bank/pre.inc.php3 b/htdocs/compta/bank/pre.inc.php3 index 11a7c6d3e48..fc6fbdab8ca 100644 --- a/htdocs/compta/bank/pre.inc.php3 +++ b/htdocs/compta/bank/pre.inc.php3 @@ -34,6 +34,7 @@ function llxHeader($head = "") { $menu = new Menu(); $menu->add("index.php3","Comptes"); + $menu->add_submenu("search.php3","Recherche"); $db = new Db(); $sql = "SELECT rowid, label FROM llx_bank_account"; diff --git a/htdocs/compta/bank/search.php3 b/htdocs/compta/bank/search.php3 new file mode 100644 index 00000000000..da2d525ff8f --- /dev/null +++ b/htdocs/compta/bank/search.php3 @@ -0,0 +1,200 @@ + + * + * $Id$ + * $Source$ + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* + * + * $viewall + * + */ +require("./pre.inc.php3"); + +require("./bank.lib.php3"); +llxHeader(); +$db = new Db(); + + + + + + if ($action == 'add') { + $author = $GLOBALS["REMOTE_USER"]; + if ($credit > 0) { + $amount = $credit ; + } else { + $amount = - $debit ; + } + + if ($num_chq) { + $sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account)"; + $sql .= " VALUES (now(), $dateo, '$label', $amount,'$author',$num_chq,$account)"; + } else { + $sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author,fk_account)"; + $sql .= " VALUES (now(), $dateo, '$label', $amount,'$author',$account)"; + } + + $result = $db->query($sql); + if ($result) { + $rowid = $db->last_insert_id(); + if ($cat1) { + $sql = "INSERT INTO llx_bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)"; + $result = $db->query($sql); + } + } else { + print $db->error(); + print "

$sql"; + } + + } + + if ($vline) { + $viewline = $vline; + } else { + $viewline = 50; + } + + print "Bank - Reload -"; + print "Voir tout"; + + print "

"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + + $sql = "SELECT count(*) FROM llx_bank"; + if ($account) { $sql .= " WHERE fk_account=$account"; } + if ( $db->query($sql) ) { + $nbline = $db->result (0, 0); + $db->free(); + + if ($nbline > $viewline ) { + $limit = $nbline - $viewline ; + } else { + $limit = $viewline; + } + } + + $sql = "SELECT rowid, label FROM llx_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(); + } + + + if ($viewall) { $nbline=0; } + + /* Another solution + * create temporary table solde type=heap select amount from llx_bank limit 100 ; + * select sum(amount) from solde ; + */ + + $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_account"; + $sql .= " FROM llx_bank as b "; if ($account) { $sql .= " WHERE fk_account=$account"; } + if ($vue) { + if ($vue == 'credit') { + $sql .= " AND b.amount >= 0 "; + } else { + $sql .= " AND b.amount < 0 "; + } + } + $sql .= " ORDER BY b.dateo ASC"; + + $result = $db->query($sql); + if ($result) { + $var=True; + $num = $db->num_rows(); + $i = 0; $total = 0; + + $sep = 0; + + while ($i < $num) { + $objp = $db->fetch_object( $i); + $total = $total + $objp->amount; + $time = time(); + if ($i > ($nbline - $viewline)) { + + + $var=!$var; + + + print ""; + print "\n"; + + if ($objp->num_chq) { + print ""; + } else { + print ""; + } + + if ($objp->amount < 0) { + print "\n"; + } else { + print "\n"; + } + + if ($total > 0) { + print "\n"; + } else { + print "\n"; + } + + if ($objp->rappro) { + print ""; + } else { + print ""; + } + + print "\n"; + + print ""; + + + } + + + $i++; + } + $db->free(); + } + + + print "
DateDescriptionDebitCreditSoldeFrancs
".strftime("%d %b %y",$objp->do)."CHQ $objp->num_chq - $objp->label$objp->label".price($objp->amount * -1)."  ".price($objp->amount)."".price($total)."".price($total)."num_releve&account=$account\">$objp->num_releverowid&account=$account\">[Del]".$objp->fk_account."
"; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>