* * $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"); $db = new Db(); if ($HTTP_POST_VARS["action"] == 'add' && $account) { if ($credit > 0) { $amount = $credit ; } else { $amount = - $debit ; } $dateop = "$dateoy" . "$dateo"; if ($num_chq) { $sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)"; $sql .= " VALUES (now(), $dateop, '$label', $amount,'$author',$num_chq,$account,'$operation')"; } else { $sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author,fk_account,fk_type)"; $sql .= " VALUES (now(), $dateop, '$label', $amount,'$author',$account,'$operation')"; } $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); } Header("Location: $PHP_SELF?account=$account"); } else { print $db->error(); print "

$sql"; } } if ($action == 'del' && $account) { bank_delete_line($db, $rowid); } llxHeader(); if ($account) { if ($vline) { $viewline = $vline; } else { $viewline = 20; } print "Bank -  -"; print "Voir tout"; /* * Formulaire de recherche * */ print '

'; print ''; print ''; print ""; print ''; print ''; print ''; print ''; print ""; print ""; print ''; print "\n"; print ""; /* * * */ 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_type"; $sql .= " FROM llx_bank as b "; if ($account) { $sql .= " WHERE fk_account=$account"; } if ($req_debit) { $sql .= " AND b.amount = -".$req_debit; } 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)) { if (!$psol && $action !='search') { print ""; print ""; print "\n"; print ''; $psol = 1; } else { $var=!$var; if ($objp->do > $time && !$sep) { $sep = 1 ; print ""; print ""; print ""; print ''; print ''; print ''; print ''; print '"; print ""; print ""; print ""; print ""; print ''; } print ""; print "\n"; print "\n"; if ($objp->num_chq) { print ""; } else { print ""; } if ($objp->amount < 0) { print "\n"; } else { print "\n"; } if ($action !='search') { if ($total > 0) { print '\n"; } else { print "\n"; } } else { print ''; } if ($objp->rappro) { print ""; } else { print ""; } if ($action !='search') { print "\n"; } else { print ''; } print ""; } } $i++; } $db->free(); } /* * Opérations futures * */ if ($sep) { print ""; print "\n"; } else { print ""; print "\n"; print ""; print ''; print "'; print "'; print ''; print ''; print ""; print ''; print ''; } print "
  --
DateTypeDescriptionDébitCréditSoldeRelFrancs
 ".price($total)." ".francs($total)." 
 ".price($total - $objp->amount)." '.francs($total - $objp->amount).'
'; print ''; print ' -'; print "
YYYYMMDD0000.00
".strftime("%d %b %y",$objp->do)."".$objp->fk_type."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]".francs($objp->amount)."-
 ".price($total)." ".francs($total)."
 ".price($total)." ".francs($total)."
'; print '"; print '"; print '
YYYYMMDD0000.00
"; print "Edit Categories"; print " Budgets"; } else { print_titre ("Comptes bancaires"); print ""; print ""; print ""; print ""; print "\n"; $sql = "SELECT rowid, label,number,bank FROM llx_bank_account"; $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); print ""; $i++; } $db->free(); } $acc = new Account($db); print "
LabelBanqueNuméro
$objp->label$objp->bank$objp->number
"; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>