phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r4313 - in phpcompta/trunk: html html/js include include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4313 - in phpcompta/trunk: html html/js include include/template
Date: Fri, 4 Nov 2011 22:27:51 +0100 (CET)

Author: danydb
Date: 2011-11-04 22:27:50 +0100 (Fri, 04 Nov 2011)
New Revision: 4313

Added:
   phpcompta/trunk/include/search.inc.php
   phpcompta/trunk/include/template/search_top.php
Removed:
   phpcompta/trunk/html/jrn_search.php
Modified:
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/html/js/acc_ledger.js
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/html/recherche.php
   phpcompta/trunk/html/style-color.css
   phpcompta/trunk/html/style-light.css
   phpcompta/trunk/html/style.css
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_html_input.php
   phpcompta/trunk/include/class_iconcerned.php
   phpcompta/trunk/include/template/ledger_detail_bottom.php
Log:

#317 IConcerne : r?\195?\169?\195?\169criture, ?\195?\160 l'avenir sera dans 
une fen?\195?\170tre interne

Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2011-11-04 21:27:21 UTC (rev 4312)
+++ phpcompta/trunk/html/ajax_misc.php  2011-11-04 21:27:50 UTC (rev 4313)
@@ -460,4 +460,23 @@
 case 'save_predf':
   require_once('save_predf_op.php');
   break;
+case 'search_op':
+       /*put_global(array
+                               (array('key'=>'ac','value'=>'JSSEARCH')),
+                               (array('key'=>'ledger_type','value'=>'ALL'))
+                          );*/
+       ob_start();
+       require_once 'search.inc.php';
+       $content=ob_get_contents();
+       ob_clean();
+       $html=escape_xml($content);
+       header('Content-type: text/xml; charset=UTF-8');
+       echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl>$ctl</ctl>
+<code>$html</code>
+</data>
+EOF;
+       break;
 }

