30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/modules/rapport/pdf_paiement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36$action =
GETPOST(
'action',
'aZ09');
39if ($user->socid > 0) {
41 $socid = $user->socid;
44$dir = $conf->facture->dir_output.
'/payments';
45if (!$user->hasRight(
'societe',
'client',
'voir')) {
46 $dir .=
'/private/'.$user->id;
55if (!$user->hasRight(
'facture',
'lire')) {
59$permissiontoread = $user->hasRight(
'facture',
'lire');
66if ($action ==
'builddoc' && $permissiontoread) {
69 $outputlangs = $langs;
70 if (
GETPOST(
'lang_id',
'aZ09')) {
72 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
77 $sav_charset_output = $outputlangs->charset_output;
79 $outputlangs->charset_output = $sav_charset_output;
81 $outputlangs->charset_output = $sav_charset_output;
98$titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
102print
'<form method="post" action="rapport.php?year='.$year.
'">';
103print
'<input type="hidden" name="token" value="'.newToken().
'">';
104print
'<input type="hidden" name="action" value="builddoc">';
105$cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
106$syear =
GETPOST(
"reyear") ?
GETPOST(
"reyear") : date(
"Y", time());
108print $formother->select_month($cmonth,
'remonth');
110print $formother->selectyear($syear,
'reyear');
112print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
119$year_dirs =
dol_dir_list($dir,
'directories', 0,
'^[0-9]{4}$',
'',
'DESC');
120foreach ($year_dirs as $d) {
121 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$d[
'name'].
'">'.$d[
'name'].
'</a> ';
125 if (is_dir($dir.
'/'.$year)) {
126 if (!empty($year_dirs)) {
130 print
'<table width="100%" class="noborder">';
131 print
'<tr class="liste_titre">';
132 print
'<td>'.$langs->trans(
"Reporting").
'</td>';
133 print
'<td class="right">'.$langs->trans(
"Size").
'</td>';
134 print
'<td class="right">'.$langs->trans(
"Date").
'</td>';
137 $files = (
dol_dir_list($dir.
'/'.$year,
'files', 0,
'^payments-[0-9]{4}-[0-9]{2}\.pdf$',
'',
'name', SORT_DESC, 1));
138 foreach ($files as $f) {
139 $relativepath = $f[
'level1name'].
'/'.$f[
'name'];
140 print
'<tr class="oddeven">';
141 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>';
142 print
'<td class="right">'.dol_print_size($f[
'size']).
'</td>';
143 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage translations.
Class to manage reporting of payments.
dol_dir_list($utf8_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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.