* Copyright (C) 2003 Xavier DUTOIT * * 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. * * $Id$ * $Source$ * */ require("./pre.inc.php"); if (!$user->rights->banque->modifier) accessforbidden(); llxHeader(); if ($HTTP_POST_VARS["action"] == 'confirm_delete_categ' && $HTTP_POST_VARS["confirm"] == yes) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = $cat1"; $db->query($sql); } if ($action == 'class') { $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = $cat1"; $db->query($sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)"; if ($db->query($sql)) { } else { print $db->error(); } } if ($action == 'update') { $author = $GLOBALS["REMOTE_USER"]; //avant de modifier la date ou le montant, on controle si ce n'est pas encore rapproche //print_r ($_POST); if (!empty($_POST['amount'])) { $sql = "SELECT b.rappro FROM ".MAIN_DB_PREFIX."bank as b WHERE rowid=$rowid"; $result = $db->query($sql); if ($result) { $var=True; $amount = str_replace(' ','',$_POST['amount']); $num = $db->num_rows(); $objp = $db->fetch_object( 0); if ($objp->rappro) die ("Vous ne pouvez pas modifier une écriture déjà rapprochée"); $sql = "update ".MAIN_DB_PREFIX."bank set label='$label' , dateo = '$date', amount='$amount' where rowid = $rowid;"; } } else $sql = "update ".MAIN_DB_PREFIX."bank set label='$label' where rowid = $rowid;"; $result = $db->query($sql); } if ($HTTP_POST_VARS["action"] == 'type') { $sql = "update ".MAIN_DB_PREFIX."bank set fk_type='$value' where rowid = $rowid;"; $result = $db->query($sql); } if ($HTTP_POST_VARS["action"] == 'num_releve') { $sql = "update ".MAIN_DB_PREFIX."bank set num_releve=$num_rel where rowid = $rowid;"; $result = $db->query($sql); } $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(); } if ($action == 'delete_categ') { $html = new Form($db); $html->form_confirm("$PHP_SELF?rowid=$rowid&cat1=$fk_categ","Supprimer dans la catégorie","Etes-vous sûr de vouloir supprimer le classement dans la catégorie ?","confirm_delete_categ"); } print_titre("Edition de la ligne"); print ''; print ""; print ""; print ""; print ""; print ""; print ""; print "\n"; $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.author, b.num_chq, b.fk_type, fk_account"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b WHERE rowid=$rowid"; $sql .= " ORDER BY dateo ASC"; $result = $db->query($sql); if ($result) { $var=True; $num = $db->num_rows(); $i = 0; $total = 0; while ($i < $num) { $objp = $db->fetch_object($i); $total = $total + $objp->amount; $acct=new Account($db,$objp->fk_account); $acct->fetch($objp->fk_account); $account = $acct->id; $var=!$var; print ""; print ""; print ""; print "\n"; print ""; if ($objp->amount < 0) { print "\n"; } else { print "\n"; } print ""; print ""; print ""; print ""; print "'; print ""; print ""; print ""; print "rowid\">"; print ""; print ""; print ""; if (!$objp->rappro) { print ""; print ""; print ""; print ""; } print ""; print "rowid\">"; print ''; print ""; print ""; print "rowid\">"; print ''; print ""; print ""; print ""; $i++; } $db->free(); } print "
DateDescriptionDebitCreditReleveAuteur
".strftime("%d %b %Y",$objp->do)."$objp->label".price($objp->amount * -1)."  ".price($objp->amount)."num_releve&ve=1&account=$account\">$objp->num_releve$objp->author
 "; print $objp->fk_type .' - '; print $objp->num_chq; print "
Catégorie"; print " "; print '
Compte".$acct->label."
Libellé"; print ''; print "
Date"; print 'do).'">'; print "
Montant"; print ''; print "
 "; print '
Relevé"; print ''; print "
"; print "

Classé dans

"; print ''; print ""; print ''; print "\n"; $sql = "SELECT c.label, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c WHERE a.lineid=$rowid AND a.fk_categ = c.rowid "; $sql .= " ORDER BY c.label"; $result = $db->query($sql); if ($result) { $var=True; $num = $db->num_rows(); $i = 0; $total = 0; while ($i < $num) { $objp = $db->fetch_object( $i); $var=!$var; print ""; print ""; print ""; print ""; print ""; $i++; } $db->free(); } print "
Description
$objp->labelrowid\">voirrowid\">Supprimer
"; $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>