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.m...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.bobudget.inc.php inc/class.m...
Date: Thu, 04 May 2006 13:47:13 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/05/04 13:47:13

Modified files:
        inc            : class.bobudget.inc.php class.menu.inc.php 
                         class.sobudget.inc.php class.sowo_hour.inc.php 
                         class.soworkorder.inc.php 
                         class.uibudget.inc.php 
        setup          : setup.inc.php tables_current.inc.php 
                         tables_update.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.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.menu.inc.php.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sobudget.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sowo_hour.inc.php.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.soworkorder.inc.php.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uibudget.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/setup.inc.php.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_current.inc.php.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_update.inc.php.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/budget.xsl.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: property/inc/class.bobudget.inc.php
diff -u property/inc/class.bobudget.inc.php:1.7 
property/inc/class.bobudget.inc.php:1.8
--- property/inc/class.bobudget.inc.php:1.7     Wed Apr 19 11:27:13 2006
+++ property/inc/class.bobudget.inc.php Thu May  4 13:47:13 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.7 2006/04/19 11:27:13 
sigurdne Exp $
+       * @version $Id: class.bobudget.inc.php,v 1.8 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        /**
@@ -112,7 +112,8 @@
                        {
                                $this->revision = $revision;
                        }
-                       if(!$this->year = $year)
+
+                       if(!$this->year == $year && 
!$GLOBALS['phpgw_info']['menuaction']=='property.uibudget.obligations')
                        {
                                unset ($this->grouping);
                                unset ($this->revision);
@@ -177,6 +178,16 @@
                }
 
 
+               function read_obligations()
+               {
+                       $obligations = 
$this->so->read_obligations(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
+                                                       'filter' => 
$this->filter,'cat_id' => $this->cat_id,'allrows'=>$this->allrows,
+                                                       'district_id' => 
$this->district_id,'year' => $this->year,'grouping' => 
$this->grouping,'revision' => $this->revision,));
+
+                       $this->total_records = $this->so->total_records;
+                       return $obligations;
+               }
+
                function read_single($budget_id)
                {
                        return $this->so->read_single($budget_id);
Index: property/inc/class.menu.inc.php
diff -u property/inc/class.menu.inc.php:1.22 
property/inc/class.menu.inc.php:1.23
--- property/inc/class.menu.inc.php:1.22        Mon Apr 10 14:36:42 2006
+++ property/inc/class.menu.inc.php     Thu May  4 13:47:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.menu.inc.php,v 1.22 2006/04/10 14:36:42 sigurdne 
Exp $
+       * @version $Id: class.menu.inc.php,v 1.23 2006/05/04 13:47:13 sigurdne 
Exp $
        */
 
        /**
@@ -488,7 +488,7 @@
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('budget');
 
                                        $i++;
-                                       if($page=='obligations')
+                                       if($page=='budget.obligations')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
Index: property/inc/class.sobudget.inc.php
diff -u property/inc/class.sobudget.inc.php:1.11 
property/inc/class.sobudget.inc.php:1.12
--- property/inc/class.sobudget.inc.php:1.11    Thu Apr 20 13:56:10 2006
+++ property/inc/class.sobudget.inc.php Thu May  4 13:47:13 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.11 2006/04/20 13:56:10 
sigurdne Exp $
+       * @version $Id: class.sobudget.inc.php,v 1.12 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        /**
@@ -403,6 +403,108 @@
                        return $receipt;
                }
 
+
+
+               function read_obligations($data)
+               {
+                       if(is_array($data))
+                       {
+                               $start  = 
(isset($data['start'])?$data['start']:0);
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $district_id = 
(isset($data['district_id'])?$data['district_id']:'');
+                               $year = (isset($data['year'])?$data['year']:'');
+                               $grouping = 
(isset($data['grouping'])?$data['grouping']:'');
+                               $revision = 
(isset($data['revision'])?$data['revision']:'');
+                       }
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by fm_b_account.category 
DESC';
+                       }
+
+                       $filtermethod = " WHERE fm_workorder.status='Bestilt' ";
+                       $where = 'AND';
+
+                       if ($district_id > 0)
+                       {
+                               $filtermethod .= " $where 
district_id='$district_id' ";
+                               $where = 'AND';
+
+                       }
+                       if ($year > 0)
+                       {
+                               $filtermethod .= " $where year='$year' ";
+                               $where = 'AND';
+
+                       }
+                       if ($grouping > 0)
+                       {
+                               $filtermethod .= " $where 
fm_b_account.category='$grouping' ";
+                               $where = 'AND';
+
+                       }
+                       if ($revision > 0)
+                       {
+                               $filtermethod .= " $where revision='$revision' 
";
+                               $where = 'AND';
+
+                       }
+
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+
+                       //      $querymethod = " $where ( descr $this->like 
'%$query%')";
+                       }
+
+
+                       $sql = "SELECT sum(combined_cost) as combined_cost, 
fm_b_account.category as b_group, district_id FROM"
+                               . " fm_workorder $this->join fm_b_account ON 
fm_workorder.account_id =fm_b_account.id "
+                               . " $this->join fm_project ON  
fm_workorder.project_id =fm_project.id "
+                               . " $this->join fm_location1 ON fm_project.loc1 
= fm_location1.loc1 "
+                               . " $this->join fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id $filtermethod 
$querymethod GROUP BY fm_b_account.category,district_id ";
+
+                       $this->db2->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db2->num_rows();
+
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
+                       $config         = CreateObject('phpgwapi.config');
+                       $config->read_repository();
+                       $tax = 1+($config->config_data['fm_tax'])/100;
+               //      $workorder['calculation']       
=number_format($workorder['calculation']*$tax, 2, ',', '');
+
+
+                       while ($this->db->next_record())
+                       {
+                               $obligations[] = array
+                               (
+                                       'grouping'              => 
$this->db->f('b_group'),
+                                       'district_id'           => 
$this->db->f('district_id'),
+                                       'budget_cost'           => 
round($this->db->f('combined_cost')*$tax),
+                               );
+                       }
+                       return $obligations;
+               }
+
+
+
                function get_b_group_list()
                {
                        $sql = "SELECT id FROM fm_b_account_category order by 
id asc";
Index: property/inc/class.sowo_hour.inc.php
diff -u property/inc/class.sowo_hour.inc.php:1.13 
property/inc/class.sowo_hour.inc.php:1.14
--- property/inc/class.sowo_hour.inc.php:1.13   Thu Mar 23 11:57:40 2006
+++ property/inc/class.sowo_hour.inc.php        Thu May  4 13:47:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage project
-       * @version $Id: class.sowo_hour.inc.php,v 1.13 2006/03/23 11:57:40 
sigurdne Exp $
+       * @version $Id: class.sowo_hour.inc.php,v 1.14 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        /**
@@ -20,15 +20,15 @@
        {
                function sowo_hour()
                {
-                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bocommon = 
CreateObject($this->currentapp.'.bocommon');
                        $this->db               = $this->bocommon->new_db();
                        $this->db2              = $this->bocommon->new_db();
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join                = 
$this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join             = $this->bocommon->join;
+                       $this->left_join        = $this->bocommon->left_join;
+                       $this->like             = $this->bocommon->like;
                }
 
                function get_chapter_list()
@@ -720,7 +720,16 @@
                                $id = 
(isset($data['workorder_id'])?$data['workorder_id']:0);
                                $calculation = 
(isset($data['calculation'])?$data['calculation']:0);
                        }
-                       $this->db->query("UPDATE fm_workorder set calculation = 
$calculation WHERE id=$id",__LINE__,__FILE__);
+
+                       $this->db->transaction_begin();
+                       $this->db->query("UPDATE fm_workorder SET calculation = 
'$calculation' WHERE id=$id",__LINE__,__FILE__);
+                       
+                       if($calculation > 0)
+                       {
+                               $this->db->query("UPDATE fm_workorder SET 
combined_cost = '$calculation' WHERE id=$id",__LINE__,__FILE__);
+                       }
+                       
+                       $this->db->transaction_commit();
                        return $receipt;
                }
        }
Index: property/inc/class.soworkorder.inc.php
diff -u property/inc/class.soworkorder.inc.php:1.15 
property/inc/class.soworkorder.inc.php:1.16
--- property/inc/class.soworkorder.inc.php:1.15 Mon Apr 17 11:36:05 2006
+++ property/inc/class.soworkorder.inc.php      Thu May  4 13:47:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage project
-       * @version $Id: class.soworkorder.inc.php,v 1.15 2006/04/17 11:36:05 
sigurdne Exp $
+       * @version $Id: class.soworkorder.inc.php,v 1.16 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        /**
@@ -421,7 +421,7 @@
                        {
                                $budget[] = array(
                                        'workorder_id'  => 
$this->db->f('workorder_id'),
-                                       'budget'                => 
sprintf("%01.2f",$this->db->f('budget'))
+                                       'budget'        => 
sprintf("%01.2f",$this->db->f('budget'))
                                        );
                        }
                        return $budget;
@@ -467,6 +467,7 @@
                                $workorder['status'],
                                $workorder['descr'],
                                $workorder['budget'],
+                               $workorder['budget'],
                                $workorder['b_account_id'],
                                $workorder['addition_rs'],
                                $workorder['addition_percentage'],
@@ -481,7 +482,7 @@
                        $this->db->transaction_begin();
 
                        $this->db->query("INSERT INTO fm_workorder 
(id,num,project_id,title,access,entry_date,start_date,end_date,status,"
-                               . 
"descr,budget,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,user_id)
 "
+                               . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,user_id)
 "
                                . "VALUES ( $values )",__LINE__,__FILE__);
 
                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES (" . $workorder['workorder_id'] . ",'workorder')");
@@ -511,30 +512,41 @@
                        $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
                        $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
 
+                       $this->db->query("SELECT status,budget,calculation FROM 
fm_workorder where id='" .$workorder['workorder_id']."'",__LINE__,__FILE__);
+                       $this->db->next_record();
+
+
+                       if ($this->db->f('calculation') > 0)
+                       {
+                               $combined_cost = $this->db->f('calculation');
+                       }
+                       else
+                       {
+                               $combined_cost = $workorder['budget'];
+                       }
+
+                       $old_status = $this->db->f('status');
+                       $old_budget = $this->db->f('budget');
+
                        $value_set=array(
                                'title'                 => $workorder['title'],
                                'status'                => $workorder['status'],
-                               'start_date'    => $workorder['start_date'],
+                               'start_date'            => 
$workorder['start_date'],
                                'end_date'              => 
$workorder['end_date'],
                                'descr'                 => $workorder['descr'],
                                'budget'                => 
(int)$workorder['budget'],
-                               'key_deliver'   => $workorder['key_deliver'],
+                               'combined_cost' => $combined_cost,
+                               'key_deliver'           => 
$workorder['key_deliver'],
                                'key_fetch'             => 
$workorder['key_fetch'],
-                               'account_id'    => $workorder['b_account_id'],
-                               'rig_addition'  => $workorder['addition_rs'],
+                               'account_id'            => 
$workorder['b_account_id'],
+                               'rig_addition'          => 
$workorder['addition_rs'],
                                'addition'              => 
$workorder['addition_percentage'],
-                               'charge_tenant' => $workorder['charge_tenant'],
+                               'charge_tenant'         => 
$workorder['charge_tenant'],
                                'vendor_id'             => 
$workorder['vendor_id']
                                );
 
                        $value_set      = 
$this->bocommon->validate_db_update($value_set);
 
-                       $this->db->query("SELECT status,budget FROM 
fm_workorder where id='" .$workorder['workorder_id']."'",__LINE__,__FILE__);
-                       $this->db->next_record();
-
-                       $old_status = $this->db->f('status');
-                       $old_budget = $this->db->f('budget');
-
                        $this->db->transaction_begin();
 
                        $this->db->query("UPDATE fm_workorder set $value_set 
WHERE id=" . $workorder['workorder_id'] ,__LINE__,__FILE__);
Index: property/inc/class.uibudget.inc.php
diff -u property/inc/class.uibudget.inc.php:1.9 
property/inc/class.uibudget.inc.php:1.10
--- property/inc/class.uibudget.inc.php:1.9     Thu Apr 20 13:56:11 2006
+++ property/inc/class.uibudget.inc.php Thu May  4 13:47:13 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.9 2006/04/20 13:56:11 
sigurdne Exp $
+       * @version $Id: class.uibudget.inc.php,v 1.10 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        /**
@@ -361,7 +361,7 @@
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'district_id',
                                                                                
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.basis',
                                                                                
                                                'district_id'   
=>$this->district_id,
                                                                                
                                                'year'          =>$this->year,
                                                                                
                                                'period'        =>$this->period,
@@ -375,7 +375,7 @@
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'b_account_id',
                                                                                
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.basis',
                                                                                
                                                'district_id'   
=>$this->district_id,
                                                                                
                                                'year'          =>$this->year,
                                                                                
                                                'period'        =>$this->period,
@@ -387,9 +387,9 @@
                                'sort_grouping' => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'grouping',
+                                                                               
        'var'   =>      'b_group',
                                                                                
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.basis',
                                                                                
                                                'district_id'   
=>$this->district_id,
                                                                                
                                                'year'          =>$this->year,
                                                                                
                                                'period'        =>$this->period,
@@ -403,7 +403,7 @@
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'budget_cost',
                                                                                
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.basis',
                                                                                
                                                'district_id'   
=>$this->district_id,
                                                                                
                                                'year'          =>$this->year,
                                                                                
                                                'period'        =>$this->period,
@@ -517,6 +517,159 @@
                                                                                
'search_field',
                                                                                
'nextmatchs'));
 
+                       $links = $this->menu->links('budget.obligations');
+
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_obligations_data','budget_receipt');
+                       
$GLOBALS['phpgw']->session->appsession('session_data','budget_receipt','');
+
+                       $list = $this->bo->read_obligations();
+                       if (isset($list) AND is_array($list))
+                       {
+                               $sum = 0;
+                               foreach($list as $entry)
+                               {
+
+                                       $content[] = array
+                                       (
+                                               'grouping'                      
=> $entry['grouping'],
+                                               'district_id'                   
=> $entry['district_id'],
+                                               'budget_cost'                   
=> $entry['budget_cost'],
+                                               'link_details'                  
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.obligation_details&district_id='
 . $entry['district_id'] . '&grouping=' . $entry['grouping']),
+                                               'lang_details_text'             
=> lang('obligation details'),
+                                               'text_details'                  
=> lang('details'),
+                                       );
+                                       $sum = $sum + $entry['budget_cost'];
+                               }
+                       }
+
+                       $table_header[] = array
+                       (
+                               'lang_budget_cost'      => lang('budget cost'),
+                               'lang_grouping'         => lang('grouping'),
+                               'lang_details'          => lang('details'),
+
+                               'lang_district_id'      => lang('district_id'),
+
+                               'sort_district_id'      => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'district_id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.obligations',
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
+                                                                               
                                                'allrows'       
=>$this->allrows)
+                                                                               
)),
+               
+
+                               'sort_grouping' => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'b_group',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.obligations',
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
+                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
)),
+
+                               'sort_budget_cost'      => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'combined_cost',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.obligations',
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
+                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
)),
+                       );
+
+
+
+                       if($acl_add)
+                       {
+                               $table_add = array
+                               (
+                                       'lang_add'              => lang('add'),
+                                       'lang_add_statustext'   => lang('add a 
budget query'),
+                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit_obligations')
+                               );
+                       }
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 
$this->currentapp.'.uibudget.obligations',
+                                               'sort'          =>$this->sort,
+                                               'order'         =>$this->order,
+                                               'cat_id'        =>$this->cat_id,
+                                               'filter'        =>$this->filter,
+                                               'query'         =>$this->query,
+                                               'district_id'   
=>$this->district_id,
+                                               'year'          =>$this->year,
+                                               'grouping'      
=>$this->grouping,
+                                               'revision'      
=>$this->revision
+                       );
+
+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
+                                               
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'sum'                                           
=> $sum,
+                               'lang_sum'                                      
=> lang('sum'),
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'links'                                         
=> $links,
+                               'allow_allrows'                                 
=> true,
+                               'allrows'                                       
=> $this->allrows,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $record_limit,
+                               'num_records'                                   
=> count($list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
+                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
+                               'query'                                         
=> $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header_budget_obligations'               
=> $table_header,
+                               'values_budget_obligations'                     
=> $content,
+                               'table_add'                                     
=> $table_add,
+                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
+                               'lang_no_district'                              
=> lang('no district'),
+                               'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
+                               'select_district_name'                  => 
'district_id',
+
+                               'grouping_list'                         => 
$this->bo->get_b_group_list($this->grouping),
+                               'lang_no_grouping'                      => 
lang('no grouping'),
+                               'lang_grouping_statustext'              => 
lang('Select the grouping the selection belongs to'),
+
+                       );
+
+                       $this->save_sessiondata();
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list obligations');
+
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_obligations' => $data));
+
                }
 
 
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.41 property/setup/setup.inc.php:1.42
--- property/setup/setup.inc.php:1.41   Thu Apr 20 09:08:51 2006
+++ property/setup/setup.inc.php        Thu May  4 13:47:13 2006
@@ -8,12 +8,12 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage setup
-       * @version $Id: setup.inc.php,v 1.41 2006/04/20 09:08:51 sigurdne Exp $
+       * @version $Id: setup.inc.php,v 1.42 2006/05/04 13:47:13 sigurdne Exp $
        */
 
        $setup_info['property']['name']      = 'property';
        $setup_info['property']['title']         = 'Property';
