Fix : label_operation on general ledger

This commit is contained in:
Alexandre SPANGARO 2017-10-03 05:27:08 +02:00
parent 0e15aef44f
commit 0acb391b36
2 changed files with 86 additions and 81 deletions

View File

@ -399,7 +399,7 @@ print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('From').' '; print $langs->trans('From').' ';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database. // use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{ {
@ -412,7 +412,7 @@ else
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to').' '; print $langs->trans('to').' ';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database. // use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{ {
@ -489,8 +489,8 @@ while ($i < min($num, $limit))
} }
print '<tr class="liste_total">'; print '<tr class="liste_total">';
if ($num < $limit) print '<td align="left" colspan="6">'.$langs->trans("Total").'</td>'; if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>';
else print '<td align="left" colspan="6">'.$langs->trans("Totalforthispage").'</td>'; else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print price($total_debit); print price($total_debit);

View File

@ -422,7 +422,6 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_operation = $val["label"];
$bookkeeping->label_compte = $langs->trans("Bank"); $bookkeeping->label_compte = $langs->trans("Bank");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
@ -433,21 +432,28 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;
// No subledger_account value for the bank line // No subledger_account value for the bank line but add a specific label_operation
if ($tabtype[$key] == 'payment') { if ($tabtype[$key] == 'payment') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_supplier') { } else if ($tabtype[$key] == 'payment_supplier') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_expensereport') { } else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_salary') { } else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_vat') { } else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $ref;
} else if ($tabtype[$key] == 'payment_donation') { } else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $ref;
} else if ($tabtype[$key] == 'payment_various') { } else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $ref;
} else if ($tabtype[$key] == 'unknown') { } else if ($tabtype[$key] == 'unknown') {
// ??? // ???
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
@ -484,7 +490,6 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->doc_type = 'bank'; $bookkeeping->doc_type = 'bank';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_operation = $tabcompany[$key]['name'];
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
@ -495,55 +500,55 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_expensereport') { } else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_salary') { } else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution } else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $objmid->labelc; $bookkeeping->label_compte = $objmid->labelc;
} else if ($tabtype[$key] == 'payment_vat') { } else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_donation') { } else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_various') { } else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'banktransfert') { } else if ($tabtype[$key] == 'banktransfert') {
$bookkeeping->label_operation = ''; $bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
@ -676,9 +681,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print " " . $sep; print " " . $sep;
if ($companystatic->name == '') { if ($companystatic->name == '') {
print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep; print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
} else { } else {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
} }
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
@ -720,9 +725,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print " " . $sep; print " " . $sep;
if ($companystatic->name == '') { if ($companystatic->name == '') {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep; print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
} else { } else {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
} }
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';