phpcompta-dev
[Top][All Lists]
Advanced

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

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


From: phpcompta-dev
Subject: [Phpcompta-dev] r5369 - in phpcompta/trunk: html html/js include
Date: Sat, 31 Aug 2013 00:25:46 +0200 (CEST)

Author: danydb
Date: 2013-08-31 00:25:45 +0200 (Sat, 31 Aug 2013)
New Revision: 5369

Modified:
   phpcompta/trunk/html/js/acc_ledger.js
   phpcompta/trunk/html/style.css
   phpcompta/trunk/include/ajax_update_predef.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/class_pre_operation.php
   phpcompta/trunk/include/compta_ach.inc.php
   phpcompta/trunk/include/compta_ven.inc.php
   phpcompta/trunk/include/operation_ods_new.inc.php
Log:
Model of operation in a DIV

Modified: phpcompta/trunk/html/js/acc_ledger.js
===================================================================
--- phpcompta/trunk/html/js/acc_ledger.js       2013-08-30 20:42:30 UTC (rev 
5368)
+++ phpcompta/trunk/html/js/acc_ledger.js       2013-08-30 22:25:45 UTC (rev 
5369)
@@ -28,21 +28,39 @@
 /**
 * @brief update the list of available predefined operation when we change the 
ledger.
 */
-function update_predef(p_type,p_direct)
+function update_predef(p_type,p_direct,p_ac)
 {
     var jrn=g("p_jrn").value;
     var dossier=g("gDossier").value;
-    var 
querystring='gDossier='+dossier+'&l='+jrn+'&t='+p_type+'&d='+p_direct+"&op=up_predef";
+    var 
querystring='gDossier='+dossier+'&l='+jrn+'&t='+p_type+'&d='+p_direct+"&op=up_predef&ac="+p_ac;
     g("p_jrn_predef").value=jrn;
-    var action=new Ajax.Request(
-                   "ajax_misc.php",
-                   {
-                   method:'get',
-                   parameters:querystring,
-                   onFailure:error_get_predef,
-                   onSuccess:success_get_predef
-                   }
-               );
+    var action = new Ajax.Request(
+            "ajax_misc.php",
+            {
+                method: 'get',
+                parameters: querystring,
+                onFailure: error_get_predef,
+                onSuccess: function(req) {
+                    try {
+                        $('info_div').innerHTML = "ok";
+                        var answer = req.responseXML;
+                        var a = answer.getElementsByTagName('code');
+                        var html = answer.getElementsByTagName('value');
+                        if (a.length == 0)
+                        {
+                            var rec = req.responseText;
+                            alert('erreur :' + rec);
+                        }
+                        var code_html = getNodeText(html[0]);
+                        code_html = unescape_xml(code_html);
+                        // document.getElementsByName(name_ctl)[0].value = 
code_html;
+                        $('modele_op_div').innerHTML=code_html;
+                    } catch (e) {
+                        $('info_div').innerHTML = e.getMessage;
+                    }
+                }
+            }
+    );
 }
 
 /**
@@ -79,25 +97,6 @@
 /**
  * @brief update the field predef
  */
-function success_get_predef(request,json)
-{
-    var i=0;
-    var answer=request.responseText.evalJSON(true);
-    obj=g("pre_def");
-    obj.innerHTML='';
-    if ( answer.count == 0 ) return;
-
-    for ( i = 0 ; i < answer.count;i++)
-    {
-        value=answer['value'+i];
-        label=answer['label'+i];
-        obj.options[obj.options.length]=new Option(label,value);
-    }
-
-}
-/**
- * @brief update the field predef
- */
 function error_get_predef(request,json)
 {
     alert ("Erreur mise à jour champs non possible");

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2013-08-30 20:42:30 UTC (rev 5368)
+++ phpcompta/trunk/html/style.css      2013-08-30 22:25:45 UTC (rev 5369)
@@ -1252,4 +1252,17 @@
     border:solid blue 1px;
     width:90%;
     margin-left:5%;
+}
+div#modele_op_div{
+    display: none;
+    background-color:#e4e7ed;
+    font-family:arial,verdana,sans-serif,helvetica;
+    padding:0;
+    margin:0;
+    overflow:hidden;
+    z-index:3;
+    position:absolute;
+    left:10%;
+    width:60%;
+    border:1px solid darkblue;
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/ajax_update_predef.php
===================================================================
--- phpcompta/trunk/include/ajax_update_predef.php      2013-08-30 20:42:30 UTC 
(rev 5368)
+++ phpcompta/trunk/include/ajax_update_predef.php      2013-08-30 22:25:45 UTC 
(rev 5369)
@@ -48,21 +48,21 @@
 $op->set('ledger',$l);
 $op->set('ledger_type',$t);
 $op->set('direct',$d);
