phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r408 - in trunk: . rapport_avance rapport_avance/doc rap


From: phpcompta-dev
Subject: [Phpcompta-dev] r408 - in trunk: . rapport_avance rapport_avance/doc rapport_avance/include rapport_avance/include/template rapport_avance/sql
Date: Sat, 22 Sep 2012 02:51:53 +0200 (CEST)

Author: danydb
Date: 2012-09-22 02:51:52 +0200 (Sat, 22 Sep 2012)
New Revision: 408

Added:
   trunk/rapport_avance/
   trunk/rapport_avance/ajax.php
   trunk/rapport_avance/ajax_add_param_detail.php
   trunk/rapport_avance/ajax_save_param_detail.php
   trunk/rapport_avance/ajax_search_code.php
   trunk/rapport_avance/include/
   trunk/rapport_avance/include/class_formulaire_param.php
   trunk/rapport_avance/include/class_formulaire_param_detail.php
   trunk/rapport_avance/include/class_rapav_formulaire.php
   trunk/rapport_avance/include/class_rapport_avance_sql.php
   trunk/rapport_avance/include/declaration.inc.php
   trunk/rapport_avance/include/formulaire.inc.php
   trunk/rapport_avance/include/template/
   trunk/rapport_avance/include/template/formulaire_definition.php
   trunk/rapport_avance/include/template/formulaire_listing.php
   trunk/rapport_avance/include/template/formulaire_titre.php
   trunk/rapport_avance/include/template/param_detail_new.php
   trunk/rapport_avance/index.php
   trunk/rapport_avance/rapav_constant.php
   trunk/rapport_avance/rapav_javascript.js
   trunk/rapport_avance/raw.php
   trunk/rapport_avance/sql/create.sql
Removed:
   trunk/rapport_avance/ajax.php
   trunk/rapport_avance/doc/625-notice.pdf
   trunk/rapport_avance/doc/extension_tva.odt
   trunk/rapport_avance/doc/extension_tva.pdf
   trunk/rapport_avance/index.php
   trunk/rapport_avance/sql/patch2.sql
Log:
definition + param

Copied: trunk/rapport_avance (from rev 402, trunk/tva)

