Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

eub_be.inc.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.8 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00021 // Author Olivier Dzwoniarkiewicz
00026 //-----------------------------------------------------
00027 // Bank type = eub
00028 //-----------------------------------------------------
00029 $row=1;
00030 while (($data = fgetcsv($handle, 2000,'!@')) !== FALSE) {
00031         $num = count($data);
00032         for ($c=0; $c < $num; $c++) {
00033 
00034                 // first line is skipped
00035                 if ( $row > 1) {
00036                 $code=""; $date_exec=""; $detail=""; $montant=""; 
00037                 list($code, $date_exec, $detail, $montant) = split(";", $data[$c]);
00038                 
00039                 $date_exec = str_replace("\t", "", $date_exec);
00040                 $date_exec = str_replace(" ", "", $date_exec);
00041                 
00042                 list($annee,$mois,$jour) = explode("-", $date_exec);
00043                 
00044                 $montant = str_replace(".", "", $montant);
00045                 $montant = str_replace(",", ".", $montant);
00046                 $montant = str_replace("+", "", $montant);
00047                 
00048                 if($code < 10) $code = "000".$code;
00049                 if($code >= 10 and $code < 100) $code = "00".$code;
00050                 if($code >= 100) $code = "0".$code;
00051                 
00052                 $code = $annee."-".$code;
00053                 
00054                 
00055                 $Sql="insert into import_tmp (code, 
00056                         date_exec ,
00057                         date_valeur,
00058                         montant,
00059                         devise,
00060                         detail,
00061                         num_compte,
00062                         bq_account      ,
00063                         jrn,
00064                         status)
00065                 values ('$code',
00066                         '$date_exec',
00067                         '$date_exec',
00068                         '$montant',
00069                         'EUR',
00070                         '".addslashes($detail)."',
00071                         '$p_bq_account',
00072                         $p_jrn,
00073                         'n')";
00074                 $Res=ExecSql($p_cn,$Sql);
00075                 }
00076         } // for ($c=0;$c<$num;$c++)
00077                 $row++;
00078 } // file is read
00079 fclose($handle);
00080 ?>