Deleted: phpcompta/trunk/html/jrn_search.php
===================================================================
--- phpcompta/trunk/html/jrn_search.php 2011-11-04 21:27:21 UTC (rev 4312)
+++ phpcompta/trunk/html/jrn_search.php 2011-11-04 21:27:50 UTC (rev 4313)
@@ -1,303 +0,0 @@
-<?php
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   PhpCompta is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with PhpCompta; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-// Copyright Author Dany De Bontridder address@hidden
-/* $Revision$ */
-/*! \file
- * \brief Search a operation from a ledger into a popup window, used for the 
"rapprochement"
- */
-
-require_once ("ac_common.php");
-require_once('class_database.php');
-require_once("user_common.php");
-/* Admin. Dossier */
-$rep=new Database();
-include_once ("class_user.php");
-require_once('class_html_input.php');
-require_once('function_javascript.php');
-echo load_all_script();
-$User=new User($rep);
-$User->Check();
-
-
-html_min_page_start($User->theme,"onLoad='window.focus();'");
-
-require_once('class_dossier.php');
-$gDossier=dossier::id();
-
-// Javascript
-
-if ( isset( $p_jrn ))
-{
-    $p_jrn=$p_jrn;
-    $_SESSION[ "p_jrn"]=$p_jrn;
-
-}
-if (isset ($_GET['p_ctl'])) $p_ctl=$_GET['p_ctl'];
-if (isset($_POST['p_ctl'])) $p_ctl=$_POST['p_ctl'];
-$opt='<OPTION VALUE="="> =';
-$opt.='<OPTION VALUE="<="> <=';
-$opt.='<OPTION VALUE="<"> <';
-$opt.='<OPTION VALUE=">"> >';
-$opt.='<OPTION VALUE=">="> >=';
-$opt_date=$opt;
-$opt_montant=$opt;
-$c_comment="";
-$c_montant="";
-$c_internal="";
-$c_date="";
-$condition="";
-$part=" where ";
-$cn=new Database($gDossier);
-// if search then build the condition
-if ( isset ($_GET["search"]) )
-{
-    $c1=0;
-    foreach( $_GET as $key=>$element)
-    {
-        ${"$key"}=$element;
-    }
-    $c_comment="";
-    if ( isset ($p_comment) && strlen(trim($p_comment)) != 0 )
-    {
-        $c_comment=" $part upper(jr_comment) like upper('%$p_comment%')";
-        $part=" and ";
-    }
-    $c_montant="";
-    if ( isset ($p_montant) && strlen($p_montant) != 0 && isNumber($p_montant) 
)
-    {
-        $p_montant=abs($p_montant);
-        $opt_montant.='<OPTION VALUE="'.$p_montant_sel.'" 
SELECTED>'.$p_montant_sel;
-        $part="  and ";
-        /* if the sign is equal then we look into the details */
-        if ( $p_montant_sel != '=' )
-        {
-            $c_montant=sprintf(" $part jr_montant %s 
abs(%s)",$p_montant_sel,$p_montant);
-        }
-        else
-        {
-            $c_montant=$part.'  jr_grpt_id in (select j_grpt from jrnx where 
j_montant = '.$p_montant.')';
-        }
-    }
-    if ( isset ($p_date) && strlen(trim($p_date)) != 0 )
-    {
-        $c_date=sprintf(" $part j_date %s 
to_date('%s','DD.MM.YYYY')",$p_date_sel,$p_date);
-        $part=" and ";
-        $opt_date.='<OPTION VALUE="'.$p_date_sel.'" SELECTED>'.$p_date_sel;
-    }
-    $c_internal="";
-    if ( isset($p_internal) &&  strlen(trim($p_internal)) != 0 )
-    {
-        $c_internal=$part." jr_internal like  ('%".$p_internal."%')";
-        $part=" and ";
-
-    }
-    $c_paid="";
-    if (isset($paid))
-    {
-        $c_paid=$part."  (jr_rapt != 'paid' or jr_rapt is null) ";
-        $part=" and ";
-    }
-    $condition=$c_comment.$c_montant.$c_date.$c_internal.$c_paid;
-}
-$condition=$condition." ".$part;
-
-// If the usr is admin he has all right
-if ( $User->admin != 1 && $User->is_local_admin()!=1)
-{
-    $condition.="  uj_priv in ('W','R') and uj_login='".$User->login."'" ;
-}
-else
-{
-    $condition.=" true ";
-}
-?>
-<div style="font-size:11px;">
-           <?php
-           echo '<FORM ACTION="jrn_search.php" METHOD="GET">';
-echo dossier::hidden();
-if (isset($paid))
-    echo '<div class="info"> Uniquement les non op&eacute;rations non 
pay&eacute;es<input type="hidden" name="paid" value="paid"></div>';
-else
-    echo '<div class="info"> Toutes les op&eacute;rations </div>';
-
-echo '<TABLE>';
-echo '<TR>';
-if ( ! isset ($p_date)) $p_date="";
-if ( ! isset ($p_montant)) $p_montant="";
-if ( ! isset ($p_comment)) $p_comment="";
-if ( ! isset ($p_internal)) $p_internal="";
-echo '<input type="hidden" name="p_ctl" value="'.$p_ctl.'">';
-echo '<TD> Date </TD>';
-echo '<TD> <SELECT NAME="p_date_sel">'.$opt_date.' </TD>';
-echo '<TD> <INPUT TYPE="text" name="p_date" VALUE="'.$p_date.'"></TD>';
-
-echo '<TD> Montant </TD>';
-echo '<TD> <SELECT NAME="p_montant_sel">'.$opt_montant.' </TD>';
-echo '<TD> <INPUT TYPE="text" name="p_montant" VALUE="'.$p_montant.'"></TD>';
-echo '</TR><TR>';
-echo '<TD> Commentaire </TD>';
-echo '<TD> contient </TD>';
-echo '<TD> <INPUT TYPE="text" name="p_comment" VALUE="'.$p_comment.'"></TD>';
-?>
-</TR><TR>
-<TD> Code interne </TD><TD>comme </TD>
-<?php
-echo '<TD> <INPUT TYPE="text" name="p_internal" VALUE="'.$p_internal.'"></TD>';
-echo "</TR>";
-
-echo '</TABLE>';
-echo HtmlInput::submit('search','cherche');
-echo '<input type="button" class="button" name="update_concerned" value="Mise 
à jour des réconciliation" onClick="updateJrn(\''.$p_ctl.'\')">';
-echo '</FORM>';
-echo '<div class="content">';
-// if a search is asked otherwise don't show all the rows
-if ( isset ($_GET["search"]) )
-{
-// If the usr is admin he has all right
-    if ( $User->admin != 1 && $User->is_local_admin()!=1)
-    {
-        $jnt="  inner join user_sec_jrn on uj_jrn_id=j_jrn_def";
-    }
-    else
-    {
-        $jnt="  ";
-    }
-    $sql="select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
-         
j_montant,jr_montant,j_poste,j_debit,j_tech_per,jr_id,jr_comment,j_grpt,pcm_lib,jr_internal,jr_rapt,j_qcode
 from jrnx inner join
-         jrn on jr_grpt_id=j_grpt inner join tmp_pcmn on j_poste=pcm_val ".
-         $jnt.
-         $condition." order by jr_date,jr_id,j_debit desc";
-    $Res=$cn->exec_sql($sql);
-
-    $MaxLine=Database::num_row($Res);
-    $offset=(isset($_GET['offset']))?$_GET['offset']:0;
-    $limit=$_SESSION['g_pagesize'];
-    $sql_limit="";
-    $sql_offset="";
-    $bar="";
-    if ( $limit != -1)
-    {
-        $page=(isset($_GET['page']))?$_GET['page']:0;
-        $sql_limit=" LIMIT $limit ";
-        $sql_offset=" OFFSET $offset ";
-        $bar=jrn_navigation_bar($offset,$MaxLine,$limit,$page,'onClick="return 
go_next_concerned();"');
-
-    }
-    $sql.=$sql_limit.$sql_offset;
-    if ( $MaxLine==0)
-    {
-        html_page_stop();
-        return;
-    }
-    $Res=$cn->exec_sql($sql);
-    $MaxLine=Database::num_row($Res);
-
-    $col_vide="<TD></TD>";
-    echo '<form id="form_jrn_concerned">';
-    echo HtmlInput::hidden('nb_item',$MaxLine);
-    echo $bar;
-    echo '<TABLE ALIGN="center" BORDER="0" CELLSPACING="O" width="100%">';
-    $l_id="";
-//   if ( $MaxLine > 250 ) {
-//     echo "Trop de lignes redéfinir la recherche";
-//     html_page_stop();
-//     return;
-//   }
-    for ( $i=0; $i < $MaxLine; $i++)
-    {
-        $l_line=Database::fetch_array($Res,$i);
-        if ( $l_id == $l_line['j_grpt'] )
-        {
-            echo $col_vide.$col_vide;
-        }
-        else
-        {
-            echo '<TR style="background-color:lightblue"><TD>';
-            echo '<INPUT TYPE="CHECKBOX" 
name="jr_concerned'.$l_line['jr_id'].'" ID="jr_concerned'.$l_line['jr_id'].'"> 
'.$l_line['jr_id'];
-            echo "</TD>";
-
-            echo "<TD>";
-            echo $l_line['j_date'];
-            echo "</TD>";
-
-            echo "<TD>";
-            echo $l_line['jr_internal'];
-            echo "</TD>";
-            $l_id=$l_line['j_grpt'];
-            if ( $l_line['jr_rapt'] == 'paid')
-                $lpay="  (Pay&eacute;) ";
-            else
-                $lpay="";
-
-            echo '<TD COLSPAN="3">'.$l_line['jr_comment'].$lpay.'</TD>';
-            echo '<td>'.$l_line['jr_montant'].'</td>';
-            echo '</tr>';
-        }
-        if ( $l_line['j_debit'] == 't' )
-        {
-            echo '<TR style="background-color:#E7FBFF;">';
-        }
-        else
-        {
-            echo '<TR style="background-color:#E7FFEB;">';
-        }
-        echo $col_vide;
-        if ( $l_line['j_debit']=='f')
-            echo $col_vide;
-
-        echo '<TD>';
-        echo $l_line['j_poste'];
-        echo '</TD>';
-
-        if ( $l_line['j_debit']=='t')
-            echo $col_vide;
-
-        echo '<TD>';
-        if ( $l_line ['j_qcode'] != "" )
-        {
-            $o=new Fiche($cn);
-            $o->get_by_qcode($l_line['j_qcode'],false);
-            echo "[ ".$l_line['j_qcode']." ]".
-            $o->strAttribut(ATTR_DEF_NAME);
-        }
-        else
-            echo $l_line['pcm_lib'];
-        echo '</TD>';
-
-        if ( $l_line['j_debit']=='f')
-            echo $col_vide;
-
-        echo '<TD>';
-        echo $l_line['j_montant'];
-        echo '</TD>';
-
-        echo "</TR>";
-
-    }
-
-    echo '</TABLE>';
-    echo $bar;
-    echo '</form>';
-    echo '</div>';
-}// if $_POST [search]
-?>
-</div>
-<?php
-html_page_stop();
-?>

Modified: phpcompta/trunk/html/js/acc_ledger.js
===================================================================
--- phpcompta/trunk/html/js/acc_ledger.js       2011-11-04 21:27:21 UTC (rev 
4312)
+++ phpcompta/trunk/html/js/acc_ledger.js       2011-11-04 21:27:50 UTC (rev 
4313)
@@ -496,85 +496,8 @@
 {
     window.location.reload();
 }
-/*! \brief this function search into the ledger
- *  \param p_ctl ctl name
- *  \param p_montant amount to search (if 0 get it from the e_other_amount
- */
-function SearchJrn(p_dossier,p_ctl,p_montant,p_paid)
-{
-    var url='jrn_search.php?p_ctl='+p_ctl+'&gDossier='+p_dossier+'&'+p_paid;
 
 
-    if ( p_montant == 0 )
-    {
-        // compute amount name replace the number
-        num=p_ctl.replace("e_concerned","");
-
-        /* Get the amount */
-        var ctl_montant_name="e_other"+num+"_amount";
-
-        if ( document.forms[0])
-        {
-
-            for ( i=0; i < document.forms[0].length; i++)
-            {
-                var e=document.forms[0].elements[i];
-                if ( e.name == ctl_montant_name )
-                {
-                    p_montant=e.value;
-                    break;
-                }
-            }
-        }
-        if ( p_montant == 0 && document.forms[1])
-        {
-
-            for ( i=0; i < document.forms[1].length; i++)
-            {
-                var e=document.forms[1].elements[i];
-                if ( e.name == ctl_montant_name )
-                {
-                    p_montant=e.value;
-                    break;
-                }
-            }
-        }
-
-    }
-
-
-    if ( p_montant == 0 )
-    {
-        var 
win=window.open(url,'Cherche','toolbar=no,width=600,height=600,scrollbars=yes');
-
-    }
-    else
-    {
-        var 
win=window.open(url+'&search&p_montant='+p_montant+'&p_montant_sel=%3D','Cherche','toolbar=no,width=600,height=600,scrollbars=yes');
-    }
-}
-
-function updateJrn(p_ctl)
-{
-    var form=document.forms[1];
-
-    for (var e=0;e<form.elements.length;e++)
-    {
-        var elmt=form.elements[e];
-        if ( elmt.type == "checkbox")
-        {
-            if (elmt.checked==true )
-            {
-                var str_name=elmt.name;
-                var nValue=str_name.replace("jr_concerned","");
-
-                set_inparent(p_ctl,nValue,1);
-            }
-        }
-    }
-    window.close();
-}
-
 function go_next_concerned()
 {
     var form=document.forms[1];

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2011-11-04 21:27:21 UTC (rev 4312)
+++ phpcompta/trunk/html/js/scripts.js  2011-11-04 21:27:50 UTC (rev 4313)
@@ -286,13 +286,10 @@
  address@hidden p_dossier the dossier where to search
  address@hidden p_style style of the detail value are E for expert or S for 
simple
  */
-function openRecherche(p_dossier,p_style)
+function popup_recherche()
 {
-    if ( p_style == 'E' )
-    {
-        p_style="expert";
-    }
-    var 
w=window.open("recherche.php?gDossier="+p_dossier+'&'+p_style,'','statusbar=no,scrollbars=yes,toolbar=no');
+       p_dossier=$('gDossier').value;
+    var 
w=window.open("recherche.php?gDossier="+p_dossier+"&ac=SEARCH",'','statusbar=no,scrollbars=yes,toolbar=no');
     w.focus();
 }
 /**
@@ -373,7 +370,7 @@
 {
     var queryString="gDossier="+obj.gDossier+"&op=cal"+"&per="+obj.value;
     var action = new Ajax.Request(
-                 "ajax_misc.php" , { method:'get', 
parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_misc}
+                 "ajax_misc.php" , {method:'get', 
parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_misc}
                  );
 
 }
@@ -435,7 +432,7 @@
 {
     var queryString="gDossier="+p_dossier+"&op=rem_cat_doc"+"&dt_id="+p_dt_id;
     var action = new Ajax.Request(
-                 "ajax_misc.php" , { method:'get', 
parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_cat_doc_remove}
+                 "ajax_misc.php" , {method:'get', 
parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_cat_doc_remove}
                  );
 }
 function success_cat_doc_remove(req)
@@ -490,7 +487,7 @@
             queryString+='&compute='+obj.compute;
         var action = new Ajax.Request(
                          "ajax_misc.php" ,
-                 { method:'get',
+                 {method:'get',
                    parameters:queryString,
                    onFailure:ajax_misc_failure,
                    onSuccess:success_popup_select_tva
@@ -544,7 +541,7 @@
             queryString+='&code='+obj.jcode;
         var action = new Ajax.Request(
                          "ajax_misc.php" ,
-                 { method:'get',
+                 {method:'get',
                    parameters:queryString,
                    onFailure:ajax_misc_failure,
                    onSuccess:success_set_tva_label
@@ -600,6 +597,7 @@
  * - style to add style
  * - id to add an id
  * - class to add a class
+ * - html is the content
  */
 function add_div(obj)
 {
@@ -639,7 +637,7 @@
 new Draggable(obj.id,{starteffect:function()
                                   {
                       new Effect.Highlight(obj.id,{scroll:window,queue:'end'});
-                                  } }
+                                  }}
                          );
         }
     }
@@ -660,6 +658,22 @@
     }
 }
 /**
+ *show a box while loading
+ *must be remove when ajax is successfull
+ * the id is wait_box
+ */
+function waiting_box()
+{
+       obj={
+               id:'wait_box',html:loading()
+               };
+       if ($('wait_box')){
+               removeDiv('wait_box');
+               }
+       add_div(obj);
+
+}
+/**
 address@hidden call add_div to add a DIV and after call the ajax
 * the queryString, the callback for function for success and error management
 * the method is always GET
@@ -755,7 +769,8 @@
 */
 function show_ledger_choice()
 {
-    g('div_jrn').style.visibility='visible';
+   if ($('div_jrn')) g('div_jrn').style.visibility='visible';
+   if ($('div_jrnsearch_op')) $('div_jrnsearch_op').style.display='block';
 }
 /**
 * hide the ledger choice
@@ -763,6 +778,7 @@
 function hide_ledger_choice()
 {
     g('div_jrn').style.visibility='hidden';
+       if ($('div_jrnsearch_op')) $('div_jrnsearch_op').style.display='none';
 }
 /**
 * show the cat of ledger choice
@@ -900,7 +916,7 @@
        }
         var action = new Ajax.Request(
             "ajax_misc.php" ,
-            { method:'get',
+            {method:'get',
               parameters:queryString,
               onFailure:ajax_misc_failure,
               onSuccess:success_display_periode
@@ -916,7 +932,7 @@
 
 }
 function success_display_periode(req)
-{    try
+{try
     {
 
         var answer=req.responseXML;
@@ -955,7 +971,7 @@
 
         var action = new Ajax.Request(
             "ajax_misc.php" ,
-            { method:'post',
+            {method:'post',
               parameters:queryString,
               onFailure:ajax_misc_failure,
               onSuccess:success_display_periode
@@ -981,10 +997,14 @@
 function fill_box(req)
 {
     try{
+
+       if ( $('wait_box')){
+                       removeDiv('wait_box');
+                       }
        var answer=req.responseXML;
        var a=answer.getElementsByTagName('ctl');
        var html=answer.getElementsByTagName('code');
-       if ( a.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
+       if ( a.length == 0 ) {var rec=req.responseText;alert ('erreur :'+rec);}
        var name_ctl=a[0].firstChild.nodeValue;
        var code_html=getNodeText(html[0]); // Firefox ne prend que les 4096 
car.
        code_html=unescape_xml(code_html);
@@ -1047,3 +1067,98 @@
 
     return false;
 }
+/**
+ *ctl_concern is the widget to update
+ */
+function search_reconcile(dossier,ctl_concern,amount_id,ledger)
+{
+       var dossier=g('gDossier').value;
+       if ( amount_id == undefined ) { amount_id=0; }
+         var target="search_op";
+    if ( $(target))
+    {
+       removeDiv(target);
+    }
+    var sx=77;
+    var sy=99;
+       if ( window.scrollY)
+        {
+            sx=window.scrollY+40;
+        }
+        else
+        {
+            sx=document.body.scrollTop+40;
+        }
+    var str_style="top:"+sx+";left:"+sy;
+
+    var div={id:target, 
cssclass:'op_detail',style:str_style,html:loading(),drag:1};
+
+    add_div(div);
+       var target={gDossier:dossier,
+                               ctlc:ctl_concern,
+                               op:'search_op',
+                               ctl:'search_op',
+                               ac:'JSSEARCH',
+                               amount_id:amount_id,
+                               ledger:ledger};
+
+    var qs=encodeJSON(target);
+
+    var action=new Ajax.Request ( 'ajax_misc.php',
+                                 {
+                                     method:'get',
+                                     parameters:qs,
+                                     onFailure:null,
+                                     onSuccess:fill_box
+                                 }
+                               );
+}
+/**
+ * search in a popin obj if the object form
+ */
+function search_operation(obj)
+{
+       var dossier=g('gDossier').value;
+       waiting_box();
+       var target="search_op";
+
+    var qs=obj.serialize()+"&op=search_op&ctl=search_op";
+
+    var action=new Ajax.Request ( 'ajax_misc.php',
+                                 {
+                                     method:'get',
+                                     parameters:qs,
+                                     onFailure:null,
+                                     onSuccess:fill_box
+                                 }
+                               );
+}
+
+function set_reconcile(obj)
+ {
+        try
+       {
+               var ctlc=obj.elements['ctlc'];
+
+               for (var e=0;e<obj.elements.length;e++)
+               {
+
+                       var elmt=obj.elements[e];
+                       if ( elmt.type == "checkbox")
+                       {
+                               if (elmt.checked==true )
+                               {
+                                       var str_name=elmt.name;
+                                       var 
nValue=str_name.replace("jr_concerned","");
+                                       if ( $(ctlc.value).value != '') {       
$(ctlc.value).value+=',';}
+                                       $(ctlc.value).value+=nValue;
+                               }
+                       }
+               }
+               removeDiv('search_op');
+       }
+       catch(e)
+       {
+               alert(e.message)
+       }
+ }
\ No newline at end of file

