Merge pull request #2314 from aspangaro/3.7-Accountancy

FIXED Accountancy clean code
This commit is contained in:
Laurent Destailleur 2015-02-03 13:11:16 +01:00
commit 7ac35593e1
8 changed files with 119 additions and 108 deletions

View File

@ -42,7 +42,7 @@ if (!$user->admin)
$action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_*
// Other parameters ACCOUNTING_EXPORT_*
$list = array (
'ACCOUNTING_EXPORT_SEPARATORCSV',
'ACCOUNTING_EXPORT_DATE',
@ -114,20 +114,24 @@ print '</tr>';
$var = ! $var;
print '<tr ' . $bc[$var] . '>';
print "<td>" . $langs->trans("Selectmodelcsv") . "</td>";
print "<td>";
print '<select class="flat" name="modelcsv" id="modelcsv">';
print '<option value="0"';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 0) {
print ' selected="selected"';
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
if (! $conf->use_javascript_ajax)
{
print '<td class="nowrap">';
print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>";
}
print '>' . $langs->trans("Modelcsv_normal") . '</option>';
print '<option value="1"';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
print ' selected="selected"';
else
{
print '<td>';
$listmodelcsv=array(
'1'=>$langs->trans("Modelcsv_normal"),
'2'=>$langs->trans("Modelcsv_CEGID")
);
print $form->selectarray("modelcsv",$listmodelcsv,$conf->global->ACCOUNTING_EXPORT_MODELCSV,0);
print '</td>';
}
print '>' . $langs->trans("Modelcsv_CEGID") . '</option>';
print "</select>";
print "</td></tr>";
print "</table>";
@ -143,6 +147,7 @@ if ($num) {
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
print "</tr>\n";
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
}
foreach ( $list as $key ) {
@ -152,7 +157,7 @@ foreach ( $list as $key ) {
// Param
$label = $langs->trans($key);
print '<td>' . $label . '</td>';
print '<td width="50%">' . $label . '</td>';
// Value
print '<td>';
@ -163,7 +168,7 @@ foreach ( $list as $key ) {
print '</form>';
print "</table>\n";
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
print '<br /><div align="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
llxFooter();
$db->close();

View File

@ -75,7 +75,7 @@ if ($action == 'delbookkeeping') {
setEventMessage($object->errors, 'errors');
}
}
} // export csv
} // Export
else if ($action == 'export_csv') {
header('Content-Type: text/csv');
@ -160,7 +160,7 @@ else {
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="export_csv">';
print '<input type="submit" class="button" style="float: right;" value="Export CSV" />';
print '<input type="submit" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '</form>';
print '<table class="noborder" width="100%">';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
*
@ -99,10 +99,10 @@ $idpays = $p[0];
$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,";
$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe soc on bu1.url_id=soc.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
// To isolate the cash of the other accounts
$sql .= " WHERE ba.courant <> 2";
$sql .= " AND ba.rowid=".$id_accountancy_journal;
@ -169,10 +169,12 @@ if ($result) {
}
$links = $object->get_url($obj->rowid);
foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment')
{
$paymentstatic->id = $links[$key]['url_id'];
@ -401,18 +403,21 @@ if ($action == 'writeBookKeeping')
setEventMessage($langs->trans('Success'), 'mesgs');
}
}
// export csv
// Export
if ($action == 'export_csv')
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$bank_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_banque.csv');
$companystatic = new Client($db);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{
$sep = ";";
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
@ -420,23 +425,23 @@ if ($action == 'export_csv')
$companystatic->name = $tabcompany[$key]['name'];
// Bank
print $date . $sep;
print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep;
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $bank_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $sep;
print $val["ref"] . $sep;
print "\n";
}
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep;
print $bank_journal . $sep;
if ($val["lib"] == '(SupplierInvoicePayment)') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
} else {
@ -446,12 +451,12 @@ if ($action == 'export_csv')
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $sep;
print $val["ref"] . $sep;
print "\n";
}
}
}
} else // Modèle Export Classique
} else // Model Classic Export
{
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
@ -459,24 +464,22 @@ if ($action == 'export_csv')
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Bank") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $companystatic->name . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
@ -503,7 +506,7 @@ else
$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($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
@ -586,5 +589,4 @@ else
// End of page
llxFooter();
}
$db->close();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
*
@ -91,10 +91,10 @@ $idpays = $p[0];
$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,";
$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe soc on bu1.url_id=soc.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
// Code opération type caisse
$sql .= " WHERE ba.courant = 2";
@ -365,67 +365,69 @@ if ($action == 'writeBookKeeping') {
setEventMessage($langs->trans('Success'), 'mesgs');
}
}
// export csv
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$cash_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition:attachment;filename=journal_caisse.csv');
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{
$sep = ";";
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Cash
print $date . $sep;
print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep;
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $cash_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print price($mt) . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
}
print utf8_decode($langs->trans("CashPayment")) . $sep;
print $val["ref"] . $sep;
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep;
if ($obj->label == '(SupplierInvoicePayment)') {
print $cash_journal . $sep;
if ($val["lib"] == '(SupplierInvoicePayment)') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
} else {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
}
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print price($mt) . $sep;
print $langs->trans("ThirdParty") . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
}
}
}
} else // Modèle Export Classique
} else // Model Classic Export
{
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
// Cash
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Cash") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
@ -455,7 +457,7 @@ if ($action == 'export_csv') {
$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($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';

View File

@ -242,16 +242,19 @@ if ($action == 'writebookkeeping') {
$companystatic = new Societe($db);
// export csv
// Export
if ($action == 'export_csv')
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_achats.csv');
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
@ -263,7 +266,7 @@ if ($action == 'export_csv')
if ($mt) {
print $date . $sep;
print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
@ -275,11 +278,10 @@ if ($action == 'export_csv')
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
@ -289,20 +291,20 @@ if ($action == 'export_csv')
print "\n";
}
}
print $date . $sep;
print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
print "\n";
}
} else // Modèle Export Classique
} else // Model Classic Export
{
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
@ -326,7 +328,6 @@ if ($action == 'export_csv')
}
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
@ -340,9 +341,9 @@ if ($action == 'export_csv')
}
// Third party
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
@ -370,7 +371,7 @@ if ($action == 'export_csv')
$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' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -434,7 +435,6 @@ if ($action == 'export_csv')
}
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print "<tr " . $bc[$var] . " >";
@ -449,13 +449,11 @@ if ($action == 'export_csv')
print "<tr " . $bc[$var] . ">";
// Third party
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
foreach ( $tabttc[$key] as $k => $mt ) {
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . length_accounta($k);
print "</td><td>" . $langs->trans("ThirdParty");
print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
*
@ -93,7 +93,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_produc
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity = " . $conf->entity;
@ -245,17 +245,20 @@ if ($action == 'writebookkeeping') {
}
}
}
// export csv
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_ventes.csv');
$companystatic = new Client($db);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
@ -263,23 +266,23 @@ if ($action == 'export_csv') {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
print $date . $sep;
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
print $val["ref"];
print "\n";
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
@ -289,11 +292,12 @@ if ($action == 'export_csv') {
print "\n";
}
}
// TVA
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
@ -304,7 +308,7 @@ if ($action == 'export_csv') {
}
}
}
} else // Modèle Export Classique
} else // Model Classic Export
{
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
@ -312,15 +316,16 @@ if ($action == 'export_csv') {
$companystatic->client = $tabcompany[$key]['code_client'];
$date = dol_print_date($db->jdate($val["date"]), 'day');
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
print "\n";
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
@ -339,7 +344,6 @@ if ($action == 'export_csv') {
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
@ -372,7 +376,7 @@ if ($action == 'export_csv') {
$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' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -420,12 +424,11 @@ if ($action == 'export_csv') {
$date = dol_print_date($db->jdate($val["date"]), 'day');
print "<tr " . $bc[$var] . ">";
// Third party
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
foreach ( $tabttc[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
@ -455,7 +458,6 @@ if ($action == 'export_csv') {
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print "<tr " . $bc[$var] . ">";
@ -473,8 +475,8 @@ if ($action == 'export_csv') {
}
print "</table>";
// End of page
llxFooter();
}
// End of page
llxFooter();
$db->close();

View File

@ -129,7 +129,7 @@ class modAccounting extends DolibarrModules
$this->const[9] = array(
"ACCOUNTING_EXPORT_MODELCSV",
"chaine",
"0"
"1"
);
$this->const[10] = array(
"ACCOUNTING_LENGTH_GACCOUNT",

View File

@ -13,7 +13,9 @@ ConfigAccountingExpert=Configuration of the module accounting expert
Journaux=Journals
JournalFinancial=Financial journals
Exports=Exports
Export=Export
Modelcsv=Model of export
OptionsDeactivatedForThisExportModel=For this export model, options are deactivated
Selectmodelcsv=Select a model of export
Modelcsv_normal=Classic export
Modelcsv_CEGID=Export towards CEGID Expert
@ -66,7 +68,7 @@ Lineofinvoice=Line of invoice
VentilatedinAccount=Ventilated successfully in the accounting account
NotVentilatedinAccount=Not ventilated in the accounting account
ACCOUNTING_SEPARATORCSV=Separator CSV
ACCOUNTING_SEPARATORCSV=Column separator in export file
ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to be breakdown shown by page (maximum recommended : 50)
ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the breakdown pages "Has to breakdown" by the most recent elements