3 /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80 foldmethod=marker:
4 -------------------------------------------------------------------------------
7 -------------------------------------------------------------------------------
8 This file is part of Protocolizacion.
10 Protocolizacion is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2 of the License, or (at your option)
15 Protocolizacion is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License; if not,
20 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21 Boston, MA 02111-1307 USA
22 -------------------------------------------------------------------------------
23 Creado: mar nov 18 10:46:28 ART 2003
24 Autor: Martin Marrese <mmarre@mecon.gov.ar>
25 -------------------------------------------------------------------------------
27 -----------------------------------------------------------------------------*/
29 //Las posibles bases son:
30 // normas (para MECON)
31 // normas_miplan (para MIPLAN)
33 require_once 'DB.php';
35 require_once 'Console/Getopt.php';
36 $con = new Console_Getopt;
37 $args = $con->readPHPArgv();
38 $options = $con->getopt($args, $so);
39 $base = (@$options[1][0]) ? @$options[1][0] : 'normas';
40 $periodo = (@$options[1][1]) ? @$options[1][1] : '2003';
42 $db = DB::connect("mysql://intranet:intranet@intranet-db/".$base,
44 if (DB::isError($db)) {
45 die ($db->getMessage());
48 //FIXME Hay que cambiar el nombre de la base segun el ministerio
49 $sql = 'SELECT DISTINCT id_firmante AS id_firmante '.
50 'FROM '.$base.'.firmante '.
51 'ORDER BY id_firmante';
53 $dbh = $db->prepare($sql);
54 $res = $db->execute($dbh);
56 while ($re = $res->fetchrow(DB_FETCHMODE_ASSOC)) {
57 print "Procesando id_firmante: ".$re['id_firmante']."\n";
58 $txt = './informe_auditoria.php '.$periodo.' '.$re['id_firmante']
60 . ' > '.$re['id_firmante'].'.pdf';
65 print "Comprimiendo archivos.\n";
66 system ('find . -name "*.pdf" -print | zip '.$base.' -@');
67 system ('rm *.pdf -f');