Modified: phpcompta/trunk/html/recherche.php
===================================================================
--- phpcompta/trunk/html/recherche.php  2011-11-04 21:27:21 UTC (rev 4312)
+++ phpcompta/trunk/html/recherche.php  2011-11-04 21:27:50 UTC (rev 4313)
@@ -41,6 +41,7 @@
 $User=new User($cn);
 $User->Check();
 $act=$User->check_dossier($gDossier);
+// AC CODE = SEARCH
 if ($act =='P')
 {
     redirect("extension.php?".dossier::get(),0);
@@ -54,6 +55,7 @@
 // display a search box
 
 $ledger=new Acc_Ledger($cn,0);
+$ledger->type='ALL';
 $search_box=$ledger->search_form('ALL',1);
 echo '<div class="content">';
 

Modified: phpcompta/trunk/html/style-color.css
===================================================================
--- phpcompta/trunk/html/style-color.css        2011-11-04 21:27:21 UTC (rev 
4312)
+++ phpcompta/trunk/html/style-color.css        2011-11-04 21:27:50 UTC (rev 
4313)
@@ -974,4 +974,35 @@
 {
                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

Modified: phpcompta/trunk/html/style-light.css
===================================================================
--- phpcompta/trunk/html/style-light.css        2011-11-04 21:27:21 UTC (rev 
4312)
+++ phpcompta/trunk/html/style-light.css        2011-11-04 21:27:50 UTC (rev 
4313)
@@ -1013,3 +1013,34 @@
        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

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2011-11-04 21:27:21 UTC (rev 4312)
+++ phpcompta/trunk/html/style.css      2011-11-04 21:27:50 UTC (rev 4313)
@@ -1004,4 +1004,35 @@
                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

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2011-11-04 21:27:21 UTC 
(rev 4312)
+++ phpcompta/trunk/include/class_acc_ledger.php        2011-11-04 21:27:50 UTC 
(rev 4313)
@@ -41,7 +41,7 @@
 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 @@
         $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.='<table class="result">';
+
+
+        $r.="<tr >";
+        $r.="<th>Internal</th>";
+        if ( $this->type=='')
+        {
+            $r.=th('Journal');
+        }
+               $r.="<th>Selection</th>";
+        $r.='<th>Date</th>';
+        $r.='<th>Pièce</td>';
+               $r.=th('tiers');
+        $r.='<th>Description</th>';
+               $r.=th('Notes',' style="width:15%"');
+        $r.='<th>Montant</th>';
+        $r.="<th>"._('Op. Concernée')."</th>";
+        $r.="</tr>";
+        // Total Amount
+        $tot=0.0;
+        $gDossier=dossier::id();
+               $str_dossier=Dossier::id();
+        for ($i=0; $i < $Max;$i++)
+        {
+
+
+            $row=Database::fetch_array($Res,$i);
+
+            if ( $i % 2 == 0 ) $tr='<TR class="odd">';
+            else $tr='<TR class="even">';
+            $r.=$tr;
+                       // Radiobox
+                       //
+
+                       $r.='<td><INPUT TYPE="CHECKBOX" 
name="jr_concerned'.$row['jr_id'].'" ID="jr_concerned'.$row['jr_id'].'"> </td>';
+            //internal code
+            // button  modify
+            $r.="<TD>";
+            // If url contains
+            //
+
+            $href=basename($_SERVER['PHP_SELF']);
+
+
+            $r.=sprintf('<A class="detail" style="text-decoration:underline" 
HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s </A>',
+                        $row['jr_id'], $gDossier, $row['jr_internal']);
+            $r.="</TD>";
+            if ( $this->type=='') $r.=td($row['jrn_def_name']);
+            // date
+            $r.="<TD>";
+            $r.=$row['jr_date'];
+            $r.="</TD>";
+
+            // pj
+            $r.="<TD>";
+            $r.=$row['jr_pj_number'];
+            $r.="</TD>";
+
+           // Tiers
+           $other=($row['quick_code']!='')?'['.$row['quick_code'].'] 
'.$row['name'].' '.$row['first_name']:'';
+           $r.=td($other);
+            // comment
+            $r.="<TD>";
+            $tmp_jr_comment=h($row['jr_comment']);
+            $r.=$tmp_jr_comment;
+            $r.="</TD>";
+           $r.=td(h($row['n_text']),' style="font-size:6"');
+            // Amount
+            // If the ledger is financial :
+            // the credit must be negative and written in red
+            $positive=0;
+
+            // Check ledger type :
+            if (  $row['jrn_def_type'] == 'FIN' )
+            {
+                $positive = $this->db->get_value("select qf_amount from 
quant_fin where jr_id=$1",
+                                                 array($row['jr_id']));
+               if ( $this->db->count() != 0)
+                 $positive=($positive < 0)?1:0;
+            }
+            $r.="<TD align=\"right\">";
+
+            $r.=( $positive != 0 )?"<font color=\"red\">  - 
".nbm($row['jr_montant'])."</font>":nbm($row['jr_montant']);
+            $r.="</TD>";
+
+
+
+            // Rapprochement
+            $rec=new Acc_Reconciliation($this->db);
+            $rec->set_jr_id($row['jr_id']);
+            $a=$rec->get();
+            $r.="<TD>";
+            if ( $a != null )
+            {
+
+                foreach ($a as $key => $element)
+                {
+                    $operation=new Acc_Operation($this->db);
+                    $operation->jr_id=$element;
+                    $l_amount=$this->db->get_value("select jr_montant from jrn 
".
+                                                   " where jr_id=$element");
+                    $r.= "<A class=\"detail\" 
HREF=\"javascript:modifyOperation('".$element."',".$gDossier.")\" > 
".$operation->get_internal()." [ $l_amount &euro; ]</A>";
+                }//for
+            }// if ( $a != null ) {
+            $r.="</TD>";
+
+            if ( $row['jr_valid'] == 'f'  )
+            {
+                $r.="<TD> Op&eacute;ration annul&eacute;e</TD>";
+            }
+            // end row
+            $r.="</tr>";
+
+        }
+               echo '</table>';
+        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 @@
      */
     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 @@
         $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 SRC="image/down.gif" border="0" >';
-        $image_desc='<IMAGE SRC="image/up.gif" border="0">';
-        $image_sel_desc='<IMAGE SRC="image/select1.gif">';
-        $image_sel_asc='<IMAGE SRC="image/select2.gif">';
+               $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");
 
-        $sort_date="<th>  <A class=\"mtitle\" 
HREF=\"?$url&o=da\">$image_asc</A>"._('Date')."<A class=\"mtitle\" 
HREF=\"?$url&o=dd\">$image_desc</A></th>";
-        $sort_description="<th>  <A class=\"mtitle\" 
HREF=\"?$url&o=ca\">$image_asc</A>"._('Description')."<A class=\"mtitle\" 
HREF=\"?$url&o=cd\">$image_desc</A></th>";
-        $sort_amount="<th style=\"text-align:right\">  <A class=\"mtitle\" 
HREF=\"?$url&o=ma\">$image_asc</A>"._('Montant')." <A class=\"mtitle\" 
HREF=\"?$url&o=md\">$image_desc</A></th>";
-        $sort_pj="<th>  <A class=\"mtitle\" 
HREF=\"?$url&o=pja\">$image_asc</A>"._('PJ')."<A class=\"mtitle\" 
HREF=\"?$url&o=pjd\">$image_desc</A></th>";
-        $sort_echeance="<th>  <A class=\"mtitle\" 
HREF=\"?$url&o=ea\">$image_asc</A>"._('Ech')." <A class=\"mtitle\" 
HREF=\"?$url&o=ed\">$image_desc</A> </th>";
-
         $own=new Own($this->db);
-        // if an order is asked
-        if ( isset ($_GET['o']) )
-        {
-            switch ($_GET['o'])
-            {
-            case 'pja':
-                // pj asc
-                $sort_pj="<th>$image_sel_asc PJ <A class=\"mtitle\" 
HREF=\"?$url&o=pjd\">$image_desc</A></th>";
-                $order=' order by  substring(jr_pj_number,\'\\\d+$\')::numeric 
asc ';
-                break;
-            case 'pjd':
-                $sort_pj="<th> <A class=\"mtitle\" 
HREF=\"?$url&o=pja\">$image_asc</A> PJ $image_sel_desc</th>";
-                // 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="<th>$image_sel_asc Date <A class=\"mtitle\" 
HREF=\"?$url&o=dd\">$image_desc</A></th>";
-                $order=' order by jr_date_order 
asc,substring(jr_pj_number,\'\\\d+$\')::numeric asc  ';
-                break;
-            case 'dd':
-                $sort_date="<th> <A class=\"mtitle\" 
HREF=\"?$url&o=da\">$image_asc</A> Date $image_sel_desc</th>";
-                // date desc
-                $order=' order by jr_date_order 
desc,substring(jr_pj_number,\'\\\d+$\')::numeric desc  ';
-                break;
-            case 'ma':
-                // montant asc
-                $sort_amount="<th style=\"text-align:right\"> $image_sel_asc 
Montant <A class=\"mtitle\" HREF=\"?$url&o=md\">$image_desc</A></th>";
-                $order=" order by jr_montant asc ";
-                break;
-            case 'md':
-                // montant desc
-                $sort_amount="<th style=\"text-align:right\">  <A 
class=\"mtitle\"  HREF=\"?$url&o=ma\">$image_asc</A>Montant 
$image_sel_desc</th>";
-                $order=" order by jr_montant desc ";
-                break;
-            case 'ca':
-                // jr_comment asc
-                $sort_description="<th> $image_sel_asc Description <A 
class=\"mtitle\" HREF=\"?$url&o=cd\">$image_desc</A></th>";
-                $order=" order by jr_comment asc ";
-                break;
-            case 'cd':
-                // jr_comment desc
-                $sort_description="<th>  <A class=\"mtitle\" 
HREF=\"?$url&o=ca\">$image_asc</A>Description $image_sel_desc</th>";
-                $order=" order by jr_comment desc ";
-                break;
-            case 'ea':
-                // jr_comment asc
-                $sort_echeance="<th> $image_sel_asc Ech. <A class=\"mtitle\" 
HREF=\"?$url&o=ed\">$image_desc</A></th>";
-                $order=" order by jr_ech asc ";
-                break;
-            case 'ed':
-                // jr_comment desc
-                $sort_echeance="<th>  <A class=\"mtitle\" 
HREF=\"?$url&o=ea\">$image_asc</A> Ech. $image_sel_desc</th>";
-                $order=" order by jr_ech desc ";
-                break;
-
-            }
-        }
-        else
-        {
-            // date asc
-            $sort_date="<th>$image_sel_asc Date <A class=\"mtitle\" 
HREF=\"?$url&o=dd\">$image_desc</A></th>";
-            $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 @@
         {
             $r.=th('Journal');
         }
-        $r.=$sort_date;
-        $r.=$sort_echeance;
-        $r.=$sort_pj;
+        $r.='<th>'.$table->get_header(0).'</th>';
+        $r.='<th>'.$table->get_header(1).'</td>';
+        $r.='<th>'.$table->get_header(2).'</th>';
        $r.=th('tiers');
-        $r.=$sort_description;
+        $r.='<th>'.$table->get_header(4).'</th>';
        $r.=th('Notes',' style="width:15%"');
-        $r.=$sort_amount;
+        $r.='<th>'.$table->get_header(3).'</th>';
         // if $p_paid is not equal to 0 then we have a paid column
         if ( $p_paid != 0 )
         {
@@ -2138,26 +2247,28 @@
         $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
+    /address@hidden return a HTML string with the form for the search
+     address@hidden $p_type if the type of ledger possible 
values=ALL,VEN,ACH,ODS,FIN
+     address@hidden $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
+        address@hidden $div is the div (for reconciliation)
+     address@hidden a HTML String without the tag FORM or DIV
+        *
+     address@hidden build_search_sql
+     address@hidden display_search_form
+     address@hidden 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 @@
         
$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 @@
        // 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 @@
             }
             $desc='';
             $qcode=(isset($qcode))?$qcode:"";
+                       if ( isset($qcodesearch_op)) $qcode=$qcodesearch_op;
             $accounting=(isset($accounting))?$accounting:"";
 
         }
@@ -2370,6 +2482,7 @@
             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 @@
             $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

Modified: phpcompta/trunk/include/class_html_input.php
===================================================================
--- phpcompta/trunk/include/class_html_input.php        2011-11-04 21:27:21 UTC 
(rev 4312)
+++ phpcompta/trunk/include/class_html_input.php        2011-11-04 21:27:50 UTC 
(rev 4313)
@@ -291,7 +291,7 @@
      address@hidden $selected is an array of checkbox
      address@hidden 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 @@
         echo $ledger->input();
 
         /* create a hidden div for the ledger */
-        echo '<div id="div_jrn">';
+        echo '<div id="div_jrn'.$div.'">';
         echo '<h2 class="info">Choix des journaux</h2>';
 
         echo '<ul>';

Modified: phpcompta/trunk/include/class_iconcerned.php
===================================================================
--- phpcompta/trunk/include/class_iconcerned.php        2011-11-04 21:27:21 UTC 
(rev 4312)
+++ phpcompta/trunk/include/class_iconcerned.php        2011-11-04 21:27:50 UTC 
(rev 4313)
@@ -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
-                   <INPUT TYPE=\"button\" 
onClick=SearchJrn(".dossier::id().",'%s',%s,'%s') value=\"?\">
-                   $etd  $td
+        $r=sprintf("
+                   <INPUT TYPE=\"button\" 
onClick=search_reconcile(".dossier::id().",'%s','%s','%s') value=\"?\">
                    <INPUT TYPE=\"text\"  
style=\"color:black;background:lightyellow;border:solid 1px grey;\"  
NAME=\"%s\" ID=\"%s\" VALUE=\"%s\" SIZE=\"8\" readonly>
-                   $etd",
+                   ",
                    $this->name,
-                   $this->extra,
-                   $this->extra2,
+                   $this->amount_id,
+                   $this->ledger,
                    $this->name,
                    $this->name,
                    $this->value

Added: phpcompta/trunk/include/search.inc.php
===================================================================
--- phpcompta/trunk/include/search.inc.php                              (rev 0)
+++ phpcompta/trunk/include/search.inc.php      2011-11-04 21:27:50 UTC (rev 
4313)
@@ -0,0 +1,141 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/* $Revision: 4215 $ */
+// Copyright Author Dany De Bontridder address@hidden
+/*! \file
+ * \brief Search module
+ */
+require_once('class_dossier.php');
+include_once("ac_common.php");
+require_once('class_acc_ledger.php');
+
+
+$gDossier=dossier::id();
+
+require_once('class_database.php');
+/* Admin. Dossier */
+
+$cn=new Database($gDossier);
+include_once ('class_user.php');
+$User=new User($cn);
+$User->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 '<div class="content" >';
+       echo     '<form method="GET">';
+       }
+       else
+       {
+               $div='search_op';
+               $action="";
+               $callback="";
+               require 'template/search_top.php';
+               echo '<form onsubmit="search_operation(this);return false">';
+               echo HtmlInput::get_to_hidden(array('ctlc','ledger'));
+               $inside=true;
+       }
+
+echo $search_box;
+echo HtmlInput::submit("viewsearch",_("Recherche"));
+echo HtmlInput::button_close('search_op');
+echo '</form>';
+
+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 '<span class="notice">Nombre 
d\'enregistrements trouvés =' .$max_line.' limite =  '.$step.'</SPAN>';
+   }
+       echo '<form method="get" onsubmit="set_reconcile(this);return false">';
+
+    echo $content;
+       echo HtmlInput::submit("upd_rec","Mettre à jour");
+       echo '</form>';
+    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 '</div>';
+?>

Modified: phpcompta/trunk/include/template/ledger_detail_bottom.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_bottom.php   2011-11-04 
21:27:21 UTC (rev 4312)
+++ phpcompta/trunk/include/template/ledger_detail_bottom.php   2011-11-04 
21:27:50 UTC (rev 4313)
@@ -25,9 +25,9 @@
                                           $aRap[$e],
                                           $tableid
                                          );
-    if ( $access=='W') 
+    if ( $access=='W')
       $remove=$rmReconciliation->input();
-    else 
+    else
       $remove='';
     echo tr (td('<a href="javascript:void(0)" onclick="'.$str.'" 
>'.$internal.'</A>').td($amount).td($array_jr[0]['jr_comment']).td($remove));
   }
@@ -37,7 +37,7 @@
 </legend>
 <?
 if ( $access=='W') {
-  $search='<INPUT TYPE="BUTTON" class="button" VALUE="Cherche" 
OnClick="SearchJrn('.$gDossier.",'rapt".$div."','".$obj->det->jr_montant."')\">";
+  $search='<INPUT TYPE="BUTTON" class="button" VALUE="Cherche" 
OnClick="search_reconcile('.$gDossier.",'rapt".$div."','".$obj->det->jr_montant."')\">";
   $rapt=new IText('rapt'.$div);
   echo $rapt->input().$search;
 }
@@ -46,10 +46,10 @@
 </fieldset>
 <?
 
-require_once('template/ledger_detail_file.php'); 
+require_once('template/ledger_detail_file.php');
 ?>
 <hr>
-<? 
+<?
 
 if ( $div != 'popup' ) {
   $a=new IButton('Fermer','Fermer');
@@ -59,8 +59,8 @@
 }
 
 ?>
-<?if ( $access=='W') { 
-  echo HtmlInput::submit('save',_('Sauver'),'onClick="return 
verify_ca(\'popup\');"'); 
+<?if ( $access=='W') {
+  echo HtmlInput::submit('save',_('Sauver'),'onClick="return 
verify_ca(\'popup\');"');
   $owner=new Own($cn);
   if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){
     echo '<input type="button" class="button" value="'._('verifie CA').'" 
onClick="verify_ca(\'popup\');">';
@@ -78,9 +78,9 @@
   $reverse->label=_('Extourner');
   $reverse->javascript="g('ext".$div."').style.display='block'";
   echo $reverse->input();
-  
+
 echo '</form>';
-  
+
   echo '<div id="ext'.$div.'" style="display:none">';
   $date=new IDate('ext_date');
   $r="<form id=\"form_".$div."\" onsubmit=\"this.divname='$div';return 
reverseOperation(this);\">";

Added: phpcompta/trunk/include/template/search_top.php
===================================================================
--- phpcompta/trunk/include/template/search_top.php                             
(rev 0)
+++ phpcompta/trunk/include/template/search_top.php     2011-11-04 21:27:50 UTC 
(rev 4313)
@@ -0,0 +1,42 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/* !\file
+ *
+ *
+ * \brief
+ *
+ */
+?>
+<div 
style="float:right;height:10px;display:block;margin-top:2px;margin-right:2px">
+<?
+   if ($div == "search_op") {
+     $callback=$_SERVER['PHP_SELF'];
+     $str="recherche.php?".Dossier::get().'&ac=SEARCH';
+     echo '<A style="background-color:blue;color:white;text-decoration:none" 
HREF="javascript:void(0)" onclick="removeDiv(\''.$div.'\');">Fermer</A>';
+   }
+?>
+</div>
+<div>
+       <? echo h2info('Recherche')?>
+</div>
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]