phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r215 - in trunk/coprop: . include include/template sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r215 - in trunk/coprop: . include include/template sql
Date: Tue, 27 Dec 2011 13:21:37 +0100 (CET)

Author: danydb
Date: 2011-12-27 13:21:35 +0100 (Tue, 27 Dec 2011)
New Revision: 215

Added:
   trunk/coprop/include/ajax_add_key.php
   trunk/coprop/include/ajax_mod_key.php
   trunk/coprop/include/class_copro_key.php
   trunk/coprop/include/template/key_detail.php
Modified:
   trunk/coprop/ajax.php
   trunk/coprop/coprop-javascript.js
   trunk/coprop/include/key.inc.php
   trunk/coprop/sql/trunk_dev.sql
Log:

Clef de r?\195?\169partition : ajout + modifie

Modified: trunk/coprop/ajax.php
===================================================================
--- trunk/coprop/ajax.php       2011-12-25 17:27:34 UTC (rev 214)
+++ trunk/coprop/ajax.php       2011-12-27 12:21:35 UTC (rev 215)
@@ -15,6 +15,13 @@
        case 'removelot':
                $cn->exec_sql("delete from coprop.lot where 
l_id=$1",array($lot_id));
                break;
+       case 'addkey':
+               require_once 'include/ajax_add_key.php';
+               break;
+       case 'modkey':
+               require_once 'include/ajax_mod_key.php';
+               break;
+
        default:
 
                var_dump($_GET);

Modified: trunk/coprop/coprop-javascript.js
===================================================================
--- trunk/coprop/coprop-javascript.js   2011-12-25 17:27:34 UTC (rev 214)
+++ trunk/coprop/coprop-javascript.js   2011-12-27 12:21:35 UTC (rev 215)
@@ -107,11 +107,32 @@
 /**
  * Ajout clef + tantième lot associés
  */
-function add_key()
+function add_key(dossier,plugin_code,ac)
 {
+       waiting_box();
        try
        {
-               alert('Ajout clef + tantième lot associés');
+               var 
queryString="plugin_code="+plugin_code+"&gDossier="+dossier+'&ac='+ac+"&act=addkey";
+               var action=new Ajax.Request ( 'ajax.php',
+               {
+                       method:'get',
+                       parameters:queryString,
+                       onFailure:null,
+                       onSuccess:function (response)
+                       {
+                               try
+                               {
+                                       remove_waiting_box();
+                                       
$('keydetail_div').innerHTML=response.responseText;
+                                       response.responseText.evalScripts();
+                               }
+                               catch(e)
+                               {
+                                       alert("Réponse Ajax ="+e.message);
+                               }
+                       }
+               }
+               );
        }
        catch(e)
        {
@@ -121,14 +142,40 @@
 /**
  * Modifie clef + tantième lot associés
  */
-function mod_key()
+function mod_key(dossier,plugin_code,ac,key_id)
 {
+       waiting_box();
        try
        {
-               alert('Modifie clef + tantième lot associés');
+               var 
queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&key_id="+key_id+'&ac='+ac+"&act=modkey";
+               var action=new Ajax.Request ( 'ajax.php',
+               {
+                       method:'get',
+                       parameters:queryString,
+                       onFailure:null,
+                       onSuccess:function (response)
+                       {
+                               try
+                               {
+                                       remove_waiting_box();
+                                       
$('keydetail_div').innerHTML=response.responseText;
+                                       response.responseText.evalScripts();
+
+                               }
+                               catch(e)
+                               {
+                                       alert("Réponse Ajax ="+e.message);
+                               }
+                       }
+               }
+               );
        }
        catch(e)
        {
                alert(e.message);
        }
+}
+function del_key(plugin_code,ac,dossier,lot_id)
+{
+
 }
\ No newline at end of file

Added: trunk/coprop/include/ajax_add_key.php
===================================================================
--- trunk/coprop/include/ajax_add_key.php                               (rev 0)
+++ trunk/coprop/include/ajax_add_key.php       2011-12-27 12:21:35 UTC (rev 
215)
@@ -0,0 +1,43 @@
+<?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 ajout clef repartition
+ *
+ */
+$date_start=new IDate('cr_start');
+$date_end=new IDate('cr_end');
+$note=new ITextarea('cr_note');
+$note->heigh=6;
+$note->width=80;
+$note->style='style="border:solid blue 1px;vertical-align:text-top;" ';
+$name=new IText('cr_name');
+$str_message="Ajout d'une clef de répartition";
+$alot=$cn->get_array("select f_id,vw_name as name,quick_code as qcode, 0 as 
l_part
+       from vw_fiche_attr where 
fd_id=$1",array($g_copro_parameter->categorie_lot));
+echo '<form method="post">';
+require_once 'template/key_detail.php';
+echo HtmlInput::submit("add_key","Ajouter",' onclick="return confirm (\'Vous 
confirmez?\')"');
+echo '</form>';
+?>

Added: trunk/coprop/include/ajax_mod_key.php
===================================================================
--- trunk/coprop/include/ajax_mod_key.php                               (rev 0)
+++ trunk/coprop/include/ajax_mod_key.php       2011-12-27 12:21:35 UTC (rev 
215)
@@ -0,0 +1,67 @@
+<?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 modifie clef
+ *
+ */
+$key=$cn->get_array("SELECT cr_name, cr_note, to_char(cr_start,'DD.MM.YYYY') 
as str_start,
+       to_char(cr_end,'DD.MM.YYYY') as str_end
+  FROM coprop.clef_repartition where cr_id=$1",array($key_id));
+
+$str_message="Modification ".h($key[0]['cr_name']);
+$date_start=new IDate('cr_start');
+$date_start->value=$key[0]['str_start'];
+
+$date_end=new IDate('cr_end');
+$date_end->value=$key[0]['str_end'];
+
+$note=new ITextarea('cr_note');
+$note->value=$key[0]['cr_note'];
+
+$note->heigh=6;
+$note->width=80;
+$note->style='style="border:solid blue 1px;vertical-align:text-top;" ';
+
+$name=new IText('cr_name');
+$name->value=$key[0]['cr_name'];
+
+$alot=$cn->get_array("select lot_fk as f_id,
+       (select ad_value from fiche_detail where f_id=lot_fk and ad_id=1) as 
name,
+       (select ad_value from fiche_detail where f_id=lot_fk and ad_id=23) as 
qcode,
+       crd_amount as l_part
+       from
+               coprop.clef_repartition_detail
+               where cr_id=$1
+       union
+select
+f_id,vw_name as name,quick_code as qcode, 0 as l_part
+       from vw_fiche_attr where fd_id=$2
+       and f_id not in (select lot_fk from coprop.clef_repartition_detail 
where cr_id=$1)",array($key_id,$g_copro_parameter->categorie_lot));
+echo '<form method="post">';
+echo HtmlInput::hidden('cr_id',$key_id);
+require_once 'template/key_detail.php';
+echo HtmlInput::submit("mod_key","Modifier",' onclick="return confirm (\'Vous 
confirmez?\')"');
+echo '</form>';
+?>

Added: trunk/coprop/include/class_copro_key.php
===================================================================
--- trunk/coprop/include/class_copro_key.php                            (rev 0)
+++ trunk/coprop/include/class_copro_key.php    2011-12-27 12:21:35 UTC (rev 
215)
@@ -0,0 +1,86 @@
+<?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 Gère les clefs
+ *
+ */
+class Copro_key
+{
+
+       function insert($p_array)
+       {
+               global $cn;
+               extract($p_array);
+               try
+               {
+                       $cn->start();
+                       $this->cr_id = $cn->get_value("insert into 
coprop.clef_repartition(cr_start,cr_end,cr_note,cr_name)
+                               
values(to_date($1,'DD.MM.YYYY'),to_date($2,'DD.MM.YYYY'),$3,$4) returning 
cr_id", array(strip_tags($cr_start), strip_tags($cr_end), strip_tags($cr_note), 
strip_tags($cr_name)));
+                       for ($i = 0; $i < count($f_id); $i++)
+                       {
+                               if (${"part" . $f_id[$i]} == '')
+                                       ${"part" . $f_id[$i]} = 0;
+                               $cn->exec_sql("insert into 
coprop.clef_repartition_detail(lot_fk,crd_amount,cr_id) values($1,$2,$3)", 
array($f_id[$i], ${"part" . $f_id[$i]}, $this->cr_id));
+                       }
+                       $cn->commit();
+               }
+               catch (Exception $exc)
+               {
+                       $cn->rollback();
+                       echo $exc->getTraceAsString();
+               }
+       }
+
+       function update($p_array)
+       {
+               global $cn;
+               extract($p_array);
+               try
+               {
+                       $cn->start();
+                       $cn->exec_sql("update coprop.clef_repartition set 
cr_start=to_date($1,'DD.MM.YYYY'),
+                               cr_end=to_date($2,'DD.MM.YYYY'),
+                               cr_note=$3,cr_name=$4
+                               where cr_id=$5",
+                                       array(strip_tags($cr_start), 
strip_tags($cr_end), strip_tags($cr_note), strip_tags($cr_name),$this->cr_id));
+                       $cn->exec_sql("delete from 
coprop.clef_repartition_detail where cr_id=$1",array($this->cr_id));
+                       for ($i = 0; $i < count($f_id); $i++)
+                       {
+                               if (${"part" . $f_id[$i]} == '')
+                                       ${"part" . $f_id[$i]} = 0;
+                               $cn->exec_sql("insert into 
coprop.clef_repartition_detail(lot_fk,crd_amount,cr_id) values($1,$2,$3)", 
array($f_id[$i], ${"part" . $f_id[$i]}, $this->cr_id));
+                       }
+                       $cn->commit();
+               }
+               catch (Exception $exc)
+               {
+                       $cn->rollback();
+                       echo $exc->getTraceAsString();
+               }
+       }
+
+}
+
+?>

Modified: trunk/coprop/include/key.inc.php
===================================================================
--- trunk/coprop/include/key.inc.php    2011-12-25 17:27:34 UTC (rev 214)
+++ trunk/coprop/include/key.inc.php    2011-12-27 12:21:35 UTC (rev 215)
@@ -26,7 +26,25 @@
  * @brief gestion des clefs de répartitions
  *
  */
+require_once 'class_copro_key.php';
 global $cn,$gDossier;
+
+// ajout nouvelle clef
+if ( isset($_POST['add_key']))
+{
+       $a=new Copro_key();
+       $a->insert($_POST);
+}
+
+// Mise à jour
+if ( isset($_POST['mod_key']))
+{
+       $a=new Copro_key();
+       $a->cr_id=$_POST['cr_id'];
+       $a->update($_POST);
+}
+
+
 $sql="select cr_id,cr_name,cr_note,cr_start,cr_end from 
coprop.clef_repartition ";
 /**
  * @todo ajouter tri
@@ -51,8 +69,8 @@
        </tr>
 <?
 for ($i=0;$i < count($a_key);$i++):
-       
$js=sprintf("mod_key(\'%s\',\'%s\',\'%s\')",$gDossier,$a_key[$i]['cr_id'],$_REQUEST['plugin_code']);
-       $mod_key=HtmlInput::anchor($a_key[$i]['cr_name'],"",$js);
+       
$js=sprintf("mod_key('%s','%s','%s','%s')",$gDossier,$_REQUEST['plugin_code'],$_REQUEST['ac'],$a_key[$i]['cr_id']);
+       $mod_key=HtmlInput::anchor($a_key[$i]['cr_name'],"","onclick=\"$js\"");
 ?>
        <tr>
                <td>
@@ -62,7 +80,7 @@
                        <?=$a_key[$i]['cr_note']?>
                </td>
                <td>
-                       <?=format_date($a_key[$i]['cr_date'])?>
+                       <?=format_date($a_key[$i]['cr_start'])?>
                </td>
                <td>
                        <?=format_date($a_key[$i]['cr_end'])?>
@@ -72,4 +90,8 @@
 endfor;
 ?>
 </table>
-<?=HtmlInput::button("add_key","Ajout 
clef","onclick=\"add_key('".$gDossier."')\"")?>
\ No newline at end of file
+<? 
$js=sprintf("add_key('%s','%s','%s')",$gDossier,$_REQUEST['plugin_code'],$_REQUEST['ac']);
+ echo HtmlInput::button("add_key","Ajout clef","onclick=\"$js\"");
+       ?>
+
+<div id="keydetail_div"></div>

Added: trunk/coprop/include/template/key_detail.php
===================================================================
--- trunk/coprop/include/template/key_detail.php                                
(rev 0)
+++ trunk/coprop/include/template/key_detail.php        2011-12-27 12:21:35 UTC 
(rev 215)
@@ -0,0 +1,84 @@
+<?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 detail of a key
+ *included from ajax_add_key or ajax_mod_key
+ */
+?>
+<div class="content" style="margin-left: 20px">
+<h1><?=$str_message?></h1>
+<h2> Caractéristique</h2>
+<table>
+       <tr>
+               <td>
+
+               Nom
+               </td>
+               <td>
+                       <?=$name->input()?>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       Date début
+               </td>
+               <td>
+                       <?=$date_start->input()?>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       Date fin
+               </td>
+               <td>
+                       <?=$date_end->input()?>
+               </td>
+       </tr>
+</table>
+Description
+<?=$note->input()?>
+<h2>Détail des lots</h2>
+<table>
+<?
+       for ($i=0;$i<count($alot);$i++):
+?>
+       <tr>
+               <td>
+                       
<?=HtmlInput::card_detail($alot[$i]['qcode'],$alot[$i]['name'])?>
+                       <?=HtmlInput::hidden('f_id[]',$alot[$i]['f_id'])?>
+               </td>
+               <td>
+                       <?
+                       $num=new INum('part'.$alot[$i]['f_id']);
+                       $num->value=$alot[$i]['l_part'];
+                       echo $num->input();
+                       ?>
+               </td>
+       </tr>
+<?
+       endfor;
+?>
+</table>
+</div>
\ No newline at end of file

Modified: trunk/coprop/sql/trunk_dev.sql
===================================================================
--- trunk/coprop/sql/trunk_dev.sql      2011-12-25 17:27:34 UTC (rev 214)
+++ trunk/coprop/sql/trunk_dev.sql      2011-12-27 12:21:35 UTC (rev 215)
@@ -4,7 +4,7 @@
 
 -- Dumped from database version 9.0.4
 -- Dumped by pg_dump version 9.0.4
--- Started on 2011-12-11 16:40:35 CET
+-- Started on 2011-12-27 13:17:14 CET
 
 SET statement_timeout = 0;
 SET client_encoding = 'UTF8';
@@ -15,24 +15,20 @@
 
 --
 -- TOC entry 8 (class 2615 OID 7283076)
--- Name: coprop; Type: SCHEMA; Schema: -; Owner: dany
+-- Name: coprop; Type: SCHEMA; Schema: -; Owner: -
 --
 
 CREATE SCHEMA coprop;
 
 
-ALTER SCHEMA coprop OWNER TO dany;
-
 SET search_path = coprop, pg_catalog;
 
-SET default_tablespace = '';
-
 SET default_with_oids = false;
 
 --
--- TOC entry 2087 (class 1259 OID 7283087)
+-- TOC entry 2090 (class 1259 OID 7283087)
 -- Dependencies: 8
--- Name: clef_repartition; Type: TABLE; Schema: coprop; Owner: dany; 
Tablespace: 
+-- Name: clef_repartition; Type: TABLE; Schema: coprop; Owner: -
 --
 
 CREATE TABLE clef_repartition (
@@ -44,12 +40,10 @@
 );
 
 
-ALTER TABLE coprop.clef_repartition OWNER TO dany;
-
 --
--- TOC entry 2086 (class 1259 OID 7283085)
--- Dependencies: 2087 8
--- Name: clef_repartition_cr_id_seq; Type: SEQUENCE; Schema: coprop; Owner: 
dany
+-- TOC entry 2089 (class 1259 OID 7283085)
+-- Dependencies: 8 2090
+-- Name: clef_repartition_cr_id_seq; Type: SEQUENCE; Schema: coprop; Owner: -
 --
 
 CREATE SEQUENCE clef_repartition_cr_id_seq
@@ -60,46 +54,33 @@
     CACHE 1;
 
 
-ALTER TABLE coprop.clef_repartition_cr_id_seq OWNER TO dany;
-
 --
--- TOC entry 2399 (class 0 OID 0)
--- Dependencies: 2086
--- Name: clef_repartition_cr_id_seq; Type: SEQUENCE OWNED BY; Schema: coprop; 
Owner: dany
+-- TOC entry 2406 (class 0 OID 0)
+-- Dependencies: 2089
+-- Name: clef_repartition_cr_id_seq; Type: SEQUENCE OWNED BY; Schema: coprop; 
Owner: -
 --
 
 ALTER SEQUENCE clef_repartition_cr_id_seq OWNED BY clef_repartition.cr_id;
 
 
 --
--- TOC entry 2400 (class 0 OID 0)
--- Dependencies: 2086
--- Name: clef_repartition_cr_id_seq; Type: SEQUENCE SET; Schema: coprop; 
Owner: dany
+-- TOC entry 2092 (class 1259 OID 7283136)
+-- Dependencies: 2384 8
+-- Name: clef_repartition_detail; Type: TABLE; Schema: coprop; Owner: -
 --
 
-SELECT pg_catalog.setval('clef_repartition_cr_id_seq', 1, false);
-
-
---
--- TOC entry 2089 (class 1259 OID 7283136)
--- Dependencies: 2379 8
--- Name: clef_repartition_detail; Type: TABLE; Schema: coprop; Owner: dany; 
Tablespace: 
---
-
 CREATE TABLE clef_repartition_detail (
     crd_id integer NOT NULL,
-    crd_lot bigint,
+    lot_fk bigint,
     crd_amount numeric(20,4) DEFAULT 0,
     cr_id bigint
 );
 
 
-ALTER TABLE coprop.clef_repartition_detail OWNER TO dany;
-
 --
--- TOC entry 2088 (class 1259 OID 7283134)
--- Dependencies: 8 2089
--- Name: clef_repartition_detail_crd_id_seq; Type: SEQUENCE; Schema: coprop; 
Owner: dany
+-- TOC entry 2091 (class 1259 OID 7283134)
+-- Dependencies: 8 2092
+-- Name: clef_repartition_detail_crd_id_seq; Type: SEQUENCE; Schema: coprop; 
Owner: -
 --
 
 CREATE SEQUENCE clef_repartition_detail_crd_id_seq
@@ -110,48 +91,43 @@
     CACHE 1;
 
 
-ALTER TABLE coprop.clef_repartition_detail_crd_id_seq OWNER TO dany;
-
 --
--- TOC entry 2401 (class 0 OID 0)
--- Dependencies: 2088
--- Name: clef_repartition_detail_crd_id_seq; Type: SEQUENCE OWNED BY; Schema: 
coprop; Owner: dany
+-- TOC entry 2407 (class 0 OID 0)
+-- Dependencies: 2091
+-- Name: clef_repartition_detail_crd_id_seq; Type: SEQUENCE OWNED BY; Schema: 
coprop; Owner: -
 --
 
 ALTER SEQUENCE clef_repartition_detail_crd_id_seq OWNED BY 
clef_repartition_detail.crd_id;
 
 
 --
--- TOC entry 2402 (class 0 OID 0)
--- Dependencies: 2088
--- Name: clef_repartition_detail_crd_id_seq; Type: SEQUENCE SET; Schema: 
coprop; Owner: dany
+-- TOC entry 2096 (class 1259 OID 7302202)
+-- Dependencies: 8
+-- Name: coproprietaire; Type: TABLE; Schema: coprop; Owner: -
 --
 
-SELECT pg_catalog.setval('clef_repartition_detail_crd_id_seq', 1, false);
+CREATE TABLE coproprietaire (
+    c_id integer NOT NULL,
+    c_fiche_id bigint
+);
 
 
 --
--- TOC entry 2091 (class 1259 OID 7283155)
--- Dependencies: 8
--- Name: jnt_coprop_lot; Type: TABLE; Schema: coprop; Owner: dany; Tablespace: 
+-- TOC entry 2408 (class 0 OID 0)
+-- Dependencies: 2096
+-- Name: TABLE coproprietaire; Type: COMMENT; Schema: coprop; Owner: -
 --
 
-CREATE TABLE jnt_coprop_lot (
-    jcl_id integer NOT NULL,
-    jcl_copro bigint,
-    jcl_lot bigint
-);
+COMMENT ON TABLE coproprietaire IS 'Liste des copropriétaires';
 
 
-ALTER TABLE coprop.jnt_coprop_lot OWNER TO dany;
-
 --
--- TOC entry 2090 (class 1259 OID 7283153)
--- Dependencies: 8 2091
--- Name: jnt_coprop_lot_jlc_id_seq; Type: SEQUENCE; Schema: coprop; Owner: dany
+-- TOC entry 2095 (class 1259 OID 7302200)
+-- Dependencies: 8 2096
+-- Name: coproprietaire_c_id_seq; Type: SEQUENCE; Schema: coprop; Owner: -
 --
 
-CREATE SEQUENCE jnt_coprop_lot_jlc_id_seq
+CREATE SEQUENCE coproprietaire_c_id_seq
     START WITH 1
     INCREMENT BY 1
     NO MINVALUE
@@ -159,115 +135,113 @@
     CACHE 1;
 
 
-ALTER TABLE coprop.jnt_coprop_lot_jlc_id_seq OWNER TO dany;
-
 --
--- TOC entry 2403 (class 0 OID 0)
--- Dependencies: 2090
--- Name: jnt_coprop_lot_jlc_id_seq; Type: SEQUENCE OWNED BY; Schema: coprop; 
Owner: dany
+-- TOC entry 2409 (class 0 OID 0)
+-- Dependencies: 2095
+-- Name: coproprietaire_c_id_seq; Type: SEQUENCE OWNED BY; Schema: coprop; 
Owner: -
 --
 
-ALTER SEQUENCE jnt_coprop_lot_jlc_id_seq OWNED BY jnt_coprop_lot.jcl_id;
+ALTER SEQUENCE coproprietaire_c_id_seq OWNED BY coproprietaire.c_id;
 
 
 --
--- TOC entry 2404 (class 0 OID 0)
--- Dependencies: 2090
--- Name: jnt_coprop_lot_jlc_id_seq; Type: SEQUENCE SET; Schema: coprop; Owner: 
dany
+-- TOC entry 2094 (class 1259 OID 7302189)
+-- Dependencies: 2386 8
+-- Name: lot; Type: TABLE; Schema: coprop; Owner: -
 --
 
-SELECT pg_catalog.setval('jnt_coprop_lot_jlc_id_seq', 1, false);
+CREATE TABLE lot (
+    l_id integer NOT NULL,
+    l_fiche_id bigint,
+    l_part numeric(20,4) DEFAULT 0,
+    coprop_fk bigint NOT NULL
+);
 
 
 --
--- TOC entry 2085 (class 1259 OID 7283077)
--- Dependencies: 8
--- Name: parameter; Type: TABLE; Schema: coprop; Owner: dany; Tablespace: 
+-- TOC entry 2410 (class 0 OID 0)
+-- Dependencies: 2094
+-- Name: TABLE lot; Type: COMMENT; Schema: coprop; Owner: -
 --
 
-CREATE TABLE parameter (
-    pr_id text NOT NULL,
-    pr_value text
-);
+COMMENT ON TABLE lot IS 'liste des Lots';
 
 
-ALTER TABLE coprop.parameter OWNER TO dany;
-
 --
--- TOC entry 2377 (class 2604 OID 7283090)
--- Dependencies: 2086 2087 2087
--- Name: cr_id; Type: DEFAULT; Schema: coprop; Owner: dany
+-- TOC entry 2093 (class 1259 OID 7302187)
+-- Dependencies: 2094 8
+-- Name: lot_l_id_seq; Type: SEQUENCE; Schema: coprop; Owner: -
 --
 
-ALTER TABLE clef_repartition ALTER COLUMN cr_id SET DEFAULT 
nextval('clef_repartition_cr_id_seq'::regclass);
+CREATE SEQUENCE lot_l_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
 
 
 --
--- TOC entry 2378 (class 2604 OID 7283139)
--- Dependencies: 2088 2089 2089
--- Name: crd_id; Type: DEFAULT; Schema: coprop; Owner: dany
+-- TOC entry 2411 (class 0 OID 0)
+-- Dependencies: 2093
+-- Name: lot_l_id_seq; Type: SEQUENCE OWNED BY; Schema: coprop; Owner: -
 --
 
-ALTER TABLE clef_repartition_detail ALTER COLUMN crd_id SET DEFAULT 
nextval('clef_repartition_detail_crd_id_seq'::regclass);
+ALTER SEQUENCE lot_l_id_seq OWNED BY lot.l_id;
 
 
 --
--- TOC entry 2380 (class 2604 OID 7283158)
--- Dependencies: 2090 2091 2091
--- Name: jcl_id; Type: DEFAULT; Schema: coprop; Owner: dany
+-- TOC entry 2088 (class 1259 OID 7283077)
+-- Dependencies: 8
+-- Name: parameter; Type: TABLE; Schema: coprop; Owner: -
 --
 
-ALTER TABLE jnt_coprop_lot ALTER COLUMN jcl_id SET DEFAULT 
nextval('jnt_coprop_lot_jlc_id_seq'::regclass);
+CREATE TABLE parameter (
+    pr_id text NOT NULL,
+    pr_value text
+);
 
 
 --
--- TOC entry 2394 (class 0 OID 7283087)
--- Dependencies: 2087
--- Data for Name: clef_repartition; Type: TABLE DATA; Schema: coprop; Owner: 
dany
+-- TOC entry 2382 (class 2604 OID 7283090)
+-- Dependencies: 2089 2090 2090
+-- Name: cr_id; Type: DEFAULT; Schema: coprop; Owner: -
 --
 
-COPY clef_repartition (cr_id, cr_name, cr_note, cr_start, cr_end) FROM stdin;
-\.
+ALTER TABLE clef_repartition ALTER COLUMN cr_id SET DEFAULT 
nextval('clef_repartition_cr_id_seq'::regclass);
 
 
 --
--- TOC entry 2395 (class 0 OID 7283136)
--- Dependencies: 2089
--- Data for Name: clef_repartition_detail; Type: TABLE DATA; Schema: coprop; 
Owner: dany
+-- TOC entry 2383 (class 2604 OID 7283139)
+-- Dependencies: 2091 2092 2092
+-- Name: crd_id; Type: DEFAULT; Schema: coprop; Owner: -
 --
 
-COPY clef_repartition_detail (crd_id, crd_lot, crd_amount, cr_id) FROM stdin;
-\.
+ALTER TABLE clef_repartition_detail ALTER COLUMN crd_id SET DEFAULT 
nextval('clef_repartition_detail_crd_id_seq'::regclass);
 
 
 --
--- TOC entry 2396 (class 0 OID 7283155)
--- Dependencies: 2091
--- Data for Name: jnt_coprop_lot; Type: TABLE DATA; Schema: coprop; Owner: dany
+-- TOC entry 2387 (class 2604 OID 7302205)
+-- Dependencies: 2095 2096 2096
+-- Name: c_id; Type: DEFAULT; Schema: coprop; Owner: -
 --
 
-COPY jnt_coprop_lot (jcl_id, jcl_copro, jcl_lot) FROM stdin;
-\.
+ALTER TABLE coproprietaire ALTER COLUMN c_id SET DEFAULT 
nextval('coproprietaire_c_id_seq'::regclass);
 
 
 --
--- TOC entry 2393 (class 0 OID 7283077)
--- Dependencies: 2085
--- Data for Name: parameter; Type: TABLE DATA; Schema: coprop; Owner: dany
+-- TOC entry 2385 (class 2604 OID 7302192)
+-- Dependencies: 2094 2093 2094
+-- Name: l_id; Type: DEFAULT; Schema: coprop; Owner: -
 --
 
-COPY parameter (pr_id, pr_value) FROM stdin;
-categorie_lot  1
-categorie_coprop       2
-poste_appel    740
-journal_appel  4
-\.
+ALTER TABLE lot ALTER COLUMN l_id SET DEFAULT 
nextval('lot_l_id_seq'::regclass);
 
 
 --
--- TOC entry 2386 (class 2606 OID 7283142)
--- Dependencies: 2089 2089
--- Name: clef_repartition_detail_pkey; Type: CONSTRAINT; Schema: coprop; 
Owner: dany; Tablespace: 
+-- TOC entry 2393 (class 2606 OID 7283142)
+-- Dependencies: 2092 2092
+-- Name: clef_repartition_detail_pkey; Type: CONSTRAINT; Schema: coprop; 
Owner: -
 --
 
 ALTER TABLE ONLY clef_repartition_detail
@@ -275,9 +249,9 @@
 
 
 --
--- TOC entry 2384 (class 2606 OID 7283095)
--- Dependencies: 2087 2087
--- Name: clef_repartition_pkey; Type: CONSTRAINT; Schema: coprop; Owner: dany; 
Tablespace: 
+-- TOC entry 2391 (class 2606 OID 7283095)
+-- Dependencies: 2090 2090
+-- Name: clef_repartition_pkey; Type: CONSTRAINT; Schema: coprop; Owner: -
 --
 
 ALTER TABLE ONLY clef_repartition
@@ -285,9 +259,9 @@
 
 
 --
--- TOC entry 2382 (class 2606 OID 7283084)
--- Dependencies: 2085 2085
--- Name: copro_parameter_pkey; Type: CONSTRAINT; Schema: coprop; Owner: dany; 
Tablespace: 
+-- TOC entry 2389 (class 2606 OID 7283084)
+-- Dependencies: 2088 2088
+-- Name: copro_parameter_pkey; Type: CONSTRAINT; Schema: coprop; Owner: -
 --
 
 ALTER TABLE ONLY parameter
@@ -295,56 +269,76 @@
 
 
 --
--- TOC entry 2388 (class 2606 OID 7283160)
--- Dependencies: 2091 2091
--- Name: jnt_coprop_lot_pkey; Type: CONSTRAINT; Schema: coprop; Owner: dany; 
Tablespace: 
+-- TOC entry 2397 (class 2606 OID 7302219)
+-- Dependencies: 2096 2096
+-- Name: coproprietaire_c_fiche_id_key; Type: CONSTRAINT; Schema: coprop; 
Owner: -
 --
 
-ALTER TABLE ONLY jnt_coprop_lot
-    ADD CONSTRAINT jnt_coprop_lot_pkey PRIMARY KEY (jcl_id);
+ALTER TABLE ONLY coproprietaire
+    ADD CONSTRAINT coproprietaire_c_fiche_id_key UNIQUE (c_fiche_id);
 
 
 --
--- TOC entry 2390 (class 2606 OID 7283148)
--- Dependencies: 2089 2087 2383
--- Name: clef_repartition_detail_cr_id_fkey; Type: FK CONSTRAINT; Schema: 
coprop; Owner: dany
+-- TOC entry 2399 (class 2606 OID 7302207)
+-- Dependencies: 2096 2096
+-- Name: coproprietaire_pkey; Type: CONSTRAINT; Schema: coprop; Owner: -
 --
 
+ALTER TABLE ONLY coproprietaire
+    ADD CONSTRAINT coproprietaire_pkey PRIMARY KEY (c_id);
+
+
+--
+-- TOC entry 2395 (class 2606 OID 7302194)
+-- Dependencies: 2094 2094
+-- Name: lot_pkey; Type: CONSTRAINT; Schema: coprop; Owner: -
+--
+
+ALTER TABLE ONLY lot
+    ADD CONSTRAINT lot_pkey PRIMARY KEY (l_id);
+
+
+--
+-- TOC entry 2400 (class 2606 OID 7283148)
+-- Dependencies: 2090 2390 2092
+-- Name: clef_repartition_detail_cr_id_fkey; Type: FK CONSTRAINT; Schema: 
coprop; Owner: -
+--
+
 ALTER TABLE ONLY clef_repartition_detail
     ADD CONSTRAINT clef_repartition_detail_cr_id_fkey FOREIGN KEY (cr_id) 
REFERENCES clef_repartition(cr_id) ON UPDATE CASCADE ON DELETE CASCADE;
 
 
 --
--- TOC entry 2389 (class 2606 OID 7283143)
--- Dependencies: 2089 1947
--- Name: clef_repartition_detail_crl_lot_fkey; Type: FK CONSTRAINT; Schema: 
coprop; Owner: dany
+-- TOC entry 2403 (class 2606 OID 7302208)
+-- Dependencies: 2096 1950
+-- Name: coproprietaire_c_fiche_id_fkey; Type: FK CONSTRAINT; Schema: coprop; 
Owner: -
 --
 
-ALTER TABLE ONLY clef_repartition_detail
-    ADD CONSTRAINT clef_repartition_detail_crl_lot_fkey FOREIGN KEY (crd_lot) 
REFERENCES public.fiche(f_id) ON UPDATE CASCADE ON DELETE CASCADE;
+ALTER TABLE ONLY coproprietaire
+    ADD CONSTRAINT coproprietaire_c_fiche_id_fkey FOREIGN KEY (c_fiche_id) 
REFERENCES public.fiche(f_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE 
INITIALLY DEFERRED;
 
 
 --
--- TOC entry 2391 (class 2606 OID 7283161)
--- Dependencies: 1947 2091
--- Name: jnt_coprop_lot_jcl_copro_fkey; Type: FK CONSTRAINT; Schema: coprop; 
Owner: dany
+-- TOC entry 2402 (class 2606 OID 7302230)
+-- Dependencies: 2396 2094 2096
+-- Name: lot_coprop_fk_fkey; Type: FK CONSTRAINT; Schema: coprop; Owner: -
 --
 
-ALTER TABLE ONLY jnt_coprop_lot
-    ADD CONSTRAINT jnt_coprop_lot_jcl_copro_fkey FOREIGN KEY (jcl_copro) 
REFERENCES public.fiche(f_id) ON UPDATE CASCADE ON DELETE CASCADE;
+ALTER TABLE ONLY lot
+    ADD CONSTRAINT lot_coprop_fk_fkey FOREIGN KEY (coprop_fk) REFERENCES 
coproprietaire(c_fiche_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE 
INITIALLY DEFERRED;
 
 
 --
--- TOC entry 2392 (class 2606 OID 7283166)
--- Dependencies: 1947 2091
--- Name: jnt_coprop_lot_jcl_lot_fkey; Type: FK CONSTRAINT; Schema: coprop; 
Owner: dany
+-- TOC entry 2401 (class 2606 OID 7302195)
+-- Dependencies: 1950 2094
+-- Name: lot_fiche_fk; Type: FK CONSTRAINT; Schema: coprop; Owner: -
 --
 
-ALTER TABLE ONLY jnt_coprop_lot
-    ADD CONSTRAINT jnt_coprop_lot_jcl_lot_fkey FOREIGN KEY (jcl_lot) 
REFERENCES public.fiche(f_id) ON UPDATE CASCADE ON DELETE CASCADE;
+ALTER TABLE ONLY lot
+    ADD CONSTRAINT lot_fiche_fk FOREIGN KEY (l_fiche_id) REFERENCES 
public.fiche(f_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY 
DEFERRED;
 
 
--- Completed on 2011-12-11 16:40:35 CET
+-- Completed on 2011-12-27 13:17:14 CET
 
 --
 -- PostgreSQL database dump complete




reply via email to

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