diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 0a4db2f84e4..965c3dea5ac 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -124,7 +124,7 @@ if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !
$arrayfields=array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
- 't.doc_ref'=>array('label'=>$langs->trans("Docref"), 'checked'=>1),
+ 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@@ -576,17 +576,17 @@ print '';
print "\n";
print '
';
-if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
-if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
-if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
-if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
-if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
-if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
-if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
-if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
-if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
-if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
-if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
+if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
+if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
+if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
+if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
+if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
+if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
+if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
+if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
+if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
+if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
+if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "
\n";
@@ -677,14 +677,14 @@ if ($num > 0)
// Creation operation date
if (! empty($arrayfields['t.date_creation']['checked']))
{
- print '' . dol_print_date($line->date_creation, 'day') . ' | ';
+ print '' . dol_print_date($line->date_creation, 'dayhour') . ' | ';
if (! $i) $totalarray['nbfield']++;
}
// Modification operation date
if (! empty($arrayfields['t.tms']['checked']))
{
- print '' . dol_print_date($line->date_modification, 'day') . ' | ';
+ print '' . dol_print_date($line->date_modification, 'dayhour') . ' | ';
if (! $i) $totalarray['nbfield']++;
}
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 4aba5bb0591..b59258f6cd7 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -781,7 +781,8 @@ class BookKeeping extends CommonObject
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
- $sql .= " t.date_creation";
+ $sql .= " t.date_creation,";
+ $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter
$sqlwhere = array ();
@@ -849,7 +850,8 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
- $line->date_creation = $obj->date_creation;
+ $line->date_creation = $this->db->jdate($obj->date_creation);
+ $line->date_modification = $this->db->jdate($obj->date_modification);
$this->lines[] = $line;
}
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index b9b079067b8..248b9177d85 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -303,6 +303,7 @@ if ($result) {
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
+ $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
@@ -423,7 +424,14 @@ if (! $error && $action == 'writebookkeeping') {
// Line into bank account
foreach ( $tabbq[$key] as $k => $mt )
{
- if ($mt) {
+ if ($mt)
+ {
+ $reflabel = $langs->trans("Bank");
+ $reflabel.= ' '.$val['bank_account_ref'];
+ if (! empty($val['soclib'])) {
+ $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
+ }
+
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $ref;
@@ -491,108 +499,151 @@ if (! $error && $action == 'writebookkeeping') {
}
// Third party
- if (! $errorforline && is_array($tabtp[$key]))
+ if (! $errorforline)
{
- // Line into thirdparty account
- foreach ( $tabtp[$key] as $k => $mt ) {
- if ($mt) {
- $bookkeeping = new BookKeeping($db);
- $bookkeeping->doc_date = $val["date"];
- $bookkeeping->doc_ref = $ref;
- $bookkeeping->doc_type = 'bank';
- $bookkeeping->fk_doc = $key;
- $bookkeeping->fk_docdet = $val["fk_bank"];
- $bookkeeping->montant = $mt;
- $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
- $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
- $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
- $bookkeeping->code_journal = $journal;
- $bookkeeping->journal_label = $journal_label;
- $bookkeeping->fk_user_author = $user->id;
- $bookkeeping->date_create = $now;
+ if (is_array($tabtp[$key]))
+ {
+ // Line into thirdparty account
+ foreach ( $tabtp[$key] as $k => $mt ) {
+ if ($mt)
+ {
+ $reflabel = dol_string_nohtmltag($val['soclib']);
- if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
- $bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
- $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
- $bookkeeping->subledger_label = $tabcompany[$key]['name'];
- $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
- $bookkeeping->label_compte = '';
- } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
- $bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
- $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
- $bookkeeping->subledger_label = $tabcompany[$key]['name'];
- $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
- $bookkeeping->label_compte = '';
- } else if ($tabtype[$key] == 'payment_expensereport') {
- $bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
- $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
- $bookkeeping->subledger_label = $tabuser[$key]['name'];
- $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
- $bookkeeping->label_compte = '';
- } else if ($tabtype[$key] == 'payment_salary') {
- $bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
- $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
- $bookkeeping->subledger_label = $tabuser[$key]['name'];
- $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
- $bookkeeping->label_compte = '';
- } else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
- $bookkeeping->label_operation = $ref;
- $bookkeeping->subledger_account = '';
- $bookkeeping->subledger_label = '';
- $bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = $objmid->labelc;
- } else if ($tabtype[$key] == 'payment_vat') {
- $bookkeeping->label_operation = $ref;
- $bookkeeping->subledger_account = '';
- $bookkeeping->subledger_label = '';
- $bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = '';
- } else if ($tabtype[$key] == 'payment_donation') {
- $bookkeeping->label_operation = $ref;
- $bookkeeping->subledger_account = '';
- $bookkeeping->subledger_label = '';
- $bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = '';
- } else if ($tabtype[$key] == 'payment_various') {
- $bookkeeping->label_operation = $ref;
- $bookkeeping->subledger_account = '';
- $bookkeeping->subledger_label = '';
- $bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = '';
- } else if ($tabtype[$key] == 'banktransfert') {
- $bookkeeping->label_operation = $ref;
- $bookkeeping->subledger_account = '';
- $bookkeeping->subledger_label = '';
- $bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = '';
- } else {
- if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
- {
- // Temporary account
- $bookkeeping->label_operation = '';
+ $bookkeeping = new BookKeeping($db);
+ $bookkeeping->doc_date = $val["date"];
+ $bookkeeping->doc_ref = $ref;
+ $bookkeeping->doc_type = 'bank';
+ $bookkeeping->fk_doc = $key;
+ $bookkeeping->fk_docdet = $val["fk_bank"];
+ $bookkeeping->montant = $mt;
+ $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
+ $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
+ $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
+ $bookkeeping->code_journal = $journal;
+ $bookkeeping->journal_label = $journal_label;
+ $bookkeeping->fk_user_author = $user->id;
+ $bookkeeping->date_create = $now;
+
+ if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
+ $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
+ $bookkeeping->subledger_label = $tabcompany[$key]['name'];
+ $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
+ $bookkeeping->label_compte = '';
+ } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
+ $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
+ $bookkeeping->subledger_label = $tabcompany[$key]['name'];
+ $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
+ $bookkeeping->label_compte = '';
+ } else if ($tabtype[$key] == 'payment_expensereport') {
+ $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
+ $bookkeeping->subledger_label = $tabuser[$key]['name'];
+ $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
+ $bookkeeping->label_compte = '';
+ } else if ($tabtype[$key] == 'payment_salary') {
+ $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
+ $bookkeeping->subledger_label = $tabuser[$key]['name'];
+ $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
+ $bookkeeping->label_compte = '';
+ } else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
- $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
+ $bookkeeping->numero_compte = $k;
+ $bookkeeping->label_compte = $objmid->labelc;
+ } else if ($tabtype[$key] == 'payment_vat') {
+ $bookkeeping->subledger_account = '';
+ $bookkeeping->subledger_label = '';
+ $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
+ } else if ($tabtype[$key] == 'payment_donation') {
+ $bookkeeping->subledger_account = '';
+ $bookkeeping->subledger_label = '';
+ $bookkeeping->numero_compte = $k;
+ $bookkeeping->label_compte = '';
+ } else if ($tabtype[$key] == 'payment_various') {
+ $bookkeeping->subledger_account = '';
+ $bookkeeping->subledger_label = '';
+ $bookkeeping->numero_compte = $k;
+ $bookkeeping->label_compte = '';
+ } else if ($tabtype[$key] == 'banktransfert') {
+ $bookkeeping->subledger_account = '';
+ $bookkeeping->subledger_label = '';
+ $bookkeeping->numero_compte = $k;
+ $bookkeeping->label_compte = '';
+ } else {
+ if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
+ {
+ // Temporary account
+ $bookkeeping->subledger_account = '';
+ $bookkeeping->subledger_label = '';
+ $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
+ $bookkeeping->label_compte = '';
+ }
+ }
+
+ $bookkeeping->label_operation = $reflabel;
+
+ $totaldebit += $bookkeeping->debit;
+ $totalcredit += $bookkeeping->credit;
+
+ $result = $bookkeeping->create($user);
+ if ($result < 0) {
+ if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
+ {
+ $error++;
+ $errorforline++;
+ setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
+ }
+ else
+ {
+ $error++;
+ $errorforline++;
+ setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
+ }
}
}
+ }
+ }
+ else { // If thirdparty unkown, output the waiting account
+ foreach ( $tabbq[$key] as $k => $mt ) {
+ if ($mt)
+ {
+ $reflabel = 'WaitingAccount';
- $totaldebit += $bookkeeping->debit;
- $totalcredit += $bookkeeping->credit;
+ $bookkeeping = new BookKeeping($db);
+ $bookkeeping->doc_date = $val["date"];
+ $bookkeeping->doc_ref = $ref;
+ $bookkeeping->doc_type = 'bank';
+ $bookkeeping->fk_doc = $key;
+ $bookkeeping->fk_docdet = $val["fk_bank"];
+ $bookkeeping->montant = $mt;
+ $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
+ $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
+ $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
+ $bookkeeping->code_journal = $journal;
+ $bookkeeping->journal_label = $journal_label;
+ $bookkeeping->fk_user_author = $user->id;
+ $bookkeeping->date_create = $now;
+ $bookkeeping->label_compte = '';
- $result = $bookkeeping->create($user);
- if ($result < 0) {
- if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
- {
- $error++;
- $errorforline++;
- setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
- }
- else
- {
- $error++;
- $errorforline++;
- setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
+ $bookkeeping->label_operation = $reflabel;
+
+ $totaldebit += $bookkeeping->debit;
+ $totalcredit += $bookkeeping->credit;
+
+ $result = $bookkeeping->create($user);
+ if ($result < 0) {
+ if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
+ {
+ $error++;
+ $errorforline++;
+ setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
+ }
+ else
+ {
+ $error++;
+ $errorforline++;
+ setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
+ }
}
}
}
@@ -665,12 +716,28 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$companystatic = new Client($db);
$userstatic = new User($db);
+//var_dump($langs);exit;
+
+ // CSV header line
+ print '"' . $langs->trans("BankId").'"' . $sep;
+ print '"' . $langs->trans("Date") . '"' . $sep;
+ print '"' . $langs->trans("PaymentMode") . '"' . $sep;
+ print '"' . $langs->trans("AccountAccounting") . '"' . $sep;
+ print '"' . $langs->trans("GeneralAccount") . '"' . $sep;
+ print '"' . $langs->trans("SubledgerAccount") . '"' . $sep;
+ print '"' . $langs->trans("Label"). '"' . $sep;
+ print '"' . $langs->trans("Amount") . '"' . $sep;
+ print '"' . $langs->trans("Amount") . '"' . $sep;
+ print '"' . $langs->trans("Journal") . '"' . $sep;
+ print "\n";
+
+
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]);
- //
+ // Third party (company or user)
if (! empty($tabcompany[$key]['id']))
{
$companystatic->id = $tabcompany[$key]['id'];
@@ -696,67 +763,76 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
- print '"' . $key . '"' . $sep;
- print '"' . $date . '"' . $sep;
- print '"' . $val["type_payment"] . '"' . $sep;
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print " " . $sep;
- if ($companystatic->name == '') {
- print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
- } else {
- print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
+ if ($mt)
+ {
+ $reflabel = $langs->trans("Bank");
+ $reflabel.= ' '.$val['bank_account_ref'];
+ if (! empty($val['soclib'])) {
+ $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
+ }
+
+ print '"' . $key . '"' . $sep;
+ print '"' . $date . '"' . $sep;
+ print '"' . $val["type_payment"] . '"' . $sep;
+ print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
+ print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
+ print " " . $sep;
+ print '"' . $reflabel . '"' . $sep;
+ print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
+ print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
+ print '"' . $journal . '"' . $sep;
+ print "\n";
}
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
- print '"' . $journal . '"' . $sep;
- print "\n";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
- if ($mt) {
+ if ($mt)
+ {
+ $reflabel = dol_string_nohtmltag($val['soclib']);
+
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($tabtype[$key] == 'payment_supplier') {
- print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
+ print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} else if($tabtype[$key] == 'payment') {
- print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
+ print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
+ } else if($tabtype[$key] == 'payment_expensereport') {
+ print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
+ } else if($tabtype[$key] == 'payment_salary') {
+ print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
} else {
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
+ print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
}
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
- if ($companystatic->name == '') {
- print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
- } else {
- print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
- }
+ print '"' . $reflabel . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print "\n";
}
}
- } else {
+ } else { // If thirdparty unkown, output the waiting account
foreach ( $tabbq[$key] as $k => $mt ) {
- print '"' . $key . '"' . $sep;
- print '"' . $date . '"' . $sep;
- print '"' . $val["type_payment"] . '"' . $sep;
- print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
- print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
- print " " . $sep;
- if ($companystatic->name == '') {
- print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
- } else {
- print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
+ if ($mt)
+ {
+ $reflabel = 'WaitingAccount';
+
+ print '"' . $key . '"' . $sep;
+ print '"' . $date . '"' . $sep;
+ print '"' . $val["type_payment"] . '"' . $sep;
+ print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
+ print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
+ print "" . $sep;
+ print '"' . $reflabel . '"' . $sep;
+ print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
+ print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
+ print '"' . $journal . '"' . $sep;
+ print "\n";
}
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . $journal . '"' . $sep;
- print "\n";
}
}
}
@@ -862,7 +938,8 @@ if (empty($action) || $action == 'view') {
$r = '';
- foreach ( $tabpay as $key => $val ) { // $key is rowid in llx_bank
+ foreach ( $tabpay as $key => $val ) // $key is rowid in llx_bank
+ {
$date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]);
@@ -870,48 +947,55 @@ if (empty($action) || $action == 'view') {
// Bank
foreach ( $tabbq[$key] as $k => $mt )
{
- //var_dump($tabpay[$key]);
- print '';
- print '';
- print " | ";
- print "" . $date . " | ";
- print "" . $ref . " | ";
- // Ledger account
- print "";
- $accounttoshow = length_accountg($k);
- if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
+ if ($mt)
{
- print ''.$langs->trans("BankAccountNotDefined").'';
+ $reflabel = $langs->trans("Bank");
+ $reflabel.= ' '.$val['bank_account_ref'];
+ if (! empty($val['soclib'])) {
+ $reflabel .= " - " . $val['soclib'];
+ }
+
+ //var_dump($tabpay[$key]);
+ print '';
+ print ' |
';
+ print " | ";
+ print "" . $date . " | ";
+ print "" . $ref . " | ";
+ // Ledger account
+ print "";
+ $accounttoshow = length_accountg($k);
+ if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
+ {
+ print ''.$langs->trans("BankAccountNotDefined").'';
+ }
+ else print $accounttoshow;
+ print " | ";
+ // Subledger account
+ print "";
+ /*$accounttoshow = length_accountg($k);
+ if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
+ {
+ print ''.$langs->trans("BankAccountNotDefined").'';
+ }
+ else print $accounttoshow;*/
+ print " | ";
+ print "";
+ print $reflabel;
+ print " | ";
+ print "" . $val["type_payment"] . " | ";
+ print "" . ($mt >= 0 ? price($mt) : '') . " | ";
+ print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
+ print "
";
}
- else print $accounttoshow;
- print "";
- // Subledger account
- print "";
- /*$accounttoshow = length_accountg($k);
- if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
- {
- print ''.$langs->trans("BankAccountNotDefined").'';
- }
- else print $accounttoshow;*/
- print " | ";
- print "";
- //var_dump($tabpay[$key]);
- print $langs->trans("Bank");
- print ' '.$val['bank_account_ref'];
- if (! empty($val['soclib'])) {
- print " - " . $val['soclib'];
- }
- print " | ";
- print "" . $val["type_payment"] . " | ";
- print "" . ($mt >= 0 ? price($mt) : '') . " | ";
- print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
- print "";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
- if ($k != 'type') {
+ if ($mt)
+ {
+ $reflabel = $val['soclib'];
+
print '';
print '';
print " | ";
@@ -974,42 +1058,47 @@ if (empty($action) || $action == 'view') {
}
}
print "";
- print "" . $reflabel . ' ' . $val['soclib'] . " | ";
+ print "" . $reflabel . " | ";
print "" . $val["type_payment"] . " | ";
print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
print "" . ($mt >= 0 ? price($mt) : '') . " | ";
print "
";
}
}
- } else {
+ } else { // Waiting account
foreach ( $tabbq[$key] as $k => $mt ) {
- print '';
- print '';
- print " | ";
- print "" . $date . " | ";
- print "" . $ref . " | ";
- // Ledger account
- print "";
- /*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
+ if ($mt)
{
- print ''.$langs->trans("WaitAccountNotDefined").'';
+ $reflabel = 'WaitingAccount';
+
+ print '';
+ print ' |
';
+ print " | ";
+ print "" . $date . " | ";
+ print "" . $ref . " | ";
+ // Ledger account
+ print "";
+ /*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
+ {
+ print ''.$langs->trans("WaitAccountNotDefined").'';
+ }
+ else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
+ print " | ";
+ // Subledger account
+ print "";
+ /*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
+ {
+ print ''.$langs->trans("WaitAccountNotDefined").'';
+ }
+ else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
+ */
+ print " | ";
+ print "" . $reflabel . " | ";
+ print "" . $val["type_payment"] . " | ";
+ print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
+ print "" . ($mt >= 0 ? price($mt) : '') . " | ";
+ print "
";
}
- else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
- print "";
- // Subledger account
- print "";
- /*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
- {
- print ''.$langs->trans("WaitAccountNotDefined").'';
- }
- else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
- */
- print " | ";
- print "" . $reflabel . " | ";
- print "" . $val["type_payment"] . " | ";
- print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
- print "" . ($mt >= 0 ? price($mt) : '') . " | ";
- print "";
}
}
}
@@ -1089,6 +1178,13 @@ function getSourceDocRef($val, $typerecord)
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
$ref = $langs->trans("SalaryPayment");
}
+ elseif ($typerecord == 'sc')
+ {
+ $sqlmid = 'SELECT sc.rowid as ref';
+ $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
+ $sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
+ $ref = $langs->trans("SocialContribution");
+ }
elseif ($typerecord == 'payment_vat')
{
$sqlmid = 'SELECT v.rowid as ref';
diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php
index 85603de2ae5..f5a3624939d 100644
--- a/htdocs/admin/salaries.php
+++ b/htdocs/admin/salaries.php
@@ -39,8 +39,7 @@ $action = GETPOST('action', 'alpha');
// Other parameters SALARIES_*
$list = array (
- 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
- 'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
+ 'SALARIES_XXX',
);
/*
@@ -97,7 +96,7 @@ print "\n";
foreach ($list as $key)
{
-
+
print '';
diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php
index e037b35728e..aecb9eeb49f 100644
--- a/htdocs/core/modules/modSalaries.class.php
+++ b/htdocs/core/modules/modSalaries.class.php
@@ -67,7 +67,8 @@ class modSalaries extends DolibarrModules
$this->dirs = array("/salaries/temp");
// Config pages
- $this->config_page_url = array('salaries.php');
+ //$this->config_page_url = array('salaries.php');
+ $this->config_page_url = array();
// Dependencies
$this->depends = array();
diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang
index 2a3372ed847..f1db7ea1cf3 100644
--- a/htdocs/langs/en_US/salaries.lang
+++ b/htdocs/langs/en_US/salaries.lang
@@ -1,7 +1,7 @@
# Dolibarr language file - Source file is en_US - salaries
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accouting account on user is not defined.
-SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for personnel expenses
+SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments
Salary=Salary
Salaries=Salaries
NewSalaryPayment=New salary payment