[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r275 - in trunk/coprop/include: . template
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r275 - in trunk/coprop/include: . template |
Date: |
Wed, 11 Jan 2012 12:20:27 +0100 (CET) |
Author: danydb
Date: 2012-01-11 12:20:26 +0100 (Wed, 11 Jan 2012)
New Revision: 275
Modified:
trunk/coprop/include/class_copro_lot.php
trunk/coprop/include/lot.inc.php
trunk/coprop/include/template/coprop_lot_list.php
Log:
Ajout vue immeuble, lot, coprop
Modified: trunk/coprop/include/class_copro_lot.php
===================================================================
--- trunk/coprop/include/class_copro_lot.php 2012-01-10 20:56:16 UTC (rev
274)
+++ trunk/coprop/include/class_copro_lot.php 2012-01-11 11:20:26 UTC (rev
275)
@@ -29,86 +29,7 @@
*/
class Copro_Lot
{
- function insert($p_array)
- {
- global $cn;
- extract($p_array);
- try
- {
- // find the coprop
- $coprop=new Fiche($cn);
- $coprop->get_by_qcode($w_copro);
- if ($coprop->id == 0) throw new Exception("Ce
copropriétaire $w_copro n'existe pas",1);
- $count=$cn->get_value("select count(*) from
coprop.coproprietaire where c_fiche_id=$1",
- array($coprop->id));
- if ( $count > 0 ) throw
new Exception ("Copropriétaire déjà encodé",2);
- $cn->exec_sql("insert into
coprop.coproprietaire(c_fiche_id)values($1)",
- array($coprop->id));
- // Find the lot.
- $str_warning="";$n_warning=0;
- for ($i=0;$i<count($lot);$i++)
- {
- $flot=new Fiche($cn);
- $flot->id=$lot[$i];
- // si w_lot pas inseré alors inserer
- $cn->exec_sql("insert into
coprop.lot(l_fiche_id,coprop_fk)".
- " values ($1,$2)",
- array($flot->id,$coprop->id));
- }
- }
- catch (Exception $e)
- {
- echo $e->getMessage();
- echo $e->getTraceAsString();
-
- }
-
-
- }
- function add_lot($p_array)
- {
- global $cn;
- extract($p_array);
- try
- {
- // find the coprop
- $coprop=new Fiche($cn);
- $coprop->id=$copro_id;
- if ($coprop->id == 0) throw new Exception("Ce
copropriétaire $w_copro n'existe pas",1);
- $count=$cn->get_value("select count(*) from
coprop.coproprietaire where c_fiche_id=$1",
- array($coprop->id));
- // Find the lot.
- $str_warning="";$n_warning=0;
- for ($i=0;$i<count($lot);$i++)
- {
- $flot=new Fiche($cn);
- $flot->id=$lot[$i];
-
- // si w_lot pas inseré alors inserer
- $cn->exec_sql("insert into
coprop.lot(l_fiche_id,coprop_fk)".
- " values ($1,$2)",
- array($flot->id,$coprop->id));
-
- }
- }
- catch (Exception $e)
- {
- echo $e->getMessage();
- echo $e->getTraceAsString();
-
- }
-
-
- }
- function update_lot($p_array)
- {
-
- return;
-
- }
-
-
}
?>
Modified: trunk/coprop/include/lot.inc.php
===================================================================
--- trunk/coprop/include/lot.inc.php 2012-01-10 20:56:16 UTC (rev 274)
+++ trunk/coprop/include/lot.inc.php 2012-01-11 11:20:26 UTC (rev 275)
@@ -26,49 +26,8 @@
* @brief liaison entre lot et copropriétaires
*
*/
-require_once 'class_copro_lot.php';
global $cn,$g_copro_parameter;
-if ( isset($_POST['copro_new']))
-{
- var_dump($_POST);
- $cp=new Copro_Lot();
- try
- {
- $cp->insert($_POST);
- }
- catch(Exception $e)
- {
- echo $e->getTraceAsString();
- }
}
-// Ajout de lots
-if (isset($_POST['addlot']))
-{
- var_dump($_POST);
- $cp=new Copro_Lot();
- try
- {
- $cp->add_lot($_POST);
- }
- catch(Exception $e)
- {
- echo $e->getTraceAsString();
- }
-}
-// Mise à jour lots existants
-if ( isset($_POST['updexist']))
-{
- var_dump($_POST);
- $cp=new Copro_Lot();
- try
- {
- $cp->update_lot($_POST);
- }
- catch(Exception $e)
- {
- echo $e->getTraceAsString();
- }
-}
//require_once 'include/class_coprop-lot_coprop.php';
/* Add button */
$f_add_button=new IButton('add_card');
@@ -80,42 +39,55 @@
+/**
+ * @todo ajouter tri
+ */
+
// liste Immeuble
-$sql=" select a.f_id ,
- (select ad_value from fiche_detail where f_id=a.f_id and ad_id=1) as
building_name,
- (select ad_value from fiche_detail where f_id=a.f_id and ad_id=23) as
building_qcode
+$a_immeuble=$cn->get_array(" select f_id,vw_name,quick_code
+ from vw_fiche_attr
+ where
+ fd_id=$1
+ ",array($g_copro_parameter->categorie_immeuble));
+
+/*
+ * Liste coprop par immeuble
+ */
+$coprop=$cn->prepare("coprop"," select coprop_id,
+ vw_name as copro_name,
+ vw_first_name as copro_first_name,
+ quick_code as copro_qcode
from
- fiche as a
+ coprop.summary as s join vw_fiche_attr using (f_id)
where
- a.fd_id=$1";
-
+ s.building_id=$1
+ ");
/*
* Liste coprop par immeuble
*/
-$sql=" select f_id,
- (select ad_value from fiche_detail where f_id=c_fiche_id and ad_id=1)
as copro_name,
- (select ad_value from fiche_detail where f_id=c_fiche_id and ad_id=23)
as copro_qcode
- (select ad_value from fiche_detail where f_id=c_fiche_id and ad_id=10)
as copro_start,
- (select ad_value from fiche_detail where f_id=c_fiche_id and ad_id=33)
as copro_end
+$lot=$cn->prepare("lot"," select lot_id,
+ vw_name as lot_name,
+ quick_code as lot_qcode,
+ vw_description as lot_desc
from
- fiche
+ coprop.summary as s join vw_fiche_attr using (f_id)
where
- fd_id=$1
- and f_id in ( select f_id from fiche_detail where ad_id=$1 and
ad_value=$2)
- ";
-/**
- * @todo ajouter tri
+ s.building_id=$1 and s.coprop_id=$2
+ ");
+/*
+ * Lot sans immeuble or coprop
*/
-/*$a_copro=$cn->get_array($sql,array($g_copro_parameter->categorie_coprop));
+$a_undef_lot=$cn->get_array(" select lot_id,
+ vw_name as lot_name,
+ quick_code as lot_qcode,
+ vw_description as lot_desc
+ from
+ coprop.summary as s join vw_fiche_attr using (f_id)
+ where
+ coalesce(s.building_id,'')='' or coalesce(s.coprop_id,'')=''
+ ");
-$sql_lot=$cn->prepare ("lot","select f_id,
- (select ad_value from fiche_detail where f_id=l_fiche_id and ad_id=1)
as lot_name,
- (select ad_value from fiche_detail where f_id=l_fiche_id and ad_id=23)
as lot_qcode,
- (select ad_value from fiche_detail where f_id=l_fiche_id and ad_id=9)
as lot_desc
- from fiche where f_id in ( select f_id from fiche_detail where ad_id=$1
and ad_value=$2)
- and fd_id=$3");
-*/
echo $f_add_button->input();
Modified: trunk/coprop/include/template/coprop_lot_list.php
===================================================================
--- trunk/coprop/include/template/coprop_lot_list.php 2012-01-10 20:56:16 UTC
(rev 274)
+++ trunk/coprop/include/template/coprop_lot_list.php 2012-01-11 11:20:26 UTC
(rev 275)
@@ -23,45 +23,53 @@
/**
* @file
- * @brief show list between lot et copropriétaire
+ * @brief show list building, lot and copropriétaire
*
*/
$gDossier=Dossier::id();
?>
-<table class="result">
- <tr>
- <th> Nom copropriétaire </th>
- <th>
- Lot(s)
- </th>
- </tr>
-<?
-for ($i=0;$i<count($a_copro);$i++):
-
$col_copro=HtmlInput::anchor($a_copro[$i]['copro_name'],"","onclick=\"mod_coprop($gDossier,'".$a_copro[$i]['c_fiche_id']."','".$_REQUEST['plugin_code']."','".$_REQUEST['ac']."')\"");
-?>
- <tr>
- <td><?=$col_copro?></td>
- <td>
- <?
-
$rlot=$cn->execute('lot',array($a_copro[$i]['c_fiche_id']));
- $max=Database::num_row($rlot);
- $sp="";
- for ($e=0;$e<$max;$e++):
- $row=Database::fetch_array($rlot,$e);
-
$js_lot=HtmlInput::card_detail($row['lot_qcode'],$row['lot_name'],'
class="line"');
- $js_lot.=$row['lot_desc'];
- echo $sp.$js_lot;
- $sp=" , ";
- endfor;
- ?>
+<h1>Lots affectés</h1>
+<? for ( $i=0;$i<count($a_immeuble);$i++):?>
+<h2><?=HtmlInput::card_detail($a_immeuble[$i]['quick_code'],$a_immeuble[$i]['vw_name'])?></h2>
- </td>
-</tr>
-<?
-endfor;
+<?
+$ret_coprop=$cn->execute("coprop",array($a_immeuble[$i]['f_id']));
+$max_coprop=Database::nuw_row($ret_coprop);
+if ($max_coprop==0)
+{
+ echo "Pas de copropriétaires pour cet immeuble";
+ continue;
+}
?>
+<ul>
+<?for ($e=0;$e<$max_coprop;$e++):
+ $r=Database::fetch_array($ret_coprop,$e);
+ ?>
+ <li><?=HtmlInput::card_detail($r['copro_qcode'],h($r['copro_name']."
".$r['copro_name']))?></li>
+ <?
+ $ret_lot=$cn->execute("lot",array($a_immeuble[$i]['f_id'],$r['copro_id']));
+ $max_lot=Database::nuw_row($ret_lot);
+ if ($max_lot==0)
+ {
+ echo "Pas de lot pour ce copropriétaires ";
+ continue;
+ }
+ ?>
+ <ul>
+ <?for ($l=0;$e<$max_lot;$l++):
+ $s=Database::fetch_array($ret_lot,$e);
+ ?>
+ <li><?=HtmlInput::card_detail($s['lot_qcode'],h($r['lot_name']."
".$s['lot_desc']))?></li>
+ <? endfor;?>
+ </ul>
+ <? endfor;?>
+</ul>
-</table>
-<?
-echo HtmlInput::button("add_link","Ajout Copropriétaire / lot
","onclick=\"add_coprop()\"");
-?>
\ No newline at end of file
+<? endfor; ?>
+
+<h1>Lot sans immeuble ou sans copropriétaires</h1>
+<ul>
+<? for($e=0;$e<count($a_undef_lot);$e++):?>
+
<li><?=HtmlInput::card_detail($a_undef_lot[$e]['lot_qcode'],h($a_undef_lot[$e]['lot_name']."
".$a_undef_lot[$e]['lot_desc']))?></li>
+<? endfor; ?>
+</ul>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r275 - in trunk/coprop/include: . template,
phpcompta-dev <=