From 7a719c6be6fe5c85d8296e60ad6ccdd6db3f9010 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 29 Oct 2017 05:37:50 +0100 Subject: [PATCH 1/2] NEW General ledger : Add field and selected field --- htdocs/accountancy/bookkeeping/list.php | 220 ++++++++++++------ .../accountancy/class/bookkeeping.class.php | 20 +- 2 files changed, 167 insertions(+), 73 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 30db29db927..ca98431a16e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,8 @@ $search_doc_ref = GETPOST("search_doc_ref"); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); +$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int')); +$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int')); if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { $action = 'delbookkeepingyear'; @@ -102,15 +104,28 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); } - +$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.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), + 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), + 't.crebit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), + 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), + 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), +); /* - * Action + * Actions */ if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_mvt_num = ''; @@ -128,6 +143,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_ledger_code = ''; $search_date_start = ''; $search_date_end = ''; + $search_date_creation_start = ''; + $search_date_creation_end = ''; } // Must be after the remove filter action, before the export. @@ -196,6 +213,16 @@ if (! empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; $param .= '&search_mvt_num=' . $search_mvt_num; } +if (! empty($search_date_creation_start)) { + $filter['t.date_creation>='] = $search_date_creation_start; + $tmp=dol_getdate($search_date_creation_start); + $param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year']; +} +if (! empty($search_date_creation_end)) { + $filter['t.date_creation<='] = $search_date_creation_end; + $tmp=dol_getdate($search_date_end); + $param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year']; +} if ($action == 'delbookkeeping') { @@ -370,85 +397,138 @@ print '
'; -print ''; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +print '
'; +print '
'; + +// Filters lines print ''; -print ''; -print ''; -print ''; -print ''; -print ''; + print ''; } -print ''; -print '
'; -print $langs->trans('to').' '; -// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not -// use setup of keypress to select thirdparty and this hang browser on large database. -if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) +// Ref document +if (! empty($arrayfields['t.doc_ref']['checked'])) { - print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); + print '
'; } -else +// Accountancy account +if (! empty($arrayfields['t.numero_compte']['checked'])) { - print ''; + print ''; +} +// Subledger account +if (! empty($arrayfields['t.subledger_account']['checked'])) +{ + print ''; +} +// Label operation +if (! empty($arrayfields['t.label_operation']['checked'])) +{ + print ''; +} +// Debit +if (! empty($arrayfields['t.debit']['checked'])) +{ + print ''; +} +// Credit +if (! empty($arrayfields['t.credit']['checked'])) +{ + print ''; +} +// Code journal +if (! empty($arrayfields['t.code_journal']['checked'])) +{ + print ''; +} +// Date creation +if (! empty($arrayfields['t.date_creation']['checked'])) +{ + print '
'; + print $langs->trans('From') . ' '; + print $form->select_date($search_date_creation_start, 'date_creation_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->select_date($search_date_creation_end, 'date_creation_end', 0, 0, 1); + print '
'; + print ''; } -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; print ''; -print ''; +print "\n"; print ''; -print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); -$checkpicto=''; -if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); -print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); +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); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -478,6 +558,10 @@ while ($i < min($num, $limit)) $result = $accountingjournal->fetch('',$line->code_journal); $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal); print ''; + if (! empty($arrayfields['t.date_creation']['checked'])) + { + print ''; + } print ''; if (! empty($arrayfields['t.piece_num']['checked'])) { print ''; - print ''; } +// Action column print '\n"; -$total_debit = 0; -$total_credit = 0; - -$i=0; -while ($i < min($num, $limit)) +if ($num > 0) { - $line = $object->lines[$i]; - - $total_debit += $line->debit; - $total_credit += $line->credit; - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('',$line->code_journal); - $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal); - print ''; - if (! empty($arrayfields['t.date_creation']['checked'])) + $i=0; + $totalarray=array(); + while ($i < min($num, $limit)) { - print ''; + $line = $object->lines[$i]; + + $total_debit += $line->debit; + $total_credit += $line->credit; + + print ''; + + // Piece number + if (! empty($arrayfields['t.piece_num']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Document date + if (! empty($arrayfields['t.doc_date']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Document ref + if (! empty($arrayfields['t.doc_ref']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Account number + if (! empty($arrayfields['t.numero_compte']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Subledger account + if (! empty($arrayfields['t.subledger_account']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Label operation + if (! empty($arrayfields['t.label_operation']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Amount debit + if (! empty($arrayfields['t.debit']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; + $totalarray['totaldebit'] += $line->debit; + } + + // Amount credit + if (! empty($arrayfields['t.credit']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; + $totalarray['totalcredit'] += $line->credit; + } + + // Journal code + if (! empty($arrayfields['t.code_journal']['checked'])) + { + $accountingjournal = new AccountingJournal($db); + $result = $accountingjournal->fetch('',$line->code_journal); + $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal); + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Creation operation date + if (! empty($arrayfields['t.date_creation']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print "\n"; + + $i++; } - print ''; - print "\n"; + // Show total line + if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield'])) + { + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit && empty($offset)) print ''; + else print ''; + } + elseif ($totalarray['totaldebitfield'] == $i) print ''; + elseif ($totalarray['totalcreditfield'] == $i) print ''; + else print ''; + } + print ''; - $i++; + } } -print ''; -if ($num < $limit) print ''; -else print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - print "
'; -print '
'; -print $langs->trans('From') . ' '; -print $form->select_date($search_date_start, 'date_start', 0, 0, 1); -print '
'; -print '
'; -print $langs->trans('to') . ' '; -print $form->select_date($search_date_end, 'date_end', 0, 0, 1); -print '
'; -print '
'; -print '
'; -print $langs->trans('From').' '; -print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200'); -print '
'; -print '
'; -print $langs->trans('to').' '; -print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200'); -print '
'; -print '
'; -print '
'; -print $langs->trans('From').' '; -// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not -// use setup of keypress to select thirdparty and this hang browser on large database. -if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) +// Movement number +if (! empty($arrayfields['t.piece_num']['checked'])) { - print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); + print '
'; } -else +// Date document +if (! empty($arrayfields['t.doc_date']['checked'])) { - print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->select_date($search_date_start, 'date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->select_date($search_date_end, 'date_end', 0, 0, 1); + print '
'; + print '
'; + print '
'; + print $langs->trans('From').' '; + print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200'); + print '
'; + print '
'; + print $langs->trans('to').' '; + print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200'); + print '
'; + print '
'; + print '
'; + print $langs->trans('From').' '; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not + // use setup of keypress to select thirdparty and this hang browser on large database. + if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) + { + print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); + } + else + { + print ''; + } + print '
'; + print '
'; + print $langs->trans('to').' '; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not + // use setup of keypress to select thirdparty and this hang browser on large database. + if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) + { + print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); + } + else + { + print ''; + } + print '
'; + print '
'; + print ''; + print '  '; -print ''; -print '  '; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
' . $journaltoshow . '' . dol_print_date($line->date_creation, 'day') . ''; print '' . img_edit() . ' '; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 2b03f86d2e9..cf35a3d8fff 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -564,7 +564,8 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.journal_label,"; - $sql .= " t.piece_num"; + $sql .= " t.piece_num,"; + $sql .= " t.date_creation"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t'; $sql .= ' WHERE 1 = 1'; $sql .= " AND entity IN (" . getEntity('accountancy') . ")"; @@ -603,6 +604,7 @@ class BookKeeping extends CommonObject $this->code_journal = $obj->code_journal; $this->journal_label = $obj->journal_label; $this->piece_num = $obj->piece_num; + $this->date_creation = $this->db->jdate($obj->date_creation); } $this->db->free($resql); @@ -658,7 +660,8 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.journal_label,"; - $sql .= " t.piece_num"; + $sql .= " t.piece_num,"; + $sql .= " t.date_creation"; // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -725,6 +728,7 @@ 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; $this->lines[] = $line; } @@ -777,7 +781,8 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.journal_label,"; - $sql .= " t.piece_num"; + $sql .= " t.piece_num,"; + $sql .= " t.date_creation"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; // Manage filter $sqlwhere = array (); @@ -841,6 +846,7 @@ 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; $this->lines[] = $line; } @@ -1336,6 +1342,7 @@ class BookKeeping extends CommonObject $this->code_journal = 'VT'; $this->journal_label = 'Journal de vente'; $this->piece_num = ''; + $this->date_creation = $now; } /** @@ -1348,7 +1355,7 @@ class BookKeeping extends CommonObject public function fetchPerMvt($piecenum, $mode='') { global $conf; - $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type"; + $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode; $sql .= " WHERE piece_num = " . $piecenum; $sql .= " AND entity IN (" . getEntity('accountancy') . ")"; @@ -1364,6 +1371,7 @@ class BookKeeping extends CommonObject $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_ref = $obj->doc_ref; $this->doc_type = $obj->doc_type; + $this->date_creation = $obj->date_creation; } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); @@ -1414,7 +1422,7 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num"; + $sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode; $sql .= " WHERE piece_num = " . $piecenum; $sql .= " AND entity IN (" . getEntity('accountancy') . ")"; @@ -1447,6 +1455,7 @@ 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; $this->linesmvt[] = $line; } @@ -1785,4 +1794,5 @@ class BookKeepingLine public $code_journal; public $journal_label; public $piece_num; + public $date_creation; } From f9e801b4a755847908a6de4451e314315d484191 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 1 Nov 2017 08:42:17 +0100 Subject: [PATCH 2/2] Update works --- htdocs/accountancy/bookkeeping/list.php | 168 +++++++++++++----- .../accountancy/class/bookkeeping.class.php | 4 + 2 files changed, 124 insertions(+), 48 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ca98431a16e..c3dd606adb2 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -112,7 +112,7 @@ $arrayfields=array( 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), - 't.crebit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), + 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), ); @@ -410,11 +410,11 @@ print '
'; } // Date document if (! empty($arrayfields['t.doc_date']['checked'])) { + print ''; print '
'; print $langs->trans('From') . ' '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); @@ -501,6 +501,7 @@ if (! empty($arrayfields['t.code_journal']['checked'])) // Date creation if (! empty($arrayfields['t.date_creation']['checked'])) { + print '
'; print '
'; print $langs->trans('From') . ' '; print $form->select_date($search_date_creation_start, 'date_creation_start', 0, 0, 1); @@ -511,6 +512,7 @@ if (! empty($arrayfields['t.date_creation']['checked'])) print '
'; print '
'; $searchpicto=$form->showFilterButtons(); print $searchpicto; @@ -532,59 +534,129 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="c print "
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->subledger_account) . '' . $line->label_operation . '' . ($line->debit ? price($line->debit) : ''). '' . ($line->credit ? price($line->credit) : '') . '' . $journaltoshow . '' . dol_print_date($line->date_creation, 'day') . '
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->subledger_account) . '' . $line->label_operation . '' . ($line->debit ? price($line->debit) : ''). '' . ($line->credit ? price($line->credit) : '') . '' . $journaltoshow . '' . dol_print_date($line->date_creation, 'day') . ''; + print '' . img_edit() . ' '; + print '' . img_delete() . ''; + print '
'; - print '' . img_edit() . ' '; - print '' . img_delete() . ''; - print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totaldebit']).''.price($totalarray['totalcredit']).'
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''; -print price($total_debit); -print ''; -print price($total_credit); -print '
"; print '
'; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index cf35a3d8fff..2f5e1a6bbd7 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -678,6 +678,8 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; } elseif ($key == 't.label_operation') { $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; + } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { + $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; } else { $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; } @@ -798,6 +800,8 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key . '=' . $value; } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; + } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { + $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; } else { $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; }