25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/modules/rapport/pdf_paiement_fourn.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 $langs->loadLangs(array(
'bills'));
35 if (!empty($user->socid)) $socid = $user->socid;
36 $result =
restrictedArea($user,
'fournisseur', $id,
'facture_fourn',
'facture');
38 $action =
GETPOST(
'action',
'aZ09');
44 $socid = $user->socid;
47 $dir = $conf->fournisseur->facture->dir_output.
'/payments';
48 if (!$user->rights->societe->client->voir || $socid) $dir .=
'/private/'.$user->id;
51 if (!$year) { $year = date(
"Y"); }
58 if ($action ==
'builddoc')
62 $outputlangs = $langs;
66 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
71 $sav_charset_output = $outputlangs->charset_output;
72 if ($rap->write_file($dir,
GETPOST(
"remonth",
'int'),
GETPOST(
"reyear",
'int'), $outputlangs) > 0)
74 $outputlangs->charset_output = $sav_charset_output;
76 $outputlangs->charset_output = $sav_charset_output;
80 $year =
GETPOST(
"reyear",
'int');
91 $titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
98 print '<form method="post" action="rapport.php?year='.$year.
'">';
99 print '<input type="hidden" name="token" value="'.newToken().
'">';
100 print '<input type="hidden" name="action" value="builddoc">';
101 $cmonth =
GETPOST(
"remonth") ?
GETPOST(
"remonth") : date(
"n", time());
102 $syear =
GETPOST(
"reyear") ?
GETPOST(
"reyear") : date(
"Y", time());
104 print $formother->select_month($cmonth,
'remonth');
106 print $formother->select_year($syear,
'reyear');
108 print '<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
115 $linkforyear = array();
119 $handle = opendir($dir);
120 if (is_resource($handle))
122 while (($file = readdir($handle)) !==
false)
124 if (is_dir($dir.
'/'.$file) && !preg_match(
'/^\./', $file) && is_numeric($file))
127 $linkforyear[] = $file;
133 foreach ($linkforyear as $cursoryear)
135 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$cursoryear.
'">'.$cursoryear.
'</a> ';
140 if (is_dir($dir.
'/'.$year))
142 $handle = opendir($dir.
'/'.$year);
144 if ($found)
print '<br>';
146 print '<table width="100%" class="noborder">';
147 print '<tr class="liste_titre">';
148 print '<td>'.$langs->trans(
"Reporting").
'</td>';
149 print '<td class="right">'.$langs->trans(
"Size").
'</td>';
150 print '<td class="right">'.$langs->trans(
"Date").
'</td>';
153 if (is_resource($handle))
155 while (($file = readdir($handle)) !==
false)
157 if (preg_match(
'/^supplier_payment/i', $file))
159 $tfile = $dir.
'/'.$year.
'/'.$file;
160 $relativepath = $year.
'/'.$file;
161 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>';
163 print '<td class="right">'.dol_print_date(
dol_filemtime($tfile),
"dayhour").
'</td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Classe permettant de generer les rapports de paiement.
dol_filesize($pathoffile)
Return size of a file.
img_pdf($titlealt= 'default', $size=3)
Show pdf logo.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage translations.
print
Draft customers invoices.
dol_filemtime($pathoffile)
Return time of a file.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...