28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/expensereport.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport_ik.class.php';
35$langs->loadLangs(array(
"admin",
"trips",
"errors",
"other",
"dict"));
39$action =
GETPOST(
'action',
'aZ09');
42$ikoffset =
GETPOST(
'ikoffset',
'int');
44$fk_c_exp_tax_cat =
GETPOST(
'fk_c_exp_tax_cat');
45$fk_range =
GETPOST(
'fk_range',
'int');
58if ($action ==
'updateik') {
60 $result = $expIk->fetch($id);
67 $expIk->ikoffset = $ikoffset;
68 $expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
69 $expIk->fk_range = $fk_range;
72 $result = $expIk->update($user);
74 $result = $expIk->create($user);
79 header(
'Location: '.$_SERVER[
'PHP_SELF']);
84} elseif ($action ==
'delete') {
86 $result = $expIk->fetch($id);
91 $expIk->delete($user);
94 header(
'Location: '.$_SERVER[
'PHP_SELF']);
98$rangesbycateg = $expIk->getAllRanges();
105llxHeader(
'', $langs->trans(
"ExpenseReportsSetup"));
107$form =
new Form($db);
109$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
110print
load_fiche_titre($langs->trans(
"ExpenseReportsSetup"), $linkback,
'title_setup');
113print
dol_get_fiche_head($head,
'expenseik', $langs->trans(
"ExpenseReportsIk"), -1,
'trip');
115echo
'<span class="opacitymedium">'.$langs->trans(
'ExpenseReportIkDesc').
'</span>';
118echo
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
119echo
'<input type="hidden" name="token" value="'.newToken().
'" />';
121if ($action ==
'edit') {
122 echo
'<input type="hidden" name="id" value="'.$id.
'" />';
123 echo
'<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.
'" />';
124 echo
'<input type="hidden" name="fk_range" value="'.$fk_range.
'" />';
125 echo
'<input type="hidden" name="action" value="updateik" />';
128echo
'<table class="noborder centpercent">';
130foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) {
131 $title = ($Tab[
'active'] == 1) ? $langs->trans($Tab[
'label']) : $form->textwithpicto($langs->trans($Tab[
'label']), $langs->trans(
'expenseReportCatDisabled'), 1,
'help',
'', 0, 3);
132 echo
'<tr class="liste_titre">';
133 echo
'<td>'.$title.
'</td>';
134 echo
'<td>'.$langs->trans(
'expenseReportOffset').
'</td>';
135 echo
'<td>'.$langs->trans(
'expenseReportCoef').
'</td>';
136 echo
'<td>'.$langs->trans(
'expenseReportTotalForFive').
'</td>';
137 echo
'<td> </td>';
140 if ($Tab[
'active'] == 0) {
146 foreach ($Tab[
'ranges'] as $k => $range) {
147 if (isset($Tab[
'ranges'][$k + 1])) {
148 $label = $langs->trans(
'expenseReportRangeFromTo', $range->range_ik, ($Tab[
'ranges'][$k + 1]->range_ik - 1));
150 $label = $langs->trans(
'expenseReportRangeMoreThan', $range->range_ik);
153 if ($range->range_active == 0) {
154 $label = $form->textwithpicto($label, $langs->trans(
'expenseReportRangeDisabled'), 1,
'help',
'', 0, 3);
157 echo
'<tr class="oddeven">';
160 echo
'<td class="nowraponall"><b>['.$langs->trans(
'RangeNum', $tranche++).
']</b> - '.$label.
'</td>';
163 echo
'<td class="nowraponall">';
164 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
165 echo
'<input type="text" class="maxwidth100" name="ikoffset" value="'.$range->ik->ikoffset.
'" />';
167 echo $range->ik->ikoffset;
171 echo
'<td class="nowraponall">';
172 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
173 echo
'<input type="text" class="maxwidth100" name="coef" value="'.$range->ik->coef.
'" />';
175 echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans(
'expenseReportCoefUndefined'));
180 echo
'<td class="nowraponall">'.$langs->trans(
'expenseReportPrintExample',
price($range->ik->ikoffset + 5 * $range->ik->coef)).
'</td>';
183 echo
'<td class="right">';
184 if ($range->range_active == 1) {
185 if ($action ==
'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
186 echo
'<input id="" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'" type="submit" />';
187 echo
'<input class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onclick="history.go(-1)" type="button" />';
189 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>';
190 if (!empty($range->ik->id)) {
191 echo
'<a class="paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.newToken().
'&id='.$range->ik->id.
'">'.
img_delete().
'</a>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage inventories.
expensereport_admin_prepare_head()
Return array head with list of tabs to view object informations.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.