26require
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/modules/rapport/pdf_paiement_fourn.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32$langs->loadLangs(array(
'bills'));
36if (!empty($user->socid)) {
37 $socid = $user->socid;
39$result =
restrictedArea($user,
'fournisseur', 0,
'facture_fourn',
'facture');
41$action =
GETPOST(
'action',
'aZ09');
44if ($user->socid > 0) {
46 $socid = $user->socid;
49$dir = $conf->fournisseur->facture->dir_output.
'/payments';
50if (!$user->hasRight(
"societe",
"client",
"voir") || $socid) {
51 $dir .=
'/private/'.$user->id;
59$permissiontoread = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
60$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
67if ($action ==
'builddoc' && $permissiontoread) {
70 $outputlangs = $langs;
71 if (
GETPOST(
'lang_id',
'aZ09')) {
73 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
78 $sav_charset_output = $outputlangs->charset_output;
80 $outputlangs->charset_output = $sav_charset_output;
82 $outputlangs->charset_output = $sav_charset_output;
97$titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
99llxHeader(
'', $titre,
'',
'', 0, 0,
'',
'',
'',
'mod-fourn-facture page-rapport');
104print
'<form method="post" action="rapport.php?year='.$year.
'">';
105print
'<input type="hidden" name="token" value="'.newToken().
'">';
106print
'<input type="hidden" name="action" value="builddoc">';
107$cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
108$syear =
GETPOST(
"reyear") ?
GETPOST(
"reyear") : date(
"Y", time());
110print $formother->select_month($cmonth,
'remonth');
112print $formother->selectyear($syear,
'reyear');
114print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
121$linkforyear = array();
124 $handle = opendir($dir);
125 if (is_resource($handle)) {
126 while (($file = readdir($handle)) !==
false) {
127 if (is_dir($dir.
'/'.$file) && !preg_match(
'/^\./', $file) && is_numeric($file)) {
129 $linkforyear[] = $file;
135foreach ($linkforyear as $cursoryear) {
136 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$cursoryear.
'">'.$cursoryear.
'</a> ';
140 if (is_dir($dir.
'/'.$year)) {
141 $handle = opendir($dir.
'/'.$year);
147 print
'<table width="100%" class="noborder">';
148 print
'<tr class="liste_titre">';
149 print
'<td>'.$langs->trans(
"Reporting").
'</td>';
150 print
'<td class="right">'.$langs->trans(
"Size").
'</td>';
151 print
'<td class="right">'.$langs->trans(
"Date").
'</td>';
154 if (is_resource($handle)) {
155 while (($file = readdir($handle)) !==
false) {
156 if (preg_match(
'/^supplier_payment/i', $file)) {
157 $tfile = $dir.
'/'.$year.
'/'.$file;
158 $relativepath = $year.
'/'.$file;
159 print
'<tr class="oddeven"><td><a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?modulepart=facture_fournisseur&file=payments/'.urlencode($relativepath).
'">'.
img_pdf().
' '.$file.
'</a>'.$formfile->showPreview($file,
'facture_fournisseur',
'payments/'.$relativepath, 0).
'</td>';
160 print
'<td class="right">'.dol_print_size(
dol_filesize($tfile)).
'</td>';
161 print
'<td class="right">'.dol_print_date(
dol_filemtime($tfile),
"dayhour").
'</td></tr>';
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 permettant de generer les rapports de paiement.
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
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...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.