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';
44$action =
GETPOST(
'action',
'aZ09');
45$fileToRemove =
GETPOST(
'removefile',
'alpha');
48if ($user->socid > 0) {
50 $socid = $user->socid;
53$dir =
$conf->facture->dir_output.
'/payments';
54if (!$user->hasRight(
'societe',
'client',
'voir')) {
55 $dir .=
'/private/'.$user->id;
64if (!$user->hasRight(
'facture',
'lire')) {
68$permissiontoread = ($user->hasRight(
'facture',
'lire') == 1);
75if ($action ==
'builddoc' && $permissiontoread) {
78 $outputlangs = $langs;
79 if (
GETPOST(
'lang_id',
'aZ09')) {
81 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
86 $sav_charset_output = $outputlangs->charset_output;
88 $outputlangs->charset_output = $sav_charset_output;
90 $outputlangs->charset_output = $sav_charset_output;
98if ($action ==
'removedoc' && $permissiontoread && $fileToRemove) {
100 $fileDirectory = dirname($fullpathfile);
106 setEventMessages($langs->trans(
"FileWasRemoved", $fileToRemove),
null,
'mesgs');
108 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", $fileToRemove),
null,
'errors');
122$titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
126print
'<form method="post" action="rapport.php?year='.$year.
'">';
127print
'<input type="hidden" name="token" value="'.newToken().
'">';
128print
'<input type="hidden" name="action" value="builddoc">';
129$cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
130$syear =
GETPOST(
"reyear") ?
GETPOST(
"reyear") : date(
"Y", time());
132print $formother->select_month($cmonth,
'remonth');
134print $formother->selectyear($syear,
'reyear');
136print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
143$year_dirs =
dol_dir_list($dir,
'directories', 0,
'^[0-9]{4}$',
'',
'DESC');
144foreach ($year_dirs as $d) {
145 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$d[
'name'].
'">'.$d[
'name'].
'</a> ';
149 if (is_dir($dir.
'/'.$year)) {
150 if (!empty($year_dirs)) {
154 print
'<table width="100%" class="noborder">';
155 print
'<tr class="liste_titre">';
156 print
'<td>'.$langs->trans(
"Reporting").
'</td>';
157 print
'<td class="right">'.$langs->trans(
"Size").
'</td>';
158 print
'<td class="right">'.$langs->trans(
"Date").
'</td>';
159 print
'<td class="right"></td>';
162 $files = (
dol_dir_list($dir.
'/'.$year,
'files', 0,
'^payments-[0-9]{4}-[0-9]{2}\.pdf$',
'',
'name', SORT_DESC, 1));
163 foreach ($files as $f) {
164 $relativepath = $f[
'level1name'].
'/'.$f[
'name'];
165 print
'<tr class="oddeven">';
166 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>';
167 print
'<td class="right">'.dol_print_size($f[
'size']).
'</td>';
168 print
'<td class="right">'.dol_print_date($f[
'date'],
"dayhour").
'</td>';
169 print
'<td class="right"><a href="rapport.php?removefile='.urlencode($relativepath).
'&action=removedoc&token='.
newToken().
'">'.
img_delete().
'</a></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_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
dol_sanitizePathName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a path name.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.