fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10959] property: condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10959] property: condition survey
Date: Mon, 04 Mar 2013 18:24:46 +0000

Revision: 10959
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10959
Author:   sigurdne
Date:     2013-03-04 18:24:46 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
property: condition survey

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/js/yahoo/request.index.js

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2013-03-04 14:52:29 UTC (rev 
10958)
+++ trunk/property/inc/class.borequest.inc.php  2013-03-04 18:24:46 UTC (rev 
10959)
@@ -41,7 +41,9 @@
                var $sort;
                var $order;
                var $cat_id;
-               public $sum_budget = 0;
+               public $sum_investment = 0;
+               public $sum_operation = 0;
+               public $sum_potential_grants = 0;
                public $sum_consume = 0;
                public $acl_location = '.project.request';
 
@@ -479,11 +481,13 @@
                                'property_cat_id' => $this->property_cat_id, 
'building_part' => $this->building_part,
                                'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter, 'condition_survey_id' => 
$this->condition_survey_id));
 
-                       $this->total_records    = $this->so->total_records;
-                       $this->sum_budget               = $this->so->sum_budget;
-                       $this->sum_consume              = 
$this->so->sum_consume;
-                       $this->uicols                   = $this->so->uicols;
-                       $cols_extra                             = 
$this->so->cols_extra;
+                       $this->total_records                    = 
$this->so->total_records;
+                       $this->sum_investment                   = 
$this->so->sum_investment;
+                       $this->sum_operation                    = 
$this->so->sum_operation;
+                       $this->sum_potential_grants             = 
$this->so->sum_potential_grants;
+                       $this->sum_consume                              = 
$this->so->sum_consume;
+                       $this->uicols                                   = 
$this->so->uicols;
+                       $cols_extra                                             
= $this->so->cols_extra;
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2013-03-04 14:52:29 UTC (rev 
10958)
+++ trunk/property/inc/class.sorequest.inc.php  2013-03-04 18:24:46 UTC (rev 
10959)
@@ -37,8 +37,9 @@
 
        class property_sorequest extends property_socommon_core
        {
-               public $sum_budget = 0;
-               public $sum_consume = 0;
+               public $sum_investment = 0;
+               public $sum_operation = 0;
+               public $sum_potential_grants = 0;
                public $uicols = array();
 
                protected $global_lock = false;
@@ -231,7 +232,8 @@
                        $sql = "SELECT DISTINCT fm_request.id as 
request_id,fm_request_status.descr as status,fm_request.building_part,"
                        . " 
fm_request.start_date,fm_request.closed_date,fm_request.in_progress_date,fm_request.category
 as cat_id,"
                        . " fm_request.delivered_date,fm_request.title as 
title,max(fm_request_condition.degree) as condition_degree,"
-                       . " sum(fm_request_planning.amount) as planned_budget, 
fm_request.budget,fm_request.score,min(fm_request_planning.date) as 
planned_year"
+                       . " sum(fm_request_planning.amount) as planned_budget, 
fm_request.amount_investment,"
+                       . " 
fm_request.amount_operation,fm_request.amount_potential_grants,fm_request.score,min(fm_request_planning.date)
 as planned_year"
                        . " FROM (((( fm_request  LEFT JOIN fm_request_status 
ON fm_request.status = fm_request_status.id)"
                        . " LEFT JOIN fm_request_planning ON fm_request.id = 
fm_request_planning.request_id)"
                        . " LEFT JOIN fm_request_consume ON fm_request.id = 
fm_request_consume.request_id)"
@@ -241,12 +243,15 @@
                        . " 
building_part,fm_request.start_date,fm_request.entry_date,fm_request.closed_date,"
                        . " 
fm_request.in_progress_date,fm_request.delivered_date,title,budget,score,fm_request.id,fm_request_status.descr";
 
