29 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
32 require_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');
53 if ($action ==
'ventil' && $user->rights->accounting->bind->write)
57 if ($codeventil < 0) $codeventil = 0;
59 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"expensereport_det";
60 $sql .=
" SET fk_code_ventilation = ".$codeventil;
61 $sql .=
" WHERE rowid = ".$id;
67 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"), null,
'mesgs');
70 header(
"Location: ".$backtopage);
75 header(
"Location: ./lines.php");
85 llxHeader(
"", $langs->trans(
'FicheVentilation'));
87 if ($cancel == $langs->trans(
"Cancel")) {
92 $form =
new Form($db);
97 $sql =
"SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,";
98 $sql .=
" f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
99 $sql .=
" aa.account_number, aa.label";
100 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport_det as erd";
101 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_fees as f ON f.id = erd.fk_c_type_fees";
102 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON erd.fk_code_ventilation = aa.rowid";
103 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"expensereport as er ON er.rowid = erd.fk_expensereport";
104 $sql .=
" WHERE er.fk_statut > 0 AND erd.rowid = ".$id;
105 $sql .=
" AND er.entity IN (".getEntity(
'expensereport', 0).
")";
107 dol_syslog(
"/accounting/expensereport/card.php sql=".$sql, LOG_DEBUG);
108 $result = $db->query($sql);
111 $num_lines = $db->num_rows($result);
115 $objp = $db->fetch_object($result);
117 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'" method="post">'.
"\n";
118 print '<input type="hidden" name="token" value="'.newToken().
'">';
119 print '<input type="hidden" name="action" value="ventil">';
120 print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
126 print '<table class="border centpercent">';
129 print '<tr><td class="titlefield">'.$langs->trans(
"ExpenseReport").
'</td>';
130 $expensereport_static->ref = $objp->ref;
131 $expensereport_static->id = $objp->erid;
132 print '<td>'.$expensereport_static->getNomUrl(1).
'</td>';
135 print '<tr><td>'.$langs->trans(
"Line").
'</td>';
136 print '<td>'.stripslashes(nl2br($objp->rowid)).
'</td></tr>';
138 print '<tr><td>'.$langs->trans(
"Description").
'</td>';
139 print '<td>'.stripslashes(nl2br($objp->comments)).
'</td></tr>';
141 print '<tr><td>'.$langs->trans(
"TypeFees").
'</td>';
142 print '<td>'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).
'</td>';
144 print '<tr><td>'.$langs->trans(
"Account").
'</td><td>';
145 print $formaccounting->select_account($objp->fk_code_ventilation,
'codeventil', 1);
151 print '<div class="center">';
152 print '<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
153 print ' ';
154 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
165 print "Error ID incorrect";
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= '')
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.
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 Calling this function terminate execution ...
Class to manage Trips and Expenses.
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.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_get_fiche_end($notab=0)
Return tab footer of a card.