phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property inc/class.bobudget.inc.php inc/class.s...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.bobudget.inc.php inc/class.s...
Date: Mon, 10 Apr 2006 19:22:31 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/04/10 19:22:31

Modified files:
        inc            : class.bobudget.inc.php class.sobudget.inc.php 
                         class.uibudget.inc.php 
        templates/base : budget.xsl 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bobudget.inc.php.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sobudget.inc.php.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uibudget.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/budget.xsl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: property/inc/class.bobudget.inc.php
diff -u property/inc/class.bobudget.inc.php:1.4 
property/inc/class.bobudget.inc.php:1.5
--- property/inc/class.bobudget.inc.php:1.4     Mon Apr 10 14:36:42 2006
+++ property/inc/class.bobudget.inc.php Mon Apr 10 19:22:30 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage budget
-       * @version $Id: class.bobudget.inc.php,v 1.4 2006/04/10 14:36:42 
sigurdne Exp $
+       * @version $Id: class.bobudget.inc.php,v 1.5 2006/04/10 19:22:30 
sigurdne Exp $
        */
 
        /**
@@ -211,24 +211,34 @@
                }
 
 
-               function save_basis($budget)
+               function save_basis($values)
                {
 
-                       if ($budget['budget_id'])
+                       if ($values['budget_id'])
                        {
-                               if ($budget['budget_id'] != 0)
+                               if ($values['budget_id'] != 0)
                                {
-                                       $budget_id = $budget['budget_id'];
-                                       $receipt=$this->so->edit_basis($budget);
+                                       $budget_id = $values['budget_id'];
+                                       $receipt=$this->so->edit_basis($values);
                                }
                        }
                        else
                        {
-                               $receipt = $this->so->add_basis($budget);
+                               $receipt = $this->so->add_basis($values);
+                       }
+
+                       if($values['distribute'] && 
is_array($values['distribute']))
+                       {
+                               $this->distribute($values,$receipt);
                        }
                        return $receipt;
                }
 
+               function distribute($values,$receipt='')
+               {
+                       return $this->so->distribute($values,$receipt);
+               }
+
                function delete($params)
                {
                        if (is_array($params))
@@ -253,6 +263,11 @@
                        }
                }
 
+               function get_distribute_year_list($selected ='')
+               {
+                       $distribute_year_list = 
$this->so->get_distribute_year_list();
+                       return 
$this->bocommon->select_multi_list($selected,$distribute_year_list);
+               }
 
                function get_b_group_list($selected ='')
                {
Index: property/inc/class.sobudget.inc.php
diff -u property/inc/class.sobudget.inc.php:1.4 
property/inc/class.sobudget.inc.php:1.5
--- property/inc/class.sobudget.inc.php:1.4     Mon Apr 10 14:36:42 2006
+++ property/inc/class.sobudget.inc.php Mon Apr 10 19:22:31 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage budget
-       * @version $Id: class.sobudget.inc.php,v 1.4 2006/04/10 14:36:42 
sigurdne Exp $
+       * @version $Id: class.sobudget.inc.php,v 1.5 2006/04/10 19:22:31 
sigurdne Exp $
        */
 
        /**
@@ -327,7 +327,7 @@
 
                function get_b_group_list()
                {
-                       $sql = "SELECT grouping FROM fm_b_account group by 
grouping";
+                       $sql = "SELECT grouping FROM fm_b_account group by 
grouping order by grouping asc";
                        $this->db->query($sql);
 
                        while ($this->db->next_record())
@@ -438,6 +438,24 @@
                        return $grouping_list;
                }
 
+               function get_distribute_year_list()
+               {
+                       $table = 'fm_budget_cost';
+                       $sql = "SELECT year FROM $table group by year order by 
year asc";
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $year_list[] = array
+                               (
+                                       'id'    => $this->db->f('year'),
+                                       'name'  => $this->db->f('year')
+                               );
+                       }
+                       return $year_list;
+               }
+
+
                function delete($budget_id)
                {
                        $this->db->query('DELETE FROM fm_budget WHERE id=' . 
intval($budget_id),__LINE__,__FILE__);
@@ -448,5 +466,27 @@
                        $this->db->query('DELETE FROM fm_budget_basis WHERE 
id=' . intval($budget_id),__LINE__,__FILE__);
                }
 
+               function distribute($values,$receipt='')
+               {
+                       foreach ($values['distribute'] as $basis_id)
+                       {
+                               $this->db->query("select * from fm_budget_basis 
where id='$basis_id'",__LINE__,__FILE__);
+
+                               if ($this->db->next_record())
+                               {
+                                       $basis['year']                  = 
$this->db->f('year');
+                                       $basis['district_id']           = 
$this->db->f('district_id');
+                                       $basis['revision']              = 
$this->db->f('revision');
+                                       $basis['b_group']               = 
$this->db->f('b_group');
+                                       $basis['budget_cost']           = 
$this->db->f('budget_cost');
+                               }
+
+
+                       
+                       }
+
+               }
+
+
        }
 ?>
Index: property/inc/class.uibudget.inc.php
diff -u property/inc/class.uibudget.inc.php:1.5 
property/inc/class.uibudget.inc.php:1.6
--- property/inc/class.uibudget.inc.php:1.5     Mon Apr 10 14:36:42 2006
+++ property/inc/class.uibudget.inc.php Mon Apr 10 19:22:31 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage budget
-       * @version $Id: class.uibudget.inc.php,v 1.5 2006/04/10 14:36:42 
sigurdne Exp $
+       * @version $Id: class.uibudget.inc.php,v 1.6 2006/04/10 19:22:31 
sigurdne Exp $
        */
 
        /**
@@ -734,7 +734,7 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uibudget.basis');
                        }
 
-
+                       $distribute_year = $values['distribute_year'];
                        if ($budget_id)
                        {
                                $values = 
$this->bo->read_single_basis($budget_id);
@@ -755,6 +755,11 @@
 
                        $data = array
                        (
+                               'lang_distribute'                       => 
lang('distribute'),
+                               'lang_distribute_year'                  => 
lang('distribute year'),
+                               'lang_distribute_year_statustext'       => 
lang('of years'),
+                               'distribute_year_list'                  => 
$this->bo->get_distribute_year_list($distribute_year),
+                               
                                'lang_revision'                         => 
lang('revision'),
                                'lang_revision_statustext'              => 
lang('Select revision'),
                                'revision_list'                         => 
$this->bo->get_revision_list($revision),
Index: property/templates/base/budget.xsl
diff -u property/templates/base/budget.xsl:1.5 
property/templates/base/budget.xsl:1.6
--- property/templates/base/budget.xsl:1.5      Mon Apr 10 14:36:42 2006
+++ property/templates/base/budget.xsl  Mon Apr 10 19:22:31 2006
@@ -480,6 +480,35 @@
                                </td>
                        </tr>
 
+                       <tr  align="left">
+                               <td valign="top">
+                                       <xsl:value-of select="lang_distribute"/>
+                               </td>
+                               <td align="left" valign="top">
+                                       <input type="checkbox" 
name="values[distribute][]" value="{value_budget_id}"  
onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_distribute_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+                       <tr  align="left">
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_distribute_year"/>
+                               </td>
+                               <td align="left" valign="top">
+                                       <xsl:variable 
name="lang_distribute_year_statustext"><xsl:value-of 
select="lang_distribute_year_statustext"/></xsl:variable>
+                                       <select 
name="values[distribute_year][]" class="forms" multiple="multiple" 
onMouseover="window.status='{$lang_distribute_year_statustext}'; return true;" 
onMouseout="window.status='';return true;">
+                                               <xsl:apply-templates 
select="distribute_year_list"/>
+                                       </select>
+
+                               </td>
+                       </tr>
+
+
+
                        <tr height="50">
                                <td valign="bottom">
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
@@ -876,4 +905,15 @@
                </xsl:choose>
        </xsl:template>
 
-
+       <xsl:template match="distribute_year_list">
+       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="selected">
+                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+       




reply via email to

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