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 ==
'') {
55 $in_bookkeeping =
'notyet';
64 if ($user->socid > 0) {
67 if (empty($user->rights->accounting->mouvements->lire)) {
80 $accountingjournalstatic->fetch($id_journal);
81 $journal = $accountingjournalstatic->code;
82 $journal_label = $accountingjournalstatic->label;
84 $date_start =
dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
85 $date_end =
dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
87 if (empty($date_startmonth) || empty($date_endmonth)) {
90 $date_start = $dates[
'date_start'];
91 $date_end = $dates[
'date_end'];
92 $pastmonthyear = $dates[
'pastmonthyear'];
93 $pastmonth = $dates[
'pastmonth'];
96 if (!
GETPOSTISSET(
'date_startmonth') && (empty($date_start) || empty($date_end))) {
101 $sql =
"SELECT er.rowid, er.ref, er.date_debut as de,";
102 $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, ";
103 $sql .=
" u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
104 $sql .=
" f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
105 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport_det as erd";
106 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_fees as f ON f.id = erd.fk_c_type_fees";
107 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
108 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"expensereport as er ON er.rowid = erd.fk_expensereport";
109 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = er.fk_user_author";
110 $sql .=
" WHERE er.fk_statut > 0";
111 $sql .=
" AND erd.fk_code_ventilation > 0";
112 $sql .=
" AND er.entity IN (".getEntity(
'expensereport', 0).
")";
113 if ($date_start && $date_end) {
114 $sql .=
" AND er.date_debut >= '".$db->idate($date_start).
"' AND er.date_debut <= '".$db->idate($date_end).
"'";
117 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
118 $sql .=
" AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING).
"'";
121 if ($in_bookkeeping ==
'already') {
122 $sql .=
" AND er.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
124 if ($in_bookkeeping ==
'notyet') {
125 $sql .=
" AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
127 $sql .=
" ORDER BY er.date_debut";
129 dol_syslog(
'accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
130 $result = $db->query($sql);
137 $tablocaltax1 = array();
138 $tablocaltax2 = array();
141 $num = $db->num_rows($result);
144 $account_salary = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT :
'NotDefined';
145 $account_vat = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT :
'NotDefined';
149 $obj = $db->fetch_object($result);
152 $compta_user = (!empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
153 $compta_fees = $obj->compte;
155 $vatdata =
getTaxesFromId($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), $mysoc, $mysoc, 0);
156 $compta_tva = (!empty($vatdata[
'accountancy_code_buy']) ? $vatdata[
'accountancy_code_buy'] : $account_vat);
157 $compta_localtax1 = (!empty($vatdata[
'accountancy_code_buy']) ? $vatdata[
'accountancy_code_buy'] : $cpttva);
158 $compta_localtax2 = (!empty($vatdata[
'accountancy_code_buy']) ? $vatdata[
'accountancy_code_buy'] : $cpttva);
161 if (
price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
162 $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.
')' :
''));
165 $taber[$obj->rowid][
"date"] = $db->jdate($obj->de);
166 $taber[$obj->rowid][
"ref"] = $obj->ref;
167 $taber[$obj->rowid][
"comments"] = $obj->comments;
168 $taber[$obj->rowid][
"fk_expensereportdet"] = $obj->erdid;
171 if (!isset($tabttc[$obj->rowid][$compta_user])) {
172 $tabttc[$obj->rowid][$compta_user] = 0;
174 if (!isset($tabht[$obj->rowid][$compta_fees])) {
175 $tabht[$obj->rowid][$compta_fees] = 0;
177 if (!isset($tabtva[$obj->rowid][$compta_tva])) {
178 $tabtva[$obj->rowid][$compta_tva] = 0;
180 if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) {
181 $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
183 if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) {
184 $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
187 $tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
188 $tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
189 $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
190 $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
191 $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
192 $tabuser[$obj->rowid] = array(
195 'user_accountancy_code' => $obj->user_accountancy_account
205 if ($action ==
'writebookkeeping') {
210 $accountingaccountexpense->fetch(
null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT,
true);
212 foreach ($taber as $key => $val) {
221 if (!$errorforline) {
222 foreach ($tabttc[$key] as $k => $mt) {
225 $bookkeeping->doc_date = $val[
"date"];
226 $bookkeeping->doc_ref = $val[
"ref"];
227 $bookkeeping->date_creation = $now;
228 $bookkeeping->doc_type =
'expense_report';
229 $bookkeeping->fk_doc = $key;
230 $bookkeeping->fk_docdet = $val[
"fk_expensereportdet"];
232 $bookkeeping->subledger_account = $tabuser[$key][
'user_accountancy_code'];
233 $bookkeeping->subledger_label = $tabuser[$key][
'name'];
235 $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
236 $bookkeeping->label_compte = $accountingaccountexpense->label;
238 $bookkeeping->label_operation = $tabuser[$key][
'name'];
239 $bookkeeping->montant = $mt;
240 $bookkeeping->sens = ($mt >= 0) ?
'C' :
'D';
241 $bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
242 $bookkeeping->credit = ($mt > 0) ? $mt : 0;
243 $bookkeeping->code_journal = $journal;
244 $bookkeeping->journal_label = $langs->transnoentities($journal_label);
245 $bookkeeping->fk_user_author = $user->id;
246 $bookkeeping->entity = $conf->entity;
248 $totaldebit += $bookkeeping->debit;
249 $totalcredit += $bookkeeping->credit;
251 $result = $bookkeeping->create($user);
253 if ($bookkeeping->error ==
'BookkeepingRecordAlreadyExists') {
268 if (!$errorforline) {
269 foreach ($tabht[$key] as $k => $mt) {
272 if ($accountingaccount->fetch(
null, $k,
true)) {
274 $bookkeeping->doc_date = $val[
"date"];
275 $bookkeeping->doc_ref = $val[
"ref"];
276 $bookkeeping->date_creation = $now;
277 $bookkeeping->doc_type =
'expense_report';
278 $bookkeeping->fk_doc = $key;
279 $bookkeeping->fk_docdet = $val[
"fk_expensereportdet"];
281 $bookkeeping->subledger_account =
'';
282 $bookkeeping->subledger_label =
'';
284 $bookkeeping->numero_compte = $k;
285 $bookkeeping->label_compte = $accountingaccount->label;
287 $bookkeeping->label_operation = $accountingaccount->label;
288 $bookkeeping->montant = $mt;
289 $bookkeeping->sens = ($mt < 0) ?
'C' :
'D';
290 $bookkeeping->debit = ($mt > 0) ? $mt : 0;
291 $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
292 $bookkeeping->code_journal = $journal;
293 $bookkeeping->journal_label = $langs->transnoentities($journal_label);
294 $bookkeeping->fk_user_author = $user->id;
295 $bookkeeping->entity = $conf->entity;
297 $totaldebit += $bookkeeping->debit;
298 $totalcredit += $bookkeeping->credit;
300 $result = $bookkeeping->create($user);
302 if ($bookkeeping->error ==
'BookkeepingRecordAlreadyExists') {
318 if (!$errorforline) {
319 $listoftax = array(0, 1, 2);
320 foreach ($listoftax as $numtax) {
321 $arrayofvat = $tabtva;
323 $arrayofvat = $tablocaltax1;
326 $arrayofvat = $tablocaltax2;
329 foreach ($arrayofvat[$key] as $k => $mt) {
331 $accountingaccount->fetch(
null, $k,
true);
332 $account_label = $accountingaccount->label;
336 $bookkeeping->doc_date = $val[
"date"];
337 $bookkeeping->doc_ref = $val[
"ref"];
338 $bookkeeping->date_creation = $now;
339 $bookkeeping->doc_type =
'expense_report';
340 $bookkeeping->fk_doc = $key;
341 $bookkeeping->fk_docdet = $val[
"fk_expensereportdet"];
343 $bookkeeping->subledger_account =
'';
344 $bookkeeping->subledger_label =
'';
346 $bookkeeping->numero_compte = $k;
347 $bookkeeping->label_compte = $account_label;
349 $bookkeeping->label_operation = $langs->trans(
"VAT").
' '.join(
', ', $def_tva[$key][$k]).
' %';
350 $bookkeeping->montant = $mt;
351 $bookkeeping->sens = ($mt < 0) ?
'C' :
'D';
352 $bookkeeping->debit = ($mt > 0) ? $mt : 0;
353 $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
354 $bookkeeping->code_journal = $journal;
355 $bookkeeping->journal_label = $langs->transnoentities($journal_label);
356 $bookkeeping->fk_user_author = $user->id;
357 $bookkeeping->entity = $conf->entity;
359 $totaldebit += $bookkeeping->debit;
360 $totalcredit += $bookkeeping->credit;
362 $result = $bookkeeping->create($user);
364 if ($bookkeeping->error ==
'BookkeepingRecordAlreadyExists') {
383 setEventMessages(
'Try to insert a non balanced transaction in book for '.$val[
"ref"].
'. Canceled. Surely a bug.',
null,
'errors');
386 if (!$errorforline) {
392 setEventMessages($langs->trans(
"ErrorTooManyErrorsProcessStopped"),
null,
'errors');
400 if (empty($error) && count($tabpay) > 0) {
402 } elseif (count($tabpay) == $error) {
405 setEventMessages($langs->trans(
"GeneralLedgerSomeRecordWasNotRecorded"),
null,
'warnings');
411 if (count($tabpay) != $error) {
412 $param =
'id_journal='.$id_journal;
413 $param .=
'&date_startday='.$date_startday;
414 $param .=
'&date_startmonth='.$date_startmonth;
415 $param .=
'&date_startyear='.$date_startyear;
416 $param .=
'&date_endday='.$date_endday;
417 $param .=
'&date_endmonth='.$date_endmonth;
418 $param .=
'&date_endyear='.$date_endyear;
419 $param .=
'&in_bookkeeping='.$in_bookkeeping;
421 header(
"Location: ".$_SERVER[
'PHP_SELF'].($param ?
'?'.$param :
''));
433 $userstatic =
new User($db);
436 if ($action ==
'exportcsv') {
437 $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
439 $filename =
'journal';
440 $type_export =
'journal';
441 include DOL_DOCUMENT_ROOT.
'/accountancy/tpl/export_journal.tpl.php';
444 print
'"'.$langs->transnoentitiesnoconv(
"Date").
'"'.$sep;
445 print
'"'.$langs->transnoentitiesnoconv(
"Piece").
'"'.$sep;
446 print
'"'.$langs->transnoentitiesnoconv(
"AccountAccounting").
'"'.$sep;
447 print
'"'.$langs->transnoentitiesnoconv(
"LabelOperation").
'"'.$sep;
448 print
'"'.$langs->transnoentitiesnoconv(
"Debit").
'"'.$sep;
449 print
'"'.$langs->transnoentitiesnoconv(
"Credit").
'"'.$sep;
452 foreach ($taber as $key => $val) {
455 $userstatic->id = $tabuser[$key][
'id'];
456 $userstatic->name = $tabuser[$key][
'name'];
459 foreach ($tabht[$key] as $k => $mt) {
461 $accountingaccount->fetch(
null, $k,
true);
463 print
'"'.$date.
'"'.$sep;
464 print
'"'.$val[
"ref"].
'"'.$sep;
465 print
'"'.length_accountg(html_entity_decode($k)).
'"'.$sep;
466 print
'"'.dol_trunc($accountingaccount->label, 32).
'"'.$sep;
467 print
'"'.($mt >= 0 ?
price($mt) :
'').
'"'.$sep;
468 print
'"'.($mt < 0 ?
price(-$mt) :
'').
'"';
473 foreach ($tabtva[$key] as $k => $mt) {
475 print
'"'.$date.
'"'.$sep;
476 print
'"'.$val[
"ref"].
'"'.$sep;
477 print
'"'.length_accountg(html_entity_decode($k)).
'"'.$sep;
478 print
'"'.dol_trunc($langs->trans(
"VAT")).
'"'.$sep;
479 print
'"'.($mt >= 0 ?
price($mt) :
'').
'"'.$sep;
480 print
'"'.($mt < 0 ?
price(-$mt) :
'').
'"';
486 foreach ($tabttc[$key] as $k => $mt) {
487 print
'"'.$date.
'"'.$sep;
488 print
'"'.$val[
"ref"].
'"'.$sep;
489 print
'"'.length_accounta(html_entity_decode($k)).
'"'.$sep;
490 print
'"'.dol_trunc($userstatic->name).
'"'.$sep;
491 print
'"'.($mt < 0 ?
price(-$mt) :
'').
'"'.$sep;
492 print
'"'.($mt >= 0 ?
price($mt) :
'').
'"';
498 if (empty($action) || $action ==
'view') {
499 llxHeader(
'', $langs->trans(
"ExpenseReportsJournal"));
501 $nom = $langs->trans(
"ExpenseReportsJournal").
' | '.$accountingjournalstatic->getNomUrl(0, 1, 1,
'', 1);
506 $description .= $langs->trans(
"DescJournalOnlyBindedVisible").
'<br>';
508 $listofchoices = array(
'notyet'=>$langs->trans(
"NotYetInGeneralLedger"),
'already'=>$langs->trans(
"AlreadyInGeneralLedger"));
509 $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);
510 $period .=
' - '.$langs->trans(
"JournalizationInLedgerStatus").
' '.
$form->selectarray(
'in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
512 $varlink =
'id_journal='.$id_journal;
514 journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array(
'action' =>
''),
'', $varlink);
517 if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT ==
'-1') {
518 print
'<br><div class="warning">'.img_warning().
' '.$langs->trans(
"SomeMandatoryStepsOfSetupWereNotDone");
519 $desc =
' : '.$langs->trans(
"AccountancyAreaDescMisc", 4,
'{link}');
520 $desc = str_replace(
'{link}',
'<strong>'.$langs->transnoentitiesnoconv(
"MenuAccountancy").
'-'.$langs->transnoentitiesnoconv(
"Setup").
"-".$langs->transnoentitiesnoconv(
"MenuDefaultAccounts").
'</strong>', $desc);
524 print
'<div class="tabsAction tabsActionNoBottom centerimp">';
526 if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping ==
'notyet') {
527 print
'<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans(
"ExportDraftJournal").
'" onclick="launch_export();" />';
529 if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT ==
'-1') {
530 print
'<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"SomeMandatoryStepsOfSetupWereNotDone")).
'" value="'.$langs->trans(
"WriteBookKeeping").
'" />';
532 if ($in_bookkeeping ==
'notyet') {
533 print
'<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans(
"WriteBookKeeping").
'" onclick="writebookkeeping();" />';
535 print
'<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans(
"WriteBookKeeping").
'</a>';
542 <script type="text/javascript">
543 function launch_export() {
544 $("div.fiche form input[name=\"action\"]").val("exportcsv");
545 $("div.fiche form input[type=\"submit\"]").click();
546 $("div.fiche form input[name=\"action\"]").val("");
548 function writebookkeeping() {
549 console.log("click on writebookkeeping");
550 $("div.fiche form input[name=\"action\"]").val("writebookkeeping");
551 $("div.fiche form input[type=\"submit\"]").click();
552 $("div.fiche form input[name=\"action\"]").val("");
562 print
'<div class="div-table-responsive">';
563 print
"<table class=\"noborder\" width=\"100%\">";
564 print
"<tr class=\"liste_titre\">";
565 print
"<td>".$langs->trans(
"Date").
"</td>";
566 print
"<td>".$langs->trans(
"Piece").
' ('.$langs->trans(
"ExpenseReportRef").
")</td>";
567 print
"<td>".$langs->trans(
"AccountAccounting").
"</td>";
568 print
"<td>".$langs->trans(
"SubledgerAccount").
"</td>";
569 print
"<td>".$langs->trans(
"LabelOperation").
"</td>";
570 print
'<td class="right">'.$langs->trans(
"Debit").
"</td>";
571 print
'<td class="right">'.$langs->trans(
"Credit").
"</td>";
579 foreach ($taber as $key => $val) {
580 $expensereportstatic->id = $key;
581 $expensereportstatic->ref = $val[
"ref"];
582 $expensereportlinestatic->comments = html_entity_decode(
dol_trunc($val[
"comments"], 32));
587 foreach ($tabht[$key] as $k => $mt) {
589 $accountingaccount->fetch(
null, $k,
true);
592 print
'<tr class="oddeven">';
593 print
"<!-- Fees -->";
594 print
"<td>".$date.
"</td>";
595 print
"<td>".$expensereportstatic->getNomUrl(1).
"</td>";
596 $userstatic->id = $tabuser[$key][
'id'];
597 $userstatic->name = $tabuser[$key][
'name'];
601 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined') {
602 print
'<span class="error">'.$langs->trans(
"FeeAccountNotDefined").
'</span>';
610 $userstatic->id = $tabuser[$key][
'id'];
611 $userstatic->name = $tabuser[$key][
'name'];
612 print
"<td>".$userstatic->getNomUrl(0,
'user', 16).
' - '.$accountingaccount->label.
"</td>";
613 print
'<td class="right nowraponall amount">'.($mt >= 0 ?
price($mt) :
'').
"</td>";
614 print
'<td class="right nowraponall amount">'.($mt < 0 ?
price(-$mt) :
'').
"</td>";
620 foreach ($tabttc[$key] as $k => $mt) {
621 $userstatic->id = $tabuser[$key][
'id'];
622 $userstatic->name = $tabuser[$key][
'name'];
624 print
'<tr class="oddeven">';
625 print
"<!-- Thirdparty -->";
626 print
"<td>".$date.
"</td>";
627 print
"<td>".$expensereportstatic->getNomUrl(1).
"</td>";
630 $accountoshow =
length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
631 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined') {
632 print
'<span class="error">'.$langs->trans(
"MainAccountForUsersNotDefined").
'</span>';
640 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined') {
641 print
'<span class="error">'.$langs->trans(
"UserAccountNotDefined").
'</span>';
646 print
"<td>".$userstatic->getNomUrl(0,
'user', 16).
' - '.$langs->trans(
"SubledgerAccount").
"</td>";
647 print
'<td class="right nowraponall amount">'.($mt < 0 ?
price(-$mt) :
'').
"</td>";
648 print
'<td class="right nowraponall amount">'.($mt >= 0 ?
price($mt) :
'').
"</td>";
653 $listoftax = array(0, 1, 2);
654 foreach ($listoftax as $numtax) {
655 $arrayofvat = $tabtva;
657 $arrayofvat = $tablocaltax1;
660 $arrayofvat = $tablocaltax2;
663 foreach ($arrayofvat[$key] as $k => $mt) {
665 print
'<tr class="oddeven">';
666 print
"<!-- VAT -->";
667 print
"<td>".$date.
"</td>";
668 print
"<td>".$expensereportstatic->getNomUrl(1).
"</td>";
672 if (($accountoshow ==
"") || $accountoshow ==
'NotDefined') {
673 print
'<span class="error">'.$langs->trans(
"VATAccountNotDefined").
'</span>';
681 print
"<td>".$userstatic->getNomUrl(0,
'user', 16).
' - '.$langs->trans(
"VAT").
' '.join(
', ', $def_tva[$key][$k]).
' %'.($numtax ?
' - Localtax '.$numtax :
'');
683 print
'<td class="right nowraponall amount">'.($mt >= 0 ?
price($mt) :
'').
"</td>";
684 print
'<td class="right nowraponall amount">'.($mt < 0 ?
price(-$mt) :
'').
"</td>";