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,11 +499,16 @@ if (! $error && $action == 'writebookkeeping') {
} }
// Third party // Third party
if (! $errorforline && is_array($tabtp[$key])) if (! $errorforline)
{
if (is_array($tabtp[$key]))
{ {
// Line into thirdparty account // Line into thirdparty account
foreach ( $tabtp[$key] as $k => $mt ) { foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) { if ($mt)
{
$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;
@ -512,55 +525,46 @@ 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 = $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 = $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'] . ' - ' . $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'] . ' - ' . $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 = $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 = $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 = $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 = $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 = $ref;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
@ -569,7 +573,6 @@ if (! $error && $action == 'writebookkeeping') {
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty. if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
{ {
// Temporary account // 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 = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
@ -577,6 +580,8 @@ if (! $error && $action == 'writebookkeeping') {
} }
} }
$bookkeeping->label_operation = $reflabel;
$totaldebit += $bookkeeping->debit; $totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit; $totalcredit += $bookkeeping->credit;
@ -598,6 +603,52 @@ if (! $error && $action == 'writebookkeeping') {
} }
} }
} }
else { // If thirdparty unkown, output the waiting account
foreach ( $tabbq[$key] as $k => $mt ) {
if ($mt)
{
$reflabel = 'WaitingAccount';
$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 = '';
$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');
}
}
}
}
}
}
if ($totaldebit != $totalcredit) if ($totaldebit != $totalcredit)
{ {
@ -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,27 +763,35 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
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 '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print " " . $sep; print " " . $sep;
if ($companystatic->name == '') { print '"' . $reflabel . '"' . $sep;
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
} else {
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) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep; print '"' . $journal . '"' . $sep;
print "\n"; 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;
@ -725,34 +800,34 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
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 ) {
if ($mt)
{
$reflabel = 'WaitingAccount';
print '"' . $key . '"' . $sep; print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $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 '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print " " . $sep; print "" . $sep;
if ($companystatic->name == '') { print '"' . $reflabel . '"' . $sep;
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
} else {
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) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep; print '"' . $journal . '"' . $sep;
@ -760,6 +835,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
} }
} }
} }
}
} }
@ -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,6 +947,14 @@ if (empty($action) || $action == 'view') {
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) foreach ( $tabbq[$key] as $k => $mt )
{ {
if ($mt)
{
$reflabel = $langs->trans("Bank");
$reflabel.= ' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) {
$reflabel .= " - " . $val['soclib'];
}
//var_dump($tabpay[$key]); //var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->'; print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -895,23 +980,22 @@ if (empty($action) || $action == 'view') {
else print $accounttoshow;*/ else print $accounttoshow;*/
print "</td>"; print "</td>";
print "<td>"; print "<td>";
//var_dump($tabpay[$key]); print $reflabel;
print $langs->trans("Bank");
print ' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) {
print " - " . $val['soclib'];
}
print "</td>"; print "</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>";
} }
}
// 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,15 +1058,19 @@ 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 ) {
if ($mt)
{
$reflabel = 'WaitingAccount';
print '<!-- Wait bank.rowid='.$key.' -->'; print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td></td>"; print "<td></td>";
@ -1013,6 +1101,7 @@ if (empty($action) || $action == 'view') {
} }
} }
} }
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';
@ -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