-       $setup_info['property']['version']   = '0.9.17.521';
+       $setup_info['property']['version']   = '0.9.17.522';
        $setup_info['property']['app_order'] = 8;
        $setup_info['property']['enable']    = 1;
        $setup_info['property']['app_group']    = 'office';
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.60 
property/setup/tables_current.inc.php:1.61
--- property/setup/tables_current.inc.php:1.60  Fri Apr 21 17:17:50 2006
+++ property/setup/tables_current.inc.php       Thu May  4 13:47:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage setup
-       * @version $Id: tables_current.inc.php,v 1.60 2006/04/21 17:17:50 
sigurdne Exp $
+       * @version $Id: tables_current.inc.php,v 1.61 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        $phpgw_baseline = array(
@@ -558,6 +558,7 @@
                                'title' => array('type' => 
'varchar','precision' => '255','nullable' => False),
                                'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'calculation' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'combined_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'deviation' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
                                'act_mtrl_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'act_vendor_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.44 
property/setup/tables_update.inc.php:1.45
--- property/setup/tables_update.inc.php:1.44   Thu Apr 20 09:08:51 2006
+++ property/setup/tables_update.inc.php        Thu May  4 13:47:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage setup
-       * @version $Id: tables_update.inc.php,v 1.44 2006/04/20 09:08:51 
sigurdne Exp $
+       * @version $Id: tables_update.inc.php,v 1.45 2006/05/04 13:47:13 
sigurdne Exp $
        */
 
        /**
@@ -1292,3 +1292,49 @@
                $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.521';
                return $GLOBALS['setup_info']['property']['currentver'];
        }
+
+       /**
+       * Update property version from 0.9.17.521 to 0.9.17.522
+       */
+
+       $test[] = '0.9.17.521';
+       function property_upgrade0_9_17_521()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','combined_cost', 
array('type' => 'decimal','precision' => '20','scale' => '2','nullable' => 
True,'default' => '0.00'));
+
+               $sql = "SELECT app_version from phpgw_applications WHERE 
app_name = 'property'";
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $version = $GLOBALS['phpgw_setup']->oProc->f('app_version');
+
+               if($version =='0.9.17.521')
+               {
+                       $db2 = clone($GLOBALS['phpgw_setup']->oProc->m_odb);
+                       $sql = "SELECT id, budget, calculation from 
fm_workorder";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+                       while($GLOBALS['phpgw_setup']->oProc->next_record())
+                       {
+                               if 
($GLOBALS['phpgw_setup']->oProc->f('calculation') > 0)
+                               {
+                                       $combined_cost = 
$GLOBALS['phpgw_setup']->oProc->f('calculation');
+                               }
+                               else
+                               {
+                                       $combined_cost = 
$GLOBALS['phpgw_setup']->oProc->f('budget');
+                               }
+                               
+                               if($combined_cost > 0)
+                               {
+                               
+                                       $db2->query("UPDATE fm_workorder SET 
combined_cost = '$combined_cost' WHERE id = " . 
(int)$GLOBALS['phpgw_setup']->oProc->f('id'),__LINE__,__FILE__);
+                               }
+                       }
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit();
+               $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.522';
+               return $GLOBALS['setup_info']['property']['currentver'];
+       }
+       
Index: property/templates/base/budget.xsl
diff -u property/templates/base/budget.xsl:1.7 
property/templates/base/budget.xsl:1.8
--- property/templates/base/budget.xsl:1.7      Wed Apr 19 11:27:01 2006
+++ property/templates/base/budget.xsl  Thu May  4 13:47:13 2006
@@ -772,6 +772,113 @@
                </table>
        </xsl:template>
        
