diff --git a/htdocs/compta/export/index.php b/htdocs/compta/export/index.php index eddd0f13a9b..0fb644c9e39 100644 --- a/htdocs/compta/export/index.php +++ b/htdocs/compta/export/index.php @@ -33,8 +33,18 @@ require_once("./ComptaJournalVente.class.php"); $langs->load("compta"); -$dir = $conf->compta->dir_output."/export/"; +$now = time(); +if (isset($_GET["year"])) +{ + $year = $_GET["year"]; +} +else +{ + $year = strftime("%Y",$now); +} +$updir = $conf->compta->dir_output."/export/"; +$dir = $conf->compta->dir_output."/export/".$year."/"; /* * Actions @@ -42,35 +52,34 @@ $dir = $conf->compta->dir_output."/export/"; if ($_GET["action"] == 'export') { - $modulename='Poivre'; - - include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php'; - - create_exdir($dir); - - $exc = new ComptaExport($db, $user, $modulename); - - if($_GET["id"] > 0) - { - $exc->Export($_GET["id"]); - } - else - { - $exc->Export(); - } - - /* Génération du journal des Paiements */ - - $jp= new ComptaJournalPaiement($db); - $jp->GeneratePdf($user, $exc->id, $exc->ref); - - /* Génération du journal des Ventes */ - - $jp= new ComptaJournalVente($db); - $jp->GeneratePdf($user, $exc->id, $exc->ref); + $modulename='Poivre'; + + include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php'; + + create_exdir($dir); + + $exc = new ComptaExport($db, $user, $modulename); + + if($_GET["id"] > 0) + { + $exc->Export($_GET["id"], $dir); + } + else + { + $exc->Export(0, $dir); + } + + /* Génération du journal des Paiements */ + + $jp= new ComptaJournalPaiement($db); + $jp->GeneratePdf($user, $dir, $exc->id, $exc->ref); + + /* Génération du journal des Ventes */ + + $jp= new ComptaJournalVente($db); + $jp->GeneratePdf($user, $dir, $exc->id, $exc->ref); } - /* * Affichage page */ @@ -84,7 +93,6 @@ if ($exc->error_message) print '
'.$exc->error_message.'
'; } - print ''; print ''; $var=!$var; print ''; -print "
'; @@ -117,11 +125,32 @@ $var=false; print '
'.$langs->trans("Invoices").''.$nbfac.'
'.$langs->trans("Payments").''.$nbp.'
\n"; +print "
\n"; + +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$handle=@opendir($updir); +if ($handle) +{ + while (($file = readdir($handle))!==false) + { + if (is_readable($updir.$file) && is_dir($updir.$file) && strlen($file) == 4) + { + $var=!$var; + print ''; + } + } + closedir($handle); +} + +print "
'.$langs->trans("Year").' 
'.$file.'
"; print ''; - print ''; print ''; print ''; @@ -131,21 +160,20 @@ print "\n"; $handle=@opendir($dir); if ($handle) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle))!==false) + { + if (is_readable($dir.$file) && is_file($dir.$file)) { - if (is_readable($dir.$file) && is_file($dir.$file)) - { - print ''; - } + print ''; } + } + closedir($handle); } print "
'.$langs->trans("File").'
'.$file.''; - - print '
'.$file.''; + print '
"; print ''; - llxFooter('$Date$ - $Revision$'); ?>