29require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
35$langs->loadLangs(array(
"bills",
"accountancy",
"trips"));
37$action =
GETPOST(
'action',
'aZ09');
38$cancel =
GETPOST(
'cancel',
'alpha');
39$backtopage =
GETPOST(
'backtopage',
'alpha');
41$codeventil =
GETPOST(
'codeventil',
'int');
45if (!isModEnabled(
'accounting')) {
48if ($user->socid > 0) {
51if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
60if ($action ==
'ventil' && $user->hasRight(
'accounting',
'bind',
'write')) {
62 if ($codeventil < 0) {
66 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"expensereport_det";
67 $sql .=
" SET fk_code_ventilation = ".((int) $codeventil);
68 $sql .=
" WHERE rowid = ".((int) $id);
70 $resql = $db->query($sql);
74 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
76 header(
"Location: ".$backtopage);
81 header(
"Location: ./lines.php");
91$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
93llxHeader(
"", $langs->trans(
'FicheVentilation'), $help_url);
95if ($cancel == $langs->trans(
"Cancel")) {
100$form =
new Form($db);
105 $sql =
"SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,";
106 $sql .=
" f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
107 $sql .=
" aa.account_number, aa.label";
108 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport_det as erd";
109 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_fees as f ON f.id = erd.fk_c_type_fees";
110 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON erd.fk_code_ventilation = aa.rowid";
111 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"expensereport as er ON er.rowid = erd.fk_expensereport";
112 $sql .=
" WHERE er.fk_statut > 0 AND erd.rowid = ".((int) $id);
113 $sql .=
" AND er.entity IN (".getEntity(
'expensereport', 0).
")";
115 dol_syslog(
"/accounting/expensereport/card.php", LOG_DEBUG);
116 $result = $db->query($sql);
119 $num_lines = $db->num_rows($result);
123 $objp = $db->fetch_object($result);
125 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'" method="post">'.
"\n";
126 print
'<input type="hidden" name="token" value="'.newToken().
'">';
127 print
'<input type="hidden" name="action" value="ventil">';
128 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
130 print
load_fiche_titre($langs->trans(
'ExpenseReportsVentilation'),
'',
'title_accountancy');
134 print
'<table class="border centpercent">';
137 print
'<tr><td class="titlefield">'.$langs->trans(
"ExpenseReport").
'</td>';
138 $expensereport_static->ref = $objp->ref;
139 $expensereport_static->id = $objp->erid;
140 print
'<td>'.$expensereport_static->getNomUrl(1).
'</td>';
143 print
'<tr><td>'.$langs->trans(
"Line").
'</td>';
144 print
'<td>'.stripslashes(nl2br($objp->rowid)).
'</td></tr>';
146 print
'<tr><td>'.$langs->trans(
"Description").
'</td>';
147 print
'<td>'.stripslashes(nl2br($objp->comments)).
'</td></tr>';
149 print
'<tr><td>'.$langs->trans(
"TypeFees").
'</td>';
150 print
'<td>'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).
'</td>';
152 print
'<tr><td>'.$langs->trans(
"Account").
'</td><td>';
153 print $formaccounting->select_account($objp->fk_code_ventilation,
'codeventil', 1);
159 print
'<div class="center">';
160 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
161 print
' ';
162 print
'<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
173 print
"Error ID incorrect";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Trips and Expenses.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.