30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/expensereport.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport_ik.class.php';
45$langs->loadLangs(array(
"admin",
"trips",
"errors",
"other",
"dict"));
49$action =
GETPOST(
'action',
'aZ09');
54$fk_c_exp_tax_cat =
GETPOSTINT(
'fk_c_exp_tax_cat');
68if ($action ==
'updateik') {
70 $result = $expIk->fetch($id);
77 $expIk->ikoffset = $ikoffset;
78 $expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
79 $expIk->fk_range = $fk_range;
82 $result = $expIk->update($user);
84 $result = $expIk->create($user);
89 header(
'Location: '.$_SERVER[
'PHP_SELF']);
94} elseif ($action ==
'delete') {
96 $result = $expIk->fetch($id);
101 $expIk->delete($user);
104 header(
'Location: '.$_SERVER[
'PHP_SELF']);
108$rangesbycateg = $expIk->getAllRanges();
115llxHeader(
'', $langs->trans(
"ExpenseReportsSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-expensereport_ik');
117$form =
new Form($db);
119$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
120print
load_fiche_titre($langs->trans(
"ExpenseReportsSetup"), $linkback,
'title_setup');
123print
dol_get_fiche_head($head,
'expenseik', $langs->trans(
"ExpenseReportsIk"), -1,
'trip');
125echo
'<span class="opacitymedium">'.$langs->trans(
'ExpenseReportIkDesc').
'</span>';
128echo
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
129echo
'<input type="hidden" name="token" value="'.newToken().
'" />';
131if ($action ==
'edit') {
132 echo
'<input type="hidden" name="id" value="'.$id.
'" />';
133 echo
'<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.
'" />';
134 echo
'<input type="hidden" name="fk_range" value="'.$fk_range.
'" />';
135 echo
'<input type="hidden" name="action" value="updateik" />';
138echo
'<table class="noborder centpercent">';
140foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) {
141 $title = ($Tab[
'active'] == 1) ? $langs->trans($Tab[
'label']) : $form->textwithpicto($langs->trans($Tab[
'label']), $langs->trans(
'expenseReportCatDisabled'), 1,
'help',
'', 0, 3);
142 echo
'<tr class="liste_titre">';
143 echo
'<td>'.$title.
'</td>';
144 echo
'<td>'.$langs->trans(
'expenseReportOffset').
'</td>';
145 echo
'<td>'.$langs->trans(
'expenseReportCoef').
'</td>';
146 echo
'<td>'.$langs->trans(
'expenseReportTotalForFive').
'</td>';
147 echo
'<td> </td>';
150 if ($Tab[
'active'] == 0) {
156 foreach ($Tab[
'ranges'] as $k => $range) {
158 '@phan-var-force ExpenseReportIk $ik';
159 if (isset($Tab[
'ranges'][$k + 1])) {
160 $label = $langs->trans(
'expenseReportRangeFromTo', $range->range_ik, ($Tab[
'ranges'][$k + 1]->range_ik - 1));
162 $label = $langs->trans(
'expenseReportRangeMoreThan', $range->range_ik);
165 if ($range->range_active == 0) {
166 $label = $form->textwithpicto($label, $langs->trans(
'expenseReportRangeDisabled'), 1,
'help',
'', 0, 3);
169 echo
'<tr class="oddeven">';
172 echo
'<td class="nowraponall"><b>['.$langs->trans(
'RangeNum', $tranche++).
']</b> - '.$label.
'</td>';
175 echo
'<td class="nowraponall">';
176 if ($action ==
'edit' && $ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
177 echo
'<input type="text" class="maxwidth100" name="ikoffset" value="'.$ik->ikoffset.
'" />';
184 echo
'<td class="nowraponall">';
185 if ($action ==
'edit' && $ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
186 echo
'<input type="text" class="maxwidth100" name="coef" value="'.$ik->coef.
'" />';
188 echo($ik->id > 0 ? $ik->coef : $langs->trans(
'expenseReportCoefUndefined'));
193 echo
'<td class="nowraponall">'.$langs->trans(
'expenseReportPrintExample',
price($ik->ikoffset + 5 * $ik->coef)).
'</td>';
196 echo
'<td class="right">';
197 if ($range->range_active == 1) {
198 if ($action ==
'edit' && $ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
199 echo
'<input id="" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'" type="submit" />';
200 echo
'<input class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onclick="history.go(-1)" type="button" />';
202 echo
'<a class="editfielda marginrightonly paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?action=edit&token='.
newToken().
'&id='.$ik->id.
'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.
'&fk_range='.$range->rowid.
'">'.
img_edit().
'</a>';
203 if (!empty($ik->id)) {
204 echo
'<a class="paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$ik->id.
'">'.
img_delete().
'</a>';
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 inventories.
expensereport_admin_prepare_head()
Return array head with list of tabs to view object information.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.