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"));
40 $action =
GETPOST(
'action',
'aZ09');
42 $ikoffset =
GETPOST(
'ikoffset',
'int');
45 $fk_c_exp_tax_cat =
GETPOST(
'fk_c_exp_tax_cat');
46 $fk_range =
GETPOST(
'fk_range');
48 if ($action ==
'updateik')
53 $result = $expIk->fetch($id);
57 $expIk->setValues($_POST);
58 $result = $expIk->create($user);
62 header(
'Location: '.
$_SERVER[
'PHP_SELF']);
67 } elseif ($action ==
'delete')
72 $result = $expIk->fetch($id);
75 $expIk->delete($user);
79 header(
'Location: '.
$_SERVER[
'PHP_SELF']);
90 llxHeader(
'', $langs->trans(
"ExpenseReportsSetup"));
92 $form =
new Form($db);
94 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
100 echo
'<span class="opacitymedium">'.$langs->trans(
'ExpenseReportIkDesc').
'</span>';
103 echo
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="post">';
105 if ($action ==
'edit')
107 echo
'<input type="hidden" name="id" value="'.$id.
'" />';
108 echo
'<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.
'" />';
109 echo
'<input type="hidden" name="fk_range" value="'.$fk_range.
'" />';
110 echo
'<input type="hidden" name="action" value="updateik" />';
113 echo
'<input type="hidden" name="token" value="'.newToken().
'" />';
115 echo
'<table class="noborder centpercent">';
117 foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
119 $title = ($Tab[
'active'] == 1) ? $langs->trans($Tab[
'label']) : $form->textwithpicto($langs->trans($Tab[
'label']), $langs->trans(
'expenseReportCatDisabled'), 1,
'help',
'', 0, 3);
120 echo
'<tr class="liste_titre">';
121 echo
'<td>'.$title.
'</td>';
122 echo
'<td>'.$langs->trans(
'expenseReportOffset').
'</td>';
123 echo
'<td>'.$langs->trans(
'expenseReportCoef').
'</td>';
124 echo
'<td>'.$langs->trans(
'expenseReportTotalForFive').
'</td>';
125 echo
'<td> </td>';
128 if ($Tab[
'active'] == 0)
continue;
132 foreach ($Tab[
'ranges'] as $k => $range)
134 if (isset($Tab[
'ranges'][$k + 1])) $label = $langs->trans(
'expenseReportRangeFromTo', $range->range_ik, ($Tab[
'ranges'][$k + 1]->range_ik - 1));
135 else $label = $langs->trans(
'expenseReportRangeMoreThan', $range->range_ik);
137 if ($range->range_active == 0) $label = $form->textwithpicto($label, $langs->trans(
'expenseReportRangeDisabled'), 1,
'help',
'', 0, 3);
139 echo
'<tr class="oddeven">';
142 echo
'<td class="nowraponall"><b>['.$langs->trans(
'RangeNum', $tranche++).
']</b> - '.$label.
'</td>';
145 echo
'<td class="nowraponall">';
146 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo
'<input type="text" class="maxwidth100" name="ikoffset" value="'.$range->ik->ikoffset.
'" />';
148 echo $range->ik->ikoffset;
152 echo
'<td class="nowraponall">';
153 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo
'<input type="text" class="maxwidth100" name="coef" value="'.$range->ik->coef.
'" />';
154 else echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans(
'expenseReportCoefUndefined'));
158 echo
'<td class="nowraponall">'.$langs->trans(
'expenseReportPrintExample',
price($range->ik->ikoffset + 5 * $range->ik->coef)).
'</td>';
161 echo
'<td class="right">';
162 if ($range->range_active == 1)
164 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat)
166 echo
'<input id="" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'" type="submit" />';
167 echo
'<input class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onclick="javascript:history.go(-1)" type="button" />';
169 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>';
170 if (!empty($range->ik->id)) echo
'<a class="paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$range->ik->id.
'">'.
img_delete().
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
static getAllRanges()
Return an array of ranges grouped by category.
Class to manage inventories.
expensereport_admin_prepare_head()
Return array head with list of tabs to view object informations.
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.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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...
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.
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.