phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.boinvestment.inc.php,NONE,1.1


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.boinvestment.inc.php,NONE,1.1 class.soinvestment.inc.php,NONE,1.1 class.uiinvestment.inc.php,NONE,1.1 class.bocommon.inc.php,1.4,1.5 class.soinvoice.inc.php,1.8,1.9 class.uiinvoice.inc.php,1.8,1.9
Date: Tue, 21 Jan 2003 12:53:05 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv21741/inc

Modified Files:
        class.bocommon.inc.php class.soinvoice.inc.php 
        class.uiinvoice.inc.php 
Added Files:
        class.boinvestment.inc.php class.soinvestment.inc.php 
        class.uiinvestment.inc.php 
Log Message:
no message

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/

        class boinvestment
        {
                var $start;
                var $query;
                var $filter;
                var $sort;
                var $order;
                var $cat_id;
//              var $part_of_town_id;

                var $public_functions = array
                (
                        'read'                          => True,
                        'read_single'           => True,
                        'save'                          => True,
                        'delete'                        => True,
                        'check_perms'           => True
                );

                var $soap_functions = array(
                        'list' => array(
                                'in'  => 
array('int','int','struct','string','int'),
                                'out' => array('array')
                        ),
                        'read' => array(
                                'in'  => array('int','struct'),
                                'out' => array('array')
                        ),
                        'save' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        ),
                        'delete' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        )
                );

                function boinvestment($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.soinvestment');
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');

                        $start  = get_var('start',array('POST','GET'));
                        $query  = get_var('query',array('POST','GET'));
                        $sort   = get_var('sort',array('POST','GET'));
                        $order  = get_var('order',array('POST','GET'));
                        $filter = get_var('filter',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));
                        $part_of_town_id        = 
get_var('part_of_town_id',array('POST','GET'));

                        if ($start)
                        {
                                $this->start=$start;
                        }
                        else
                        {
                                $this->start=0;
                        }

                        if(isset($query))
                        {
                                $this->query = $query;
                        }
                        if(!empty($filter))
                        {
                                $this->filter = $filter;
                        }
                        if(isset($sort))
                        {
                                $this->sort = $sort;
                        }
                        if(isset($order))
                        {
                                $this->order = $order;
                        }
                        if(isset($cat_id))
                        {
                                $this->cat_id = $cat_id;
                        }
                        if(isset($part_of_town_id))
                        {
                                $this->part_of_town_id = $part_of_town_id;
                        }
                }


                function read()
                {
                        $investment = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'part_of_town_id' 
=> $this->part_of_town_id));
                        $this->total_records = $this->so->total_records;

                        for ($i=0; $i<count($investment); $i++)
                        {
        //                      $investment[$i]['date']  = 
$GLOBALS['phpgw']->common->show_date($investment[$i]['date']);
                        }
                        return $investment;
                }


                function select_category($format='',$selected='')
                {
                        switch($format)
                        {
                                case 'select':
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
                                        break;
                                case 'filter':
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
                                        break;
                        }

                        $categories= $this->so->get_type_list();

                        while (is_array($categories) && list(,$category) = 
each($categories))
                        {
                                $sel_category = '';
                                if ($category['id']==$selected)
                                {
                                        $sel_category = 'selected';
                                }

                                $category_list[] = array
                                (
                                        'cat_id'        => $category['id'],
                                        'name'          => $category['num'],
                                        'selected'      => $sel_category
                                );
                        }

                        for ($i=0;$i<count($category_list);$i++)
                        {
                                if ($category_list[$i]['selected'] != 
'selected')
                                {
                                        unset($category_list[$i]['selected']);
                                }
                        }

                        return $category_list;
                }


                function read_single($property_id,$building_id)
                {
                        return 
$this->so->read_single($property_id,$building_id);
                }

                function select_part_of_town($part_of_town_id)
                {
                        return 
$this->socommon->select_part_of_town($part_of_town_id);
                }

                function save($building,$action='')
                {
                        if ($building['access'])
                        {
                                $building['access'] = 'private';
                        }
                        else
                        {
                                $building['access'] = 'public';
                        }

                        if ($action=='edit')
                        {
                                if ($building['building_id'] != 0)
                                {
                                        $message = $this->so->edit($building);
                                }
                        }
                        else
                        {

                                
$building['location_code']=$this->socommon->location_code($building['property_id'],$building['building_id']);
                                $message = $this->so->add($building);
//print_r($ids);
//print_();
                        }
                        return $message;
                }

                function delete($property_id,$building_id)
                {
                        $this->so->delete($property_id,$building_id);
                }
        }
