* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004 Laurent Destailleur * * 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"); $user->getrights('banque'); if (!$user->admin && !$user->rights->banque) accessforbidden(); llxHeader(); if ($_POST["action"] == 'add') { // Creation compte $account = new Account($db,0); $account->bank = $_POST["bank"]; $account->label = $_POST["label"]; $account->courant = $_POST["courant"]; $account->clos = $_POST["clos"]; $account->code_banque = $_POST["code_banque"]; $account->code_guichet = $_POST["code_guichet"]; $account->number = $_POST["number"]; $account->cle_rib = $_POST["cle_rib"]; $account->bic = $_POST["bic"]; $account->iban_prefix = $_POST["iban_prefix"]; $account->domiciliation = $_POST["domiciliation"]; $account->proprio = $_POST["proprio"]; $account->adresse_proprio = $_POST["adresse_proprio"]; $account->solde = $_POST["solde"]; $account->date_solde = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $id = $account->create($user->id); if (! $id) { $message=$account->error(); $_GET["action"]='create'; // Force chargement page en mode creation } else { $_GET["id"]=$id; // Force chargement page en mode visu } } if ($_POST["action"] == 'update' && ! $_POST["cancel"]) { // Modification $account = new Account($db, $_POST["id"]); $account->fetch($_POST["id"]); $account->bank = $_POST["bank"]; $account->label = $_POST["label"]; $account->courant = $_POST["courant"]; $account->clos = $_POST["clos"]; $account->code_banque = $_POST["code_banque"]; $account->code_guichet = $_POST["code_guichet"]; $account->number = $_POST["number"]; $account->cle_rib = $_POST["cle_rib"]; $account->bic = $_POST["bic"]; $account->iban_prefix = $_POST["iban_prefix"]; $account->domiciliation = $_POST["domiciliation"]; $account->proprio = $_POST["proprio"]; $account->adresse_proprio = $_POST["adresse_proprio"]; $result = $account->update($user); if (! $result) { $message=$account->error(); $_GET["action"]='edit'; // Force chargement page edition } else { $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu } } /* ************************************************************************** */ /* */ /* Nouvel compte */ /* */ /* ************************************************************************** */ if ($_GET["action"] == 'create') { print_titre("Nouveau compte bancaire"); if ($message) { print "
$message

\n"; } print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '"; print ''; print ''; print '"; print ''; print ''; print ''; print ''; print ''; print ''; print '
Banque
'.$langs->trans("Label").'
Code BanqueCode GuichetNuméroClé RIB
Clé IBAN
Identifiant BIC
Compte Courant'; $form=new Form($db); print $form->selectyesnonum("courant",isset($_POST["courant"])?$_POST["courant"]:1); print '
Domiciliation'; print "
Nom propriétaire du compte
Adresse propriétaire du compte'; print "
Solde
Date Solde'; $now=time(); print '/'; print '/'; print ''; print '
'; } /* ************************************************************************** */ /* */ /* Visu et edition */ /* */ /* ************************************************************************** */ else { if ($_GET["id"] && $_GET["action"] != 'edit') { $account = new Account($db, $_GET["id"]); $account->fetch($_GET["id"]); /* * Affichage onglets */ $h = 0; $head[$h][0] = "fiche.php?id=$account->id"; $head[$h][1] = "Compte bancaire $account->number"; $h++; dolibarr_fiche_head($head, $hselected); print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '\n"; print '\n"; print '\n"; print '
Banque'.$account->bank.'
'.$langs->trans("Label").''.$account->label.'
Code BanqueCode GuichetNuméroClé RIB
'.$account->code_banque.''.$account->code_guichet.''.$account->number.''.$account->cle_rib.'
Clé IBAN'.$account->iban_prefix.'
Identifiant BIC'.$account->bic.'
Compte Courant'.yn($account->courant).'
Compte Clos'.yn($account->clos).'
Domiciliation'; print $account->domiciliation; print "
Nom propriétaire du compte'; print $account->proprio; print "
Adresse propriétaire du compte'; print $account->adresse_proprio; print "
'; print '
'; print ''; /* * Barre d'actions * */ print '
'; if ($user->rights->banque->configurer) { print ''.$langs->trans("Edit").''; } print '
'; } /* ************************************************************************** */ /* */ /* Edition */ /* */ /* ************************************************************************** */ if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configurer) { $account = new Account($db, $_GET["id"]); $account->fetch($_GET["id"]); $form = new Form($db); print_titre("Edition compte bancaire"); print "
"; if ($message) { print "$message

\n"; } print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '"; print ''; print ''; print "\n"; print '"; print ''; print ''; print '
Banque
'.$langs->trans("Label").'
Code BanqueCode GuichetNuméroClé RIB
Clé IBAN
Identifiant BIC
Compte Courant'; $form->selectyesnonum("courant",$account->courant); print '
Compte Cloturé'; $form->selectyesnonum("clos",$account->clos); print '
Domiciliation'; print "
Nom propriétaire du compte
Adresse propriétaire du compte'; print "
'; print '   '; print '
'; } } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>