noalyss
Version-9
include
export
export_stock_histo_csv.php
Go to the documentation of this file.
1
<?php
2
3
/*
4
* This file is part of NOALYSS.
5
*
6
* NOALYSS is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* NOALYSS is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with NOALYSS; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*/
20
21
// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23
/**
24
* @file
25
* @brief export in CSV the export of history
26
*
27
*/
28
if
( ! defined (
'ALLOWED'
) ) die(
'Appel direct ne sont pas permis'
);
29
$export
=
new
Noalyss_Csv
(_(
'historique-stock'
));
30
$stock
=
new
Stock
(
$cn
);
31
$sql
=
$stock
->create_query_histo(
$_GET
);
32
$sql
.=
" order by real_date asc"
;
33
34
$res
=
$cn
->exec_sql(
$sql
);
35
$max_row
=
Database::num_row
(
$res
);
36
$export
->send_header();
37
38
$export
->write_header(array(_(
"Date"
),
39
_(
'Code Stock'
),
40
_(
'Depot'
),
41
_(
'Fiche'
),
42
_(
'Commentaire'
),
43
_(
'Quantité'
),
44
_(
'IN/OUT'
)));
45
46
for
(
$i
=0;
$i
<
$max_row
;
$i
++)
47
{
48
$row
=
Database::fetch_array
(
$res
,
$i
);
49
$export
->add(
$row
[
'cdate'
]);
50
$export
->add(
$row
[
'sg_code'
]);
51
$export
->add(
$row
[
'r_name'
]);
52
$export
->add(
$row
[
'qcode'
]);
53
$row
[
'ccomment'
]=
noalyss_str_replace
(
'"'
,
''
,
$row
[
'ccomment'
]);
54
$export
->add(
$row
[
'ccomment'
]);
55
$export
->add(
$row
[
'sg_quantity'
],
"number"
);
56
$export
->add(
$row
[
'direction'
]);
57
$export
->write();
58
59
}
60
61
?>
noalyss_str_replace
noalyss_str_replace($search, $replace, $string)
Definition:
ac_common.php:1553
$i
$i
Definition:
action_document_type_mtable_input.php:83
$cn
$cn
Definition:
ajax_anc_accounting.php:30
$row
$row
Definition:
ajax_anc_detail_operation.php:33
$_GET
$_GET['qcode']
Definition:
category_followup.inc.php:53
DatabaseCore\fetch_array
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
Definition:
database_core.class.php:757
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_num_rows
Definition:
database_core.class.php:744
Noalyss_Csv
Manage the CSV : manage files and write CSV record.
Definition:
noalyss_csv.class.php:34
Stock
manage the stocks
Definition:
stock.class.php:37
$sql
$sql
Definition:
export_stock_histo_csv.php:31
$max_row
$max_row
Definition:
export_stock_histo_csv.php:35
$res
$res
Definition:
export_stock_histo_csv.php:34
$export
$export
Definition:
export_stock_histo_csv.php:29
$stock
$stock
Definition:
export_stock_histo_csv.php:30