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

decla.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.3 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00036 function MakeListingVat($p_cn,$p_array,$p_year) {
00037   // declarant
00038   //--
00039   require_once("class_own.php");
00040   // load the data
00041   $my=new Own($p_cn);
00042   //Make the first record
00043   $a="000000";
00044   $a.=sprintf("% 32s",$my->MY_NAME);
00045   $b=$my->MY_STREET.",".$my->MY_NUMBER;
00046   $a.=sprintf("% 24s",$b);
00047   $b=$my->MY_CP." ".$my->MY_COMMUNE;
00048   $a.=sprintf("% 27s",$b);
00049   $a.="BE";
00050   $a.=sprintf("%9s",$my->MY_TVA);
00051   // special zone
00052   $a.=sprintf("% 20s",' ');
00053   //
00054   $a.="E";
00055   $a.=$p_year;
00056   $a.="\n";
00057   // customer record
00058   $rec_id=0;
00059   $tot_amount=0;
00060   $tot_tva=0;
00061   foreach ($p_array as $client) {
00062     if ( strlen(trim($client['tva'])) != 0 ) {
00063       $rec_id++;
00064       $a.=sprintf("%06d",$rec_id);
00065       $a.=sprintf("% 32s",$client['name']);
00066       $a.=str_repeat(" ",51);
00067       $a.=sprintf("BE%s",$client['vat_number']);
00068       $a.=sprintf("%010d",$client['amount']*100);
00069       $a.=sprintf("%010d",$client['tva']*100);
00070       $a.=str_repeat(" ",10);
00071       $a.="\n";
00072       $tot_amount=+$client['amount']*100;
00073       $tot_tva+=$client['tva']*100;
00074     }
00075   }
00076     //Last Record
00077   $a.="999999";
00078   $a.=sprintf("%016d",$tot_amount);
00079   $a.=sprintf("%016d",$tot_tva);
00080   $a.=str_repeat(" ",51);
00081   $a.="BE";
00082   $a.=$my->MY_TVA;
00083   $a.=str_repeat(" ",28);
00084   $a.="\r\n";
00085   return $a;
00086 }