?>

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/

        class soinvestment
        {
                var $grants;

                function soinvestment()
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
                        {
                                $this->join = " JOIN ";
                        }
                        else
                        {
                                $this->join = " LEFT JOIN ";
                        }


                }


                function get_type_list()
                {
                        $this->db->query("SELECT entity_type FROM fm_investment 
GROUP BY entity_type ");
                        while ($this->db->next_record())
                        {
                                $type_list[] = Array(
                                        'id'        => 
$this->db->f('entity_type'),
                                        'num'       => 
lang($this->db->f('entity_type'))
                                );
                        }
                        return $type_list;
                }


                function read($data)
                {
                        if(is_array($data))
                        {
                                if ($data['start'])
                                {
                                        $start=$data['start'];
                                }
                                else
                                {
                                        $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']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:'');
                                $part_of_town_id = 
(isset($data['part_of_town_id'])?$data['part_of_town_id']:'');

                        }

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
        //                      $ordermethod = ' order by entity_id DESC';
                        }

                        if ($part_of_town_id)
                        {
                                $filtermethod = "and boei_bydel.bydel_id 
='$part_of_town_id'";
                        }

                        if ($cat_id=='property')
                        {
                                $sql = "SELECT fm_investment.entity_id as 
entity_id, fm_investment.descr as descr, 
fm_investment_value.invest_id,initial_value, boei_objekt.navn, 
boei_bydel.omraade_id, boei_bydel.bydel,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index, "
                                . " fm_investment_value.index_count"
                                . " FROM boei_objekt $this->join "
                                . " boei_bydel ON boei_objekt.bydel_id = 
boei_bydel.bydel_id $this->join "
                                . " fm_investment_value ON 
boei_objekt.objekt_id = left(fm_investment_value.entity_id,4) $this->join "
                                . " fm_investment ON 
fm_investment_value.entity_id = fm_investment.entity_id AND "
                                . " fm_investment_value.invest_id = 
fm_investment.invest_id "
                                . " WHERE ( current_index = '1'  or (this_index 
= NULL and index_count= '1')) $filtermethod "
                                . " ORDER BY 
boei_bydel.bydel,boei_objekt.objekt_id ";

                        }
                        if ($cat_id=='equipment')
                        {
                                $sql = "SELECT fm_investment.entity_id, 
fm_investment.descr as descr, fm_investment_value.invest_id,initial_value,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index,fm_equipment.descr as 
equipment_descr, fm_equipment_type.name as equipment_name, "
                                . " fm_investment_value.index_count "
                                . " FROM fm_investment $this->join "
                                . " fm_equipment ON fm_investment.entity_id = 
fm_equipment.equipment_id $this->join "
                                . " fm_equipment_type ON 
fm_equipment.equipment_type_id = fm_equipment_type.id $this->join "
                                . " fm_investment_value ON 
fm_investment_value.entity_id = fm_investment.entity_id AND "
                                . " fm_investment_value.invest_id = 
fm_investment.invest_id "
                                . " WHERE ( current_index = '1'  or (this_index 
= NULL and index_count= '1')) and (fm_investment.entity_type='equipment') "
                                . " ORDER BY fm_investment.entity_id ";

                        }

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->query($sql . $ordermethod,__LINE__,__FILE__);

                        $i=0;
                        while ($this->db->next_record())
                        {
                                $investment[$i]['counter']                      
= $i;
                                $investment[$i]['entity_id']            = 
$this->db->f('entity_id');
                                $investment[$i]['investment_id']        = 
$this->db->f('invest_id');
                                $investment[$i]['district_id']          = 
$this->db->f('omraade_id');
                                $investment[$i]['part_of_town']         = 
$this->db->f('bydel');
                                $investment[$i]['descr']                        
= $this->db->f('descr');
                                $investment[$i]['initial_value']        = 
$this->db->f('initial_value');
                                $investment[$i]['value']                        
= $this->db->f('value');
                                $investment[$i]['this_index']           = 
$this->db->f('this_index');
                                $investment[$i]['index_count']          = 
$this->db->f('index_count');
                                $investment[$i]['date']                         
= $this->db->f('date');
                                $investment[$i]['equipment_descr']      = 
$this->db->f('equipment_descr');
                                if ($cat_id=='property')
                                {
                                        $investment[$i]['entity_name']  = 
$this->db->f('navn');
                                }
                                else
                                {
                                        $investment[$i]['entity_name']  = 
$this->db->f('equipment_name');
                                }

                                $investment[$i]['this_write_off']       = 
round(($this->db->f('index_count') * $this->db->f('initial_value')),2);
                                $i++;
                        }
