28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/modules/rapport/pdf_paiement.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34$action =
GETPOST(
'action',
'aZ09');
37if ($user->socid > 0) {
39 $socid = $user->socid;
42$dir = $conf->facture->dir_output.
'/payments';
43if (empty($user->rights->societe->client->voir) || $socid) {
44 $dir .=
'/private/'.$user->id;
53if (!$user->hasRight(
'facture',
'lire')) {
62if ($action ==
'builddoc') {
65 $outputlangs = $langs;
66 if (
GETPOST(
'lang_id',
'aZ09')) {
68 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
73 $sav_charset_output = $outputlangs->charset_output;
74 if ($rap->write_file($dir,
GETPOST(
"remonth",
"int"),
GETPOST(
"reyear",
"int"), $outputlangs) > 0) {
75 $outputlangs->charset_output = $sav_charset_output;
77 $outputlangs->charset_output = $sav_charset_output;
81 $year =
GETPOST(
"reyear",
"int");
94$titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
98print
'<form method="post" action="rapport.php?year='.$year.
'">';
99print
'<input type="hidden" name="token" value="'.newToken().
'">';
100print
'<input type="hidden" name="action" value="builddoc">';
101$cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
104print $formother->select_month($cmonth,
'remonth');
106print $formother->selectyear($syear,
'reyear');
108print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
115$year_dirs =
dol_dir_list($dir,
'directories', 0,
'^[0-9]{4}$',
'',
'DESC');
116foreach ($year_dirs as $d) {
117 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$d[
'name'].
'">'.$d[
'name'].
'</a> ';
121 if (is_dir($dir.
'/'.$year)) {
122 if (!empty($year_dirs)) print
'<br>';
124 print
'<table width="100%" class="noborder">';
125 print
'<tr class="liste_titre">';
126 print
'<td>'.$langs->trans(
"Reporting").
'</td>';
127 print
'<td class="right">'.$langs->trans(
"Size").
'</td>';
128 print
'<td class="right">'.$langs->trans(
"Date").
'</td>';
131 $files = (
dol_dir_list($dir.
'/'.$year,
'files', 0,
'^payments-[0-9]{4}-[0-9]{2}\.pdf$',
'',
'name',
'DESC', 1));
132 foreach ($files as $f) {
133 $relativepath = $f[
'level1name'].
'/'.$f[
'name'];
134 print
'<tr class="oddeven">';
135 print
'<td><a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).
'">'.
img_pdf().
' '.$f[
'name'].
'</a>'.$formfile->showPreview($f[
'name'],
'facture_paiement', $relativepath, 0).
'</td>';
136 print
'<td class="right">'.dol_print_size($f[
'size']).
'</td>';
137 print
'<td class="right">'.dol_print_date($f[
'date'],
"dayhour").
'</td>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage translations.
Class to manage reporting of payments.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_pdf($titlealt='default', $size=3)
Show pdf logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.