24 require
'../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/fiscalyear.class.php';
28 $action =
GETPOST(
'action',
'aZ09');
31 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
32 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
33 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
35 if (empty($page) || $page == -1) { $page = 0; }
36 $offset = $limit * $page;
37 $pageprev = $page - 1;
38 $pagenext = $page + 1;
39 if (!$sortfield) $sortfield =
"f.rowid";
40 if (!$sortorder) $sortorder =
"ASC";
43 $langs->loadLangs(array(
"admin",
"compta"));
48 if (!$user->rights->accounting->fiscalyear->write)
54 static $tmpstatut2label = array(
55 '0' =>
'OpenFiscalYear',
56 '1' =>
'CloseFiscalYear'
58 $statut2label = array(
61 foreach ($tmpstatut2label as $key => $val)
62 $statut2label[$key] = $langs->trans($val);
81 $form =
new Form($db);
84 $title = $langs->trans(
'AccountingPeriods');
88 $sql =
"SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
89 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_fiscalyear as f";
90 $sql .=
" WHERE f.entity = ".$conf->entity;
91 $sql .= $db->order($sortfield, $sortorder);
94 $nbtotalofrecords =
'';
95 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
97 $result = $db->query($sql);
98 $nbtotalofrecords = $db->num_rows($result);
99 if (($page * $limit) > $nbtotalofrecords)
106 $sql .= $db->plimit($limit + 1, $offset);
108 $result = $db->query($sql);
111 $num = $db->num_rows($result);
116 $addbutton .=
dolGetButtonTitle($langs->trans(
'NewFiscalYear'),
'',
'fa fa-plus-circle',
'fiscalyear_card.php?action=create',
'', $user->rights->accounting->fiscalyear->write);
119 $title = $langs->trans(
'AccountingPeriods');
120 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $params, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_accountancy', 0, $addbutton,
'', $limit, 1);
123 print '<div class="div-table-responsive">';
124 print '<table class="tagtable liste centpercent">';
125 print '<tr class="liste_titre">';
126 print '<td>'.$langs->trans(
"Ref").
'</td>';
127 print '<td>'.$langs->trans(
"Label").
'</td>';
128 print '<td>'.$langs->trans(
"DateStart").
'</td>';
129 print '<td>'.$langs->trans(
"DateEnd").
'</td>';
130 print '<td class="center">'.$langs->trans(
"NumberOfAccountancyEntries").
'</td>';
131 print '<td class="center">'.$langs->trans(
"NumberOfAccountancyMovements").
'</td>';
132 print '<td class="right">'.$langs->trans(
"Statut").
'</td>';
136 while ($i < $num && $i < $max) {
137 $obj = $db->fetch_object($result);
139 $fiscalyearstatic->id = $obj->rowid;
141 print '<tr class="oddeven">';
143 print $fiscalyearstatic->getNomUrl(1);
145 print '<td class="left">'.$obj->label.
'</td>';
146 print '<td class="left">'.dol_print_date($db->jdate($obj->date_start),
'day').
'</td>';
147 print '<td class="left">'.dol_print_date($db->jdate($obj->date_end),
'day').
'</td>';
148 print '<td class="center">'.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).
'</td>';
149 print '<td class="center">'.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).
'</td>';
150 print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->statut, 5).
'</td>';
155 print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage fiscal year.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...