Deleted: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/tva/ajax.php  2012-09-04 16:45:36 UTC (rev 402)
+++ trunk/rapport_avance/ajax.php       2012-09-22 00:51:52 UTC (rev 408)
@@ -1,232 +0,0 @@
-<?php
-require_once('class_database.php');
-require_once('class_ext_tva.php');
-require_once('class_ibutton.php');
-require_once ('class_ext_list_intra.php');
-require_once ('class_ext_list_assujetti.php');
-require_once('class_acc_ledger.php');
-
-extract($_GET);
-global $g_parameter,$cn;
-
-$html='';$extra='';$ctl='';
-switch($act) {
-case 'dsp_decl':
-  /* the hide button */
-  $button=new IButton('hide');
-  $button->label=_('Retour');
-  $button->javascript="$('detail').hide();$('main').show();";
-  if ( $type == 1) {
-    /* display the declaration of amount */
-    $decl=new Ext_Tva($cn);
-    $decl->set_parameter('id',$id);
-    $decl->load();
-    $r=$button->input();
-    $r.=$decl->display();
-    $r.=$button->input();
-  }
-  if ( $type == 3) {
-    /* display the declaration for INTRACOM */
-    $decl=new Ext_List_Intra($cn);
-    $decl->set_parameter('id',$id);
-    $decl->load();
-    $r=$button->input();
-    $r.=$decl->display();
-    $r.=$button->input();
-  }
-  if ( $type == 2) {
-    /* display the declaration of customer */
-    $decl=new Ext_List_Assujetti($cn);
-    $decl->set_parameter('id',$id);
-    $decl->load();
-    $r=$button->input();
-    $r.=$decl->display();
-    $r.=$button->input();
-  }
-
-  break;
-  /**
-   * generate writing
-   */
-case 'rw':
-  require_once('class_acc_ledger.php');
-  $count=$cn->get_value('select count(*) from tva_belge.declaration_amount 
where da_id=$1',array($_REQUEST['p_id']));
-  if ( $count == 1 )
-    {
-      $ctl='record_write';
-      $ledger=new Acc_ledger($cn,0);
-      $sel_ledger=$ledger->select_ledger('ODS',1);
-      $r=HtmlInput::title_box('Génération écriture','record_write');
-         if ($sel_ledger != null)
-         {
-                 $r.='<form onsubmit="save_write(this);return false;">';
-                 $decl=new Ext_Tva($cn);
-                 $decl->set_parameter('id',$_GET['p_id']);
-                 $decl->load();
-                 $date=new IDate('pdate');
-                 $r.="Date :".$date->input().'<br>';
-                 $r.="Choix du journal : ".$sel_ledger->input();
-                 $r.=$decl->propose_form();
-                 $r.=HtmlInput::hidden('mt',microtime(true));
-                 $r.=HtmlInput::extension();
-                 $r.=dossier::hidden();
-                 $r.=HtmlInput::submit('save','Sauver','onclick="return 
confirm(\'Vous confirmez ? \')"');
-                 $r.='</form>';
-               } else {
-                       $r.='<h2 class="error"> Aucun journal accessible</h2>';
-               }
-       }
-       else
-    {
-      $ctl='record_write';
-      $r=HtmlInput::anchor_close($ctl);
-      $r.="<h2 class=\"info\">Désolé cette opération n'existe pas </h2>";
-      $r.='<span class="notice">Il se peut que l\'information aie été 
effacée</span>';
-      $r.=HtmlInput::button_close($ctl);
-    }
-  break;
-
-case 'sw':
-  $ctl='record_write';
-  ob_start();
-  echo   '<div style="float:right"><a class="mtitle" href="javascript:void(0)" 
onclick="removeDiv(\'record_write\')">fermer</a></div>';
-  extract($_GET);
-  try {
-    $array=array();
-    $array['e_date']=$pdate;
-    /* give automatically the periode */
-    $periode=new Periode($cn);
-    $periode->find_periode($pdate);
-    $array['period']=$periode->p_id;
-    $nb_item=count($account);
-    for ($i=0;$i<count($account);$i++) {
-      $array['amount'.$i]=$amount[$i];
-      $array['poste'.$i]=$account[$i];
-      $array['ld'.$i]='';
-      if ( isset($deb[$i])) $array['ck'.$i]=1;
-    }
-    /* ATVA */
-    if ( isset($atva)) {
-      $array['poste'.$i]=$atva;
-      $array['amount'.$i]=$atva_amount;
-      $array['ld'.$i]='';
-      if ( isset($atva_ic)) $array['ck'.$i]=1;
-      $i++;
-      $nb_item++;
-    }
-    /* CRED */
-   if ( isset($crtva)) {
-      $array['poste'.$i]=$crtva;
-      $array['amount'.$i]=$crtva_amount;
-      $array['ld'.$i]='';
-      if ( isset($crtva_ic)) $array['ck'.$i]=1;
-      $i++;
-      $nb_item++;
-    }
-    /* DET */
-   if ( isset($dttva)) {
-      $array['poste'.$i]=$dttva;
-      $array['amount'.$i]=$dttva_amount;
-      $array['ld'.$i]='';
-      if ( isset($dttva_ic)) $array['ck'.$i]=1;
-      $i++;
-      $nb_item++;
-    }
-    /* solde */
-   if ( isset($solde)) {
-      $array['poste'.$i]=$solde;
-      $array['amount'.$i]=$solde_amount;
-      $array['ld'.$i]='';
-      if ( isset($solde_ic)) $array['ck'.$i]=1;
-      $i++;
-      $nb_item++;
-    }
-   $array['nb_item']=$nb_item;
-   $array['e_pj']='';
-   $array['e_pj_suggest']='NONE';
-
-   $array['p_jrn']=$p_jrn;
-   $array['mt']=$mt;
-
-   $array['desc']='Extension TVA : écriture générée';
-   $ods=new Acc_Ledger($cn,$p_jrn);
-   $ods->save($array);
-   echo h2info("Sauvée : ajoutez le numéro de pièce");
-   echo   HtmlInput::detail_op($ods->jr_id,'détail opération : 
'.$ods->internal);
-   $ods->with_concerned=false;
-   echo $ods->confirm($array,true);
-  } catch(Exception $e) {
-    echo alert($e->getMessage());
-  }
-  $r=ob_get_contents();
-  ob_end_clean();
-   break;
-case 'rm_form':
-  switch($type)
-    {
-    case 'da':
-      $sql="delete from tva_belge.declaration_amount where da_id=$1";
-      break;
-    case 'li':
-      $sql="delete from tva_belge.intracomm where i_id=$1";
-      break;
-    case 'lc':
-      $sql="delete from tva_belge.assujetti where a_id=$1";
-      break;
-    }
-  $ctl='remove_form';
-  $cn->exec_sql($sql,array($_REQUEST['p_id']));
-  $r=HtmlInput::anchor_close($ctl);
-  $r.='<h2 class="info"> Information </h2>';
-  $r.='<h2 class="notice">Opération effacée</h2>';
-  $r.=HtmlInput::button_close($ctl);
-  $html=escape_xml($r);
-  break;
-case 'add_param':
-       $ctl="paramadd_id";
-       $r=HtmlInput::title_box("Ajout paramètre",$ctl);
-       $r.='<h3>'._('Pour la grille ').$pcode.'</h3>';
-       // TVA input
-       $text = new ITva_Popup('tva_id');
-       $text->add_label('tva_label');
-       $text->js = 'onchange="set_tva_label(this);"';
-       $text->with_button(true);
-
-       // Accounting
-       $iposte=new IPoste('paccount');
-       $iposte->set_attribute('gDossier',Dossier::id());
-       $iposte->set_attribute('jrn',0);
-       $iposte->set_attribute('account','paccount');
-       $iposte->set_attribute('label','paccount_label');
-
-
-       $r.='<form method="POST" id="faddparm"onsubmit="return confirm(\'Vous 
confirmez ?\');" style="margin-left:15px">';
-       
$r.=HtmlInput::request_to_hidden(array("tab","gDossier","plugin_code","ac","pcode"));
-       $r.=_(" Code TVA ");
-       $r.=$text->input();
-       $r.='<span id="tva_label" style="display:block"></span>';
-       $r.=" Poste comptable (utilisez le % pour inclure les postes qui en 
dépendent)";
-       $r.=$iposte->input();
-
-       $r.='<span id="paccount_label" style="display:inline"></span>';
-       $r.='<span style="display:block"></span>';
-       $r.=HtmlInput::submit("save_addparam","Sauver");
-       $r.=HtmlInput::button_close($ctl);
-       $r.='</form>';
-       break;
-default:
-  $r=var_export($_REQUEST,true);
-}
-
-$html=escape_xml($r);
-
-header('Content-type: text/xml; charset=UTF-8');
-echo <<<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<data>
-<ctl>$ctl</ctl>
-<code>$html</code>
-<extra>$extra</extra>
-</data>
-EOF;
-?>
\ No newline at end of file

Copied: trunk/rapport_avance/ajax.php (from rev 402, trunk/tools/ajax.php)
===================================================================
--- trunk/rapport_avance/ajax.php                               (rev 0)
+++ trunk/rapport_avance/ajax.php       2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,122 @@
+<?php
+extract($_GET);
+global $cn;
+switch ($act)
+{
+       /*       * 
*******************************************************************************************************
 */
+       // Modifie une definition de formulaire
+       /*       * 
*******************************************************************************************************
 */
+
+       case 'mod_form':
+               require_once 'include/class_rapav_formulaire.php';
+               if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
+                       exit();
+               echo '<h1>Définition </h1>';
+               $form = new RAPAV_formulaire($_REQUEST['f_id']);
+               $form->load_definition();
+               echo '<form method="POST" class="print">';
+               $form->input_formulaire();
+               $form->input_definition();
+               echo HtmlInput::submit('form_def_sub', 'Sauve');
+               echo '</form>';
+               break;
+       /*       * 
**************************************************************************************************************
+        * Ajoute une ligne dans la definition
+        * 
***************************************************************************************************************
 */
+       case 'add_row_definition':
+               $type_row = $cn->make_array("select p_type,p_description from 
rapport_advanced.type_row order by p_description");
+               $type_periode = $cn->make_array("select t_id,t_description from 
rapport_advanced.periode_type order by t_description");
+               ?>
+               <td>
+                       <?= HtmlInput::hidden('p_id[]', -1)?>
+                       <?
+                       $p_code = new IText('p_code[]');
+                       $p_code->size = "10";
+                       echo $p_code->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                       $p_libelle = new IText('p_libelle[]');
+                       $p_libelle->css_size = "100%";
+                       echo $p_libelle->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                       $p_type = new ISelect('p_type[]');
+                       $p_type->value = $type_row;
+                       echo $p_type->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                       $p_type_periode = new ISelect('t_id[]');
+                       $p_type_periode->value = $type_periode;
+                       echo $p_type_periode->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                       $p_order = new INum('p_order[]');
+                       $p_order->prec = 0;
+                       $p_order->size = 4;
+                       echo $p_order->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                       $p_info = new IText('p_info[]');
+                       $p_info->css_size = "100%";
+                       echo $p_info->input();
+                       ?>
+               </td>'
+               <?
+               break;
+       /*       * 
**************************************************************************************************************
+        * Montre le résultat et permet de changer les paramètrages d'un 
formulaire
+        * uniquement pour ceux ayant un champs de calcul (formule, code 
tva+poste comptable + totaux intermédiare
+        * 
***************************************************************************************************************
 */
+       case 'mod_param':
+               require_once 'include/class_rapav_formulaire.php';
+               if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
+                       exit();
+               echo '<h1>Paramètre </h1>';
+               $form = new RAPAV_formulaire($_REQUEST['f_id']);
+               $form->load_definition();
+               echo '<form method="POST" class="print">';
+               echo HtmlInput::hidden('f_id', $_REQUEST['f_id']);
+               $form->echo_formulaire();
+               $form->input_parameter();
+               echo HtmlInput::submit('form_param_sub', 'Sauve');
+               echo '</form>';
+               break;
+
+       
/******************************************************************************************************************
+        * Montre un écran pour ajouter une ligne de formulaire dans les 
paramètre de formulaires
+        */
+       case 'add_param_detail':
+               include 'ajax_add_param_detail.php';
+               break;
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       //rapav_search_code cherche les codes du formulaires courants
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       case 'rapav_search_code':
+               include 'ajax_search_code.php';
+               break;
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       // Sauve résultat et renvoie un xml
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       case 'save_param_detail':
+               include 'ajax_save_param_detail.php';
+               break;
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       // Delete un formulaire_param_detail
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       case 'delete_param_detail':
+               $cn->exec_sql("delete from 
rapport_advanced.formulaire_param_detail where fp_id=$1",array($fp_id));
+       default:
+               break;
+
+}
+?>

Added: trunk/rapport_avance/ajax_add_param_detail.php
===================================================================
--- trunk/rapport_avance/ajax_add_param_detail.php                              
(rev 0)
+++ trunk/rapport_avance/ajax_add_param_detail.php      2012-09-22 00:51:52 UTC 
(rev 408)
@@ -0,0 +1,37 @@
+<?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 Montre un form pour ajouter une formule
+ * retour en XML
+ */
+require_once 'include/class_formulaire_param.php';
+require_once 'include/class_formulaire_param_detail.php';
+
+global $cn;
+
+$obj=new Formulaire_Param_Detail();
+
+$obj->input_new($p_id);
+?>

Added: trunk/rapport_avance/ajax_save_param_detail.php
===================================================================
--- trunk/rapport_avance/ajax_save_param_detail.php                             
(rev 0)
+++ trunk/rapport_avance/ajax_save_param_detail.php     2012-09-22 00:51:52 UTC 
(rev 408)
@@ -0,0 +1,136 @@
+<?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 sauve la nouvelle ligne de détail (paramètre) et renvoie un xml
+ * avec code = ok ou nok, p_id pk de formulaire_param et html le code html à 
afficher : soit une ligne à ajouter à la table
+ * soit le message d'erreur à ajouter dans le div
+ *
+ *
+ */
+require_once 'class_impress.php';
+require_once 'include/class_formulaire_param_detail.php';
+$fp_id=0;
+switch($tab)
+{
+       case 'account_tva':
+               $acc_tva=new RAPAV_Account_Tva();
+               $acc_tva->tva_id=$code_tva;
+               $acc_tva->tmp_val=$formtva;
+               $acc_tva->jrn_def_type=$code_jrn;
+               $acc_tva->p_id=$p_id;
+               $acc_tva->type_detail=2;
+               if ($acc_tva->verify() == 1)
+               {
+                       $code='nok';
+                       $html="Erreur dans la formule ".$acc_tva->errcode;
+               }
+               else
+               {
+                       $acc_tva->insert();
+                       $code='ok';
+                       $fp_id=$acc_tva->fp_id;
+                       $html='<td>';
+                       ob_start();
+                       $acc_tva->display_row();
+                       $html.=ob_get_contents();
+                       ob_end_clean();
+                       $html.= '</td>';
+                       $html.='<td id="del_'.$acc_tva->fp_id.'">';
+                       
$html.=HtmlInput::anchor("Effacer","",sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+                                       , $_REQUEST['plugin_code'], 
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_tva->fp_id));
+                       $html.= '</td>';
+               }
+               break;
+       case 'formula':
+               $acc_formula=new RAPAV_Formula();
+               $acc_formula->fp_formula=$formula_new;
+               $acc_formula->p_id=$p_id;
+               $acc_formula->type_detail=1;
+               if ($acc_formula->verify() == 1)
+               {
+                       $code='nok';
+                       $html=$acc_formula->errcode;
+               }
+               else
+               {
+                       $acc_formula->insert();
+                       $fp_id=$acc_formula->fp_id;
+                       $code='ok';
+                       $html='<td>';
+                       ob_start();
+                       $acc_formula->display_row();
+                       $html.=ob_get_contents();
+                       ob_end_clean();
+                       $html.= '</td>';
+                       $html.='<td id="del_'.$acc_formula->fp_id.'">';
+                       
$html.=HtmlInput::anchor("Effacer","",sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+                               , $_REQUEST['plugin_code'], $_REQUEST['ac'], 
$_REQUEST['gDossier'], $acc_formula->fp_id));
+                       $html.='</td>';
+
+               }
+               break;
+       case 'compute_id':
+               $acc_compute=new RAPAV_Compute();
+               $acc_compute->fp_formula=$form_compute;
+               $acc_compute->p_id=$p_id;
+               $acc_compute->type_detail=3;
+               if ($acc_compute->verify() == 1)
+               {
+                       $code='nok';
+                       $html=$acc_compute->errcode;
+               }
+               else
+               {
+                       $acc_compute->insert();
+                       $fp_id=$acc_compute->fp_id;
+                       $code='ok';
+                       $html='<td>';
+                       ob_start();
+                       $acc_compute->display_row();
+                       $html.=ob_get_contents();
+                       ob_end_clean();
+                       $html.= '</td>';
+                       $html.='<td id="del_'.$acc_compute->fp_id.'">';
+                       
$html.=HtmlInput::anchor("Effacer","",sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+                                       , $_REQUEST['plugin_code'], 
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_compute->fp_id));
+                       $html.='</td>';
+
+               }
+               break;
+}
+//echo $html;exit();
+$html=escape_xml($html);
+
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<code>$code</code>
+<html>$html</html>
+<p_id>$p_id</p_id>
+<fp_id>$fp_id</fp_id>
+</data>
+EOF;
+?>

Added: trunk/rapport_avance/ajax_search_code.php
===================================================================
--- trunk/rapport_avance/ajax_search_code.php                           (rev 0)
+++ trunk/rapport_avance/ajax_search_code.php   2012-09-22 00:51:52 UTC (rev 
408)
@@ -0,0 +1,52 @@
+<?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 show the list of code of the form
+ *
+ */
+global $cn;
+$array=$cn->get_array("select p_id,p_code,p_libelle from 
rapport_advanced.formulaire_param where p_type=3 order by 2");
+echo HtmlInput::title_box('Code Formulaire','search_code_div');
+?>
+<table>
+       <tr>
+               <th>
+                       Code
+               </th>
+               <th>
+                       Libellé
+               </th>
+       </tr>
+       <? for ($i=0;$i<count($array);$i++): ?>
+       <tr>
+               <td>
+                       
<?=HtmlInput::anchor(h($array[$i]['p_code']),"",'onclick="$(\'form_compute\').value+=\'['.$array[$i]['p_code'].']\';removeDiv(\'search_code_div\');"')?>
+               </td>
+               <td>
+                       <?=h($array[$i]['p_libelle'])?>
+               </td>
+       </tr>
+       <?endfor;?>
+</table>
\ No newline at end of file

Deleted: trunk/rapport_avance/doc/625-notice.pdf
===================================================================
(Binary files differ)

Deleted: trunk/rapport_avance/doc/extension_tva.odt
===================================================================
(Binary files differ)

Deleted: trunk/rapport_avance/doc/extension_tva.pdf
===================================================================
(Binary files differ)

Added: trunk/rapport_avance/include/class_formulaire_param.php
===================================================================
--- trunk/rapport_avance/include/class_formulaire_param.php                     
        (rev 0)
+++ trunk/rapport_avance/include/class_formulaire_param.php     2012-09-22 
00:51:52 UTC (rev 408)
@@ -0,0 +1,219 @@
+<?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 factory
+ *
+ */
+require_once 'class_rapport_avance_sql.php';
+require_once 'class_formulaire_param_detail.php';
+
+class Formulaire_Param extends Formulaire_Param_Sql
+{
+
+       static function factory(Formulaire_Param_Sql $form)
+       {
+               switch ($form->p_type)
+               {
+                       case 1:
+                               return new Formulaire_Title1($form);
+                       case 2:
+                               return new Formulaire_Title2($form);
+                       case 6:
+                               return new Formulaire_Title3($form);
+                       case 3:
+                               return new Formulaire_Formula($form);
+               }
+       }
+
+}
+
+class Formulaire_Row
+{
+
+       function __construct(formulaire_param_sql $e)
+       {
+               $this->obj = $e;
+       }
+
+       function display()
+       {
+
+       }
+
+       function input()
+       {
+
+       }
+
+       function compute()
+       {
+
+       }
+
+       /**
+        * @brief load all the row from formulaire_param_detail, children of 
formulaire_param
+        *  return an array of objects Formulaire_Param_Detail
+        * @param type $p_id
+        */
+       static function load_all($p_id)
+       {
+               global $cn;
+               $a_value = $cn->get_array("select fp_id,type_detail from 
rapport_advanced.formulaire_param_detail where p_id=$1",
+                               array($p_id));
+               return $a_value;
+       }
+
+}
+
+class formulaire_title1 extends Formulaire_Row
+{
+
+       function display()
+       {
+               echo h1($this->obj->p_libelle, "");
+       }
+
+       function compute()
+       {
+
+       }
+
+       function input()
+       {
+               echo h1($this->obj->p_libelle, ' class="title"');
+       }
+
+}
+
+class formulaire_title2 extends Formulaire_Row
+{
+
+       function display()
+       {
+               echo h2($this->obj->p_libelle, 'class="title"');
+       }
+
+       function compute()
+       {
+
+       }
+
+       function input()
+       {
+               echo h2($this->obj->p_libelle, 'class="title"');
+       }
+
+}
+
+class formulaire_title3 extends Formulaire_Row
+{
+
+       function display()
+       {
+               echo "<h3>" . $this->obj->p_libelle . "</h3>";
+       }
+
+       function compute()
+       {
+
+       }
+
+       function input()
+       {
+               echo "<h3 class=\"title\">" . $this->obj->p_libelle . "</h3>";
+       }
+
+}
+
+class Formulaire_Formula extends Formulaire_Row
+{
+
+       function __construct(formulaire_param_sql $e)
+       {
+               $this->obj = $e;
+               $this->id = $e->p_id;
+               $this->parametre = Formulaire_Row::load_all($this->id);
+       }
+
+       function display()
+       {
+               echo $this->obj->p_libelle;
+       }
+
+       function make_object($p_index)
+       {
+               $elt=$this->parametre[$p_index]['type_detail'];
+               switch ($elt)
+               {
+                       case '1':
+                               return new 
RAPAV_Formula($this->parametre[$p_index]['fp_id']);
+                               break;
+                       case '2':
+                               return new 
RAPAV_Account_Tva($this->parametre[$p_index]['fp_id']);
+                               break;
+                       case '3':
+                               return new 
RAPAV_Compute($this->parametre[$p_index]['fp_id']);
+                               break;
+               }
+       }
+
+       function input()
+       {
+               echo '<h4 class="title">' . $this->obj->p_libelle . "(" . 
$this->obj->p_code . ")" . '</h4>';
+               echo HtmlInput::hidden('p_id[]', $this->obj->p_id);
+               $max = count($this->parametre);
+               echo HtmlInput::hidden("count_" . $this->id, $max);
+               echo '<h5 class="title">' . 'code ' . $this->obj->p_code . 
'</h5>';
+               echo '<p>';
+               echo '<table id="table_' . $this->id . '">';
+               for ($i = 0; $i < $max; $i++)
+               {
+                       $formula=$this->make_object($i);
+
+                       echo '<tr id="tr_'.$formula->fp_id.'">';
+                       echo '<td>';
+                       echo $formula->display_row();
+                       echo '</td>';
+                       echo "<td id=\"del_".$formula->fp_id."\">";
+                       echo 
HtmlInput::anchor("Effacer","",sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+                                       , $_REQUEST['plugin_code'], 
$_REQUEST['ac'], $_REQUEST['gDossier'], $formula->fp_id));
+                       echo '</td>';
+                       echo '</tr>';
+               }
+               if ($max==0) echo '<tr></tr>';
+               echo "</table>";
+               echo '</p>';
+               echo HtmlInput::button_anchor(
+                               "Ajout d'une ligne", "javascript:void(0)", 
"add_row" . $this->id, 
sprintf("onclick=\"add_param_detail('%s','%s','%s','%s');\"",
+                                               $_REQUEST['plugin_code'], 
$_REQUEST['ac'], $_REQUEST['gDossier'], $this->id)
+               );
+       }
+
+}
+
+
+
+
+?>

Added: trunk/rapport_avance/include/class_formulaire_param_detail.php
===================================================================
--- trunk/rapport_avance/include/class_formulaire_param_detail.php              
                (rev 0)
+++ trunk/rapport_avance/include/class_formulaire_param_detail.php      
2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,174 @@
+<?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
+ *
+ */
+require_once 'class_rapport_avance_sql.php';
+require_once 'class_rapav_formulaire.php';
+
+class Formulaire_Param_Detail extends Formulaire_Param_Detail_SQL
+{
+
+       function input_new($p_id)
+       {
+               $parent = new Formulaire_Param($p_id);
+               echo HtmlInput::title_box($parent->p_code . " " . 
$parent->p_libelle, 'param_detail_div');
+               require_once 'template/param_detail_new.php';
+       }
+
+}
+
+class RAPAV_Formula extends Formulaire_Param_Detail
+{
+
+       function display_row()
+       {
+               printf("Résultat de la formule %s", $this->fp_formula);
+       }
+
+       static function new_row()
+       {
+               $account = new IPoste("formula_new", "", "form_id");
+               $account->size = 50;
+               $account->label = _("Recherche poste");
+               $account->set_attribute('gDossier', dossier::id());
+               $account->set_attribute('bracket', 1);
+               $account->set_attribute('no_overwrite', 1);
+               $account->set_attribute('noquery', 1);
+               $account->set_attribute('account', $account->id);
+               echo $account->input();
+       }
+
+       function verify()
+       {
+               if (Impress::check_formula($this->fp_formula)==false)
+               {
+                       $this->errcode="Erreur dans votre formule";
+                       return 1;
+               }
+               if ( trim($this->fp_formula)=="")
+               {
+                       $this->errcode=" Aucune formule trouvée";
+                       return 1;
+               }
+               return 0;
+       }
+}
+
+class RAPAV_Account_Tva extends Formulaire_Param_Detail
+{
+
+       function display_row()
+       {
+               printf("Poste comptable %s avec le code tva %s (%s) dans le 
journal %s", $this->tmp_val, $this->tva_id, $this->tva_id, $this->jrn_def_type);
+       }
+
+       static function new_row()
+       {
+               global $cn;
+               $account = new IPoste("formtva", "", "formtva_id");
+               $account->size = 20;
+               $account->label = _("Recherche poste");
+               $account->set_attribute('gDossier', dossier::id());
+               $account->set_attribute('noquery', 1);
+               $account->set_attribute('account', $account->id);
+
+               $tva = new ITva_Popup("code_tva");
+               $tva->id = HtmlInput::generate_id("code_tva");
+               $tva->set_attribute('gDossier', dossier::id());
+
+               // Jrn type
+               $select = new ISelect('code_jrn');
+               $select->value = array(
+                       array('value' => 'VEN', 'label' => 'journaux Vente'),
+                       array('value' => 'ACH', 'label' => 'journaux Achat')
+               );
+               echo '<table>';
+               echo '<tr><td>Poste comptable</td>';
+               echo td($account->input());
+               echo '</tr>';
+               echo td('TVA') . td($tva->input());
+               echo '</tr>';
+               echo td(_('Choix du type de journal ')) . td($select->input());
+               // Base or VAT
+               echo '</tr>';
+               $code_base = new ISelect('code_base');
+               $code_base->value = $cn->make_array("select tt_id,tt_label from 
rapport_advanced.total_type order by 2");
+               echo td("Type de total");
+               echo td($code_base->input());
+               echo '</tr>';
+               echo '</table>';
+       }
+
+       function verify()
+       {
+               global $cn;
+               if (trim($this->tmp_val) == "")
+               {
+                       $this->errcode = 'Poste comptable est vide';
+                       return 1;
+               }
+               $count = $cn->get_value("select count(*) from tva_rate where 
tva_id=$1", array($this->tva_id));
+               if ($count == 0)
+               {
+                       $this->errcode = 'Code TVA inexistant';
+                       return 1;
+               }
+       }
+
+}
+
+class RAPAV_Compute extends Formulaire_Param_Detail
+{
+
+       function display_row()
+       {
+               printf("Total des codes du formulaire %s", $this->fp_formula);
+       }
+
+       static function new_row($p_id)
+       {
+               global $cn;
+               $f_id = $cn->get_value("select f_id from 
rapport_advanced.formulaire_param where p_id=$1", array($p_id));
+               $account = new IText("form_compute");
+               $account->size = 50;
+               echo $account->input();
+               echo HtmlInput::button('rapav_search_code_bt', 'Cherche codes', 
sprintf(" onclick=\"rapav_search_code('%s','%s','%s','%s')\"", $_REQUEST['ac'], 
$_REQUEST['plugin_code'], $_REQUEST['gDossier'], $f_id));
+       }
+       function verify()
+       {
+
+               if ( trim($this->fp_formula)=="")
+               {
+                       $this->errcode=" Aucune formule trouvée";
+                       return 1;
+               }
+               return 0;
+       }
+
+}
+
+?>

Added: trunk/rapport_avance/include/class_rapav_formulaire.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_formulaire.php                     
        (rev 0)
+++ trunk/rapport_avance/include/class_rapav_formulaire.php     2012-09-22 
00:51:52 UTC (rev 408)
@@ -0,0 +1,234 @@
+<?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 Manage les formulaires
+ *
+ */
+require_once 'class_rapport_avance_sql.php';
+require_once 'class_formulaire_param.php';
+
+class RAPAV_Formulaire extends Formulaire_Sql
+{
+
+       function __construct($f_id = -1)
+       {
+               $this->f_id = $f_id;
+               $this->definition = array();
+               parent::__construct($f_id);
+       }
+
+       /**
+        *  show a list of all existing declaration
+        * @global type $cn database connection
+        */
+       static function listing()
+       {
+               global $cn;
+               $alist = $cn->get_array("select f_id,f_title,f_description from 
rapport_advanced.formulaire order by 2");
+               require 'template/formulaire_listing.php';
+       }
+
+       /**
+        * Get data from database, from the table 
rapport_advanced.formulaire_param
+        */
+       function load_definition()
+       {
+               $f = new Formulaire_Param_Sql();
+               $ret = $f->seek(" order by p_order ");
+               $max = Database::num_row($ret);
+
+               for ($i = 0; $i < $max; $i++)
+               {
+                       $o = new Formulaire_Param_Sql();
+                       $o = $f->next($ret, $i);
+                       $this->definition[] = clone $o;
+               }
+       }
+
+       function input_formulaire()
+       {
+               $this->load();
+               require_once 'template/formulaire_titre.php';
+       }
+
+       /**
+        * input the definition
+        */
+       function input_definition()
+       {
+               $max = count($this->definition);
+               global $cn;
+
+               require 'template/formulaire_definition.php';
+       }
+
+       /**
+        * save the definition
+        * $p_array contains
+        *   - f_id id of the formulaire
+        *   - f_title title of the formulaire
+        *   - f_description description of the formulaire
+        *   - p_id array of the row in formulaire_param
+        *   - p_code array of the row in formulaire_param
+        *   - p_libelle array of the row in formulaire_param
+        *   - p_type array of the row in formulaire_param
+        *   - t_id array of the row in formulaire_param
+        *   - p_order array of the row in formulaire_param
+        *
+        */
+       static function save_definition($p_array)
+       {
+               if ($p_array['f_id'] == -1)
+               {
+                       self::insert_definition($p_array);
+                       return;
+               }
+               else
+               {
+                       self::update_definition($p_array);
+                       return;
+               }
+       }
+
+       /**
+        * insert into formulaire and formulaire_param
+        * @see save_definition
+        * @param type $p_array
+        */
+       static function insert_definition($p_array)
+       {
+
+       }
+
+       /**
+        *
+        * @see save_definition
+        * @param type $p_array
+        */
+       static function update_definition($p_array)
+       {
+               $rapav = new RAPAV_Formulaire($p_array['f_id']);
+               // save into table formulaire
+               $rapav->f_title = $p_array['f_title'];
+               $rapav->f_description = $p_array['f_description'];
+               $rapav->update();
+
+               for ($i = 0; $i < count($p_array['p_id']); $i++)
+               {
+                       $form_param = new 
formulaire_param_sql($p_array['p_id'][$i]);
+                       $form_param->p_code = $p_array['p_code'][$i];
+                       $form_param->p_libelle = $p_array['p_libelle'][$i];
+                       $form_param->p_type = $p_array['p_type'][$i];
+                       $form_param->p_order = $p_array['p_order'][$i];
+                       $form_param->t_id = $p_array['t_id'][$i];
+                       // update or insert the row
+                       if ($p_array['p_id'][$i] == -1)
+                               $form_param->insert();
+                       else
+                               $form_param->update();
+               }
+       }
+
+       function echo_formulaire()
+       {
+               echo '<h2>' . h($this->f_title) . '</h2>';
+               echo '<p>' . h($this->f_description) . '<p>';
+       }
+
+       function input_parameter()
+       {
+               $max = count($this->definition);
+               for ($i = 0; $i < $max; $i++)
+               {
+                       $obj = Formulaire_Param::factory($this->definition[$i]);
+
+                       $obj->input();
+               }
+       }
+
+       static function save_parameter($p_array)
+       {
+               $param = new RAPAV_Formulaire($p_array['f_id']);
+               $param->load_definition();
+               // save everything
+               $max = count($p_array['fp_id']);
+
+               // update
+               for ($i = 0; $i < $max; $i++)
+               {
+                       // update
+                       if (isset($p_array['fp_id'][$i]))
+                       {
+                               $fp_id = $p_array['fp_id'][$i];
+                               $old_frm = new 
Formulaire_Param_Detail($p_array['fp_id'][$i]);
+                               $new_frm = new Formulaire_Param_Detail();
+                               $new_frm->p_id = $old_frm->p_id;
+                               $new_frm->fp_id = $p_array['fp_id'][$i];
+                               // update formula
+                               $new_frm->fp_formula = $p_array['frm' . $fp_id];
+                               $new_frm->tmp_val = (isset($p_array['code_frm' 
. $fp_id])) ? $p_array['code_frm' . $fp_id] : null;
+                               $new_frm->tva_id = (isset($p_array['code_tva' . 
$fp_id])) ? $p_array['code_tva' . $fp_id] : null;
+                               $new_frm->jrn_def_type = 
(isset($p_array['code_jrn' . $fp_id])) ? $p_array['code_jrn' . $fp_id] : null;
+                               $new_frm->tt_id = (isset($p_array['code_base' . 
$fp_id])) ? $p_array['code_base' . $fp_id] : null;
+                               $new_frm->update();
+                       }
+               }
+               
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+               // insert fp_id
+               
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+               if (isset($p_array['new']))
+               {
+                       $max_new = count($p_array['new']);
+                       for ($i = 0; $i < $max_new; $i++)
+                       {
+                               $new_frm = new Formulaire_Param_Detail();
+                               $new_frm->p_id = $p_array['new'][$i];
+                               // if it is a formula
+                               $new_frm->fp_formula = 
(isset($p_array['new_frm'][$i])) ? $p_array['new_frm'][$i] : null;
+                               $new_frm->tmp_val = 
(isset($p_array['new_code_frm'][$i])) ? $p_array['new_code_frm'][$i] : null;
+                               $new_frm->tva_id = 
(isset($p_array['new_code_tva'][$i])) ? $p_array['new_code_tva'][$i] : null;
+                               $new_frm->jrn_def_type = 
(isset($p_array['new_code_jrn'][$i])) ? $p_array['new_code_jrn'][$i] : null;
+                               $new_frm->tt_id = 
(isset($p_array['new_code_base'][$i])) ? $p_array['new_code_base'][$i] : null;
+                               $new_frm->insert();
+                       }
+               }
+               
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+               // Delete fp_id
+               
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+               if (isset($p_array['delete']))
+               {
+                       //delete
+                       $max_del = count($p_array['delete']);
+                       for ($i = 0; $i < $max_del; $i++)
+                       {
+                               $frm = new 
Formulaire_Param_Detail($p_array['delete'][$i]);
+                               $frm->delete();
+                       }
+               }
+       }
+
+}
+
+?>

Added: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php                   
        (rev 0)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php   2012-09-22 
00:51:52 UTC (rev 408)
@@ -0,0 +1,145 @@
+<?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 handle the data: database level
+ *
+ */
+require_once 'class_phpcompta_sql.php';
+class formulaire_param_sql extends phpcompta_sql
+{
+
+       function __construct($p_id=-1)
+       {
+
+
+               $this->table = "rapport_advanced.formulaire_param";
+               $this->primary_key = "p_id";
+
+               $this->name = array(
+                       "p_id" => "p_id",
+                       "p_code" => "p_code",
+                       "p_libelle" => "p_libelle",
+                       "p_type" => "p_type",
+                       "p_order" => "p_order",
+                       "f_id" => "f_id",
+                       "p_info" => "p_info",
+                       "t_id" => "t_id"
+               );
+
+               $this->type = array(
+                       "p_id" => "numeric",
+                       "p_code" => "text",
+                       "p_libelle" => "text",
+                       "p_type" => "numeric",
+                       "p_order" => "numeric",
+                       "f_id" => "numeric",
+                       "p_info" => "text",
+                       "t_id" => "numeric"
+               );
+
+               $this->default = array(
+                       "p_id" => "auto"
+               );
+               global $cn;
+
+               parent::__construct($cn, $p_id);
+       }
+
+}
+class formulaire_sql extends phpcompta_sql
+{
+
+       function __construct($p_id=-1)
+       {
+
+
+               $this->table = "rapport_advanced.formulaire";
+               $this->primary_key = "f_id";
+
+               $this->name = array(
+                       "f_id" => "f_id",
+                       "f_title" => "f_title",
+                       "f_description" => "f_description"
+               );
+
+               $this->type = array(
+                       "f_id" => "numeric",
+                       "f_title" => "text",
+                       "f_description" => "text"
+               );
+
+               $this->default = array(
+                       "f_id" => "auto"
+               );
+               global $cn;
+
+               parent::__construct($cn, $p_id);
+       }
+
+}
+class Formulaire_Param_Detail_SQL extends phpcompta_sql
+{
+
+       function __construct($p_id=-1)
+       {
+
+
+               $this->table = "rapport_advanced.formulaire_param_detail";
+               $this->primary_key = "fp_id";
+
+               $this->name = array(
+                       "fp_id" => "fp_id",
+                       "p_id" => "p_id",
+                       "tmp_val" => "tmp_val",
+                       "tva_id"=>"tva_id",
+                       "fp_formula"=>"fp_formula",
+                       "fp_signed"=>"fp_signed",
+                       "jrn_def_type"=>"jrn_def_type",
+                       "tt_id"=>"tt_id",
+                       "type_detail"=>"type_detail"
+               );
+
+               $this->type = array(
+                       "fp_id" => "numeric",
+                       "p_id" => "numeric",
+                       "tmp_val" => "text",
+                       "tva_id"=>"numeric",
+                       "fp_formula"=>"text",
+                       "fp_signed"=>"numeric",
+                       "jrn_def_type"=>"text",
+                       "tt_id"=>"numeric",
+                       "type_detail"=>"numeric"
+               );
+
+               $this->default = array(
+                       "fp_id" => "auto"
+               );
+               global $cn;
+
+               parent::__construct($cn, $p_id);
+       }
+
+}
+?>

Added: trunk/rapport_avance/include/declaration.inc.php
===================================================================
--- trunk/rapport_avance/include/declaration.inc.php                            
(rev 0)
+++ trunk/rapport_avance/include/declaration.inc.php    2012-09-22 00:51:52 UTC 
(rev 408)
@@ -0,0 +1,29 @@
+<?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 Déclaration
+ *
+ */
+?>

Added: trunk/rapport_avance/include/formulaire.inc.php
===================================================================
--- trunk/rapport_avance/include/formulaire.inc.php                             
(rev 0)
+++ trunk/rapport_avance/include/formulaire.inc.php     2012-09-22 00:51:52 UTC 
(rev 408)
@@ -0,0 +1,41 @@
+<?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 liste des déclarations + modification, création...
+ *
+ */
+require_once 'class_rapav_formulaire.php';
+if ( isset($_POST['form_def_sub']))
+{
+       RAPAV_formulaire::save_definition($_POST);
+       exit();
+}
+if (isset ($_POST['form_param_sub']))
+{
+       RAPAV_Formulaire::save_parameter($_POST);
+}
+RAPAV_formulaire::listing();
+var_dump($_POST);
+?>

Added: trunk/rapport_avance/include/template/formulaire_definition.php
===================================================================
--- trunk/rapport_avance/include/template/formulaire_definition.php             
                (rev 0)
+++ trunk/rapport_avance/include/template/formulaire_definition.php     
2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,110 @@
+<?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 show the definition
+ *
+ */
+$type_row=$cn->make_array("select p_type,p_description from 
rapport_advanced.type_row order by p_description");
+$type_periode=$cn->make_array("select t_id,t_description from 
rapport_advanced.periode_type order by t_description");
+?>
+<table id="table_formulaire_definition_id" class="result" style="table-layout: 
auto">
+       <thead>
+       <tr>
+       <th style="width:92px">
+               Code <?=HtmlInput::infobulle(200)?>
+       </th>
+       <th>
+               Libellé
+       </th>
+       <th style="width:192px">
+               Type de ligne
+       </th>
+       <th>
+               Période
+       </th>
+       <th style="width:92px">
+               Ordre d'apparition
+       </th>
+       <th>
+               Message d'aide
+       </th>
+       </tr>
+       </thead>
+       <tbody id="table_body_id">
+       <? for ($i=0;$i<$max;$i++):?>
+       <tr id="row_<?=$i?>">
+
+               <td>
+                       
<?=HtmlInput::hidden('p_id[]',$this->definition[$i]->p_id) ?>
+                       <?
+                               $p_code=new 
IText('p_code[]',$this->definition[$i]->p_code);
+                               $p_code->size="10";
+                               echo $p_code->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                               $p_libelle=new 
IText('p_libelle[]',$this->definition[$i]->p_libelle);
+                               $p_libelle->css_size="100%";
+                               echo $p_libelle->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                               $p_type=new ISelect('p_type[]');
+                               $p_type->value=$type_row;
+                               $p_type->selected=$this->definition[$i]->p_type;
+                               echo $p_type->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                               $p_type_periode=new ISelect('t_id[]');
+                               $p_type_periode->value=$type_periode;
+                               
$p_type_periode->selected=$this->definition[$i]->t_id;
+                               echo $p_type_periode->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                               $p_order=new 
INum('p_order[]',$this->definition[$i]->p_order);
+                               $p_order->prec=0;
+                               $p_order->size=4;
+                               echo $p_order->input();
+                       ?>
+               </td>
+               <td>
+                       <?
+                               $p_info=new 
IText('p_info[]',$this->definition[$i]->p_info);
+                               $p_info->css_size="100%";
+                               echo $p_info->input();
+                       ?>
+               </td>
+       </tr>
+       <?endfor;?>
+       </tbody>
+</table>
+<?=HtmlInput::button_anchor("Ajout d'une ligne","javascript:void(0)","add_def",
+               
sprintf('onclick="add_row_definition(\'%s\',\'%s\',\'%s\')"',$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier']))?>

Added: trunk/rapport_avance/include/template/formulaire_listing.php
===================================================================
--- trunk/rapport_avance/include/template/formulaire_listing.php                
                (rev 0)
+++ trunk/rapport_avance/include/template/formulaire_listing.php        
2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,61 @@
+<?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 display list of formulaire + button
+ *
+ */
+?>
+<div id="form_list_div">
+<table class="result">
+       <tr>
+               <th>Nom du formulaire</th>
+               <th>Description</th>
+               <th></th>
+               <th></th>
+       </tr>
+<?
+       for ($i=0;$i<count($alist);$i++):
+?>
+       <tr>
+               <td>
+                       <?=h($alist[$i]['f_title'])?>
+               </td>
+               <td>
+                       <?=h($alist[$i]['f_description'])?>
+               </td>
+               <td>
+                       <?=HtmlInput::anchor('Définition', 
"",sprintf('onclick="rapav_form_def(\'%s\',\'%s\',\'%s\',\'%s\')"',$_REQUEST['plugin_code'],$_REQUEST['ac'],dossier::id(),$alist[$i]['f_id']))?>
+               </td>
+               <td>
+                       <?=HtmlInput::anchor('Paramètre', 
"",sprintf('onclick="rapav_form_param(\'%s\',\'%s\',\'%s\',\'%s\')"',$_REQUEST['plugin_code'],$_REQUEST['ac'],dossier::id(),$alist[$i]['f_id']))?>
+               </td>
+       </tr>
+
+<?     endfor; ?>
+</table>
+</div>
+<div id="form_mod_div">
+
+</div>
\ No newline at end of file

Added: trunk/rapport_avance/include/template/formulaire_titre.php
===================================================================
--- trunk/rapport_avance/include/template/formulaire_titre.php                  
        (rev 0)
+++ trunk/rapport_avance/include/template/formulaire_titre.php  2012-09-22 
00:51:52 UTC (rev 408)
@@ -0,0 +1,56 @@
+<?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 input for title, description
+ *
+ */
+?>
+<?=HtmlInput::hidden('f_id',$this->f_id)?>
+<table>
+       <tr>
+               <td>
+                       Nom
+               </td>
+               <td>
+                       <?
+                       $title=new IText("f_title",$this->f_title);
+                       $title->size=50;
+                       echo $title->input();
+                       ?>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       Description
+               </td>
+               <td>
+                       <?
+                       $description=new 
IText("f_description",$this->f_description);
+                       $description->size=100;
+                       echo $description->input();
+                       ?>
+               </td>
+       </tr>
+</table>

Added: trunk/rapport_avance/include/template/param_detail_new.php
===================================================================
--- trunk/rapport_avance/include/template/param_detail_new.php                  
        (rev 0)
+++ trunk/rapport_avance/include/template/param_detail_new.php  2012-09-22 
00:51:52 UTC (rev 408)
@@ -0,0 +1,98 @@
+<?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
+ *
+ */
+
+?>
+
+<table style="width:90%;margin-left:5%" >
+       <tr>
+       <td id="new_formula_id_bt" class="tool" style="background:red">
+               <a class="mtitle"  href="javascript:void(0)"  
onclick="show_type_formula('new_formula_id')">
+                       Formule
+               </a>
+       </td>
+       <td id="new_compute_id_bt"  class="tool" style="background:inherit">
+               <a class="mtitle" href="javascript:void(0)"
+                  onclick="show_type_formula('new_compute_id')">
+                       Compute
+               </a>
+       </td>
+       <td id="new_account_tva_id_bt"  class="tool" style="background:inherit">
+               <a class="mtitle" href="javascript:void(0)"   
onclick="show_type_formula('new_account_tva_id')">
+                       Poste comptable et code TVA
+               </a>
+       </td>
+</tr>
+</table>
+<div style="width:100%;height:290px;margin:1px">
+       <span class="error" id="param_detail_info_div"></span>
+<div id="new_formula_id" style="display: block">
+       <p>
+       Entrer une formule avec des postes comptables, la syntaxe est la même 
que celle des "rapports"
+       </p>
+               <p>
+       Exemple : [70%]*0.25+[71%]
+       </p>
+
+<form id="new_padef" method="POST" 
onsubmit="save_param_detail('new_padef');return false">
+       
<?=HtmlInput::request_to_hidden(array('gDossier','ac','plugin_code','p_id'))?>
+       <p>
+       <?=HtmlInput::hidden('tab','formula')?>
+               <?=RAPAV_Formula::new_row()?>
+       </p>
+<?=HtmlInput::submit('save','Sauve')?>
+
+</form>
+</div>
+<div id="new_account_tva_id" style="display: none">
+       <p>
+       Entrer un poste comptable et un code de TVA
+       </p>
+<form id="new_padea" method="POST" 
onsubmit="save_param_detail('new_padea');return false">
+       
<?=HtmlInput::request_to_hidden(array('gDossier','ac','plugin_code','p_id'))?>
+
+       <?=HtmlInput::hidden('tab','account_tva')?>
+               <?=RAPAV_Account_Tva::new_row()?>
+<?=HtmlInput::submit('save','Sauve')?>
+
+</form>
+</div>
+<div id="new_compute_id" style="display: none">
+       <p>
+       Entrer une formule avec des codes utilisés dans ce formulaires
+       </p>
+<form id="new_padec" method="POST" 
onsubmit="save_param_detail('new_padec');return false">
+       
<?=HtmlInput::request_to_hidden(array('gDossier','ac','plugin_code','p_id'))?>
+
+       <?=HtmlInput::hidden('tab','compute_id')?>
+               <?=RAPAV_Compute::new_row($p_id)?>
+<?=HtmlInput::submit('save','Sauve')?>
+
+</form>
+</div>
+</div>
\ No newline at end of file

Deleted: trunk/rapport_avance/index.php
===================================================================
--- trunk/tva/index.php 2012-09-04 16:45:36 UTC (rev 402)
+++ trunk/rapport_avance/index.php      2012-09-22 00:51:52 UTC (rev 408)
@@ -1,137 +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
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder address@hidden
-
-/*!\file
- * \brief main file for tva
- */
-global $version_plugin;
-$version_plugin=SVNINFO;
-Extension::check_version(4900);
-
-$url='?'.dossier::get().'&plugin_code='.$_REQUEST['plugin_code']."&ac=".$_REQUEST['ac'];
-$array=array (
-       array($url.'&sa=dec',_('Déclaration TVA'),_('Déclaration Trimestriel ou 
annuel de TVA'),1),
-       array($url.'&sa=li',_('Listing intracommunautaire'),_('Listing 
intracommunautaire trimestriel'),2),
-       array($url.'&sa=lc',_('Listing Assujetti'),_('Listing des clients 
assujettis'),3),
-       array($url.'&sa=ltva',_('Liste des déclarations TVA'),_('Historique des 
déclarations TVA'),4),
-       array($url.'&sa=param',_('Paramètrage '),_('Paramètre pour la TVA'),5)
-       );
-echo '<script language="javascript">';
-require_once('js_scripts.js');
-echo '</script>';
-
-$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:0;
-$def=0;
-switch($sa) {
-case 'dec':
-  $def=1;
-  break;
-case 'li':
-  $def=2;
-  break;
-case 'lc':
-  $def=3;
-  break;
-case 'ltva':
-  $def=4;
-  break;
-case 'param':
-  $def=5;
-  break;
-
-}
-$install=0;
-$cn=new Database(dossier::id());
-if ( $cn->exist_schema('tva_belge') == false) {
-  require_once('class_install_plugin.php');
-  $install=1;
-  $iplugn=new Install_Plugin($cn);
-  $iplugn->install();
-  echo_warning(_("L'extension est installée, pourriez-vous en vérifier le 
paramètrage ?"));
-  $def=5;
-}
-
-// check schema
-$a=$cn->exist_column('assujetti_chld','ac_periode','tva_belge');
-if ( $a == false)
-  $cn->exec_sql("alter table tva_belge.assujetti_chld add ac_periode text");
-
-$a=$cn->exist_column('assujetti_chld','exercice','tva_belge');
-if ( $a == false)
-  $cn->exec_sql("alter table tva_belge.assujetti_chld add exercice text");
-
-$a=$cn->exist_column('declaration_amount','exercice','tva_belge');
-if ( $a == false)
-  $cn->exec_sql("alter table tva_belge.declaration_amount add exercice text");
-
-$a=$cn->exist_column('intracomm','exercice','tva_belge');
-if ( $a == false)
-  $cn->exec_sql("alter table tva_belge.intracomm add exercice text");
-
-$a=$cn->exist_column('assujetti','exercice','tva_belge');
-if ( $a == false)
-  $cn->exec_sql("alter table tva_belge.assujetti add exercice text");
-if ( $cn->exist_table("version","tva_belge")==false)
-{
-
-  $file=dirname(__FILE__)."/sql/patch2.sql";
-               $cn->execute_script($file);
-               if ( $install == 0 ) echo_warning(_("Mise à jour du plugin, 
pourriez-vous en vérifier le paramètrage ?"));
-               $def=5;
-}
-echo '<div style="float:right"><a class="mtitle" style="font-size:140%" 
href="http://wiki.phpcompta.eu/doku.php?id=tva"; target="_blank">Aide</a>'.
-'<span style="font-size:0.8em;color:red;display:inline">vers:SVNINFO</span>'.
-'</div>';
-// show menu
-echo ShowItem($array,'H',"mtitle","mtitle",$def,' 
style="width:80%;margin-left:10%;border-spacing:5;" ');
-?>
-<div class="content" style="margin-left: 30px">
-<?
-// include the right file
-if ($def==1) {
-  require_once('decl_tva.inc.php');
-  exit();
-}
-
-/* Listing of all */
-if ($def==4) {
-  require_once('list_tva.inc.php');
-  exit();
-}
-/* listing intracomm */
-if ($def==2) {
-  require_once('list_intra.inc.php');
-  exit();
-}
-/* listing assujetti */
-if ($def==3) {
-  require_once('list_assujetti.inc.php');
-  exit();
-}
-
-/* setting */
-if ( $def==5) {
-  require_once('tva_param.inc.php');
-  exit();
-}
-?>
-</div>

Copied: trunk/rapport_avance/index.php (from rev 402, trunk/tools/index.php)
===================================================================
--- trunk/rapport_avance/index.php                              (rev 0)
+++ trunk/rapport_avance/index.php      2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,90 @@
+<?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 main file for tools
+ */
+
+global $version_plugin;
+$version_plugin=SVNINFO;
+Extension::check_version(5082);
+require_once 'class_phpcompta_sql.php';
+require_once 'rapav_constant.php';
+/*
+ * load javascript
+ */
+ob_start();
+require_once('rapav_javascript.js');
+$j=ob_get_contents();
+ob_end_clean();
+echo create_script($j);
+
+$url='?'.dossier::get()."&plugin_code=".$_REQUEST['plugin_code']."&ac=".$_REQUEST['ac'];
+$array=array (
+         array($url.'&sa=fo',_('Formulaire'),_('Création, modification, 
Paramètre'),1),
+         array($url.'&sa=de',_('Déclaration'),_('Déclaration TVA calculée'),2),
+         array($url.'&sa=hi',_('Historique'),_('Historique des déclarations 
faites'),3)
+       );
+
+$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
+$def=0;
+switch($sa)
+  {
+  case 'fo':
+    $def=1;
+    break;
+  case 'de':
+    $def=2;
+    break;
+  case 'hi':
+         $def=3;
+         break;
+  }
+
+$cn=new Database(dossier::id());
+// show menu
+echo '<div style="float:right"><a class="mtitle" style="font-size:140%" 
href="http://wiki.phpcompta.eu/doku.php?id=rapport_avances"; 
target="_blank">Aide</a>'.
+'<span style="font-size:0.8em;color:red;display:inline">vers:SVNINFO</span>'.
+'</div>';
+
+echo ShowItem($array,'H','mtitle ','mtitle ',$def,' 
style="width:80%;margin-left:10%;border-collapse: separate;border-spacing:  
5px;"');
+echo '<div class="content" style="width:80%;margin-left:10%">';
+// include the right file
+if ($def==1)
+  {
+    require_once('include/formulaire.inc.php');
+    exit();
+  }
+
+/* Déclaration*/
+if ($def==2)
+  {
+    require_once('include/declaration.inc.php');
+    exit();
+  }
+/* Historique */
+  if ($def == 3 )
+  {
+         require_once 'include/historique.inc.php';
+         exit();
+  }
+?>

Copied: trunk/rapport_avance/rapav_constant.php (from rev 402, 
trunk/tools/tools_constant.php)
===================================================================
--- trunk/rapport_avance/rapav_constant.php                             (rev 0)
+++ trunk/rapport_avance/rapav_constant.php     2012-09-22 00:51:52 UTC (rev 
408)
@@ -0,0 +1,14 @@
+<?
+/**
+ address@hidden
+ *Contains all the needed variable for the plugin
+ *is name is plugin_name_constant.php
+ * You can use some globale variable, especially for the database
+ *  connection
+ */
+
+require_once ('class_database.php');
+
+global $cn;
+$cn=new Database (dossier::id());
+?>
\ No newline at end of file

Copied: trunk/rapport_avance/rapav_javascript.js (from rev 402, 
trunk/tools/tools_javascript.js)
===================================================================
--- trunk/rapport_avance/rapav_javascript.js                            (rev 0)
+++ trunk/rapport_avance/rapav_javascript.js    2012-09-22 00:51:52 UTC (rev 
408)
@@ -0,0 +1,394 @@
+
+
+content[200]="Le code doit être unique pour ce formulaire";
+content[201]="Formula TODO";
+
+
+function rapav_form_def(plugin_code,ac,dossier,f_id)
+{
+       try
+       {
+               $('form_list_div').hide();
+               $('form_mod_div').innerHTML="";
+               $('form_mod_div').show();
+               waiting_box();
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=mod_form'+"&f_id="+f_id;
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       var answer=req.responseText;
+                                       $('form_mod_div').innerHTML=answer;
+                                       answer.evalScripts()
+                               }
+                       }
+                       );
+       }
+       catch(e)
+       {
+               alert(e.message);
+       }
+}
+/**
+ * @brief Add a row to the table in formulaire_definition
+ * table id = table_formulaire_definition_id
+ */
+function add_row_definition(plugin_code,ac,dossier)
+{
+       try
+       {
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=add_row_definition';
+               waiting_box();
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       var answer=req.responseText;
+                                       var 
mytable=g("table_formulaire_definition_id").tBodies[0];
+                                       var nNumberRow=mytable.rows.length;
+                                       var oRow=mytable.insertRow(nNumberRow);
+                                       oRow.innerHTML=answer;
+                               }
+                       }
+                       );
+
+       }catch (e)
+       {
+               alert(e.message);
+       }
+}
+
+/**
+ * @brief Add a row to the table in formulaire_parametre
+ * table id = table p_id
+ */
+function add_param_detail(plugin_code,ac,dossier,p_id)
+{
+       try
+       {
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=add_param_detail'+"&p_id="+p_id;
+               waiting_box();
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       removeDiv('param_detail_div');
+                                       var nTop=calcy(100);
+                                       var nLeft="200px";
+                                       var 
str_style="top:"+nTop+"px;left:"+nLeft+";width:50em;height:auto";
+                                       add_div({
+                                               id:'param_detail_div',
+                                               style:str_style,
+                                               cssclass:'inner_box',
+                                               drag:1
+                                       });
+                                       
$('param_detail_div').innerHTML=req.responseText;
+                                       req.responseText.evalScripts();
+                               }
+                       }
+                       );
+
+       }catch (e)
+       {
+               alert("add_param_detail"+e.message);
+       }
+}
+function rapav_search_code(ac,plugin_code,dossier,f_id)
+{
+       try
+       {
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=rapav_search_code'+"&f_id="+f_id;
+               waiting_box();
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       removeDiv('search_code_div');
+                                       var nTop=calcy(80);
+                                       var nLeft="400px";
+                                       var 
str_style="top:"+nTop+"px;left:"+nLeft+";width:50em;height:auto;z-index:4";
+                                       add_div({
+                                               id:'search_code_div',
+                                               style:str_style,
+                                               cssclass:'inner_box',
+                                               drag:1
+                                       });
+                                       
$('search_code_div').innerHTML=req.responseText;
+                               //req.responseText.evalScripts();
+                               }
+                       }
+                       );
+
+       }catch (e)
+       {
+               alert("add_param_detail"+e.message);
+       }
+}
+function delete_param_detail(plugin_code,ac,dossier,fp_id)
+{
+       try
+       {
+               if ( ! confirm("Confirmez-vous l'effacement ?")) { return 
false;}
+               waiting_box();
+
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=delete_param_detail'+"&fp_id="+fp_id;
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       
$('tr_'+fp_id).style.textDecoration="line-through";
+                                       $('tr_'+fp_id).style.color="red";
+                                       $('del_'+fp_id).innerHTML="";
+                               }
+                       }
+                       );
+       }catch (e)
+       {
+               alert(e);
+       }
+}
+/**
+ address@hidden Sauve les données
+ */
+/*function  show_poste(answer) {
+       try{
+               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);
+               }
+               var name_ctl=a[0].firstChild.nodeValue;
+               var code_html=html[0].firstChild.nodeValue;
+               // ou mieux
+               var code_html=getNodeText(html[0]); // Firefox ne prend que les 
4096 car.
+               code_html=unescape_xml(code_html);
+               $(name_ctl).innerHTML=code_html;
+       }
+       catch (e) {
+               alert(e.message);
+       }
+       try{
+               code_html.evalScripts();
+       }
+       catch(e){
+               alert("Impossible executer script de la reponse\n"+e.message);
+       }
+
+}*/
+/**
+ * @brief Add a row to the table in formulaire_parametre
+ * table id = table p_id
+ */
+/*function row_add_code_tva(plugin_code,ac,dossier,p_id)
+{
+try
+       {
+               var max=parseFloat($('count_'+p_id).value);
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=row_add_code_tva'+"&p_id="+p_id+"&max="+max;
+               waiting_box();
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       var answer=req.responseText;
+                                       var mytable=g("table_"+p_id).tBodies[0];
+                                       var nNumberRow=mytable.rows.length;
+                                       var oRow=mytable.insertRow(nNumberRow);
+                                       oRow.innerHTML=answer;
+                                       var 
max2=parseFloat($('count_'+p_id).value)+1;
+                                       $('count_'+p_id).value=max2;
+                                       answer.evalScripts();
+                               }
+                       }
+                       );
+
+       }catch (e)
+       {
+               alert(e.message);
+       }
+}*/
+/**
+ * @brief Add a row to the table in formulaire_parametre, with total
+ * table id = table p_id
+ */
+/*function row_add_compute(plugin_code,ac,dossier,p_id)
+{
+try
+       {
+               var max=parseFloat($('count_'+p_id).value);
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=row_add_compute'+"&p_id="+p_id+"&max="+max;
+               waiting_box();
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       var answer=req.responseText;
+                                       var mytable=g("table_"+p_id).tBodies[0];
+                                       var nNumberRow=mytable.rows.length;
+                                       var oRow=mytable.insertRow(nNumberRow);
+                                       oRow.innerHTML=answer;
+                                       var 
max2=parseFloat($('count_'+p_id).value)+1;
+                                       $('count_'+p_id).value=max2;
+                                       answer.evalScripts();
+                               }
+                       }
+                       );
+
+       }catch (e)
+       {
+               alert(e.message);
+       }
+}*/
+/**
+ * @brief  montre les détails d'un formulaire
+ */
+function rapav_form_param(plugin_code,ac,dossier,f_id)
+{
+       try
+       {
+               $('form_list_div').hide();
+               $('form_mod_div').innerHTML="";
+               $('form_mod_div').show();
+               waiting_box();
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=mod_param'+"&f_id="+f_id;
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       var answer=req.responseText;
+                                       $('form_mod_div').innerHTML=answer;
+                                       answer.evalScripts()
+                               }
+                       }
+                       );
+       }
+       catch(e)
+       {
+               alert(e.message);
+       }
+}
+/**
+ * @brief montre le div contenant le type de formule
+ */
+function show_type_formula(p_toshow)
+{
+       try
+       {
+               var 
div=['new_account_tva_id','new_formula_id','new_compute_id'];
+               for (var r =0;r<div.length;r++ ) {
+                       $(div[r]).hide();
+                       $(div[r]+'_bt').style.backgroundColor="inherit";
+
+               }
+               $(p_toshow).show();
+               $(p_toshow+'_bt').style.backgroundColor="red";
+       } catch (e)
+{
+               alert (e.message);
+       }
+
+}
+/**
+ * @brief sauve les données pour nouvelle formule, code,...
+ */
+function save_param_detail(p_form_id)
+{
+       try
+       {
+               var qs=$(p_form_id).serialize()+'&act=save_param_detail';
+               waiting_box();
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:qs,
+                               onFailure:error_get_predef,
+                               onSuccess:function infodiv(req,json) {
+                                       try{
+                                               remove_waiting_box();
+                                               var answer=req.responseXML;
+                                               var 
acode=answer.getElementsByTagName('code');
+                                               var 
ap_id=answer.getElementsByTagName('p_id');
+                                               var 
html=answer.getElementsByTagName('html');
+
+                                               if ( acode.length == 0 ) {
+                                                       var 
rec=req.responseText;
+                                                       alert ('erreur :'+rec);
+                                               }
+                                               var 
code=acode[0].firstChild.nodeValue;
+                                               var 
code_xml=getNodeText(html[0]);
+                                               var 
code_html=unescape_xml(code_xml);
+                                               if ( code == 'ok')
+                                                       {
+                                                               var 
afpid=answer.getElementsByTagName('fp_id');
+                                                               var 
fp_id=afpid[0].firstChild.nodeValue;
+                                                               var 
p_id=ap_id[0].firstChild.nodeValue;
+                                                               // Ajoute une 
ligne avec résultat
+                                                               var 
mytable=g("table_"+p_id).tBodies[0];
+                                                               var 
nNumberRow=mytable.rows.length;
+                                                               var 
oRow=mytable.insertRow(nNumberRow);
+                                                               
oRow.id="tr_"+fp_id;
+                                                               
oRow.innerHTML=code_html;
+
+                                                       }
+                                               if (code == 'nok')
+                                                       {
+                                                               // montre erreur
+                                                               
$('param_detail_info_div').innerHTML=code_html;
+                                                       }
+                                       }
+                                       catch (e) {
+                                               alert("save_param_detail 
"+e.message);
+                                       }
+                                       try{
+                                               code_html.evalScripts();
+                                       }
+                                       catch(e){
+                                               alert("save_param_detail 
Impossible executer script de la reponse\n"+e.message);
+                                       }
+
+                               }
+                       }
+                       );
+       }
+       catch(e)
+       {
+               alert(e.message);
+       }
+
+       return false;
+}
\ No newline at end of file

Copied: trunk/rapport_avance/raw.php (from rev 402, trunk/tools/raw.php)
===================================================================
--- trunk/rapport_avance/raw.php                                (rev 0)
+++ trunk/rapport_avance/raw.php        2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,29 @@
+<?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 raw file for PDF ewa
+ */
+
+extract ($_REQUEST);
+
+?>

Added: trunk/rapport_avance/sql/create.sql
===================================================================
--- trunk/rapport_avance/sql/create.sql                         (rev 0)
+++ trunk/rapport_avance/sql/create.sql 2012-09-22 00:51:52 UTC (rev 408)
@@ -0,0 +1,69 @@
+create schema rapport_advanced;
+
+create table rapport_advanced.formulaire
+(f_id serial primary key,
+f_title text,
+f_description text);
+insert into rapport_advanced.formulaire values (1,'cerfa3310-ca3');
+
+create         table rapport_advanced.type_row(
+p_type integer primary key,
+p_description text);
+
+insert into rapport_advanced.type_row values (1,'Titre'), 
(2,'Sous-titre'),(3,'Formule');
+
+create table rapport_advanced.periode_type
+(
+t_id integer primary key,
+t_description text);
+
+insert into rapport_advanced.periode_type values (1,'D''après 
date'),(2,'N'),(3,'N-1'),(4,'N-2'),(5,'N-3');
+
+create table rapport_advanced.type_row_detail
+(tr_id integer primary key,
+ tr_description text);
+
+ insert into rapport_advanced.type_row_detail(tr_id,tr_description) values 
(1,'Formule'),(2,'Poste comptable et code'),(3,'Calcul sur formulaire');
+
+
+create table  rapport_advanced.formulaire_param
+(
+       p_id serial primary key,
+       p_code  text,
+       p_libelle       text,
+       p_type integer references rapport_advanced.type_row(p_type) ,
+       p_order integer not null,
+       f_id integer references rapport_advanced.formulaire(f_id) on update 
cascade,
+       t_id integer references rapport_advanced.periode_type(t_id)
+);
+create table rapport_advanced.total_type(
+       tt_id serial primary key,
+       tt_label text);
+
+insert into rapport_advanced.total_type values (0,'Total code TVA+Poste 
comptable'),(1,'Total code tva'),(2,'Total poste comptable');
+
+create table rapport_advanced.formulaire_param_detail
+(
+       fp_id serial primary key,
+       p_id integer references rapport_advanced.formulaire_param(p_id) on 
update cascade on delete cascade,
+       tmp_val account_type,
+       tva_id integer references public.tva_rate(tva_id),
+       fp_formula text,
+       fp_signed integer,
+       type_detail integer,
+       jrn_def_type char(3),
+       tt_id integer references rapport_advanced.total_type(tt_id)
+);
+ALTER TABLE rapport_advanced.formulaire_param ADD UNIQUE (f_id, p_code);
+
+ALTER TABLE rapport_advanced.formulaire_param
+   ADD COLUMN p_info text;
+COMMENT ON COLUMN rapport_advanced.formulaire_param.p_info IS 'si non vide 
affiche infobulle';
+
+ALTER TABLE rapport_advanced.formulaire_param_detail
+  ADD CONSTRAINT fk_formulaire_param_detail_type_row_detail FOREIGN KEY 
(type_detail)
+      REFERENCES rapport_advanced.type_row_detail (tr_id) MATCH SIMPLE
+      ON UPDATE SET NULL ON DELETE SET NULL;
+
+
+

Deleted: trunk/rapport_avance/sql/patch2.sql
===================================================================
--- trunk/tva/sql/patch2.sql    2012-09-04 16:45:36 UTC (rev 402)
+++ trunk/rapport_avance/sql/patch2.sql 2012-09-22 00:51:52 UTC (rev 408)
@@ -1,134 +0,0 @@
-begin;
-create table tva_belge.version (
-       id serial primary key,
-       vdate timestamp default now(),
-       vdesc text
-);
-
-CREATE TABLE tva_belge.parameter_chld
-(
-  pi_id bigserial NOT NULL, -- PK
-  pcode text, -- FK to parameter
-  tva_id bigint, -- FK to public.tva_rate
-  pcm_val account_type, -- FK to tmp_pcmn
-  CONSTRAINT parameter_chld_pkey PRIMARY KEY (pi_id ),
-  CONSTRAINT parameter_chld_tva_id_fkey FOREIGN KEY (tva_id)
-      REFERENCES tva_rate (tva_id) MATCH SIMPLE
-      ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-COMMENT ON TABLE tva_belge.parameter_chld  IS 'Child table for parameters (TVA 
Plugin)';
-COMMENT ON COLUMN tva_belge.parameter_chld.pi_id IS 'PK';
-COMMENT ON COLUMN tva_belge.parameter_chld.pcode IS 'FK to parameter';
-COMMENT ON COLUMN tva_belge.parameter_chld.tva_id IS 'FK to public.tva_rate';
-COMMENT ON COLUMN tva_belge.parameter_chld.pcm_val IS 'FK to tmp_pcmn';
-
-
-CREATE OR REPLACE FUNCTION tva_belge.fill_parameter_chld()
-  RETURNS void AS
-$BODY$
-
-declare
-   a_account text[];
-   a_tva_id text[];
-   i record;
-   e record;
-   f record;
-   n_size_tva int;
-   n_size_account int;
-   n_exist_tva int;
-begin
-
-for i in select pcode,pvalue,paccount from tva_belge.parameter
-loop
-       if length(trim(i.pvalue)) = 0 or length(trim(i.paccount)) = 0 then
-               continue;
-       end if;
-
-       a_account := string_to_array(i.paccount, ',');
-       a_tva_id  := string_to_array(i.pvalue,',');
-
-       n_size_tva := array_upper(a_tva_id,1);
-       n_size_account := array_upper(a_account,1);
-
-
-       while n_size_tva <> 0 loop
-
-               while n_size_account <> 0 loop
-
-                       select count(*) into n_exist_tva from tva_rate where 
tva_id=a_tva_id[n_size_tva]::numeric;
-
-                       if n_exist_tva != 0 then
-                               
-                                       insert into tva_belge.parameter_chld 
(pcode,tva_id,pcm_val)
-                                               values 
(i.pcode,a_tva_id[n_size_tva]::numeric,a_account[n_size_account]::account_type);
-                       end if;
-                       n_size_account := n_size_account -1;
-               end loop;
-               n_size_account := array_upper(a_account,1);
-               n_size_tva := n_size_tva -1;
-       end loop;
-
-end loop;
-
-return;
-
-end;
-
-$BODY$
-LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION tva_belge.fill_parameter_chld_assujetti()
-  RETURNS void AS
-$BODY$
-
-declare
-   a_account text[];
-   a_tva_id text[];
-   i record;
-   e record;
-   f record;
-   n_size_tva int;
-   n_size_account int;
-   n_exist_tva int;
-begin
-
-for i in select distinct pvalue from tva_belge.parameter WHERE pcode in 
('GRIL00','GRIL01','GRIL02','GRIL03')
-loop
-       if length(trim(i.pvalue)) = 0  then
-               continue;
-       end if;
-
-       a_tva_id  := string_to_array(i.pvalue,',');
-
-       n_size_tva := array_upper(a_tva_id,1);
-
-
-       while n_size_tva <> 0 loop
-               select count(*) into n_exist_tva from tva_rate where 
tva_id=a_tva_id[n_size_tva]::numeric;
-
-               if n_exist_tva != 0 then
-                       insert into tva_belge.parameter_chld (pcode,tva_id)
-                               values 
('ASSUJETTI',a_tva_id[n_size_tva]::numeric);
-               end if;
-               n_size_tva := n_size_tva -1;
-       end loop;
-
-end loop;
-
-return;
-
-end;
-
-$BODY$
-LANGUAGE plpgsql;
-
-select tva_belge.fill_parameter_chld();
-select tva_belge.fill_parameter_chld_assujetti();
-insert into tva_belge.parameter_chld (pcode,pcm_val) select pcode,paccount 
from tva_belge.parameter where pcode in ('ATVA','CRTVA','DTTVA');
-drop function tva_belge.fill_parameter_chld();
-drop function tva_belge.fill_parameter_chld_assujetti();
- alter table tva_belge.parameter drop column paccount;
- alter table tva_belge.parameter drop column pvalue;
-insert into tva_belge.version(vdesc) values ('Version 2 : amélioration 
plugin');
-commit;



---
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]