-                       $sql2 = "SELECT count(*) as cnt, sum(budget) as 
sum_budget  FROM ({$sql}) as t";
+                       $sql2 = "SELECT count(*) as cnt, sum(amount_investment) 
as sum_investment, sum(amount_operation) as sum_operation, 
sum(amount_potential_grants) as sum_potential_grants FROM ({$sql}) as t";
 
                        $this->_db->query($sql2,__LINE__,__FILE__);
                        $this->_db->next_record();
                        $this->_total_records = $this->_db->f('cnt');
-                       $this->sum_budget       = $this->_db->f('sum_budget');
+                       $this->sum_investment   = 
$this->_db->f('sum_investment');
+                       $this->sum_operation    = 
$this->_db->f('sum_operation');
+                       $this->sum_potential_grants     = 
$this->_db->f('sum_potential_grants');
+       
 //_debug_array($sql);
 
 /*
@@ -271,16 +276,17 @@
                        {
                                $values[] = array
                                (
-                                       'id'                            => 
$this->_db->f('request_id'),
-                                       'status'                        => 
$this->_db->f('status',true),
-                                       'building_part'         => 
$this->_db->f('building_part'),
-                                       'title'                         => 
$this->_db->f('title',true),
-                                       'condition_degree'      => 
$this->_db->f('condition_degree'),
-                                       'budget'                        => 
$this->_db->f('budget'),
-                                       'planned_budget'        => 
$this->_db->f('planned_budget'),
-                                       'score'                         => 
$this->_db->f('score'),
-                                       'planned_year'          => 
$this->_db->f('planned_year') ? date('Y', $this->_db->f('planned_year')) : '',
-                                       'cat_id'                        => 
$this->_db->f('cat_id'),
+                                       'id'                                    
=> $this->_db->f('request_id'),
+                                       'status'                                
=> $this->_db->f('status',true),
+                                       'building_part'                 => 
$this->_db->f('building_part'),
+                                       'title'                                 
=> $this->_db->f('title',true),
+                                       'condition_degree'              => 
$this->_db->f('condition_degree'),
+                                       'amount_investment'             => 
$this->_db->f('amount_investment'),
+                                       'amount_operation'              => 
$this->_db->f('amount_operation'),
+                                       'planned_budget'                => 
$this->_db->f('planned_budget'),
+                                       'score'                                 
=> $this->_db->f('score'),
+                                       'planned_year'                  => 
$this->_db->f('planned_year') ? date('Y', $this->_db->f('planned_year')) : '',
+                                       'cat_id'                                
=> $this->_db->f('cat_id'),
                                );
                        }
                        return $values;
@@ -423,13 +429,13 @@
                        $uicols['sortable'][]           = true;
 
 
-                       $cols.= ",$entity_table.budget as budget";
-                       $cols_return[]                          = 'budget';
-                       $cols_group[]                           = 'budget';
+                       $cols.= ",$entity_table.amount_investment as 
amount_investment";
+                       $cols_return[]                          = 
'amount_investment';
+                       $cols_group[]                           = 
'amount_investment';
                        $uicols['input_type'][]         = 'text';
-                       $uicols['name'][]                       = 'budget';
-                       $uicols['descr'][]                      = lang('cost 
estimate');
-                       $uicols['statustext'][]         = lang('total cost 
estimate');
+                       $uicols['name'][]                       = 
'amount_investment';
+                       $uicols['descr'][]                      = 
lang('investment');
+                       $uicols['statustext'][]         = lang('cost estimate');
                        $uicols['exchange'][]           = '';
                        $uicols['align'][]                      = '';
                        $uicols['datatype'][]           = '';
@@ -437,7 +443,33 @@
                        $uicols['classname'][]          = 'rightClasss';
                        $uicols['sortable'][]           = true;
 
+                       $cols.= ",$entity_table.amount_operation as 
amount_operation";
+                       $cols_return[]                          = 
'amount_operation';
+                       $cols_group[]                           = 
'amount_operation';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 
'amount_operation';
+                       $uicols['descr'][]                      = 
lang('operation');
+                       $uicols['statustext'][]         = lang('cost estimate');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = 'FormatterRight';
+                       $uicols['classname'][]          = 'rightClasss';
+                       $uicols['sortable'][]           = true;
 
+                       $cols.= ",$entity_table.amount_potential_grants as 
amount_potential_grants";
+                       $cols_return[]                          = 
'amount_potential_grants';
+                       $cols_group[]                           = 
'amount_potential_grants';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 
'amount_potential_grants';
+                       $uicols['descr'][]                      = 
lang('potential grants');
+                       $uicols['statustext'][]         = lang('potential 
grants');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = 'FormatterRight';
+                       $uicols['classname'][]          = 'rightClasss';
+                       $uicols['sortable'][]           = true;
 
 //                     $cols.= ",sum(amount) as consume";
 //                     $cols_return[]                          = 'consume';
@@ -708,12 +740,14 @@
 
                        $this->_db->fetchmode = 'ASSOC';
 
-                       $sql2 = "SELECT count(*) as cnt, sum(budget) as 
sum_budget  FROM ({$sql}) as t";
+                       $sql2 = "SELECT count(*) as cnt, sum(amount_investment) 
as sum_investment, sum(amount_operation) as sum_operation, 
sum(amount_potential_grants) as sum_potential_grants FROM ({$sql}) as t";
 
                        $this->_db->query($sql2,__LINE__,__FILE__);
                        $this->_db->next_record();
                        $this->_total_records = $this->_db->f('cnt');
-                       $this->sum_budget       = $this->_db->f('sum_budget');
+                       $this->sum_investment   = 
$this->_db->f('sum_investment');
+                       $this->sum_operation    = 
$this->_db->f('sum_operation');
+                       $this->sum_potential_grants     = 
$this->_db->f('sum_potential_grants');
 
                        $sql3 = "SELECT sum(fm_request_consume.amount) as 
sum_consume  FROM {$sql_arr[1]}";
                        $this->_db->query($sql3,__LINE__,__FILE__);
@@ -944,9 +978,9 @@
                        $value_set['descr']                                     
        = $this->_db->db_addslashes($request['descr']);
 //                     $value_set['location_code']                             
= $request['location_code'];
                        $value_set['entry_date']                                
= time();
-                       $value_set['amount_investment']                 = (int) 
$request['amount_investment');
-                       $value_set['amount_operation']                  = (int) 
$request['amount_operation');
-                       $value_set['amount_potential_grants']   = (int) 
$request['amount_potential_grants');
+                       $value_set['amount_investment']                 = (int) 
$request['amount_investment'];
+                       $value_set['amount_operation']                  = (int) 
$request['amount_operation'];
+                       $value_set['amount_potential_grants']   = (int) 
$request['amount_potential_grants'];
                        $value_set['status']                                    
= $request['status'];
                        $value_set['branch_id']                                 
= $request['branch_id'];
                        $value_set['coordinator']                               
= $request['coordinator'];
@@ -1090,9 +1124,9 @@
                                'end_date'                                      
=> $request['end_date'],
                                'coordinator'                           => 
$request['coordinator'],
                                'descr'                                         
=> $this->_db->db_addslashes($request['descr']),
-                               'amount_investment'                     => 
(int)$request['amount_investment');
-                               'amount_operation'                      => 
(int)$request['amount_operation');
-                               'amount_potential_grants']      => (int) 
$request['amount_potential_grants');
+                               'amount_investment'                     => 
(int)$request['amount_investment'],
+                               'amount_operation'                      => 
(int)$request['amount_operation'],
+                               'amount_potential_grants'       => 
(int)$request['amount_potential_grants'],
                                'location_code'                         => 
$request['location_code'],
                                'address'                                       
=> $address,
                                'authorities_demands'           => 
$request['authorities_demands'],
@@ -1120,13 +1154,15 @@
 
                        $this->_db->transaction_begin();
 
-                       $this->_db->query("SELECT 
budget,status,category,coordinator FROM fm_request where id='" 
.$request['id']."'",__LINE__,__FILE__);
+                       $this->_db->query("SELECT amount_investment, 
amount_operation, amount_potential_grants, status,category,coordinator FROM 
fm_request where id='" .$request['id']."'",__LINE__,__FILE__);
                        $this->_db->next_record();
 
-                       $old_budget                     = 
$this->_db->f('budget');
-                       $old_status = $this->_db->f('status');
-                       $old_category = $this->_db->f('category');
-                       $old_coordinator = $this->_db->f('coordinator');
+                       $old_investment                 = 
$this->_db->f('amount_investment');
+                       $old_operation                  = 
$this->_db->f('amount_operation');
+                       $old_potential_grants   = 
$this->_db->f('amount_potential_grants');
+                       $old_status                             = 
$this->_db->f('status');
+                       $old_category                   = 
$this->_db->f('category');
+                       $old_coordinator                = 
$this->_db->f('coordinator');
                        if($old_status != $request['status'])
                        {
                                $sql = "SELECT * FROM fm_request_status WHERE 
id='{$request['status']}'";
@@ -1239,12 +1275,20 @@
                                {
                                        
$this->historylog->add('C',$request['id'],$request['coordinator'],$old_coordinator);
                                }
-
-                               if ($old_budget != $request['budget'])
+/*
+                               if ((int)$old_investment != 
(int)$request['amount_investment'])
                                {
-                                       $this->historylog->add('B', 
$request['id'], $request['budget'], $old_budget);
+                                       $this->historylog->add('B', 
$request['id'], $request['amount_investment'], $old_investment);
                                }
-
+                               if ((int)$old_operation != 
(int)$request['amount_operation'])
+                               {
+                                       $this->historylog->add('B', 
$request['id'], $request['amount_operation'], $old_operation);
+                               }
+                               if ((int)$old_potential_grants != 
(int)$request['amount_potential_grants'])
+                               {
+                                       $this->historylog->add('B', 
$request['id'], $request['amount_potential_grants'], $old_potential_grants);
+                               }
+*/
                                $receipt['message'][] = 
