Go to the documentation of this file.
27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/expensereport.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport_ik.class.php';
34 $langs->loadLangs(array(
"admin",
"trips",
"errors",
"other",
"dict"));
38 $action =
GETPOST(
'action',
'aZ09');
41 $ikoffset =
GETPOST(
'ikoffset',
'int');
43 $fk_c_exp_tax_cat =
GETPOST(
'fk_c_exp_tax_cat');
44 $fk_range =
GETPOST(
'fk_range',
'int');
57 if ($action ==
'updateik') {
59 $result = $expIk->fetch($id);
66 $expIk->ikoffset = $ikoffset;
67 $expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
68 $expIk->fk_range = $fk_range;
71 $result = $expIk->update($user);
73 $result = $expIk->create($user);
78 header(
'Location: '.$_SERVER[
'PHP_SELF']);
83 } elseif ($action ==
'delete') {
85 $result = $expIk->fetch($id);
90 $expIk->delete($user);
93 header(
'Location: '.$_SERVER[
'PHP_SELF']);
97 $rangesbycateg = $expIk->getAllRanges();
104 llxHeader(
'', $langs->trans(
"ExpenseReportsSetup"));
108 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
109 print
load_fiche_titre($langs->trans(
"ExpenseReportsSetup"), $linkback,
'title_setup');
112 print
dol_get_fiche_head($head,
'expenseik', $langs->trans(
"ExpenseReportsIk"), -1,
'trip');
114 echo
'<span class="opacitymedium">'.$langs->trans(
'ExpenseReportIkDesc').
'</span>';
117 echo
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
118 echo
'<input type="hidden" name="token" value="'.newToken().
'" />';
120 if ($action ==
'edit') {
121 echo
'<input type="hidden" name="id" value="'.$id.
'" />';
122 echo
'<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.
'" />';
123 echo
'<input type="hidden" name="fk_range" value="'.$fk_range.
'" />';
124 echo
'<input type="hidden" name="action" value="updateik" />';
127 echo
'<table class="noborder centpercent">';
129 foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) {
130 $title = ($Tab[
'active'] == 1) ? $langs->trans($Tab[
'label']) :
$form->textwithpicto($langs->trans($Tab[
'label']), $langs->trans(
'expenseReportCatDisabled'), 1,
'help',
'', 0, 3);
131 echo
'<tr class="liste_titre">';
132 echo
'<td>'.$title.
'</td>';
133 echo
'<td>'.$langs->trans(
'expenseReportOffset').
'</td>';
134 echo
'<td>'.$langs->trans(
'expenseReportCoef').
'</td>';
135 echo
'<td>'.$langs->trans(
'expenseReportTotalForFive').
'</td>';
136 echo
'<td> </td>';
139 if ($Tab[
'active'] == 0) {
145 foreach ($Tab[
'ranges'] as $k => $range) {
146 if (isset($Tab[
'ranges'][$k + 1])) {
147 $label = $langs->trans(
'expenseReportRangeFromTo', $range->range_ik, ($Tab[
'ranges'][$k + 1]->range_ik - 1));
149 $label = $langs->trans(
'expenseReportRangeMoreThan', $range->range_ik);
152 if ($range->range_active == 0) {
153 $label =
$form->textwithpicto($label, $langs->trans(
'expenseReportRangeDisabled'), 1,
'help',
'', 0, 3);
156 echo
'<tr class="oddeven">';
159 echo
'<td class="nowraponall"><b>['.$langs->trans(
'RangeNum', $tranche++).
']</b> - '.$label.
'</td>';
162 echo
'<td class="nowraponall">';
163 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
164 echo
'<input type="text" class="maxwidth100" name="ikoffset" value="'.$range->ik->ikoffset.
'" />';
166 echo $range->ik->ikoffset;
170 echo
'<td class="nowraponall">';
171 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
172 echo
'<input type="text" class="maxwidth100" name="coef" value="'.$range->ik->coef.
'" />';
174 echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans(
'expenseReportCoefUndefined'));
179 echo
'<td class="nowraponall">'.$langs->trans(
'expenseReportPrintExample',
price($range->ik->ikoffset + 5 * $range->ik->coef)).
'</td>';
182 echo
'<td class="right">';
183 if ($range->range_active == 1) {
184 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
185 echo
'<input id="" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'" type="submit" />';
186 echo
'<input class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onclick="javascript:history.go(-1)" type="button" />';
188 echo
'<a class="editfielda marginrightonly paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?action=edit&token='.
newToken().
'&id='.$range->ik->id.
'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.
'&fk_range='.$range->rowid.
'">'.
img_edit().
'</a>';
189 if (!empty($range->ik->id)) {
190 echo
'<a class="paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$range->ik->id.
'">'.
img_delete().
'</a>';
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage inventories.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
expensereport_admin_prepare_head()
Return array head with list of tabs to view object informations.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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 ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.