//_debug_array($investment);
                        return $investment;
                }

                function read_single($property_id,$building_id)
                {
                        $sql = "SELECT * FROM boei_bygg  where 
objekt_id='$property_id' and bygg_id='$building_id'";

                        $this->db->query($sql,__LINE__,__FILE__);

                        if ($this->db->next_record())
                        {
                                $building['property_id']                = 
(int)$this->db->f('objekt_id');
                                $building['building_id']                = 
(int)$this->db->f('bygg_id');
                                $building['owner']                              
= $this->db->f('owner');
                                $building['name']                               
= stripslashes($this->db->f('byggnavn'));
                                $building['generaladdress']             = 
stripslashes($this->db->f('generelladresse'));
                                $building['access']                             
= $this->db->f('access');
                                $building['date']                               
= $this->db->f('entry_date');
                                $building['cat_id']                             
= (int)$this->db->f('cat_id');
                                $building['omraade_id']                 = 
$this->db->f('omraade_id');
                                $building['part_of_town']               = 
$this->db->f('bydel');
                                $building['building_type_id']   = 
$this->db->f('building_type_id');
                                $building['location_code']              = 
$this->db->f('location_code');

                                return $building;
                        }
                }

                function add($building)
                {

                        $this->db->query("INSERT INTO boei_bygg (location_code, 
objekt_id,bygg_id,owner,access,entry_date,byggnavn,generelladresse,cat_id) "
                                . "VALUES ('" . $building['location_code']. 
"','" . $building['property_id'] . "','" . $building['building_id'] . "','" . 
$this->account . "','" . $building['access'] . "','" . time() . "','" . 
$building['name']
                                . "','" . $building['generaladdress'] ."','" . 
$building['cat_id']. "')",__LINE__,__FILE__);

                        $ids['building_id'] = $building['building_id'];
                        $ids['property_id'] = $building['property_id'];

                        $message = lang('Building has been saved');
                        return $message;
                }

                function edit($building)
                {
                        $building['content'] = 
$this->db->db_addslashes($building['content']);

                        $this->db->query("UPDATE boei_bygg set byggnavn='" . 
$building['name'] . "', entry_date='" . time()
                                                . "', cat_id='" . 
$building['cat_id'] . "', generelladresse='" . $building['generaladdress'] . 
"', access='" . $building['access']
                                                . "' WHERE objekt_id= '" . 
$building['property_id']
                                                . "' AND bygg_id=" . 
$building['building_id'],__LINE__,__FILE__);

                        $message = lang('Building has been edited');
                        return $message;
                }

                function delete($property_id,$building_id )
                {
                        $this->db->query('DELETE FROM boei_bygg WHERE 
objekt_id=' . $property_id . ' and bygg_id=' . $building_id,__LINE__,__FILE__);
                }
        }
