phpcompta-dev
[Top][All Lists]
Advanced

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

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


From: phpcompta-dev
Subject: [Phpcompta-dev] r250 - in trunk/coprop: . include include/template
Date: Thu, 5 Jan 2012 16:00:58 +0100 (CET)

Author: danydb
Date: 2012-01-05 16:00:57 +0100 (Thu, 05 Jan 2012)
New Revision: 250

Added:
   trunk/coprop/include/ajax_bud_display.php
   trunk/coprop/include/class_budget.php
   trunk/coprop/include/template/bud_detail.php
   trunk/coprop/include/template/budget_list.php
Modified:
   trunk/coprop/ajax.php
   trunk/coprop/coprop-javascript.js
   trunk/coprop/include/budget.inc.php
   trunk/coprop/index.php
Log:
Ajout budget

Modified: trunk/coprop/ajax.php
===================================================================
--- trunk/coprop/ajax.php       2012-01-04 16:52:14 UTC (rev 249)
+++ trunk/coprop/ajax.php       2012-01-05 15:00:57 UTC (rev 250)
@@ -23,7 +23,8 @@
                break;
         case 'removekey':
             require_once 'include/ajax_remove_key.php';
-
+        case 'buddisplay':
+            require_once 'include/ajax_bud_display.php';
        default:
 
                var_dump($_GET);

Modified: trunk/coprop/coprop-javascript.js
===================================================================
--- trunk/coprop/coprop-javascript.js   2012-01-04 16:52:14 UTC (rev 249)
+++ trunk/coprop/coprop-javascript.js   2012-01-05 15:00:57 UTC (rev 250)
@@ -212,4 +212,36 @@
        {
                alert(e.message);
        }
+}
+function budget_detail(plugin_code,ac,dossier,bud_id)
+{
+       waiting_box();
+       try
+       {
+               var 
queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&bud_id="+bud_id+'&ac='+ac+"&act=buddisplay";
+               var action=new Ajax.Request ( 'ajax.php',
+               {
+                       method:'get',
+                       parameters:queryString,
+                       onFailure:null,
+                       onSuccess:function (response)
+                       {
+                               try
+                               {
+                                    remove_waiting_box();
+                                    
$('divbuddetail').innerHTML=response.responseText;
+                                       //response.responseText.evalScripts();
+                               }
+                               catch(e)
+                               {
+                                       alert("Réponse Ajax ="+e.message);
+                               }
+                       }
+               }
+               );
+       }
+       catch(e)
+       {
+               alert(e.message);
+       }
 }
\ No newline at end of file

Added: trunk/coprop/include/ajax_bud_display.php
===================================================================
--- trunk/coprop/include/ajax_bud_display.php                           (rev 0)
+++ trunk/coprop/include/ajax_bud_display.php   2012-01-05 15:00:57 UTC (rev 
250)
@@ -0,0 +1,11 @@
+<?php
+/**
+ * @file montre détail budget pour mise à jour
+ */
+require_once 'class_budget.php';
+
+$bud=new Budget();
+$bud->b_id=$bud_id;
+
+$bud->detail();
+?>

Modified: trunk/coprop/include/budget.inc.php
===================================================================
--- trunk/coprop/include/budget.inc.php 2012-01-04 16:52:14 UTC (rev 249)
+++ trunk/coprop/include/budget.inc.php 2012-01-05 15:00:57 UTC (rev 250)
@@ -1,6 +1,14 @@
 <?php
 
 /**
- * @file maintient des budgets
+ * @file gestion des budgets
  */
-?>
+
+require_once 'class_budget.php';
+
+
+
+
+$bud=new Budget();
+
+$bud->to_list();
\ No newline at end of file