array('msg'=>lang('request %1 has been edited',$request['id']));
                        }
                        else

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2013-03-04 14:52:29 UTC (rev 
10958)
+++ trunk/property/inc/class.uirequest.inc.php  2013-03-04 18:24:46 UTC (rev 
10959)
@@ -883,15 +883,17 @@
                        //values for Pagination
                        $json = array
                                (
-                                       'recordsReturned'       => 
$datatable['pagination']['records_returned'],
-                                       'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
-                                       'startIndex'            => 
$datatable['pagination']['records_start'],
-                                       'sort'                          => 
$datatable['sorting']['order'],
-                                       'dir'                           => 
$datatable['sorting']['sort'],
-                                       'currentPage'           => 
$datatable['sorting']['currentPage'],
-                                       'records'                       => 
array(),
-                                       'sum_budget'            => 
$this->bo->sum_budget,
-                                       'sum_consume'           => 
$this->bo->sum_consume
+                                       'recordsReturned'               => 
$datatable['pagination']['records_returned'],
+                                       'totalRecords'                  => 
(int)$datatable['pagination']['records_total'],
+                                       'startIndex'                    => 
$datatable['pagination']['records_start'],
+                                       'sort'                                  
=> $datatable['sorting']['order'],
+                                       'dir'                                   
=> $datatable['sorting']['sort'],
+                                       'currentPage'                   => 
$datatable['sorting']['currentPage'],
+                                       'records'                               
=> array(),
+                                       'sum_investment'                => 
$this->bo->sum_investment,
+                                       'sum_operation'                 => 
$this->bo->sum_operation,
+                                       'sum_potential_grants'  => 
$this->bo->sum_potential_grants,
+                                       'sum_consume'                   => 
$this->bo->sum_consume
 
                                );
 
