';
diff --git a/html/style-color.css b/html/style-color.css
index e71e7a755..6b0f27356 100644
--- a/html/style-color.css
+++ b/html/style-color.css
@@ -974,4 +974,35 @@ div#jrn_name_div
{
font-size:6px;
border:groove 1px #00ff00;
+}
+div#wait_box
+{
+ background-color:#F1E6E6;
+ font-size:10;
+ font-family:helvetica,arial,sans-serif;
+ padding:0;
+ margin:0;
+ overflow:hidden;
+ z-index:10;
+
+position:absolute;
+left:30%;
+top:30%;
+
+
+border:1px solid darkblue;
+
+}
+#wait_box h2
+{
+color:black;
+text-align:center;
+}
+div#div_jrnsearch_op{
+
+ border:1px solid black;
+ display:none;
+ width:50em;
+ background-color:#EDF3FF;
+
}
\ No newline at end of file
diff --git a/html/style-light.css b/html/style-light.css
index 49350e2aa..26417bb68 100644
--- a/html/style-light.css
+++ b/html/style-light.css
@@ -1013,3 +1013,34 @@ div#jrn_name_div
margin:1px;
}
+div#wait_box
+{
+ background-color:#F1E6E6;
+ font-size:10;
+ font-family:helvetica,arial,sans-serif;
+ padding:0;
+ margin:0;
+ overflow:hidden;
+ z-index:10;
+
+position:absolute;
+left:30%;
+top:30%;
+
+
+border:1px solid darkblue;
+
+}
+#wait_box h2
+{
+color:black;
+text-align:center;
+}
+div#div_jrnsearch_op{
+
+ border:1px solid black;
+ display:none;
+ width:50em;
+ background-color:#EDF3FF;
+
+}
\ No newline at end of file
diff --git a/html/style.css b/html/style.css
index ec76be0ef..47f9c411e 100644
--- a/html/style.css
+++ b/html/style.css
@@ -1004,4 +1004,35 @@ div#jrn_name_div
font-size:6px;
border:groove 1px #000000;
margin:1px;
+}
+div#wait_box
+{
+ background-color:#F1E6E6;
+ font-size:10;
+ font-family:helvetica,arial,sans-serif;
+ padding:0;
+ margin:0;
+ overflow:hidden;
+ z-index:10;
+
+position:absolute;
+left:30%;
+top:30%;
+
+
+border:1px solid darkblue;
+
+}
+#wait_box h2
+{
+color:black;
+text-align:center;
+}
+div#div_jrnsearch_op{
+
+ border:1px solid black;
+ display:none;
+ width:50em;
+ background-color:#EDF3FF;
+
}
\ No newline at end of file
diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php
index 0f1f31f95..37f19be21 100644
--- a/include/class_acc_ledger.php
+++ b/include/class_acc_ledger.php
@@ -41,7 +41,7 @@ require_once ('class_acc_account.php');
require_once('ac_common.php');
require_once('class_inum.php');
require_once('class_lettering.php');
-
+require_once 'class_sort_table.php';
/*!\file
* \brief Class for jrn, class acc_ledger for manipulating the ledger
*/
@@ -556,7 +556,178 @@ class Acc_Ledger
$pj_seq=$this->get_last_pj()+1;
return $pj_pref.$pj_seq;
}
+/*!\brief Show all the operation
+ *\param $sql is the sql stmt, normally created by build_search_sql
+ *\param $offset the offset
+ *\param $p_paid if we want to see info about payment
+ \code
+ // Example
+ // Build the sql
+ list($sql,$where)=$Ledger->build_search_sql($_GET);
+ // Count nb of line
+ $max_line=$cn->count_sql($sql);
+ $step=$_SESSION['g_pagesize'];
+ $page=(isset($_GET['offset']))?$_GET['page']:1;
+ $offset=(isset($_GET['offset']))?$_GET['offset']:0;
+ // create the nav. bar
+ $bar=jrn_navigation_bar($offset,$max_line,$step,$page);
+ // show a part
+ list($count,$html)= $Ledger->list_operation($sql,$offset,0);
+ echo $html;
+ // show nav bar
+ echo $bar;
+
+ \endcode
+ *\see build_search_sql
+ *\see display_search_form
+ *\see search_form
+
+ *\return HTML string
+ */
+ public function list_operation_to_reconcile($sql)
+ {
+ $user=new User($this->db);
+ $gDossier=dossier::id();
+ $limit=" LIMIT 25";
+ // Sort
+ $own=new Own($this->db);
+
+ // Count
+ $count=$this->db->count_sql($sql);
+ // Add the limit
+ $sql.=$limit;
+
+ // Execute SQL stmt
+ $Res=$this->db->exec_sql($sql);
+
+ //starting from here we can refactor, so that instead of returning the generated HTML,
+ //this function returns a tree structure.
+
+ $r="";
+
+
+ $Max=Database::num_row($Res);
+
+ if ($Max==0) return array(0,_("Aucun enregistrement trouvé"));
+
+ $r.='
';
+ return array ($count,$r);
+ }
/*!\brief Show all the operation
*\param $sql is the sql stmt, normally created by build_search_sql
*\param $offset the offset
@@ -588,6 +759,7 @@ class Acc_Ledger
*/
public function list_operation($sql,$offset,$p_paid=0)
{
+ $table=new Sort_Table();
$user=new User($this->db);
$gDossier=dossier::id();
$amount_paid=0.0;
@@ -596,87 +768,24 @@ class Acc_Ledger
$offset=($_SESSION['g_pagesize']!=-1)?" OFFSET ".Database::escape_string($offset):"";
$order=" order by jr_date_order asc,jr_internal asc";
// Sort
- $url=CleanUrl();
+ $url="?".CleanUrl();
$str_dossier=dossier::get();
- $image_asc='
';
- $image_desc='';
- $image_sel_desc='';
- $image_sel_asc='';
-
- $sort_date=" $image_asc"._('Date')."$image_desc | ";
- $sort_description=" $image_asc"._('Description')."$image_desc | ";
- $sort_amount=" $image_asc"._('Montant')." $image_desc | ";
- $sort_pj=" $image_asc"._('PJ')."$image_desc | ";
- $sort_echeance=" $image_asc"._('Ech')." $image_desc | ";
+ $table->add("Date",$url, 'order by jr_date asc,substring(jr_pj_number,\'\\\d+$\')::numeric asc',
+ 'order by jr_date desc,substring(jr_pj_number,\'\\\d+$\')::numeric desc', "da", "dd");
+ $table->add('Echeance',$url," order by jr_ech asc"," order by jr_ech desc",'ea','ed');
+ $table->add('PJ',$url,' order by substring(jr_pj_number,\'\\\d+$\')::numeric asc ',
+ ' order by substring(jr_pj_number,\'\\\d+$\')::numeric desc ' ,
+ "pja","pjd");
+ $table->add('Montant',$url," order by jr_montant asc"," order by jr_montant desc",
+ "ma","md");
+ $table->add("Description",$url,"order by jr_comment asc",
+ "order by jr_comment desc","ca","cd");
$own=new Own($this->db);
- // if an order is asked
- if ( isset ($_GET['o']) )
- {
- switch ($_GET['o'])
- {
- case 'pja':
- // pj asc
- $sort_pj="$image_sel_asc PJ $image_desc | ";
- $order=' order by substring(jr_pj_number,\'\\\d+$\')::numeric asc ';
- break;
- case 'pjd':
- $sort_pj=" $image_asc PJ $image_sel_desc | ";
- // pj desc
- $order=' order by substring(jr_pj_number,\'\\\d+$\')::numeric desc ';
- break;
+ $ord= ( ! isset ($_GET['ord']))?'da':$_GET['ord'];
+ $order=$table->get_sql_order($ord);
- case 'da':
- // date asc
- $sort_date="$image_sel_asc Date $image_desc | ";
- $order=' order by jr_date_order asc,substring(jr_pj_number,\'\\\d+$\')::numeric asc ';
- break;
- case 'dd':
- $sort_date=" $image_asc Date $image_sel_desc | ";
- // date desc
- $order=' order by jr_date_order desc,substring(jr_pj_number,\'\\\d+$\')::numeric desc ';
- break;
- case 'ma':
- // montant asc
- $sort_amount=" $image_sel_asc Montant $image_desc | ";
- $order=" order by jr_montant asc ";
- break;
- case 'md':
- // montant desc
- $sort_amount=" $image_ascMontant $image_sel_desc | ";
- $order=" order by jr_montant desc ";
- break;
- case 'ca':
- // jr_comment asc
- $sort_description=" $image_sel_asc Description $image_desc | ";
- $order=" order by jr_comment asc ";
- break;
- case 'cd':
- // jr_comment desc
- $sort_description=" $image_ascDescription $image_sel_desc | ";
- $order=" order by jr_comment desc ";
- break;
- case 'ea':
- // jr_comment asc
- $sort_echeance=" $image_sel_asc Ech. $image_desc | ";
- $order=" order by jr_ech asc ";
- break;
- case 'ed':
- // jr_comment desc
- $sort_echeance=" $image_asc Ech. $image_sel_desc | ";
- $order=" order by jr_ech desc ";
- break;
-
- }
- }
- else
- {
- // date asc
- $sort_date="$image_sel_asc Date $image_desc | ";
- $order=" order by jr_date_order asc,substring(jr_pj_number,'\\d+$')::numeric asc ";
- }
-
- // Count
+ // Count
$count=$this->db->count_sql($sql);
// Add the limit
$sql.=$order.$limit.$offset;
@@ -703,13 +812,13 @@ class Acc_Ledger
{
$r.=th('Journal');
}
- $r.=$sort_date;
- $r.=$sort_echeance;
- $r.=$sort_pj;
+ $r.=''.$table->get_header(0).' | ';
+ $r.=''.$table->get_header(1).'';
+ $r.=' | '.$table->get_header(2).' | ';
$r.=th('tiers');
- $r.=$sort_description;
+ $r.=''.$table->get_header(4).' | ';
$r.=th('Notes',' style="width:15%"');
- $r.=$sort_amount;
+ $r.=''.$table->get_header(3).' | ';
// if $p_paid is not equal to 0 then we have a paid column
if ( $p_paid != 0 )
{
@@ -2138,26 +2247,28 @@ class Acc_Ledger
$sql="select nextval('s_jrn_pj".$this->id."')";
$this->db->exec_sql($sql);
}
- /*!\brief return a HTML string with the form for the search
- *\param $p_type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN
- *\param $all_type_ledger
+ /*!@brief return a HTML string with the form for the search
+ *@param $p_type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN
+ *@param $all_type_ledger
* values :
* - 1 means all the ledger of this type
* - 0 No have the "Tous les journaux" availables
- *\return a HTML String without the tag FORM or DIV
- *\see build_search_sql
- *\see display_search_form
- *\see list_operation
+ *@param $div is the div (for reconciliation)
+ *@return a HTML String without the tag FORM or DIV
+ *
+ *@see build_search_sql
+ *@see display_search_form
+ *@see list_operation
*/
- function search_form($p_type,$all_type_ledger=1)
+ function search_form($p_type,$all_type_ledger=1,$div="")
{
$user=new User($this->db);
$r='';
/* security : filter ledger on user */
$filter_ledger=$user->get_ledger($p_type,3);
- $selected=(isset($_REQUEST['r_jrn']))?$_REQUEST['r_jrn']:null;
- $f_ledger=HtmlInput::select_ledger($filter_ledger,$selected);
+ $selected=(isset($_REQUEST['r_jrn'.$div]))?$_REQUEST['r_jrn'.$div]:null;
+ $f_ledger=HtmlInput::select_ledger($filter_ledger,$selected,$div);
/* widget for date_start */
$f_date_start=new IDate('date_start');
@@ -2203,7 +2314,7 @@ class Acc_Ledger
$f_amount_max->value=(isset($_REQUEST['amount_max']))?$_REQUEST['amount_max']:0;
/* input quick code */
- $f_qcode=new ICard('qcode');
+ $f_qcode=new ICard('qcode'.$div);
$f_qcode->set_attribute('typecard','all');
/* $f_qcode->set_attribute('p_jrn','0');
@@ -2214,9 +2325,9 @@ class Acc_Ledger
// Add the callback function to filter the card on the jrn
//$f_qcode->set_callback('filter_card');
$f_qcode->set_function('fill_data');
- $f_qcode->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ',
- $f_qcode->name);
- $f_qcode->value=(isset($_REQUEST['qcode']))?$_REQUEST['qcode']:'';
+ $f_qcode->javascript=sprintf(' onchange="fill_data_onchange(%s);" ',
+ $f_qcode->name);
+ $f_qcode->value=(isset($_REQUEST['qcode'.$div]))?$_REQUEST['qcode'.$div]:'';
/* $f_txt_qcode=new IText('qcode');
$f_txt_qcode->value=(isset($_REQUEST['qcode']))?$_REQUEST['qcode']:'';
@@ -2343,6 +2454,7 @@ class Acc_Ledger
}
$desc='';
$qcode=(isset($qcode))?$qcode:"";
+ if ( isset($qcodesearch_op)) $qcode=$qcodesearch_op;
$accounting=(isset($accounting))?$accounting:"";
}
@@ -2370,6 +2482,7 @@ class Acc_Ledger
if ( $p_action == 'client') $p_action='ALL';
if ( $p_action == 'supplier') $p_action='ALL';
if ( $p_action == 'adm') $p_action='ALL';
+ if ( $p_action == 'ALL') $p_action='ALL';
/* from compta.php the p_action is quick_writing instead of ODS */
if ( $p_action == 'quick_writing') $p_action='ODS';
@@ -2459,6 +2572,7 @@ class Acc_Ledger
$and=" and ";
}
// Quick Code
+ if ( isset ($qcodesearch_op)) $qcode=$qcodesearch_op;
if ( $qcode != null )
{
$fil_qcode=$and." jr_grpt_id in ( select j_grpt from
diff --git a/include/class_html_input.php b/include/class_html_input.php
index 73bf6586a..9a7bfe167 100755
--- a/include/class_html_input.php
+++ b/include/class_html_input.php
@@ -291,7 +291,7 @@ class HtmlInput
*@param $selected is an array of checkbox
*@note the choosen ledger are stored in the array r_jrn (_GET)
*/
- static function select_ledger($p_array,$p_selected)
+ static function select_ledger($p_array,$p_selected,$div='')
{
ob_start();
$ledger=new IButton('l');
@@ -300,7 +300,7 @@ class HtmlInput
echo $ledger->input();
/* create a hidden div for the ledger */
- echo '';
+ echo '
';
echo '
Choix des journaux
';
echo '
';
diff --git a/include/class_iconcerned.php b/include/class_iconcerned.php
index 08f854d22..93f00ad4a 100644
--- a/include/class_iconcerned.php
+++ b/include/class_iconcerned.php
@@ -29,25 +29,30 @@
require_once('class_html_input.php');
class IConcerned extends HtmlInput
{
+
+ public function __construct($p_name='',$p_value='')
+ {
+ $this->name=$p_name;
+ $this->value=$p_value;
+ $this->amount_id=null;
+ $this->ledger='ALL';
+ }
/*!\brief show the html input of the widget*/
public function input($p_name=null,$p_value=null)
{
$this->name=($p_name==null)?$this->name:$p_name;
$this->value=($p_value==null)?$this->value:$p_value;
if ( $this->readOnly==true) return $this->display();
- $td="";
- $etd="";
- $r=sprintf("$td
-
- $etd $td
+ $r=sprintf("
+
- $etd",
+ ",
$this->name,
- $this->extra,
- $this->extra2,
+ $this->amount_id,
+ $this->ledger,
$this->name,
$this->name,
$this->value
diff --git a/include/search.inc.php b/include/search.inc.php
new file mode 100644
index 000000000..f0bd001dc
--- /dev/null
+++ b/include/search.inc.php
@@ -0,0 +1,141 @@
+Check();
+$act=$User->check_dossier($gDossier);
+// display a search box
+
+
+/**
+ * @todo si ajax alors pas de form GET mais plutot une fonction
+ * javascript pour chercher
+ */
+$base=basename($_SERVER['SCRIPT_NAME']);
+$inside=false;
+$ledger=new Acc_Ledger($cn,0);
+$ledger->type='ALL';
+if (isset($_GET['amount_id']))
+{
+ put_global(array(
+ array("key"=>'amount_min','value'=>$_GET['amount_id']),
+ array("key"=>'amount_max','value'=>$_GET['amount_id'])
+ ));
+}
+
+$search_box=$ledger->search_form('ALL',1,'search_op');
+
+if ($base == 'recherche.php' || $base == 'do.php')
+ {
+ echo '';
+ echo '';
+
+if ( isset ($_GET['amount_min'])&& isset($_GET['amount_max'])&& ($_GET['amount_max']!=0 ||$_GET['amount_min']!=0 ))
+{
+ $_GET['viewsearch']=1;
+ put_global(
+ array
+ (
+ array('key'=>'ledger_type','value'=>'ALL'),
+ array('key'=>'date_start','value'=>'ALL'),
+ array('key'=>'date_end','value'=>'ALL'),
+ array('key'=>'desc','value'=>''),
+ array('key'=>'qcode','value'=>''),
+ array('key'=>'accounting','value'=>'')
+ )
+
+ );
+
+}
+//-----------------------------------------------------
+// Display search result
+//-----------------------------------------------------
+if ( isset ($_GET['viewsearch']) )
+{
+
+ // Navigation bar
+ $step=25;
+ $page=(isset($_GET['offset']))?$_GET['page']:1;
+ $offset=(isset($_GET['offset']))?$_GET['offset']:0;
+ if (count ($_GET) == 0)
+ $array=null;
+ else
+ $array=$_GET;
+ $array['p_action']='ALL';
+ list($sql,$where)=$ledger->build_search_sql($array);
+ // Count nb of line
+ $max_line=$cn->count_sql($sql);
+ list($count,$content)=$ledger->list_operation_to_reconcile($sql);
+ $bar=jrn_navigation_bar($offset,$max_line,$step,$page);
+
+ if (! $inside ) {
+ echo $bar;
+
+ } else
+ {
+ if ($step<$max_line ) echo 'Nombre d\'enregistrements trouvés =' .$max_line.' limite = '.$step.'';
+ }
+ echo '';
+ if (! $inside )echo $bar;
+
+ echo HtmlInput::get_to_hidden(array('ctlc','amount_id','ledger'));
+ echo HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcodesearch_op','accounting','unpaid','gDossier','ledger_type'));
+ if (isset($_GET['r_jrn'])) {
+ foreach ($_GET['r_jrn'] as $k=>$v)
+ echo HtmlInput::hidden('r_jrn['.$k.']',$v);
+ }
+}
+echo '
';
+?>
diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php
index 409dcbe9f..68b87bb81 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -25,9 +25,9 @@ if ($aRap != null ) {
$aRap[$e],
$tableid
);
- if ( $access=='W')
+ if ( $access=='W')
$remove=$rmReconciliation->input();
- else
+ else
$remove='';
echo tr (td(''.$internal.'').td($amount).td($array_jr[0]['jr_comment']).td($remove));
}
@@ -37,7 +37,7 @@ if ($aRap != null ) {
if ( $access=='W') {
- $search='det->jr_montant."')\">";
+ $search='det->jr_montant."')\">";
$rapt=new IText('rapt'.$div);
echo $rapt->input().$search;
}
@@ -46,10 +46,10 @@ if ( $access=='W') {
-require_once('template/ledger_detail_file.php');
+require_once('template/ledger_detail_file.php');
?>
-
+
if ( $div != 'popup' ) {
$a=new IButton('Fermer','Fermer');
@@ -59,8 +59,8 @@ if ( $div != 'popup' ) {
}
?>
-MY_ANALYTIC != 'nu' && $div=='popup'){
echo '';
@@ -78,9 +78,9 @@ if ( $div != 'popup' ) {
$reverse->label=_('Extourner');
$reverse->javascript="g('ext".$div."').style.display='block'";
echo $reverse->input();
-
+
echo '';
-
+
echo '';
$date=new IDate('ext_date');
$r="