From 564594c3d70e2a53573a520c5beaee89f619bc13 Mon Sep 17 00:00:00 2001 From: Florian HENRY <florian.henry@open-concept.pro> Date: Tue, 2 Feb 2016 10:58:12 +0100 Subject: [PATCH] Fix accountancy --- htdocs/accountancy/journal/bankjournal.php | 16 +++++++++------- htdocs/accountancy/journal/purchasesjournal.php | 15 +++++++++------ htdocs/accountancy/journal/sellsjournal.php | 16 +++++++++------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 314d7abbcf3..831ea87c1dd 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -413,8 +413,9 @@ if ($action == 'export_csv') { $companystatic = new Client($db); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export -{ + // Model Cegid Expert Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) + { $sep = ";"; foreach ( $tabpay as $key => $val ) { @@ -473,9 +474,8 @@ if ($action == 'export_csv') { } } } - } - } else // Model Classic Export -{ + } else { + // Model Classic Export foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -576,10 +576,12 @@ if ($action == 'export_csv') { foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); - if ($val["lib"] == '(SupplierInvoicePayment)') + if ($val["lib"] == '(SupplierInvoicePayment)') { $reflabel = $langs->trans('SupplierInvoicePayment'); - if ($val["lib"] == '(CustomerInvoicePayment)') + } + if ($val["lib"] == '(CustomerInvoicePayment)') { $reflabel = $langs->trans('CustomerInvoicePayment'); + } // Bank foreach ( $tabbq[$key] as $k => $mt ) { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 8d1c2bad1a9..7381976538d 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -267,8 +267,9 @@ if ($action == 'export_csv') { include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export -{ + // Model Cegid Expert Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) + { $sep = ";"; foreach ( $tabfac as $key => $val ) { @@ -320,8 +321,8 @@ if ($action == 'export_csv') { print "\n"; } } - } else // Model Classic Export -{ + } else { + // Model Classic Export foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -380,10 +381,12 @@ if ($action == 'export_csv') { $exportlink = ''; $builddate = time(); $description = $langs->trans("DescPurchasesJournal") . '<br>'; - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); - else + } else { $description .= $langs->trans("DepositsAreIncluded"); + } + $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array ( 'action' => '' diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index af77d3e0c06..4678a677597 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -287,14 +287,15 @@ if ($action == 'writebookkeeping') { // Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; - $journal = $conf->global->ACCOUNTING_SELL_JOURNAL; + $sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; $companystatic = new Client($db); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export -{ + // Model Cegid Expert Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) + { $sep = ";"; foreach ( $tabfac as $key => $val ) { @@ -318,14 +319,15 @@ if ($action == 'export_csv') { // Product / Service foreach ( $tabht[$key] as $k => $mt ) { - if ($mt) { + $accountingaccount_static = new AccountingAccount($db); + if ($accountingaccount_static->fetch(null, $k)) { print $date . $sep; print $sell_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print dol_trunc($val["description"], 32) . $sep; + print dol_trunc($accountingaccount_static->label, 32) . $sep; print $val["ref"]; print "\n"; } @@ -346,8 +348,8 @@ if ($action == 'export_csv') { } } } - } else // Model Classic Export -{ + } else { + // Model Classic Export foreach ( $tabfac as $key => $val ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; -- GitLab