27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/modules/rapport/pdf_paiement.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 $action =
GETPOST(
'action',
'aZ09');
39 $socid = $user->socid;
42 $dir = $conf->facture->dir_output.
'/payments';
43 if (!$user->rights->societe->client->voir || $socid) $dir .=
'/private/'.$user->id;
46 if (!$year) { $year = date(
"Y"); }
56 if ($action ==
'builddoc')
60 $outputlangs = $langs;
64 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
69 $sav_charset_output = $outputlangs->charset_output;
70 if ($rap->write_file($dir, $_POST[
"remonth"], $_POST[
"reyear"], $outputlangs) > 0)
72 $outputlangs->charset_output = $sav_charset_output;
74 $outputlangs->charset_output = $sav_charset_output;
78 $year = $_POST[
"reyear"];
91 $titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
95 print '<form method="post" action="rapport.php?year='.$year.
'">';
96 print '<input type="hidden" name="token" value="'.newToken().
'">';
97 print '<input type="hidden" name="action" value="builddoc">';
98 $cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
101 print $formother->select_month($cmonth,
'remonth');
103 print $formother->select_year($syear,
'reyear');
105 print '<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
112 $linkforyear = array();
116 $handle = opendir($dir);
117 if (is_resource($handle))
119 while (($file = readdir($handle)) !==
false)
121 if (is_dir($dir.
'/'.$file) && !preg_match(
'/^\./', $file) && is_numeric($file))
124 $linkforyear[] = $file;
130 foreach ($linkforyear as $cursoryear)
132 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$cursoryear.
'">'.$cursoryear.
'</a> ';
137 if (is_dir($dir.
'/'.$year))
139 $handle = opendir($dir.
'/'.$year);
141 if ($found)
print '<br>';
143 print '<table width="100%" class="noborder">';
144 print '<tr class="liste_titre">';
145 print '<td>'.$langs->trans(
"Reporting").
'</td>';
146 print '<td class="right">'.$langs->trans(
"Size").
'</td>';
147 print '<td class="right">'.$langs->trans(
"Date").
'</td>';
150 if (is_resource($handle))
152 while (($file = readdir($handle)) !==
false)
154 if (preg_match(
'/^payment/i', $file))
156 $tfile = $dir.
'/'.$year.
'/'.$file;
157 $relativepath = $year.
'/'.$file;
158 print '<tr class="oddeven">';
159 print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).
'">'.
img_pdf().
' '.$file.
'</a>'.$formfile->showPreview($file,
'facture_paiement', $relativepath, 0).
'</td>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_filesize($pathoffile)
Return size of a file.
img_pdf($titlealt= 'default', $size=3)
Show pdf logo.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage translations.
Classe permettant de generer les rapports de paiement.
print
Draft customers invoices.
dol_filemtime($pathoffile)
Return time of a file.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...