re enable export for expensereportsjournal

This commit is contained in:
Eric 2019-01-20 15:25:53 +01:00
parent df5aa33022
commit 88efc830fe

View File

@ -7,6 +7,7 @@
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -425,115 +426,68 @@ $form = new Form($db);
$userstatic = new User($db); $userstatic = new User($db);
// Export // Export
/*if ($action == 'exportcsv') { // ISO and not UTF8 ! if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'journal'; $filename = 'journal';
$type_export = 'journal'; $type_export = 'journal';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
// Model Cegid Expert Export // CSV header line
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { print '"' . $langs->trans("Date") . '"' . $sep;
$sep = ";"; print '"' . html_entity_decode($langs->trans("Piece")) . '"' . $sep;
print '"' . html_entity_decode($langs->trans("AccountAccounting")) . '"' . $sep;
// print '"' . html_entity_decode($langs->trans("SubledgerAccount")) . '"' . $sep;
print '"' . html_entity_decode($langs->trans("LabelOperation")) . '"' . $sep;
print '"' . html_entity_decode($langs->trans("Debit")) . '"' . $sep;
print '"' . html_entity_decode($langs->trans("Credit")) . '"' . $sep;
print "\n";
foreach ( $taber as $key => $val ) { foreach ( $taber as $key => $val ) {
$date = dol_print_date($val["date"], '%d%m%Y'); $date = dol_print_date($val["date"], 'day');
// Fees $userstatic->id = $tabuser[$key]['id'];
foreach ( $tabht[$key] as $k => $mt ) { $userstatic->name = $tabuser[$key]['name'];
$userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name']; // Fees
$userstatic->client = $tabuser[$key]['code_client']; foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
if ($mt) { $accountingaccount->fetch(null, $k, true);
print $date . $sep; if ($mt) {
print $journal . $sep; print '"' . $date . '"' . $sep;
print length_accountg(html_entity_decode($k)) . $sep; print '"' . $val["ref"] . '"' . $sep;
print $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep; print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print dol_trunc($val["comments"], 32) . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print $val["ref"]; print "\n";
print "\n"; }
} }
} // VAT
foreach ( $tabtva[$key] as $k => $mt ) {
// VAT if ($mt) {
foreach ( $tabtva[$key] as $k => $mt ) { print '"' . $date . '"' . $sep;
if ($mt) { print '"' . $val["ref"] . '"' . $sep;
print $date . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print $journal . $sep; print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
print length_accountg(html_entity_decode($k)) . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print ($mt < 0 ? 'C' : 'D') . $sep; print "\n";
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; }
print $langs->trans("VAT") . $sep; }
print $val["ref"];
print "\n"; // Third party
} foreach ( $tabttc[$key] as $k => $mt ) {
} print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
foreach ( $tabttc[$key] as $k => $mt ) { print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print $date . $sep; print '"' . dol_trunc($userstatic->name) . '"' . $sep;
print $journal . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print length_accounta(html_entity_decode($k)) . $sep; }
print ($mt < 0 ? 'D' : 'C') . $sep; print "\n";
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $userstatic->name . $sep;
print $val["ref"];
print "\n";
}
}
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $taber as $key => $val ) {
$date = dol_print_date($val["date"], 'day');
$userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name'];
// Fees
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($userstatic->name) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
}
print "\n";
}
} }
} }
*/
if (empty($action) || $action == 'view') { if (empty($action) || $action == 'view') {
@ -560,6 +514,7 @@ if (empty($action) || $action == 'view') {
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
} }
@ -567,7 +522,6 @@ if (empty($action) || $action == 'view') {
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>'; else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
} }
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
print '</div>'; print '</div>';
// TODO Avoid using js. We can use a direct link with $param // TODO Avoid using js. We can use a direct link with $param