/[openfoncier]/trunk/obj/destination_shon.class.php
ViewVC logotype

Diff of /trunk/obj/destination_shon.class.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 169 by fraynaud, Tue Oct 4 15:43:43 2011 UTC revision 271 by fraynaud, Wed Dec 14 09:14:46 2011 UTC
# Line 27  class destination_shon extends destinati Line 27  class destination_shon extends destinati
27          parent :: setType($form,$maj);          parent :: setType($form,$maj);
28          if ($maj < 2) { //ajouter et modifier          if ($maj < 2) { //ajouter et modifier
29            $form->setType('dossier', 'hiddenstatic');            $form->setType('dossier', 'hiddenstatic');
30              $form->setType('shon', 'hiddenstatic');
31          }else          }else
32               $form->setType('shon', 'text');               $form->setType('shon', 'text');
33      }      }
# Line 44  class destination_shon extends destinati Line 45  class destination_shon extends destinati
45          $form->setMax('destination', 2);          $form->setMax('destination', 2);
46          $form->setMax('dossier', 12);          $form->setMax('dossier', 12);
47      }      }
48    
49            function setLib(&$form,$maj) {
50            parent::setLib($form,$maj);
51                    $form->setLib('shon_anterieure',_('shon existante avant travaux'));
52                    $form->setLib('shon_demolie',_('shon demolie ou transformée en shob'));
53                    $form->setLib('shon_anterieure_supprimee',_('shon supprimee par changement de destination'));
54                    $form->setLib('shon_nouvelle_transformee',_('shon creee par changement de destination'));
55                    $form->setLib('shon_nouvelle',_('shon construite'));
56                    $form->setLib('shon_shob_transformee',_('shon creee par transformation de shob en shon'));
57            }
58    
59            function setOnchange(&$form,$maj) {
60            parent::setOnchange($form,$maj);
61                    $form->setOnchange('shon_anterieure','VerifNumdec(this)');
62                    $form->setOnchange('shon_demolie','VerifNumdec(this)');
63                    $form->setOnchange('shon_anterieure_supprimee','VerifNumdec(this)');
64                    $form->setOnchange('shon_nouvelle_transformee','VerifNumdec(this)');
65                    $form->setOnchange('shon_nouvelle','VerifNumdec(this)');
66                    $form->setOnchange('shon_shob_transformee','VerifNumdec(this)');
67            }
68    
69        
70        function triggerajouter($id,&$db,$val,$DEBUG){
71            $this->calculshon($val);
72        }
73        
74            
75      function triggerajouterapres($id,&$db,$val,$DEBUG){      function triggerajouterapres($id,&$db,$val,$DEBUG){
76      /// calcul shon dossier  [calculate shon dossier]      /// calcul shon dossier  [calculate shon dossier]
77         $sql ="select sum(shon) as shon from destination_shon where dossier ='"         $sql ="select sum(shon) as shon from ".DB_PREFIXE.
78         .$val['dossier']."'" ;               "destination_shon where dossier ='".$val['dossier']."'" ;
79         $res=$db->query($sql);         $res=$db->query($sql);
80         if (database :: isError($res))         if (database :: isError($res))
81            die($res->getMessage()."erreur  ".$sql);            die($res->getMessage()."erreur  ".$sql);
# Line 59  class destination_shon extends destinati Line 86  class destination_shon extends destinati
86            else            else
87                $surface = $row['shon'];                $surface = $row['shon'];
88              $valF['shon_calcul']= $surface;              $valF['shon_calcul']= $surface;
89            $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);            $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
90            if (database::isError($res1))            if (database::isError($res1))
91              die($res1->getMessage());              die($res1->getMessage());
92                    if ($DEBUG == 1)                    if ($DEBUG == 1)
# Line 71  class destination_shon extends destinati Line 98  class destination_shon extends destinati
98            }            }
99      }      }
100            
101        function triggermodifier($id,&$db,$val,$DEBUG){
102            $this->calculshon($val);
103        }
104        
105            
106      function triggermodifierapres($id,&$db,$val,$DEBUG)      function triggermodifierapres($id,&$db,$val,$DEBUG)
107      {      {
108      // calcul shon dossier [calculate shon dossier]      // calcul shon dossier [calculate shon dossier]
109          $sql ="select sum(shon) as shon from destination_shon where dossier ='"          $sql ="select sum(shon) as shon from ".DB_PREFIXE.
110          .$val['dossier']."'" ;          "destination_shon where dossier ='".$val['dossier']."'" ;
111          $res=$db->query($sql);          $res=$db->query($sql);
112           if (database::isError($res))           if (database::isError($res))
113              die($res->getMessage());              die($res->getMessage());
# Line 87  class destination_shon extends destinati Line 118  class destination_shon extends destinati
118            else            else
119                $surface = $row['shon'];                $surface = $row['shon'];
120            $valF['shon_calcul']= $surface;            $valF['shon_calcul']= $surface;
121            $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);            $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
122            if (database::isError($res1))            if (database::isError($res1))
123              die($res1->getMessage());              die($res1->getMessage());
124            if ($DEBUG == 1)            if ($DEBUG == 1)
# Line 102  class destination_shon extends destinati Line 133  class destination_shon extends destinati
133      function triggersupprimerapres($id,&$db,$val,$DEBUG)      function triggersupprimerapres($id,&$db,$val,$DEBUG)
134      {      {
135      // calcul shon dossier [calculate shon dossier]      // calcul shon dossier [calculate shon dossier]
136          $sql ="select sum(shon) as shon from destination_shon where dossier ='"          $sql ="select sum(shon) as shon from ".DB_PREFIXE."destination_shon where dossier ='"
137          .$val['dossier']."'" ;          .$val['dossier']."'" ;
138          $res=$db->query($sql);          $res=$db->query($sql);
139          if (database::isError($res))          if (database::isError($res))
# Line 114  class destination_shon extends destinati Line 145  class destination_shon extends destinati
145              else              else
146                $surface = $row['shon'];                $surface = $row['shon'];
147              $valF['shon_calcul']= $surface;              $valF['shon_calcul']= $surface;
148              $res1= $db->autoExecute('dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);              $res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle);
149              if (database::isError($res1))              if (database::isError($res1))
150              die($res1->getMessage());              die($res1->getMessage());
151              if ($DEBUG == 1)              if ($DEBUG == 1)
# Line 134  class destination_shon extends destinati Line 165  class destination_shon extends destinati
165          }          }
166      }      }
167            
168        function calculshon($val){
169            $this->valF['shon']= $val['shon_nouvelle']+$val['shon_shob_transformee']+$val['shon_nouvelle_transformee']
170                    - $val['shon_demolie']- $val['shon_anterieure_supprimee'];
171            //$val['shon']."***";
172        }
173        
174    
175    
176      
177  }// fin classe  }// fin classe
178  ?>  ?>

Legend:
Removed from v.169  
changed lines
  Added in v.271

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26