30require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
44$langs->loadLangs(array(
"bills",
"accountancy",
"trips"));
46$action =
GETPOST(
'action',
'aZ09');
47$cancel =
GETPOST(
'cancel',
'alpha');
48$backtopage =
GETPOST(
'backtopage',
'alpha');
54if (!isModEnabled(
'accounting')) {
57if ($user->socid > 0) {
60if (!$user->hasRight(
'accounting',
'bind',
'write')) {
69if ($action ==
'ventil' && $user->hasRight(
'accounting',
'bind',
'write')) {
71 if ($codeventil < 0) {
75 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"expensereport_det";
76 $sql .=
" SET fk_code_ventilation = ".((int) $codeventil);
77 $sql .=
" WHERE rowid = ".((int) $id);
79 $resql = $db->query($sql);
83 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
85 header(
"Location: ".$backtopage);
90 header(
"Location: ./lines.php");
100$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
102llxHeader(
"", $langs->trans(
'FicheVentilation'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-expensereport page-card');
104if ($cancel == $langs->trans(
"Cancel")) {
109$form =
new Form($db);
114 $sql =
"SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,";
115 $sql .=
" f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
116 $sql .=
" aa.account_number, aa.label";
117 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport_det as erd";
118 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_fees as f ON f.id = erd.fk_c_type_fees";
119 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON erd.fk_code_ventilation = aa.rowid";
120 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"expensereport as er ON er.rowid = erd.fk_expensereport";
121 $sql .=
" WHERE er.fk_statut > 0 AND erd.rowid = ".((int) $id);
122 $sql .=
" AND er.entity IN (".getEntity(
'expensereport', 0).
")";
124 dol_syslog(
"/accounting/expensereport/card.php", LOG_DEBUG);
125 $result = $db->query($sql);
128 $num_lines = $db->num_rows($result);
132 $objp = $db->fetch_object($result);
134 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'" method="post">'.
"\n";
135 print
'<input type="hidden" name="token" value="'.newToken().
'">';
136 print
'<input type="hidden" name="action" value="ventil">';
137 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
139 print
load_fiche_titre($langs->trans(
'ExpenseReportsVentilation'),
'',
'title_accountancy');
143 print
'<table class="border centpercent">';
146 print
'<tr><td class="titlefield">'.$langs->trans(
"ExpenseReport").
'</td>';
147 $expensereport_static->ref = $objp->ref;
148 $expensereport_static->id = $objp->erid;
149 print
'<td>'.$expensereport_static->getNomUrl(1).
'</td>';
152 print
'<tr><td>'.$langs->trans(
"Line").
'</td>';
153 print
'<td>'.stripslashes(nl2br($objp->rowid)).
'</td></tr>';
155 print
'<tr><td>'.$langs->trans(
"Description").
'</td>';
156 print
'<td>'.stripslashes(nl2br($objp->comments)).
'</td></tr>';
158 print
'<tr><td>'.$langs->trans(
"TypeFees").
'</td>';
159 print
'<td>'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).
'</td>';
161 print
'<tr><td>'.$langs->trans(
"Account").
'</td><td>';
162 print $formaccounting->select_account($objp->fk_code_ventilation,
'codeventil', 1);
168 print
'<div class="center">';
169 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
170 print
' ';
171 print
'<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
182 print
"Error ID incorrect";
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 Trips and Expenses.
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.
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.
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.
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.