+
+       <xsl:template match="list_obligations">
+               <xsl:call-template name="menu"/>
+               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <tr>
+                                               <td align="left" colspan="3">
+                                                       <xsl:call-template 
name="msgbox"/>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                       <tr>
+                               <td align="left">
+                                       <xsl:call-template 
name="filter_district"/>
+                               </td>
+
+                               <td align="left">
+                                       <xsl:call-template 
name="filter_grouping"/>
+                               </td>
+
+                               <td align="right">
+                                       <xsl:call-template name="search_field"/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan="8" width="100%">
+                                       <xsl:call-template name="nextmatchs"/>
+                               </td>
+                       </tr>
+               </table>
+               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
+                               <xsl:apply-templates 
select="table_header_budget_obligations"/>
+                               <xsl:apply-templates 
select="values_budget_obligations"/>
+                               <tr>
+                                       <td>
+                                       </td>
+                                       <td>
+                                       </td>
+                                       <td class="th_text" align="right">
+                                               <xsl:value-of select="sum"/>
+                                       </td>
+                                       <td>
+                                       </td>
+                               </tr>
+               </table>
+       </xsl:template>
+
+       <xsl:template match="table_header_budget_obligations">
+               <xsl:variable name="sort_district_id"><xsl:value-of 
select="sort_district_id"/></xsl:variable>
+               <xsl:variable name="sort_budget_cost"><xsl:value-of 
select="sort_budget_cost"/></xsl:variable>
+               <xsl:variable name="sort_grouping"><xsl:value-of 
select="sort_grouping"/></xsl:variable>
+               <tr class="th">
+                       <td class="th_text" width="10%" align="left">
+                               <a href="{$sort_grouping}"><xsl:value-of 
select="lang_grouping"/></a>
+                       </td>
+
+                       <td class="th_text" width="10%" align="left">
+                               <a href="{$sort_district_id}"><xsl:value-of 
select="lang_district_id"/></a>
+                       </td>
+                       <td class="th_text" width="5%" align="center">
+                               <a href="{$sort_budget_cost}"><xsl:value-of 
select="lang_budget_cost"/></a>
+                       </td>
+                       <td class="th_text" width="5%" align="center">
+                               <xsl:value-of select="lang_details"/>
+                       </td>
+               </tr>
+       </xsl:template>
+
+
+       <xsl:template match="values_budget_obligations"> 
+               <xsl:variable name="lang_details_text"><xsl:value-of 
select="lang_details_text"/></xsl:variable>
+                       <tr>
+                               <xsl:attribute name="class">
+                                       <xsl:choose>
+                                               <xsl:when test="@class">
+                                                       <xsl:value-of 
select="@class"/>
+                                               </xsl:when>
+                                               <xsl:when test="position() mod 
2 = 0">
+                                                       
<xsl:text>row_off</xsl:text>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       
<xsl:text>row_on</xsl:text>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               <td>
+                                       <xsl:value-of select="grouping"/>
+                               </td>
+
+                               <td>
+                                       <xsl:value-of select="district_id"/>
+                               </td>
+                               <td align = "right">
+                                       <xsl:value-of select="budget_cost"/>
+                               </td>
+
+                               <td align="center">
+                                       <xsl:variable 
name="link_details"><xsl:value-of select="link_details"/></xsl:variable>
+                                       <a href="{$link_details}" 
onMouseover="window.status='{$lang_details_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_details"/></a>
+                               </td>
+                       </tr>
+       </xsl:template>
+
+
+
        <xsl:template match="year">
        <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
                <xsl:choose>




reply via email to

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