-$array=$op->get_operation();
-$string='{"count":"'.count($array).'"';
-$idx=0;
-if (! empty($array))
-    foreach ($array as $a)
-{
-    $string.=',"value'.$idx.'":"'.$a['value'].'",';
-    $string.='"label'.$idx.'":"'.$a['label'].'"';
-    $idx++;
-}
-$string.="}";
+$url=http_build_query(array('action'=>'use_opd','p_jrn_predef'=>$l,'ac'=>$_GET['ac'],'gDossier'=>dossier::id()));
+$html="";
 
-header("Content-type: text/json; charset: utf8",true);
-echo $string;
+$html.=HtmlInput::title_box("Modèle d'opérations ", 'modele_op_div', 'hide');
+$html.=$op->show_button('do.php?'.$url);
 
+$html=escape_xml($html);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<code></code>
+<value>$html</value>
+</data>
+EOF;
 
 ?>
 

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-08-30 20:42:30 UTC 
(rev 5368)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-08-30 22:25:45 UTC 
(rev 5369)
@@ -1586,7 +1586,7 @@
                $wLedger = $this->select_ledger('ODS', 2);
                if ($wLedger == null)
                        exit(_('Pas de journal disponible'));
-               $wLedger->javascript = 
"onChange='update_name();update_predef(\"ods\",\"t\");$add_js'";
+               $wLedger->javascript = 
"onChange='update_name();update_predef(\"ods\",\"t\",\"".$_REQUEST['ac']."\");$add_js'";
                $label = " Journal " . HtmlInput::infobulle(2);
 
                $ret.=$label . $wLedger->input();

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-08-30 
20:42:30 UTC (rev 5368)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-08-30 
22:25:45 UTC (rev 5369)
@@ -985,7 +985,7 @@
 
                $wLedger=$this->select_ledger('ACH',2);
         if ($wLedger == null) exit (_('Pas de journal disponible'));
-        $wLedger->javascript="onChange='update_predef(\"ach\",\"f\");$add_js'";
+        
$wLedger->javascript="onChange='update_predef(\"ach\",\"f\",\"".$_REQUEST['ac']."\");$add_js'";
         $wLedger->table=1;
         $f_jrn=$wLedger->input();
 

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2013-08-30 20:42:30 UTC 
(rev 5368)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2013-08-30 22:25:45 UTC 
(rev 5369)
@@ -1051,7 +1051,7 @@
         if ($wLedger == null)
             exit(_('Pas de journal disponible'));
         $wLedger->table = 1;
-        $wLedger->javascript = 
"onChange='update_predef(\"ven\",\"f\");$add_js'";
+        $wLedger->javascript = 
"onChange='update_predef(\"ven\",\"f\",\"".$_REQUEST['ac']."\");$add_js'";
         $wLedger->label = " Journal " . HtmlInput::infobulle(2);
 
         $f_jrn = $wLedger->input();

Modified: phpcompta/trunk/include/class_pre_operation.php
===================================================================
--- phpcompta/trunk/include/class_pre_operation.php     2013-08-30 20:42:30 UTC 
(rev 5368)
+++ phpcompta/trunk/include/class_pre_operation.php     2013-08-30 22:25:45 UTC 
(rev 5369)
@@ -221,14 +221,16 @@
 
     /*!\brief show a form to use pre_op
      */
