Gestion du stockage des documents dans des repertoires annuels
This commit is contained in:
parent
ba32e15a54
commit
654dee0641
@ -33,8 +33,18 @@ require_once("./ComptaJournalVente.class.php");
|
|||||||
|
|
||||||
$langs->load("compta");
|
$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
|
* Actions
|
||||||
@ -42,35 +52,34 @@ $dir = $conf->compta->dir_output."/export/";
|
|||||||
|
|
||||||
if ($_GET["action"] == 'export')
|
if ($_GET["action"] == 'export')
|
||||||
{
|
{
|
||||||
$modulename='Poivre';
|
$modulename='Poivre';
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php';
|
||||||
|
|
||||||
create_exdir($dir);
|
create_exdir($dir);
|
||||||
|
|
||||||
$exc = new ComptaExport($db, $user, $modulename);
|
$exc = new ComptaExport($db, $user, $modulename);
|
||||||
|
|
||||||
if($_GET["id"] > 0)
|
if($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
$exc->Export($_GET["id"]);
|
$exc->Export($_GET["id"], $dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$exc->Export();
|
$exc->Export(0, $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Génération du journal des Paiements */
|
/* Génération du journal des Paiements */
|
||||||
|
|
||||||
$jp= new ComptaJournalPaiement($db);
|
$jp= new ComptaJournalPaiement($db);
|
||||||
$jp->GeneratePdf($user, $exc->id, $exc->ref);
|
$jp->GeneratePdf($user, $dir, $exc->id, $exc->ref);
|
||||||
|
|
||||||
/* Génération du journal des Ventes */
|
/* Génération du journal des Ventes */
|
||||||
|
|
||||||
$jp= new ComptaJournalVente($db);
|
$jp= new ComptaJournalVente($db);
|
||||||
$jp->GeneratePdf($user, $exc->id, $exc->ref);
|
$jp->GeneratePdf($user, $dir, $exc->id, $exc->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page
|
* Affichage page
|
||||||
*/
|
*/
|
||||||
@ -84,7 +93,6 @@ if ($exc->error_message)
|
|||||||
print '<div class="error">'.$exc->error_message.'</div>';
|
print '<div class="error">'.$exc->error_message.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<table class="notopnoleftnoright" width="100%">';
|
print '<table class="notopnoleftnoright" width="100%">';
|
||||||
print '<tr><td valign="top" width="30%">';
|
print '<tr><td valign="top" width="30%">';
|
||||||
|
|
||||||
@ -117,11 +125,32 @@ $var=false;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Payments").'</td><td align="right">'.$nbp.'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("Payments").'</td><td align="right">'.$nbp.'</td></tr>';
|
||||||
print "</table>\n";
|
print "</table><br />\n";
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Year").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print "</tr>\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 '<tr '.$bc[$var].'><td><a href="index.php?year='.$file.'">'.$file.'</a><td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
print '</td><td valign="top" width="70%">';
|
print '</td><td valign="top" width="70%">';
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("File").'</td>';
|
print '<td>'.$langs->trans("File").'</td>';
|
||||||
@ -131,21 +160,20 @@ print "</tr>\n";
|
|||||||
$handle=@opendir($dir);
|
$handle=@opendir($dir);
|
||||||
if ($handle)
|
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 '<tr><td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=export_compta&file=export/'.$year.'/'.$file.'&type=text/plain">'.$file.'</a><td>';
|
||||||
{
|
print '</tr>';
|
||||||
print '<tr><td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=export_compta&file=export/'.$file.'&type=text/plain">'.$file.'</a><td>';
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user