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;
64if ($action ==
'builddoc') {
67 $outputlangs = $langs;
68 if (
GETPOST(
'lang_id',
'aZ09')) {
70 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
75 $sav_charset_output = $outputlangs->charset_output;
77 $outputlangs->charset_output = $sav_charset_output;
79 $outputlangs->charset_output = $sav_charset_output;
94$titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
101print
'<form method="post" action="rapport.php?year='.$year.
'">';
102print
'<input type="hidden" name="token" value="'.newToken().
'">';
103print
'<input type="hidden" name="action" value="builddoc">';
104$cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
105$syear =
GETPOST(
"reyear") ?
GETPOST(
"reyear") : date(
"Y", time());
107print $formother->select_month($cmonth,
'remonth');
109print $formother->selectyear($syear,
'reyear');
111print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
118$linkforyear = array();
121 $handle = opendir($dir);
122 if (is_resource($handle)) {
123 while (($file = readdir($handle)) !==
false) {
124 if (is_dir($dir.
'/'.$file) && !preg_match(
'/^\./', $file) && is_numeric($file)) {
126 $linkforyear[] = $file;
132foreach ($linkforyear as $cursoryear) {
133 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$cursoryear.
'">'.$cursoryear.
'</a> ';
137 if (is_dir($dir.
'/'.$year)) {
138 $handle = opendir($dir.
'/'.$year);
144 print
'<table width="100%" class="noborder">';
145 print
'<tr class="liste_titre">';
146 print
'<td>'.$langs->trans(
"Reporting").
'</td>';
147 print
'<td class="right">'.$langs->trans(
"Size").
'</td>';
148 print
'<td class="right">'.$langs->trans(
"Date").
'</td>';
151 if (is_resource($handle)) {
152 while (($file = readdir($handle)) !==
false) {
153 if (preg_match(
'/^supplier_payment/i', $file)) {
154 $tfile = $dir.
'/'.$year.
'/'.$file;
155 $relativepath = $year.
'/'.$file;
156 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>';
157 print
'<td class="right">'.dol_print_size(
dol_filesize($tfile)).
'</td>';
158 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()
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.