-    function form_get ()
+    function form_get ($p_url)
     {
-
+        $r=HtmlInput::button_action("Modèle d'opérations", ' 
$(\'modele_op_div\').style.display=\'block\';$(\'lk_modele_op_tab\').focus();');
+        $r.='<div id="modele_op_div">';
+        $r.=HtmlInput::title_box("Modèle d'opérations ", 'modele_op_div', 
'hide');
         $hid=new IHidden();
-        $r=$hid->input("action","use_opd");
+        $r.=$hid->input("action","use_opd");
         $r.=$hid->input("jrn_type",$this->get("ledger_type"));
-        $r.= HtmlInput::submit('use_opd','Utilisez une op&eacute;ration 
pr&eacute;d&eacute;finie','','smallbutton');
-        $r.= $this->show_button();
+        $r.= $this->show_button($p_url);
+        $r.='</div>';
         return $r;
 
     }
@@ -242,15 +244,21 @@
         return $a;
     }
     /*!\brief show the button for selecting a predefined operation */
-    function show_button()
+    function show_button($p_url)
     {
-
-        $select=new ISelect();
-
         $value=$this->get_operation();
-        //     if ( empty($value)==true) return "";
-        $select->value=$value;
-        $r=$select->input("pre_def");
+        $r="";
+        $r.='<h2>Choississez un modèle</h2>';
+        $r.='Filtrer '.HtmlInput::filter_table('modele_op_tab', '0', '0');
+        $r.='<table style="width:100%" id="modele_op_tab">';
+        for ($i=0;$i<count($value);$i++) {
+            $r.='<tr class="'.(($i%2==0)?"even":"odd").'">';
+            $r.='<td>';
+            $r.=sprintf('<a href="%s&pre_def=%s" 
onclick="waiting_box()">%s</a>',$p_url,$value[$i]['value'],$value[$i]['label']);
+            $r.='</td>';
+            $r.='</tr>';
+        }
+        $r.='</table>';
         return $r;
     }
     public function   get_operation()

Modified: phpcompta/trunk/include/compta_ach.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ach.inc.php  2013-08-30 20:42:30 UTC (rev 
5368)
+++ phpcompta/trunk/include/compta_ach.inc.php  2013-08-30 22:25:45 UTC (rev 
5369)
@@ -179,23 +179,20 @@
 // pre defined operation
 //
 echo '<div id="predef_form">';
-echo '<form method="GET" action="do.php">';
-echo dossier::hidden();
 echo HtmlInput::hidden('p_jrn_predef', $Ledger->id);
-echo HtmlInput::hidden('ac', $_REQUEST['ac']);
 $op = new Pre_op_ach($cn);
 $op->set('ledger', $Ledger->id);
 $op->set('ledger_type', "ACH");
 $op->set('direct', 'f');
-echo $op->form_get();
-echo '</form>';
+$url=http_build_query(array('p_jrn_predef'=>$Ledger->id,'ac'=>$_REQUEST['ac'],'gDossier'=>dossier::id()));
+echo $op->form_get('do.php?'.$url);
 echo '</div>';
 echo '</div>';
 
 echo '<div class="content">';
 echo "<FORM class=\"print\"NAME=\"form_detail\" METHOD=\"POST\" >";
 /* request for a predefined operation */
-if (isset($_GET['use_opd']) && isset($_REQUEST['pre_def']) && 
!isset($_POST['correct']))
+if ( isset($_REQUEST['pre_def']) && !isset($_POST['correct']))
 {
        // used a predefined operation
        //

Modified: phpcompta/trunk/include/compta_ven.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ven.inc.php  2013-08-30 20:42:30 UTC (rev 
5368)
+++ phpcompta/trunk/include/compta_ven.inc.php  2013-08-30 22:25:45 UTC (rev 
5369)
@@ -165,7 +165,7 @@
 //
 // pre defined operation
 //
-
+echo '<div class="content">';
     if ( !isset($_REQUEST ['p_jrn']) )
     {
         $def_ledger=$Ledger->get_first('ven',2);
@@ -181,17 +181,14 @@
                $Ledger->id=$_REQUEST['p_jrn_predef'];
        }
 
-   echo '<div id="predef_form">';
-    echo '<form style="display:inline" method="GET" >';
-       echo HtmlInput::hidden('ac',$_REQUEST['ac']);
-    echo dossier::hidden();
-    echo HtmlInput::hidden('p_jrn_predef',$Ledger->id);
+    echo '<div id="predef_form">';
+    echo HtmlInput::hidden('p_jrn_predef', $Ledger->id);
     $op=new Pre_op_ven($cn);
     $op->set('ledger',$Ledger->id);
     $op->set('ledger_type',"VEN");
     $op->set('direct','f');
-    echo $op->form_get();
-    echo '</form>';
+    
$url=http_build_query(array('p_jrn_predef'=>$Ledger->id,'ac'=>$_REQUEST['ac'],'gDossier'=>dossier::id()));
+    echo $op->form_get('do.php?'.$url);
     echo '</div>';
 
    echo '<div class="content">';

Modified: phpcompta/trunk/include/operation_ods_new.inc.php
===================================================================
--- phpcompta/trunk/include/operation_ods_new.inc.php   2013-08-30 20:42:30 UTC 
(rev 5368)
+++ phpcompta/trunk/include/operation_ods_new.inc.php   2013-08-30 22:25:45 UTC 
(rev 5369)
@@ -45,18 +45,14 @@
 }
 echo '<div class="content">';
 echo '<div id="predef_form">';
-echo '<form method="GET" action="do.php">';
-echo HtmlInput::hidden("action", "use_opd");
-echo HtmlInput::hidden("ac",$_REQUEST['ac']);
-echo dossier::hidden();
 echo HtmlInput::hidden('p_jrn_predef', $ledger->id);
 $op = new Pre_op_ods($cn);
 $op->set('ledger', $ledger->id);
 $op->set('ledger_type', "ODS");
 $op->set('direct', 't');
-echo $op->form_get();
+$url=http_build_query(array('action'=>'use_opd','p_jrn_predef'=>$ledger->id,'ac'=>$_REQUEST['ac'],'gDossier'=>dossier::id()));
+echo $op->form_get('do.php?'.$url);
 
-echo '</form>';
 echo '</div>';
 echo '<div id="jrn_name_div">';
 echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . 
'</h2>';



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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