29require
'../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/modules/rapport/pdf_paiement_fourn.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44$langs->loadLangs(array(
'bills'));
48if (!empty($user->socid)) {
49 $socid = $user->socid;
51$result =
restrictedArea($user,
'fournisseur', 0,
'facture_fourn',
'facture');
55$action =
GETPOST(
'action',
'aZ09');
56$fileToRemove =
GETPOST(
'removefile',
'alpha');
59if ($user->socid > 0) {
61 $socid = $user->socid;
65if (!$user->hasRight(
"societe",
"client",
"voir") || $socid) {
66 $dir .=
'/private/'.$user->id;
74$permissiontoread = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
75$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
82if ($action ==
'builddoc' && $permissiontoread) {
85 $outputlangs = $langs;
86 if (
GETPOST(
'lang_id',
'aZ09')) {
88 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
93 $sav_charset_output = $outputlangs->charset_output;
95 $outputlangs->charset_output = $sav_charset_output;
97 $outputlangs->charset_output = $sav_charset_output;
105if ($action ==
'removedoc' && $permissiontoread && $fileToRemove) {
106 $fileDirectory = dirname($dir.
'/'.$fileToRemove);
112 setEventMessages($langs->trans(
"FileWasRemoved", $fileToRemove),
null,
'mesgs');
114 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", $fileToRemove),
null,
'errors');
126$titre = ($year ? $langs->trans(
"PaymentsReportsForYear", $year) : $langs->trans(
"PaymentsReports"));
128llxHeader(
'', $titre,
'',
'', 0, 0,
'',
'',
'',
'mod-fourn-facture page-rapport');
133print
'<form method="post" action="rapport.php?year='.$year.
'">';
134print
'<input type="hidden" name="token" value="'.newToken().
'">';
135print
'<input type="hidden" name="action" value="builddoc">';
139print $formother->select_month($cmonth,
'remonth');
141print $formother->selectyear($syear,
'reyear');
143print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
150$linkforyear = array();
153 $handle = opendir($dir);
154 if (is_resource($handle)) {
155 while (($file = readdir($handle)) !==
false) {
156 if (is_dir($dir.
'/'.$file) && !preg_match(
'/^\./', $file) && is_numeric($file)) {
158 $linkforyear[] = $file;
164foreach ($linkforyear as $cursoryear) {
165 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$cursoryear.
'">'.$cursoryear.
'</a> ';
169 if (is_dir($dir.
'/'.$year)) {
170 $handle = opendir($dir.
'/'.$year);
176 print
'<table width="100%" class="noborder">';
177 print
'<tr class="liste_titre">';
178 print
'<td>'.$langs->trans(
"Reporting").
'</td>';
179 print
'<td class="right">'.$langs->trans(
"Size").
'</td>';
180 print
'<td class="right">'.$langs->trans(
"Date").
'</td>';
181 print
'<td class="right"></td>';
184 if (is_resource($handle)) {
185 while (($file = readdir($handle)) !==
false) {
186 if (preg_match(
'/^supplier_payment/i', $file)) {
187 $tfile = $dir.
'/'.$year.
'/'.$file;
188 $relativepath = $year.
'/'.$file;
189 print
'<tr class="oddeven"><td><a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?modulepart=facture_fournisseur&file=payments/'.urlencode($relativepath).
'">'.
img_picto(
'',
'pdf').
' '.$file.
'</a>'.$formfile->showPreview([
'name' => $file,
'fullname' => $tfile],
'facture_fournisseur',
'payments/'.$relativepath, 0).
'</td>';
190 print
'<td class="right">'.dol_print_size(
dol_filesize($tfile)).
'</td>';
191 print
'<td class="right">'.dol_print_date(
dol_filemtime($tfile),
"dayhour").
'</td>';
192 print
'<td class="right"><a href="rapport.php?removefile='.urlencode($relativepath).
'&action=removedoc&token='.newToken().
'">'.
img_delete().
'</a></td>';
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 suppliers invoices.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
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.