Fix: date of modificaiton in ledger not visible.

Fix: show hours in date of creation in ledger.
Fix: label in export.
Fix: label in export of draft journal is same than on screen.
Fix: missing line desc in csv export of draft bank journal.
This commit is contained in:
Laurent Destailleur 2018-02-02 14:27:07 +01:00
parent 4ea4419cd6
commit a41847d084
6 changed files with 315 additions and 217 deletions

View File

@ -124,7 +124,7 @@ if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !
$arrayfields=array( $arrayfields=array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), '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.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@ -576,17 +576,17 @@ print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
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.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("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $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("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $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("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $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("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $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("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $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("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $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("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $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("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $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("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $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("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $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_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -677,14 +677,14 @@ if ($num > 0)
// Creation operation date // Creation operation date
if (! empty($arrayfields['t.date_creation']['checked'])) if (! empty($arrayfields['t.date_creation']['checked']))
{ {
print '<td align="center">' . dol_print_date($line->date_creation, 'day') . '</td>'; print '<td align="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Modification operation date // Modification operation date
if (! empty($arrayfields['t.tms']['checked'])) if (! empty($arrayfields['t.tms']['checked']))
{ {
print '<td align="center">' . dol_print_date($line->date_modification, 'day') . '</td>'; print '<td align="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -781,7 +781,8 @@ class BookKeeping extends CommonObject
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,"; $sql .= " t.journal_label,";
$sql .= " t.piece_num,"; $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'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
@ -849,7 +850,8 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label; $line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $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; $this->lines[] = $line;
} }

View File

@ -303,6 +303,7 @@ if ($result) {
} }
$chargestatic->ref = $chargestatic->lib; $chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
$sqlmid = 'SELECT cchgsoc.accountancy_code'; $sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
@ -423,7 +424,14 @@ if (! $error && $action == 'writebookkeeping') {
// Line into bank account // Line into bank account
foreach ( $tabbq[$key] as $k => $mt ) 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 = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $ref; $bookkeeping->doc_ref = $ref;
@ -491,108 +499,151 @@ if (! $error && $action == 'writebookkeeping') {
} }
// Third party // Third party
if (! $errorforline && is_array($tabtp[$key])) if (! $errorforline)
{ {
// Line into thirdparty account if (is_array($tabtp[$key]))
foreach ( $tabtp[$key] as $k => $mt ) { {
if ($mt) { // Line into thirdparty account
$bookkeeping = new BookKeeping($db); foreach ( $tabtp[$key] as $k => $mt ) {
$bookkeeping->doc_date = $val["date"]; if ($mt)
$bookkeeping->doc_ref = $ref; {
$bookkeeping->doc_type = 'bank'; $reflabel = dol_string_nohtmltag($val['soclib']);
$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 = new BookKeeping($db);
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref; $bookkeeping->doc_date = $val["date"];
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->doc_ref = $ref;
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->doc_type = 'bank';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->fk_doc = $key;
$bookkeeping->label_compte = ''; $bookkeeping->fk_docdet = $val["fk_bank"];
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $bookkeeping->montant = $mt;
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->code_journal = $journal;
$bookkeeping->label_compte = ''; $bookkeeping->journal_label = $journal_label;
} else if ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->fk_user_author = $user->id;
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref; $bookkeeping->date_create = $now;
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name']; if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->label_compte = ''; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
} else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref; $bookkeeping->label_compte = '';
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->label_compte = ''; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution $bookkeeping->label_compte = '';
$bookkeeping->label_operation = $ref; } else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = $objmid->labelc; $bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_vat') { } else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->label_operation = $ref; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->numero_compte = $k; $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 ($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->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $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 = ''; $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; $bookkeeping = new BookKeeping($db);
$totalcredit += $bookkeeping->credit; $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); $bookkeeping->label_operation = $reflabel;
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists $totaldebit += $bookkeeping->debit;
{ $totalcredit += $bookkeeping->credit;
$error++;
$errorforline++; $result = $bookkeeping->create($user);
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); if ($result < 0) {
} if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
else {
{ $error++;
$error++; $errorforline++;
$errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); }
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
} }
} }
} }
@ -665,12 +716,28 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$companystatic = new Client($db); $companystatic = new Client($db);
$userstatic = new User($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 ) { foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]); $ref = getSourceDocRef($val, $tabtype[$key]);
// // Third party (company or user)
if (! empty($tabcompany[$key]['id'])) if (! empty($tabcompany[$key]['id']))
{ {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
@ -696,67 +763,76 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $key . '"' . $sep; if ($mt)
print '"' . $date . '"' . $sep; {
print '"' . $val["type_payment"] . '"' . $sep; $reflabel = $langs->trans("Bank");
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; $reflabel.= ' '.$val['bank_account_ref'];
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; if (! empty($val['soclib'])) {
print " " . $sep; $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
if ($companystatic->name == '') { }
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
} else { print '"' . $key . '"' . $sep;
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $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 // Third party
if (is_array($tabtp[$key])) { if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) { foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) { if ($mt)
{
$reflabel = dol_string_nohtmltag($val['soclib']);
print '"' . $key . '"' . $sep; print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($tabtype[$key] == 'payment_supplier') { if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} else if($tabtype[$key] == 'payment') { } 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 { } 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; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') { print '"' . $reflabel . '"' . $sep;
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
} else {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep; print '"' . $journal . '"' . $sep;
print "\n"; print "\n";
} }
} }
} else { } else { // If thirdparty unkown, output the waiting account
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $key . '"' . $sep; if ($mt)
print '"' . $date . '"' . $sep; {
print '"' . $val["type_payment"] . '"' . $sep; $reflabel = 'WaitingAccount';
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"' . $key . '"' . $sep;
print " " . $sep; print '"' . $date . '"' . $sep;
if ($companystatic->name == '') { print '"' . $val["type_payment"] . '"' . $sep;
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep; print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
} else { print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $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 = ''; $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'); $date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]); $ref = getSourceDocRef($val, $tabtype[$key]);
@ -870,48 +947,55 @@ if (empty($action) || $action == 'view') {
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) foreach ( $tabbq[$key] as $k => $mt )
{ {
//var_dump($tabpay[$key]); if ($mt)
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>'; $reflabel = $langs->trans("Bank");
$reflabel.= ' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) {
$reflabel .= " - " . $val['soclib'];
}
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
/*$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;*/
print "</td>";
print "<td>";
print $reflabel;
print "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
} }
else print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
/*$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;*/
print "</td>";
print "<td>";
//var_dump($tabpay[$key]);
print $langs->trans("Bank");
print ' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) {
print " - " . $val['soclib'];
}
print "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
} }
// Third party // Third party
if (is_array($tabtp[$key])) { if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) { foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') { if ($mt)
{
$reflabel = $val['soclib'];
print '<!-- Thirdparty bank.rowid='.$key.' -->'; print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td></td>"; print "<td></td>";
@ -974,42 +1058,47 @@ if (empty($action) || $action == 'view') {
} }
} }
print "</td>"; print "</td>";
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>"; print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>"; print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";
} }
} }
} else { } else { // Waiting account
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print '<!-- Wait bank.rowid='.$key.' -->'; if ($mt)
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>'; $reflabel = 'WaitingAccount';
print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
print "</td>";
// Subledger account
print "<td>";
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
} }
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
print "</td>";
// Subledger account
print "<td>";
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
} }
} }
} }
@ -1089,6 +1178,13 @@ function getSourceDocRef($val, $typerecord)
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"]; $sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
$ref = $langs->trans("SalaryPayment"); $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') elseif ($typerecord == 'payment_vat')
{ {
$sqlmid = 'SELECT v.rowid as ref'; $sqlmid = 'SELECT v.rowid as ref';

View File

@ -39,8 +39,7 @@ $action = GETPOST('action', 'alpha');
// Other parameters SALARIES_* // Other parameters SALARIES_*
$list = array ( $list = array (
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'SALARIES_XXX',
'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
); );
/* /*

View File

@ -67,7 +67,8 @@ class modSalaries extends DolibarrModules
$this->dirs = array("/salaries/temp"); $this->dirs = array("/salaries/temp");
// Config pages // Config pages
$this->config_page_url = array('salaries.php'); //$this->config_page_url = array('salaries.php');
$this->config_page_url = array();
// Dependencies // Dependencies
$this->depends = array(); $this->depends = array();

View File

@ -1,7 +1,7 @@
# Dolibarr language file - Source file is en_US - salaries # Dolibarr language file - Source file is en_US - salaries
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties 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_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 Salary=Salary
Salaries=Salaries Salaries=Salaries
NewSalaryPayment=New salary payment NewSalaryPayment=New salary payment