?>

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * -------------------------------------------------                     
    *
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
        class uiinvestment
        {
                var $grants;
                var $cat_id;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $filter;
                var $part_of_town_id;
                var $sub;
                var $currentapp;

                var $public_functions = array
                (
                        'index'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
                );

                function uiinvestment()
                {
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'investment';
                        $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        $this->grants                           = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boinvestment',True);
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon',True);

                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->filter                           = 
$this->bo->filter;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->part_of_town_id          = 
$this->bo->part_of_town_id;
                }

                function save_sessiondata()
                {
                        $data = array
                        (
                                'start'                         => $this->start,
                                'query'                         => $this->query,
                                'sort'                          => $this->sort,
                                'order'                         => $this->order,
                                'filter'                        => 
$this->filter,
                                'cat_id'                        => 
$this->cat_id,
                                'part_of_town_id'       => 
$this->part_of_town_id
                        );
                        $this->bocommon->save_sessiondata($data);
                }

                function index()
                {

                        $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $sub = get_var('sub',array('POST','GET'));
                        $links = $this->bocommon->menu($sub);

                        $investment_list = $this->bo->read();

//_debug_array($investment_list);

                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $sep = '/';
                        $dlarr[strpos($dateformat,'y')]                 = 'Y';
                        $dlarr[strpos($dateformat,'m')]                 = 'm';
                        $dlarr[strpos($dateformat,'d')]                 = 'd';
                        ksort($dlarr);
                        $dateformat                                             
                = (implode($sep,$dlarr));

                        while (is_array($investment_list) && list(,$investment) 
= each($investment_list))
                        {

                                $content[] = array
                                (
                                        'entity_id'                             
        => $investment['entity_id'],
                                        'investment_id'                         
=> $investment['investment_id'],
                                        'district_id'                           
=> $investment['district_id'],
                                        'date'                                  
        => date($dateformat,strtotime($investment['date'])),
                                        'counter'                               
        => $investment['counter'],
                                        'part_of_town'                          
=> $investment['part_of_town'],
                                        'descr'                                 
        => $investment['descr'],
                                        'initial_value'                         
=> number_format($investment['initial_value'], 0, ',', ' '),
                                        'value'                                 
        => number_format($investment['value'], 0, ',', ' '),
                                        'this_index'                            
=> $investment['this_index'],
                                        'index_count'                           
=> $investment['index_count'],
                                        'equipment_descr'                       
=> $investment['equipment_descr'],
                                        'entity_name'                           
=> $investment['entity_name'],
                                        'this_write_off'                        
=> number_format($investment['this_write_off'], 0, ',', ' '),
                                        'link_history'                          
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
 . $investment['entity_id'].'&investment_id=' . 
$investment['investment_id'].'&entity_type=' . $this->cat_id),
                                        'lang_history'                          
=> lang('History'),
                                        'lang_history_statustext'       => 
lang('View/Edit the history')
                                );

                                $sum_initial_value                              
= $sum_initial_value + $investment['initial_value'];
                                $sum_value                                      
        = $sum_value + $investment['value'];

                        }


                        $table_header[] = array
                        (
                                'lang_district'                 => 
lang('District'),
                                'lang_part_of_town'             => lang('Part 
of town'),
                                'lang_entity_id'                => lang('entity 
id'),
                                'lang_investment_id'    => lang('investment 
id'),
                                'lang_descr'                    => 
lang('Descr'),
                                'lang_entity_name'              => lang('Entity 
name'),
                                'lang_initial_value'    => lang('Initial 
value'),
                                'lang_value'                    => 
lang('Value'),
                                'lang_last_index'               => lang('Last 
index'),
                                'lang_write_off'                => lang('Write 
off'),
                                'lang_date'                             => 
lang('Date'),
                                'lang_index_count'              => lang('Index 
count'),
                                'lang_history'                  => 
lang('History'),
                                'lang_select'                   => 
lang('Select')
                        );

                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
investment'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.edit')
                        );

                        $link_data = array
                        (
                                'menuaction'            => 
$this->currentapp.'.uiinvestment.index',
                                'order'                         => $this->order,
                                'sort'                          => $this->sort,
                                'cat_id'                        => 
$this->cat_id,
                                'user_lid'                      => 
$this->user_lid,
                                'sub'                           => $this->sub,
                                'query'                         => $this->query,
                                'start'                         => $this->start,
                                'paid'                          => $paid,
                                'filter'                        => $this->filter
                        );

                        $data = array
                        (
                                'links'                                         
        => $links,
                                'lang_search'                                   
=> lang('Search'),
                                'lang_search_statustext'                => 
lang('Search for investment entries'),
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_select_all'                               
=> lang('Select All'),
                                'img_check'                                     
        => 
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
                                'check_source'                                  
=> './'.$this->currentapp.'/inc/check.js',

                                'allow_all_rows'                                
=> false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($investment_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list investment'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the investment belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => $this->bo->select_category('select',$this->cat_id),
                                'select_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
                                'lang_town_statustext'                  => 
lang('Select the part of town the investment belongs to. To do not use a part 
of town -  select NO PART OF TOWN'),
                                'lang_part_of_town'                             
=> lang('Part of town'),
                                'lang_no_part_of_town'                  => 
lang('No part of town'),
                                'part_of_town_list'                             
=> $this->bocommon->select_part_of_town('select',$this->part_of_town_id),
                                'select_name_part_of_town'              => 
'part_of_town_id',


                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
                                '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_submit'                                   
=> lang('submit'),
                                'table_header'                                  
=> $table_header,
                                'values'                                        
        => $content,
                                'sum_initial_value'                             
=> number_format($sum_initial_value, 0, ',', ' '),
                                'sum_value'                                     
        => number_format($sum_value, 0, ',', ' '),

                                'table_add'                                     
        => $table_add
                        );

//print_r($data).'<br>';
//print_($menu);
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                        $this->save_sessiondata();
                }

                function edit()
                {
                        $entity_id = get_var('entity_id',array('GET'));
                        $investment_id = 
get_var('investment_id',array('POST','GET'));
                        $values         = get_var('values',array('POST'));

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('investment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        if ($values['save'])
                        {
                                if($investment_id)
                                {
                                        $values['entity_id']=$entity_id;
                                        $values['investment_id']=$investment_id;
                                        $action='edit';
                                }
                                else
                                {
                                        $entity_id =    $values['entity_id'];
                                        $investment_id =        
$values['investment_id'];
                                }

                                $message = $this->bo->save($values,$action);
                        }

                        if ($investment_id)
                        {
                                $investment = 
$this->bo->read_single($entity_id,$investment_id);
//print_r($investment).'<br>';
//print_($investment).'<br>';
                                $function_msg = lang('edit investment');
                        }
                        else
                        {
                                $function_msg = lang('add investment');
                        }

                        if ($investment['cat_id'] > 0)
                        {
                                $this->cat_id = $investment['cat_id'];
                        }
                        if ($investment['part_of_town_id'] > 0)
                        {
                                $this->part_of_town_id = 
$investment['part_of_town_id'];
                        }

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiinvestment.edit',
                                'entity_id'     => $entity_id,
                                'investment_id' => $investment_id
                        );

                        $data = array
                        (
                                'appname'                                       
        => lang('investment'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
                                'lang_entity_id'                                
=> lang('Property ID'),
                                'lang_investment_id'                            
=> lang('investment ID'),
                                'lang_name'                                     
        => lang('name'),
                                'lang_generaladdress'                   => 
lang('General Address'),
                                'lang_generellinfo'                             
=> lang('General Info'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'value_entity_id'                               
=> $entity_id,
                                'value_investment_id'                           
=> $investment_id,
                                'value_name'                                    
=> $investment['name'],
                                'value_generaladdress'                  => 
$investment['generaladdress'],
                                'value_access'                                  
=> $investment['access'],
                                'value_cat'                                     
        => $investment['cat'],
                                'message'                                       
        => $message,
                                'lang_name_statustext'                  => 
lang('Enter the name of the investment'),
                                'lang_entity_id_statustext'     => lang('Enter 
Property ID'),
                                'lang_investment_id_statustext' => lang('Enter 
investment ID'),
                                'lang_generaladdress_statustext'=> lang('Enter 
the general address'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the investment'),
                                'lang_access_off_statustext'    => lang('The 
investment is public. If the investment should be private, check this box'),
                                'lang_access_on_statustext'             => 
lang('The investment is private. If the investment should be public, uncheck 
this box'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the investment belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'lang_town_statustext'                  => 
lang('Select the part of town the investment belongs to. To do not use a part 
of town -  select NO PART OF TOWN'),
                                'lang_part_of_town'                             
=> lang('Part of town'),
                                'lang_no_part_of_town'                  => 
lang('No part of town'),
                                'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('format' => 
'select','selected' => $this->cat_id,'globals' => True)),
                                'part_of_town_list'                             
=> $this->bocommon->select_part_of_town('select',$this->part_of_town_id),
                                'select_name_part_of_town'              => 
'values[part_of_town_id]',
                                'omraade_id'                                    
=> $investment['omraade_id'],
                                'part_of_town'                                  
=> $investment['part_of_town'],
                                'investment_type_id'                            
=> $investment['investment_type_id'],
                                'location_code'                                 
=> $investment['location_code'],
                                'value_generellinfo'                    => 
$investment['generellinfo']


                        );
//print_r($data).'<br>';
//print_();

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }

                function delete()
                {
                        $entity_id = get_var('entity_id',array('GET'));
                        $investment_id = 
get_var('investment_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 
$this->currentapp.'.uiinvestment.index'
                        );

                        if (get_var('confirm',array('POST')))
                        {
                                $this->bo->delete($entity_id,$investment_id);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }

                        
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_delete',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header'));

                        $data = array
                        (
                                'appname'                               => 
lang('investment'),
                                'function_msg'                  => lang('delete 
investment'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.delete&entity_id='
 . $entity_id.'&investment_id=' . $investment_id),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
                                'lang_yes_statustext'   => lang('Delete the 
entry'),
                                'lang_no_statustext'    => lang('Back to the 
list'),
                                'lang_no'                               => 
lang('no')
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                }

                function view()
                {
                        $entity_id = get_var('entity_id',array('GET'));
                        $investment_id = get_var('investment_id',array('GET'));

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('investment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        $investment = 
$this->bo->read_single($entity_id,$investment_id);

                        $data = array
                        (
                                'appname'                       => 
lang('investment'),
                                'function_msg'          => lang('view 
investment'),
                                'done_action'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
                                'lang_name'                     => lang('name'),
                                'lang_category'         => lang('category'),
                                'lang_access'           => lang('access'),
                                'lang_time_created'     => lang('time created'),
                                'lang_done'                     => lang('done'),
                                'value_name'            => $investment['name'],
                                'value_access'          => 
lang(ucfirst($investment['access'])),
                                'value_cat'                     => 
$this->cats->id2name($investment['cat']),
                                'value_date'            => 
$GLOBALS['phpgw']->common->show_date($investment['date'])
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
        }
?>

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.bocommon.inc.php      20 Jan 2003 10:35:28 -0000      1.4
--- class.bocommon.inc.php      21 Jan 2003 17:53:01 -0000      1.5
***************
*** 322,334 ****
                                
$menu['sub_invoice_powermeter']=$GLOBALS['phpgw']->link('/property/list_power_meter.php','sub=invoice');
                                
$menu['sub_invoice_consume']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume&sub=invoice');
-                               
$menu['sub_invoice_property_value']=$GLOBALS['phpgw']->link('/property/list_property_value.php','sub=invoice');
                                $menu['sublang_invoice_list']=lang('Invoice');
                                $menu['sublang_invoice_paid']=lang('Paid');
                                $menu['sublang_invoice_powermeter']=lang('Power 
meter');
                                
$menu['sublang_invoice_consume']=lang('consume');
-                               
$menu['sublang_invoice_property_value']=lang('Property value');
                                if ($admin_invoice)
                                {
!                                       
$menu['sub_invoice_investment_value']=$GLOBALS['phpgw']->link('/property/list_investment_value.php','sub=invoice');
                                        
$menu['sublang_invoice_investment_value']=lang('Investment value');
                                        
$menu['sub_invoice_import']=$GLOBALS['phpgw']->link('/index.php','menuaction=property.uiXport.import&sub=invoice');
--- 322,332 ----
                                
$menu['sub_invoice_powermeter']=$GLOBALS['phpgw']->link('/property/list_power_meter.php','sub=invoice');
                                
$menu['sub_invoice_consume']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume&sub=invoice');
                                $menu['sublang_invoice_list']=lang('Invoice');
                                $menu['sublang_invoice_paid']=lang('Paid');
                                $menu['sublang_invoice_powermeter']=lang('Power 
meter');
                                
$menu['sublang_invoice_consume']=lang('consume');
                                if ($admin_invoice)
                                {
!                                       
$menu['sub_invoice_investment_value']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index&sub=invoice');
                                        
$menu['sublang_invoice_investment_value']=lang('Investment value');
                                        
$menu['sub_invoice_import']=$GLOBALS['phpgw']->link('/index.php','menuaction=property.uiXport.import&sub=invoice');

Index: class.soinvoice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soinvoice.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.soinvoice.inc.php     20 Jan 2003 10:35:28 -0000      1.8
--- class.soinvoice.inc.php     21 Jan 2003 17:53:01 -0000      1.9
***************
*** 490,497 ****
                                $consume[$i]['period']                          
        = $this->db->f('periode');
                                $consume[$i]['district_id']                     
        = $this->db->f('omraade_id');
!                               $consume[$i]['account_class']                   
= $this->db->f($select_account_class);
  
                                $i++;
                        }
                        return $consume;
                }
--- 490,498 ----
                                $consume[$i]['period']                          
        = $this->db->f('periode');
                                $consume[$i]['district_id']                     
        = $this->db->f('omraade_id');
!                               $consume[$i]['account_class']                   
= $this->db->f('b_account_class');
  
                                $i++;
                        }
+ //_debug_array($consume);
                        return $consume;
                }

Index: class.uiinvoice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiinvoice.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.uiinvoice.inc.php     20 Jan 2003 10:35:28 -0000      1.8
--- class.uiinvoice.inc.php     21 Jan 2003 17:53:01 -0000      1.9
***************
*** 113,116 ****
--- 113,118 ----
                                {
  
+                                       $sum                                    
                        = $sum + $content[$i]['amount'];
+                                       $content[$i]['amount']                  
        = number_format($content[$i]['amount'], 2, ',', ' ');
                                        $content[$i]['lang_payment_date']       
= lang('Payment Date');
                                        $content[$i]['link_sub']                
        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.list_sub&sub='.$sub);
***************
*** 196,199 ****
--- 198,202 ----
                        );
  
+                       $data['sum']                                            
        = number_format($sum, 2, ',', ' ');
                        $data['overlib_source']                                 
= './'.$this->currentapp.'/inc/overlib.js';
                        $data['links']                                          
        = $links;
***************
*** 324,327 ****
--- 327,332 ----
                                while(each($content))
                                {
+                                       $sum                                    
                                        = $sum + $content[$i]['amount'];
+                                       $content[$i]['amount']                  
                        = number_format($content[$i]['amount'], 2, ',', ' ');
                                        $content[$i]['paid']                    
                        = $paid;
                                        
$content[$i]['lang_tax_code_statustext']        = lang('select the appropiate 
tax code');
***************
*** 429,432 ****
--- 434,438 ----
                        $data = array
                        (
+                               'sum'                                           
        => number_format($sum, 2, ',', ' '),
                                'message'                                       
        => $receipt['message'],
                                'error'                                         
        => $receipt['error'],
***************
*** 562,565 ****
--- 568,572 ----
                                {
                                        $sum=$sum+$content[$i]['consume'];
+                                       $content[$i]['consume'] 
=number_format($content[$i]['consume'], 2, ',', ' ');
                                        $i++;
                                }
***************
*** 595,599 ****
  
                        $data['lang_sum']                                       
        = lang('Sum');
!                       $data['sum']                                            
        = $sum;
                        $data['overlib_source']                                 
= './'.$this->currentapp.'/inc/overlib.js';
                        $data['links']                                          
        = $links;
--- 602,606 ----
  
                        $data['lang_sum']                                       
        = lang('Sum');
!                       $data['sum']                                            
        = number_format($sum, 2, ',', ' ');
                        $data['overlib_source']                                 
= './'.$this->currentapp.'/inc/overlib.js';
                        $data['links']                                          
        = $links;





reply via email to

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