@@ -1183,15 +1185,33 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
                                }
 
-                               if(isset($values['budget']) && 
$values['budget'])
+                               if(isset($values['amount_investment']) && 
$values['amount_investment'])
                                {
-                                       $values['budget'] = str_replace(' ', 
'', $values['budget']);
-                                       if( !ctype_digit($values['budget']))
+                                       $values['amount_investment'] = 
str_replace(' ', '', $values['amount_investment']);
+                                       if( 
!ctype_digit($values['amount_investment']))
                                        {
-                                               
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
+                                               
$receipt['error'][]=array('msg'=>lang('investment') . ': ' . lang('Please enter 
an integer !'));
                                                $error_id=true;
                                        }
                                }
+                               if(isset($values['amount_operation']) && 
$values['amount_operation'])
+                               {
+                                       $values['amount_operation'] = 
str_replace(' ', '', $values['amount_operation']);
+                                       if( 
!ctype_digit($values['amount_operation']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('operation') . ': ' . lang('Please enter 
an integer !'));
+                                               $error_id=true;
+                                       }
+                               }
+                               if(isset($values['amount_potential_grants']) && 
$values['amount_potential_grants'])
+                               {
+                                       $values['amount_potential_grants'] = 
str_replace(' ', '', $values['amount_potential_grants']);
+                                       if( 
!ctype_digit($values['amount_potential_grants']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('potential grants') . ': ' . lang('Please 
enter an integer !'));
+                                               $error_id=true;
+                                       }
+                               }
 
                                $_condition = array_keys($values['condition']);
                                $__condition = isset($_condition[0]) && 
$_condition[0] ? $_condition[0] : 0;
@@ -1673,6 +1693,10 @@
                                        'value_diff'                            
                => number_format($value_diff, 0, ',', ' '),
                                        'value_diff2'                           
                => number_format($value_diff2, 0, ',', ' '),
 
+                                       'value_amount_potential_grants'         
=> number_format($values['amount_potential_grants'], 0, ',', ' '),
+                                       'value_amount_investment'               
        => number_format($values['amount_investment'], 0, ',', ' '),
+                                       'value_amount_operation'                
        => number_format($values['amount_operation'], 0, ',', ' '),
+
                                        'location_data2'                        
                => $location_data,
                        //              'location_type'                         
                => 'form2',
                                        'form_action'                           
                => $GLOBALS['phpgw']->link('/index.php',$link_data),

Modified: trunk/property/js/yahoo/request.index.js
===================================================================
--- trunk/property/js/yahoo/request.index.js    2013-03-04 14:52:29 UTC (rev 
10958)
+++ trunk/property/js/yahoo/request.index.js    2013-03-04 18:24:46 UTC (rev 
10959)
@@ -197,13 +197,17 @@
 
        this.addFooterDatatable = function()
        {
-               tmp_sum_budget = YAHOO.util.Number.format(values_ds.sum_budget, 
{decimalPlaces:0, decimalSeparator:",", thousandsSeparator:" "});
+               tmp_sum_investment = 
YAHOO.util.Number.format(values_ds.sum_investment, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               tmp_sum_operation = 
YAHOO.util.Number.format(values_ds.sum_operation, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               tmp_sum_potential_grants = 
YAHOO.util.Number.format(values_ds.sum_potential_grants, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+//             tmp_sum_budget = YAHOO.util.Number.format(values_ds.sum_budget, 
{decimalPlaces:0, decimalSeparator:",", thousandsSeparator:" "});
                tmp_sum_consume = 
YAHOO.util.Number.format(values_ds.sum_consume, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
 
+
                count_empty = 0;
                for(i=0;i<myColumnDefs.length;i++)
                {
-                       if (myColumnDefs[i].key == 'budget')
+                       if (myColumnDefs[i].key == 'amount_investment')
                        {
                                count_empty = i;
                                break;
@@ -216,7 +220,9 @@
                newTR = document.createElement('tr');
 
                td_empty(count_empty);
-               td_sum(tmp_sum_budget);
+               td_sum(tmp_sum_investment);
+               td_sum(tmp_sum_operation);
+               td_sum(tmp_sum_potential_grants);
                td_sum(tmp_sum_consume);
                td_empty(count_empty_end);
                //Add to Table




reply via email to

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