Added: trunk/coprop/include/class_budget.php
===================================================================
--- trunk/coprop/include/class_budget.php                               (rev 0)
+++ trunk/coprop/include/class_budget.php       2012-01-05 15:00:57 UTC (rev 
250)
@@ -0,0 +1,57 @@
+<?php
+
+
+class Budget
+{
+    function to_list()
+    {
+        global $cn;
+        
+        $array=$cn->get_array("select b_id, b_name,
+                    to_char(b_start,'DD.MM.YYYY') as str_start,
+                    to_char(b_end,'DD.MM.YYYY') as str_end,
+                    b_amount
+                    from coprop.budget
+                    order by b_name
+                    ");
+        
+        require_once 'template/budget_list.php';
+
+    }
+    function detail()
+    {
+        global $cn;
+        try
+        {
+            
+            if ( ! isset ($this->b_id)|| trim($this->b_id)=='')
+                    throw new Exception ("Aucun budget demandé");
+            $array=$cn->get_array("select 
bt_id,bt_amount,f_id,vw_name,quick_code,cr_name,cr_id 
+                from coprop.budget_detail
+                join coprop.clef_repartition using (cr_id)
+                where b_id=$1",array($this->b_id));
+            $a_input=array();
+            for ($i=0;$i<count($array);$i++)
+            {
+                $card=new ICard('f_id[]');
+                $card->value=$array[$i]['quick_code'];
+                $amount=new INum("bt_amount[]");
+                $amount->value=round($array[$i]['bt_amount'],2);
+                $hidden=HtmlInput::hidden("bt_id[]",$array[$i]["bt_id"]);
+                $a_input[$i]["amount"]=$amount->input();
+                $a_input[$i]["hidden"]=$hidden;
+                $a_input[$i]["card"]=$card->input();
+                
+            }
+            require_once 'template/bud_detail.php';
+        }
+        catch (Exception $e)
+        {
+            $e->getTraceAsString();
+        }
+    }
+}
+
+
+
+?>

Added: trunk/coprop/include/template/bud_detail.php
===================================================================
--- trunk/coprop/include/template/bud_detail.php                                
(rev 0)
+++ trunk/coprop/include/template/bud_detail.php        2012-01-05 15:00:57 UTC 
(rev 250)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * @file montre les détails d'un budget
+ */
+?>
+<table class="result">
+    <tr>
+        <th>Fiche dépense</th>
+        <th>Clef de répartition </th>
+        <th>Montant</th>
+    </tr>
+<? for ($i=0;$i < count($a_input);$i++):?>
+    <tr>
+        <td>
+            <?=$a_input[$i]['card']?>
+        </td>
+        <td>
+            <?=$a_input[$i]['key']?>
+            
+        </td>
+        <td>
+            <?=$a_input[$i]['amount']?>
+            
+        </td>
+    </tr> 
+    
+<? endfor?>
+    
+</table>

Added: trunk/coprop/include/template/budget_list.php
===================================================================
--- trunk/coprop/include/template/budget_list.php                               
(rev 0)
+++ trunk/coprop/include/template/budget_list.php       2012-01-05 15:00:57 UTC 
(rev 250)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Liste tous les budgets inclus
+ * @see Budget::to_list
+ */
+?>
+
+<table class="result">
+    <tr>
+        <th> Nom </th>
+        <th> Date début </th>
+        <th> Date Fin </th>
+        <th> Montant </th>
+    </tr>
+<?
+for ($i=0;$i<count($array);$i++):
+    $class=($i%2==0)?' class="evend" ':' class="odd" ';
+    $str_js=sprintf(" onclick=\"budget_detail('%s','%s','%s','%s')\" ",
+            
$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$array[$i]['b_id']);
+    $js=HtmlInput::anchor("Détail",$str_js);
+?>
+    <tr <?=$class?> >
+        <td>
+            <?=$array[$i]['b_name']?>
+        </td>
+         <td>
+            <?=$array[$i]['str_start']?>
+        </td>
+        <td>
+            <?=$array[$i]['str_end']?>
+        </td>
+        <td>
+            <?=nbm($array[$i]['b_amount'])?>
+        </td>
+        <td>
+            <?=$js?>
+        </td>
+    </tr>  
+<?
+endfor;
+?>
+    
+</table>
+<div id="divbuddetail">
+
+</div>
\ No newline at end of file

Modified: trunk/coprop/index.php
===================================================================
--- trunk/coprop/index.php      2012-01-04 16:52:14 UTC (rev 249)
+++ trunk/coprop/index.php      2012-01-05 15:00:57 UTC (rev 250)
@@ -41,7 +41,7 @@
          array($url.'&sa=lot',_('Lot'),_('Listes des lots et liaison 
copro'),1),
          array($url.'&sa=cle',_('Clef de répartition'),_('Clef de 
répartition'),2),
          array($url.'&sa=af',_('Appel de fond'),_('Création décompte pour 
appel de fond'),3),
-         array($url.'&sa=af',_('Budget'),_('budgets'),5),
+         array($url.'&sa=bu',_('Budget'),_('budgets'),5),
          array($url.'&sa=pa',_('Paramètre'),_('Configuration et paramètre'),4)
        );
 




reply via email to

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