diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 34a6b2d5ffd..9c7fef0232b 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -48,6 +48,14 @@ $search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
+$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
+$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
+$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
+$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
+$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
+$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
+$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
+$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@@ -128,6 +136,7 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
+ 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@@ -181,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
+ $search_date_export_start = '';
+ $search_date_export_end = '';
+ $search_date_export_startyear = '';
+ $search_date_export_startmonth = '';
+ $search_date_export_startday = '';
+ $search_date_export_endyear = '';
+ $search_date_export_endmonth = '';
+ $search_date_export_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@@ -253,6 +270,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
+ if (!empty($search_date_export_start)) {
+ $filter['t.date_export>='] = $search_date_export_start;
+ $param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
+ }
+ if (!empty($search_date_export_end)) {
+ $filter['t.date_export<='] = $search_date_export_end;
+ $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
+ }
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@@ -494,6 +519,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '
'.$langs->trans("NotReconciled").'';
print '';
}
+// Date export
+if (!empty($arrayfields['t.date_export']['checked'])) {
+ print '
';
+ print ' ';
+ print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print ' ';
+ print '';
+ print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print ' ';
+ print ' | ';
+}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -516,6 +552,7 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -546,13 +583,12 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber = 3;
- $colnumberend = 7;
- } else {
- $colnumber = 4;
- $colnumberend = 7;
- }
+ $colnumber = 5;
+ $colnumberend = 7;
+
+ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
+ if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
+
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
@@ -585,7 +621,7 @@ while ($i < min($num, $limit))
// Show the break account
print "";
- print '| ';
+ print ' | ';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print ''.$langs->trans("Unknown").'';
print ' | ';
@@ -735,6 +771,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
+ // Exported operation date
+ if (!empty($arrayfields['t.date_export']['checked']))
+ {
+ print ''.dol_print_date($line->date_export, 'dayhour').' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@@ -763,14 +806,6 @@ while ($i < min($num, $limit))
}
if ($num > 0) {
- // Show sub-total of last shown account
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber = 3;
- $colnumberend = 7;
- } else {
- $colnumber = 4;
- $colnumberend = 7;
- }
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print '
';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 3b03e6ae8ca..fe73ab9f376 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -795,7 +795,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
- $sql .= " t.montant,";
+ $sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
@@ -806,7 +806,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.date_export";
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@@ -823,6 +824,8 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
+ } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
+ $sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
@@ -878,7 +881,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
- $line->montant = $obj->montant;
+ $line->montant = $obj->amount; // deprecated
+ $line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
@@ -889,7 +893,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_export = $this->db->jdate($obj->date_export);
$this->lines[] = $line;
@@ -941,7 +946,7 @@ class BookKeeping extends CommonObject
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
- $sql .= " t.montant,";
+ $sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
@@ -1019,7 +1024,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
- $line->montant = $obj->montant;
+ $line->montant = $obj->amount; // deprecated
+ $line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering;