31 require
'../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/report.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
42 $langs->loadLangs(array(
"commercial",
"compta",
"bills",
"other",
"accountancy",
"trips",
"errors"));
44 $id_journal =
GETPOST(
'id_journal',
'int');
45 $action =
GETPOST(
'action',
'aZ09');
47 $date_startmonth =
GETPOST(
'date_startmonth');
48 $date_startday =
GETPOST(
'date_startday');
49 $date_startyear =
GETPOST(
'date_startyear');
50 $date_endmonth =
GETPOST(
'date_endmonth');
51 $date_endday =
GETPOST(
'date_endday');
52 $date_endyear =
GETPOST(
'date_endyear');
53 $in_bookkeeping =
GETPOST(
'in_bookkeeping');
54 if ($in_bookkeeping ==
'') $in_bookkeeping =
'notyet';
69 $accountingjournalstatic->fetch($id_journal);
70 $journal = $accountingjournalstatic->code;
71 $journal_label = $accountingjournalstatic->label;
73 $date_start =
dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
74 $date_end =
dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
76 if (empty($date_startmonth) || empty($date_endmonth))
80 $date_start = $dates[
'date_start'];
81 $date_end = $dates[
'date_end'];
82 $pastmonthyear = $dates[
'pastmonthyear'];
83 $pastmonth = $dates[
'pastmonth'];
86 if (!
GETPOSTISSET(
'date_startmonth') && (empty($date_start) || empty($date_end)))
92 $sql =
"SELECT er.rowid, er.ref, er.date_debut as de,";
93 $sql .=
" erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
94 $sql .=
" u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
95 $sql .=
" f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
96 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport_det as erd";
97 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_fees as f ON f.id = erd.fk_c_type_fees";
98 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
99 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"expensereport as er ON er.rowid = erd.fk_expensereport";
100 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = er.fk_user_author";
101 $sql .=
" WHERE er.fk_statut > 0";
102 $sql .=
" AND erd.fk_code_ventilation > 0";
103 $sql .=
" AND er.entity IN (".getEntity(
'expensereport', 0).
")";
104 if ($date_start && $date_end)
105 $sql .=
" AND er.date_debut >= '".$db->idate($date_start).
"' AND er.date_debut <= '".$db->idate($date_end).
"'";
107 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
108 $sql .=
" AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING).
"'";
111 if ($in_bookkeeping ==
'already')
113 $sql .=
" AND er.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
115 if ($in_bookkeeping ==
'notyet')
117 $sql .=
" AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
119 $sql .=
" ORDER BY er.date_debut";
121 dol_syslog(
'accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
122 $result = $db->query($sql);
129 $tablocaltax1 = array();
130 $tablocaltax2 = array();
133 $num = $db->num_rows($result);
136 $account_salary = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT :
'NotDefined';
137 $account_vat = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT :
'NotDefined';
141 $obj = $db->fetch_object($result);
144 $compta_user = (!empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
145 $compta_fees = $obj->compte;
147 $vatdata =
getTaxesFromId($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), $mysoc, $mysoc, 0);
148 $compta_tva = (!empty($vatdata[
'accountancy_code_buy']) ? $vatdata[
'accountancy_code_buy'] : $account_vat);
149 $compta_localtax1 = (!empty($vatdata[
'accountancy_code_buy']) ? $vatdata[
'accountancy_code_buy'] : $cpttva);
150 $compta_localtax2 = (!empty($vatdata[
'accountancy_code_buy']) ? $vatdata[
'accountancy_code_buy'] : $cpttva);
153 if (
price2num($obj->tva_tx) || !empty($obj->vat_src_code))
155 $def_tva[$obj->rowid][$compta_tva][
vatrate($obj->tva_tx).($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
'')] = (
vatrate($obj->tva_tx).($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''));
158 $taber[$obj->rowid][
"date"] = $db->jdate($obj->de);
159 $taber[$obj->rowid][
"ref"] = $obj->ref;
160 $taber[$obj->rowid][
"comments"] = $obj->comments;
161 $taber[$obj->rowid][
"fk_expensereportdet"] = $obj->erdid;
164 if (!isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
165 if (!isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
166 if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
167 if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
168 if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
170 $tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
171 $tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
172 $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
173 $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
174 $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
175 $tabuser[$obj->rowid] = array(
178 'user_accountancy_code' => $obj->user_accountancy_account
188 if ($action ==
'writebookkeeping') {
192 foreach ($taber as $key => $val)
204 foreach ($tabttc[$key] as $k => $mt) {
207 $bookkeeping->doc_date = $val[
"date"];
208 $bookkeeping->doc_ref = $val[
"ref"];
209 $bookkeeping->date_creation = $now;
210 $bookkeeping->doc_type =
'expense_report';
211 $bookkeeping->fk_doc = $key;
212 $bookkeeping->fk_docdet = $val[
"fk_expensereportdet"];
213 $bookkeeping->subledger_account = $tabuser[$key][
'user_accountancy_code'];
214 $bookkeeping->subledger_label = $tabuser[$key][
'name'];
215 $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
217 $accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT,
true);
218 $bookkeeping->label_compte = $accountingaccount->label;
220 $bookkeeping->label_operation = $tabuser[$key][
'name'];
221 $bookkeeping->montant = $mt;
222 $bookkeeping->sens = ($mt >= 0) ?
'C' :
'D';
223 $bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
224 $bookkeeping->credit = ($mt > 0) ? $mt : 0;
225 $bookkeeping->code_journal = $journal;
226 $bookkeeping->journal_label = $langs->transnoentities($journal_label);
227 $bookkeeping->fk_user_author = $user->id;
228 $bookkeeping->entity = $conf->entity;
230 $totaldebit += $bookkeeping->debit;
231 $totalcredit += $bookkeeping->credit;
233 $result = $bookkeeping->create($user);
235 if ($bookkeeping->error ==
'BookkeepingRecordAlreadyExists')
253 foreach ($tabht[$key] as $k => $mt) {
256 if ($accountingaccount->fetch(null, $k,
true)) {
258 $bookkeeping->doc_date = $val[
"date"];
259 $bookkeeping->doc_ref = $val[
"ref"];
260 $bookkeeping->date_creation = $now;
261 $bookkeeping->doc_type =
'expense_report';
262 $bookkeeping->fk_doc = $key;
263 $bookkeeping->fk_docdet = $val[
"fk_expensereportdet"];
264 $bookkeeping->subledger_account =
'';
265 $bookkeeping->subledger_label =
'';
266 $bookkeeping->numero_compte = $k;
267 $bookkeeping->label_compte = $accountingaccount->label;
268 $bookkeeping->label_operation = $accountingaccount->label;
269 $bookkeeping->montant = $mt;
270 $bookkeeping->sens = ($mt < 0) ?
'C' :
'D';
271 $bookkeeping->debit = ($mt > 0) ? $mt : 0;
272 $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
273 $bookkeeping->code_journal = $journal;
274 $bookkeeping->journal_label = $langs->transnoentities($journal_label);
275 $bookkeeping->fk_user_author = $user->id;
276 $bookkeeping->entity = $conf->entity;
278 $totaldebit += $bookkeeping->debit;
279 $totalcredit += $bookkeeping->credit;
281 $result = $bookkeeping->create($user);
283 if ($bookkeeping->error ==
'BookkeepingRecordAlreadyExists')
302 $listoftax = array(0, 1, 2);
303 foreach ($listoftax as $numtax)
305 $arrayofvat = $tabtva;
306 if ($numtax == 1) $arrayofvat = $tablocaltax1;
307 if ($numtax == 2) $arrayofvat = $tablocaltax2;
309 foreach ($arrayofvat[$key] as $k => $mt) {
313 $bookkeeping->doc_date = $val[
"date"];
314 $bookkeeping->doc_ref = $val[
"ref"];
315 $bookkeeping->date_creation = $now;
316 $bookkeeping->doc_type =
'expense_report';
317 $bookkeeping->fk_doc = $key;
318 $bookkeeping->fk_docdet = $val[
"fk_expensereportdet"];
319 $bookkeeping->subledger_account =
'';
320 $bookkeeping->subledger_label =
'';
321 $bookkeeping->numero_compte = $k;
323 $accountingaccount->fetch($k, null,
true);
324 $bookkeeping->label_compte = $accountingaccount->label;
326 $bookkeeping->label_operation = $langs->trans(
"VAT").
' '.join(
', ', $def_tva[$key][$k]).
' %';
327 $bookkeeping->montant = $mt;
328 $bookkeeping->sens = ($mt < 0) ?
'C' :
'D';
329 $bookkeeping->debit = ($mt > 0) ? $mt : 0;
330 $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
331 $bookkeeping->code_journal = $journal;
332 $bookkeeping->journal_label = $langs->transnoentities($journal_label);
333 $bookkeeping->fk_user_author = $user->id;
334 $bookkeeping->entity = $conf->entity;
336 $totaldebit += $bookkeeping->debit;
337 $totalcredit += $bookkeeping->credit;
339 $result = $bookkeeping->create($user);
341 if ($bookkeeping->error ==
'BookkeepingRecordAlreadyExists')
362 setEventMessages(
'Try to insert a non balanced transaction in book for '.$val[
"ref"].
'. Canceled. Surely a bug.', null,
'errors');
373 setEventMessages($langs->trans(
"ErrorTooManyErrorsProcessStopped"), null,
'errors');
381 if (empty($error) && count($tabpay) > 0) {
383 } elseif (count($tabpay) == $error)
387 setEventMessages($langs->trans(
"GeneralLedgerSomeRecordWasNotRecorded"), null,
'warnings');
393 if (count($tabpay) != $error)
395 $param =
'id_journal='.$id_journal;
396 $param .=
'&date_startday='.$date_startday;
397 $param .=
'&date_startmonth='.$date_startmonth;
398 $param .=
'&date_startyear='.$date_startyear;
399 $param .=
'&date_endday='.$date_endday;
400 $param .=
'&date_endmonth='.$date_endmonth;
401 $param .=
'&date_endyear='.$date_endyear;
402 $param .=
'&in_bookkeeping='.$in_bookkeeping;
404 header(
"Location: ".
$_SERVER[
'PHP_SELF'].($param ?
'?'.$param :
''));
414 $form =
new Form($db);
416 $userstatic =
new User($db);
419 if ($action ==
'exportcsv') {
420 $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
422 $filename =
'journal';
423 $type_export =
'journal';
424 include DOL_DOCUMENT_ROOT.
'/accountancy/tpl/export_journal.tpl.php';
427 print '"'.$langs->transnoentitiesnoconv(
"Date").
'"'.$sep;
428 print '"'.$langs->transnoentitiesnoconv(
"Piece").
'"'.$sep;
429 print '"'.$langs->transnoentitiesnoconv(
"AccountAccounting").
'"'.$sep;
430 print '"'.$langs->transnoentitiesnoconv(
"LabelOperation").
'"'.$sep;
431 print '"'.$langs->transnoentitiesnoconv(
"Debit").
'"'.$sep;
432 print '"'.$langs->transnoentitiesnoconv(
"Credit").
'"'.$sep;
435 foreach ($taber as $key => $val) {
438 $userstatic->id = $tabuser[$key][
'id'];
439 $userstatic->name = $tabuser[$key][
'name'];
442 foreach ($tabht[$key] as $k => $mt) {
444 $accountingaccount->fetch(null, $k,
true);
446 print '"'.$date.
'"'.$sep;
447 print '"'.$val[
"ref"].
'"'.$sep;
448 print '"'.length_accountg(html_entity_decode($k)).
'"'.$sep;
449 print '"'.dol_trunc($accountingaccount->label, 32).
'"'.$sep;
450 print '"'.($mt >= 0 ?
price($mt) :
'').
'"'.$sep;
456 foreach ($tabtva[$key] as $k => $mt) {
458 print '"'.$date.
'"'.$sep;
459 print '"'.$val[
"ref"].
'"'.$sep;
460 print '"'.length_accountg(html_entity_decode($k)).
'"'.$sep;
461 print '"'.dol_trunc($langs->trans(
"VAT")).
'"'.$sep;
462 print '"'.($mt >= 0 ?
price($mt) :
'').
'"'.$sep;
469 foreach ($tabttc[$key] as $k => $mt) {
470 print '"'.$date.
'"'.$sep;
471 print '"'.$val[
"ref"].
'"'.$sep;
472 print '"'.length_accounta(html_entity_decode($k)).
'"'.$sep;
473 print '"'.dol_trunc($userstatic->name).
'"'.$sep;
474 print '"'.($mt < 0 ?
price(-$mt) :
'').
'"'.$sep;
481 if (empty($action) || $action ==
'view') {
482 llxHeader(
'', $langs->trans(
"ExpenseReportsJournal"));
484 $nom = $langs->trans(
"ExpenseReportsJournal").
' | '.$accountingjournalstatic->getNomUrl(0, 1, 1,
'', 1);
489 $description .= $langs->trans(
"DescJournalOnlyBindedVisible").
'<br>';
491 $listofchoices = array(
'notyet'=>$langs->trans(
"NotYetInGeneralLedger"),
'already'=>$langs->trans(
"AlreadyInGeneralLedger"));
492 $period = $form->selectDate($date_start ? $date_start : -1,
'date_start', 0, 0, 0,
'', 1, 0).
' - '.$form->selectDate($date_end ? $date_end : -1,
'date_end', 0, 0, 0,
'', 1, 0);
493 $period .=
' - '.$langs->trans(
"JournalizationInLedgerStatus").
' '.$form->selectarray(
'in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
495 $varlink =
'id_journal='.$id_journal;
497 journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array(
'action' =>
''),
'', $varlink);
500 if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT ==
'-1') {
501 print '<br>'.img_warning().
' '.$langs->trans(
"SomeMandatoryStepsOfSetupWereNotDone");
502 print ' : '.$langs->trans(
"AccountancyAreaDescMisc", 4,
'<strong>'.$langs->transnoentitiesnoconv(
"MenuAccountancy").
'-'.$langs->transnoentitiesnoconv(
"Setup").
"-".$langs->transnoentitiesnoconv(
"MenuDefaultAccounts").
'</strong>');
504 print '<div class="tabsAction tabsActionNoBottom">';
506 if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping ==
'notyet')
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans(
"ExportDraftJournal").
'" onclick="launch_export();" />';
507 if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT ==
'-1') {
508 print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"SomeMandatoryStepsOfSetupWereNotDone")).
'" value="'.$langs->trans(
"WriteBookKeeping").
'" />';
510 if ($in_bookkeeping ==
'notyet')
print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans(
"WriteBookKeeping").
'" onclick="writebookkeeping();" />';
511 else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans(
"WriteBookKeeping").
'</a>';
517 <script type="text/javascript">
518 function launch_export() {
519 $("div.fiche form input[name=\"action\"]").val("exportcsv");
520 $("div.fiche form input[type=\"submit\"]").click();
521 $("div.fiche form input[name=\"action\"]").val("");
523 function writebookkeeping() {
524 console.log("click on writebookkeeping");
525 $("div.fiche form input[name=\"action\"]").val("writebookkeeping");
526 $("div.fiche form input[type=\"submit\"]").click();
527 $("div.fiche form input[name=\"action\"]").val("");
537 print '<div class="div-table-responsive">';
538 print "<table class=\"noborder\" width=\"100%\">";
539 print "<tr class=\"liste_titre\">";
540 print "<td>".$langs->trans(
"Date").
"</td>";
541 print "<td>".$langs->trans(
"Piece").
' ('.$langs->trans(
"ExpenseReportRef").
")</td>";
542 print "<td>".$langs->trans(
"AccountAccounting").
"</td>";
543 print "<td>".$langs->trans(
"SubledgerAccount").
"</td>";
544 print "<td>".$langs->trans(
"LabelOperation").
"</td>";
545 print '<td class="right">'.$langs->trans(
"Debit").
"</td>";
546 print '<td class="right">'.$langs->trans(
"Credit").
"</td>";
554 foreach ($taber as $key => $val) {
555 $expensereportstatic->id = $key;
556 $expensereportstatic->ref = $val[
"ref"];
557 $expensereportlinestatic->comments = html_entity_decode(
dol_trunc($val[
"comments"], 32));
562 foreach ($tabht[$key] as $k => $mt) {
564 $accountingaccount->fetch(null, $k,
true);
567 print '<tr class="oddeven">';
568 print "<!-- Fees -->";
569 print "<td>".$date.
"</td>";
570 print "<td>".$expensereportstatic->getNomUrl(1).
"</td>";
571 $userstatic->id = $tabuser[$key][
'id'];
572 $userstatic->name = $tabuser[$key][
'name'];
576 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined')
578 print '<span class="error">'.$langs->trans(
"FeeAccountNotDefined").
'</span>';
579 }
else print $accountoshow;
584 $userstatic->id = $tabuser[$key][
'id'];
585 $userstatic->name = $tabuser[$key][
'name'];
586 print "<td>".$userstatic->getNomUrl(0,
'user', 16).
' - '.$accountingaccount->label.
"</td>";
587 print '<td class="right nowraponall">'.($mt >= 0 ?
price($mt) :
'').
"</td>";
588 print '<td class="right nowraponall">'.($mt < 0 ?
price(-$mt) :
'').
"</td>";
594 foreach ($tabttc[$key] as $k => $mt) {
595 $userstatic->id = $tabuser[$key][
'id'];
596 $userstatic->name = $tabuser[$key][
'name'];
598 print '<tr class="oddeven">';
599 print "<!-- Thirdparty -->";
600 print "<td>".$date.
"</td>";
601 print "<td>".$expensereportstatic->getNomUrl(1).
"</td>";
604 $accountoshow =
length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
605 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined')
607 print '<span class="error">'.$langs->trans(
"MainAccountForUsersNotDefined").
'</span>';
608 }
else print $accountoshow;
613 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined')
615 print '<span class="error">'.$langs->trans(
"UserAccountNotDefined").
'</span>';
616 }
else print $accountoshow;
618 print "<td>".$userstatic->getNomUrl(0,
'user', 16).
' - '.$langs->trans(
"SubledgerAccount").
"</td>";
619 print '<td class="right nowraponall">'.($mt < 0 ?
price(-$mt) :
'').
"</td>";
620 print '<td class="right nowraponall">'.($mt >= 0 ?
price($mt) :
'').
"</td>";
625 $listoftax = array(0, 1, 2);
626 foreach ($listoftax as $numtax) {
627 $arrayofvat = $tabtva;
628 if ($numtax == 1) $arrayofvat = $tablocaltax1;
629 if ($numtax == 2) $arrayofvat = $tablocaltax2;
631 foreach ($arrayofvat[$key] as $k => $mt) {
633 print '<tr class="oddeven">';
634 print "<!-- VAT -->";
635 print "<td>".$date.
"</td>";
636 print "<td>".$expensereportstatic->getNomUrl(1).
"</td>";
640 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined')
642 print '<span class="error">'.$langs->trans(
"VATAccountNotDefined").
'</span>';
643 }
else print $accountoshow;
648 print "<td>".$userstatic->getNomUrl(0,
'user', 16).
' - '.$langs->trans(
"VAT").
' '.join(
', ', $def_tva[$key][$k]).
' %'.($numtax ?
' - Localtax '.$numtax :
'');
650 print '<td class="right nowraponall">'.($mt >= 0 ?
price($mt) :
'').
"</td>";
651 print '<td class="right nowraponall">'.($mt < 0 ?
price(-$mt) :
'').
"</td>";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Class of expense report details lines.
dol_now($mode= 'auto')
Return date for now.
getDefaultDatesForTransfer()
Return Default dates for transfer based on periodicity option in accountancy setup.
Class to manage Dolibarr users.
getTaxesFromId($vatrate, $buyer=null, $seller=null, $firstparamisid=1)
Get tax (VAT) main information from Id.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
journalHead($nom, $variante, $period, $periodlink, $description, $builddate, $exportlink= '', $moreparam=array(), $calcmode= '', $varlink= '')
Show header of a page used to transfer/dispatch data in accounting.
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...
Class to manage Ledger (General Ledger and Subledger)
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
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 ...
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
Class to manage Trips and Expenses.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
Class to manage accounting accounts.
Class to manage accounting accounts.
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous) ...
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.