noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
export_stock_histo_csv.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**
00024  * @file
00025  * @brief export in CSV the export of history
00026  *
00027  */
00028 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00029 require_once 'class_stock.php';
00030 
00031 $stock=new Stock();
00032 $sql = $stock->create_query_histo($_GET);
00033 $sql .= " order by  real_date asc";
00034 
00035 $res=$cn->exec_sql($sql);
00036 $max_row=Database::num_row($res);
00037 header('Pragma: public');
00038 header('Content-type: application/csv');
00039 header('Content-Disposition: attachment;filename="histo-stock.csv"',FALSE);
00040 printf('"Date";');
00041         printf('"%s";','Code Stock');
00042         printf('"%s";','Depot');
00043         printf('"%s";','Fiche');
00044         printf('"%s";','Commentaire');
00045         printf('%s;','Quantité');
00046         printf('"%s";','IN/OUT');
00047                 printf("\n\r");
00048 for ($i=0;$i<$max_row;$i++)
00049 {
00050         $row=Database::fetch_array($res,$i);
00051         printf('"%s";',$row['cdate']);
00052         printf('"%s";',$row['sg_code']);
00053         printf('"%s";',$row['r_name']);
00054         printf('"%s";',$row['qcode']);
00055         $row['ccomment']=str_replace('"','',$row['ccomment']);
00056         printf('"%s";',$row['ccomment']);
00057         printf('%s;',nbm($row['sg_quantity']));
00058         printf('"%s";',$row['direction']);
00059         printf("\n\r");
00060 
00061 }
00062 
00063 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations