fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11621] Property: monthly filter on accounting


From: Sigurd Nes
Subject: [Fmsystem-commits] [11621] Property: monthly filter on accounting
Date: Wed, 22 Jan 2014 21:02:34 +0000

Revision: 11621
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11621
Author:   sigurdne
Date:     2014-01-22 21:02:33 +0000 (Wed, 22 Jan 2014)
Log Message:
-----------
Property: monthly filter on accounting

Modified Paths:
--------------
    trunk/property/inc/class.bobudget.inc.php
    trunk/property/inc/class.sobudget.inc.php
    trunk/property/inc/class.uibudget.inc.php
    trunk/property/js/yahoo/budget.obligations.js

Modified: trunk/property/inc/class.bobudget.inc.php
===================================================================
--- trunk/property/inc/class.bobudget.inc.php   2014-01-22 17:26:09 UTC (rev 
11620)
+++ trunk/property/inc/class.bobudget.inc.php   2014-01-22 21:02:33 UTC (rev 
11621)
@@ -84,6 +84,7 @@
                        $allrows                                = 
phpgw::get_var('allrows', 'bool');
                        $district_id                    = 
phpgw::get_var('district_id', 'int');
                        $year                                   = 
phpgw::get_var('year', 'int');
+                       $month                                  = 
phpgw::get_var('month', 'int');
                        $grouping                               = 
phpgw::get_var('grouping', 'int');
                        $revision                               = 
phpgw::get_var('revision', 'int');
                        $allrows                                = 
phpgw::get_var('allrows', 'bool');
@@ -102,8 +103,8 @@
                        $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
                        $this->order                    = isset($order) && 
$order ? $order : '';
                        $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
-                       $this->dimb_id                  = isset($dimb_id) && 
$dimb_id ? $dimb_id : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb'];
-                       $this->department                       = 
isset($department) && $department ? $department : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['department'];
+                       $this->dimb_id                  = isset($dimb_id) && 
$dimb_id ? $dimb_id : 
'';//$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb'];
+                       $this->department               = isset($department) && 
$department ? $department : 
'';//$GLOBALS['phpgw_info']['user']['preferences']['property']['department'];
 
                        $this->part_of_town_id  = isset($part_of_town_id) && 
$part_of_town_id ? $part_of_town_id : '';
                        $this->district_id              = isset($district_id) 
&& $district_id ? $district_id : '';
@@ -111,6 +112,7 @@
                        $this->revision                 = isset($revision) && 
$revision ? $revision : 1;
                        $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
                        $this->year                             = isset($year) 
&& $year ? $year : date('Y');
+                       $this->month                    = isset($month) && 
$month ? $month : 0;
                        $this->details                  = $details;
 
                        if(isset($year) && !$this->year == $year && 
!$GLOBALS['phpgw_info']['menuaction']=='property.uibudget.obligations')
@@ -190,7 +192,7 @@
                        $obligations = 
$this->so->read_obligations(array('start' => $this->start, 'query' => 
$this->query,
                                'sort' => strtoupper($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,
+                               'year' => $this->year,'month' => $this->month, 
'grouping' => $this->grouping, 'revision' => $this->revision,
                                'details' => $this->details,'dimb_id' => 
$this->dimb_id, 'department' => $this->department,
                                'direction'     => $this->direction));
 

Modified: trunk/property/inc/class.sobudget.inc.php
===================================================================
--- trunk/property/inc/class.sobudget.inc.php   2014-01-22 17:26:09 UTC (rev 
11620)
+++ trunk/property/inc/class.sobudget.inc.php   2014-01-22 21:02:33 UTC (rev 
11621)
@@ -518,7 +518,7 @@
 
                function read_obligations($data)
                {
-                       //_debug_array($data);
+//                     _debug_array($data);
                        $start                  = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
                        $filter                 = isset($data['filter']) ? 
$data['filter'] : 'none';
                        $query                  = isset($data['query']) ? 
$data['query'] : '';
@@ -526,10 +526,10 @@
                        $order                  = isset($data['order']) ? 
$data['order'] : '';
                        $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
                        $filter_district_id     = isset($data['district_id']) 
&& $data['district_id'] ? (int)$data['district_id'] : 0;
-                       $year                   = isset($data['year']) ? 
(int)$data['year'] : '';
                        $grouping               = isset($data['grouping']) ? 
$data['grouping'] : '';
                        $revision               = isset($data['revision']) ? 
$data['revision'] : 1;
                        $year                   = isset($data['year']) &&  
$data['year'] ? (int)$data['year'] : 0;
+                       $month                  = isset($data['month']) &&  
$data['month'] ? (int)$data['month'] : 0;
                        $cat_id                 = isset($data['cat_id']) ? 
$data['cat_id'] : '';
                        $details                = isset($data['details']) ? 
$data['details'] : '';
                        $dimb_id                = isset($data['dimb_id'])  && 
$data['dimb_id'] ? (int)$data['dimb_id'] : 0;
@@ -541,6 +541,8 @@
                                return array();
                        }
 
+                       $filter_period = $month ? 
sprintf("%s%02d",$year,$month) : '';
+
                        $filtermethod_direction = '';
 
                        if($direction == 'income')
@@ -564,7 +566,7 @@
 
 
                        $filtermethod = '';
-                       $filtermethod_order = " WHERE (fm_workorder_budget.year 
= $year OR fm_workorder_status.closed IS NULL)";
+                       $filtermethod_order = " WHERE (fm_workorder_budget.year 
= {$year} OR fm_workorder_status.closed IS NULL)";
 
                        $where = 'AND';
 
@@ -711,6 +713,11 @@
                                {
                                        if($budget['year'] == $year)
                                        {
+
+                                               if($budget['period'] != 
"{$year}00" && $filter_period && ((int)$filter_period+1) > $budget['period'])
+                                               {
+                                                       continue;
+                                               }
 /*
 $projects3[$projects2[$order_id]]['actual_cost']+= $budget['actual_cost'];
 $projects3[$projects2[$order_id]]['combined_cost']+= $budget['sum_orders'];

Modified: trunk/property/inc/class.uibudget.inc.php
===================================================================
--- trunk/property/inc/class.uibudget.inc.php   2014-01-22 17:26:09 UTC (rev 
11620)
+++ trunk/property/inc/class.uibudget.inc.php   2014-01-22 21:02:33 UTC (rev 
11621)
@@ -75,6 +75,7 @@
                        $this->allrows          = $this->bo->allrows;
                        $this->district_id      = $this->bo->district_id;
                        $this->year                     = $this->bo->year;
+                       $this->month            = $this->bo->month;
                        $this->grouping         = $this->bo->grouping;
                        $this->revision         = $this->bo->revision;
                        $this->details          = $this->bo->details;
@@ -96,7 +97,8 @@
                                        'cat_id'                => 
$this->cat_id,
                                        'dimb_id'               => 
$this->dimb_id,
                                        'allrows'               => 
$this->allrows,
-                                       'direction'             => 
$this->direction
+                                       'direction'             => 
$this->direction,
+                                       'month'                 => $this->month
                                );
                        $this->bo->save_sessiondata($data);
                }
@@ -1029,6 +1031,7 @@
                                                'district_id'   => 
$this->district_id,
                                                'grouping'              => 
$this->grouping,
                                                'year'                  => 
$this->year,
+                                               'month'                 => 
$this->month,
                                                'details'               => 
$this->details,
                                                'allrows'               => 
$this->allrows,
                                                'dimb_id'               => 
$this->dimb_id,
@@ -1043,6 +1046,7 @@
                                        ."district_id:'{$this->district_id}',"
                                        ."grouping:'{$this->grouping}',"
                                        ."year:'{$this->year}',"
+                                       ."month:'{$this->month}',"
                                        ."details:'{$this->details}',"
                                        ."dimb_id:'{$this->dimb_id}',"
                                        ."direction:'{$this->direction}',"
@@ -1053,14 +1057,23 @@
                                $default_value = array 
('id'=>'','name'=>lang('no year'));
                                array_unshift 
($values_combo_box[0],$default_value);
 
-                               $values_combo_box[1]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+
+
+                               for ($i=1;$i< 13 ;$i++)
+                               {
+                                       $values_combo_box[1][] = array ('id'=> 
$i,'name'=> sprintf("%02s",$i));
+                               }
+
+                               array_unshift ($values_combo_box[1], array 
('id'=>'','name'=>lang('month')));
+
+                               $values_combo_box[2]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
                                $default_value = array 
('id'=>'','name'=>lang('no district'));
-                               array_unshift 
($values_combo_box[1],$default_value);
+                               array_unshift 
($values_combo_box[2],$default_value);
 
                                $cat_filter =  
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data));
                                foreach($cat_filter['cat_list'] as $_cat)
                                {
-                                       $values_combo_box[2][] = array
+                                       $values_combo_box[3][] = array
                                        (
                                                'id' => $_cat['cat_id'],
                                                'name' => $_cat['name'],
@@ -1068,27 +1081,27 @@
                                        );
                                }
 
-                               array_unshift ($values_combo_box[2],array 
('id'=>'', 'name'=>lang('no category')));
+                               array_unshift ($values_combo_box[3],array 
('id'=>'', 'name'=>lang('no category')));
 
 //_debug_array($values_combo_box[2]);
 
-                               $values_combo_box[3] =  
$this->bo->get_b_group_list($this->grouping);
+                               $values_combo_box[4] =  
$this->bo->get_b_group_list($this->grouping);
                                $default_value = array 
('id'=>'','name'=>lang('no grouping'));
-                               array_unshift 
($values_combo_box[3],$default_value);
+                               array_unshift 
($values_combo_box[4],$default_value);
 
-                               $values_combo_box[4]  = 
$this->bocommon->select_category_list(array('type'=>'department'));
-                               array_unshift ($values_combo_box[4], array 
('id'=>'','name'=>lang('department')));
+                               $values_combo_box[5]  = 
$this->bocommon->select_category_list(array('type'=>'department'));
+                               array_unshift ($values_combo_box[5], array 
('id'=>'','name'=>lang('department')));
 
-                               $values_combo_box[5]  = 
$this->bocommon->select_category_list(array('type'=>'dimb'));
-                               foreach($values_combo_box[5] as & $_dimb)
+                               $values_combo_box[6]  = 
$this->bocommon->select_category_list(array('type'=>'dimb'));
+                               foreach($values_combo_box[6] as & $_dimb)
                                {
                                        $_dimb['name'] = 
"{$_dimb['id']}-{$_dimb['name']}";
                                }
                                $default_value = array 
('id'=>'','name'=>lang('no dimb'));
-                               array_unshift 
($values_combo_box[5],$default_value);
+                               array_unshift 
($values_combo_box[6],$default_value);
 
 
-                               $values_combo_box[6]  = array
+                               $values_combo_box[7]  = array
                                (
                                        array
                                        (
@@ -1128,13 +1141,22 @@
                                                                        
'tab_index' => 1
                                                                ),
                                                                array
+                                                               ( //boton       
YEAR
+                                                                       'id'    
        => 'btn_month',
+                                                                       'name'  
        => 'month',
+                                                                       'value' 
        => lang('month'),
+                                                                       'type'  
        => 'button',
+                                                                       'style' 
        => 'filter',
+                                                                       
'tab_index' => 2
+                                                               ),
+                                                               array
                                                                ( //boton       
DISTRICT
                                                                        'id'    
        => 'btn_district_id',
                                                                        'name'  
        => 'district_id',
                                                                        'value' 
        => lang('district_id'),
                                                                        'type'  
        => 'button',
                                                                        'style' 
        => 'filter',
-                                                                       
'tab_index' => 2
+                                                                       
'tab_index' => 3
                                                                ),
 /*                                                             array
                                                                ( //boton       
CATEGORY
@@ -1164,7 +1186,7 @@
                                                                        'style' 
=> 'filter',
                                                                        
'values' => $values_combo_box[2],
                                                                        
'onchange'=> 'onChangeSelect("cat_id");',
-                                                                       
'tab_index' => 3
+                                                                       
'tab_index' => 5
                                                                ),
 /*
                                                                array
@@ -1188,9 +1210,9 @@
                                                                        'value' 
=> lang('department'),
                                                                        'type' 
=> 'select',
                                                                        'style' 
=> 'filter',
-                                                                       
'values' => $values_combo_box[4],
+                                                                       
'values' => $values_combo_box[5],
                                                                        
'onchange'=> 'onChangeSelect("department");',
-                                                                       
'tab_index' => 5
+                                                                       
'tab_index' => 6
                                                                ),
                                                                array
                                                                ( //boton       
USER
@@ -1200,9 +1222,9 @@
                                                                        'value' 
=> lang('dimb'),
                                                                        'type' 
=> 'select',
                                                                        'style' 
=> 'filter',
-                                                                       
'values' => $values_combo_box[5],
+                                                                       
'values' => $values_combo_box[6],
                                                                        
'onchange'=> 'onChangeSelect("dimb_id");',
-                                                                       
'tab_index' => 6
+                                                                       
'tab_index' => 7
                                                                ),
                                                                array
                                                                ( //boton       
USER
@@ -1212,17 +1234,16 @@
                                                                        'value' 
=> lang('direction'),
                                                                        'type' 
=> 'select',
                                                                        'style' 
=> 'filter',
-                                                                       
'values' => $values_combo_box[6],
+                                                                       
'values' => $values_combo_box[7],
                                                                        
'onchange'=> 'onChangeSelect("direction");',
-                                                                       
'tab_index' => 7
+                                                                       
'tab_index' => 8
                                                                ),
-
                                                                array
                                                                (
                                                                        'type'  
=> 'button',
                                                                        'id'    
=> 'btn_export',
                                                                        'value' 
=> lang('download'),
-                                                                       
'tab_index' => 10
+                                                                       
'tab_index' => 11
                                                                ),
                                                                array
                                                                ( //boton     
SEARCH
@@ -1230,7 +1251,7 @@
                                                                        'name'  
        => 'search',
                                                                        'value' 
        => lang('search'),
                                                                        'type'  
        => 'button',
-                                                                       
'tab_index' => 9
+                                                                       
'tab_index' => 10
                                                                ),
                                                                array
                                                                ( // TEXT IMPUT
@@ -1240,7 +1261,7 @@
                                                                        'type'  
        => 'text',
                                                                        'size'  
        => 28,
                                                                        
'onkeypress'=> 'return pulsar(event)',
-                                                                       
'tab_index' => 8
+                                                                       
'tab_index' => 9
                                                                )
                                                        ),
                                                        'hidden_value' => array
@@ -1256,16 +1277,14 @@
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[1])
                                                                ),
                                                                array
+                                                               ( //div values  
combo_box_2
+                                                                       'id' => 
'values_combo_box_2',
+                                                                       'value' 
=> $this->bocommon->select2String($values_combo_box[2])
+                                                               ),              
                                                array
                                                                ( //div values  
combo_box_3
-                                                                       'id' => 
'values_combo_box_2',
+                                                                       'id' => 
'values_combo_box_3',
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[3])
-                                                               ),/*
-                                                               array
-                                                               ( //div values  
combo_box_4
-                                                                       'id' => 
'values_combo_box_4',
-                                                                       'value' 
=> $this->bocommon->select2String($values_combo_box[4])
-                                                               )*/
-
+                                                               )
                                                        )
                                                )
                                        )

Modified: trunk/property/js/yahoo/budget.obligations.js
===================================================================
--- trunk/property/js/yahoo/budget.obligations.js       2014-01-22 17:26:09 UTC 
(rev 11620)
+++ trunk/property/js/yahoo/budget.obligations.js       2014-01-22 21:02:33 UTC 
(rev 11621)
@@ -3,12 +3,12 @@
 //--------------------------------------------------------
 
                //define SelectButton
-               var oMenuButton_0, oMenuButton_1, oMenuButton_2;//, 
oMenuButton_3, oMenuButton_4;
+               var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
                var selectsButtons = [
                {order:0, var_URL:'year',               name:'btn_year',        
        style:'',dependiente:[]},
-               {order:1, var_URL:'district_id',name:'btn_district_id', 
style:'',dependiente:[]},
-               {order:2, var_URL:'grouping',   name:'btn_grouping',    
style:'',dependiente:[]}
-//             {order:4, var_URL:'dimb_id',    name:'btn_dimb_id',             
style:'',dependiente:[]}
+               {order:1, var_URL:'month',              name:'btn_month',       
        style:'',dependiente:[]},
+               {order:2, var_URL:'district_id',name:'btn_district_id', 
style:'',dependiente:[]},
+               {order:3, var_URL:'grouping',   name:'btn_grouping',    
style:'',dependiente:[]}
                ]
 
                // define buttons
@@ -53,30 +53,33 @@
                        execute_ds();
                }
 
-               this.filter_grouping = function(year,district_id,param,details)
+               this.filter_grouping = 
function(year,month,district_id,param,details)
                {
                        if(details)
                        {
                                //look for  "grouping" column
-                               oMenuButton_2.set("label", ("<em>" + param + 
"</em>"));
-                               oMenuButton_2.set("value", param);
+                               oMenuButton_3.set("label", ("<em>" + param + 
"</em>"));
+                               oMenuButton_3.set("value", param);
                                path_values.grouping = param;
                        }
                        else
                        {
                                //reset GROUPING filter
-                               oMenuButton_2.set("label", ("<em>" + 
array_options[2][0][1] + "</em>"));
-                               path_values.grouping =  array_options[2][0][0];
+                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][0][1] + "</em>"));
+                               path_values.grouping =  array_options[3][0][0];
                                path_values.b_account = param;
                        }
 
                        oMenuButton_0.set("label", ("<em>" + year + "</em>"));
                        path_values.year= year;
+
+                       oMenuButton_1.set("label", ("<em>" + month + "</em>"));
+                       path_values.month= month;
                
                        //look for REVISION filter 's text using COD
                        index = locate_in_array_options(1,"value",district_id);
-                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
-                       oMenuButton_1.set("value", array_options[1][index][0]);
+                       oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                       oMenuButton_2.set("value", array_options[2][index][0]);
                        path_values.district_id = district_id;
                        
                        path_values.details = details;
@@ -104,7 +107,7 @@
                                district_id = oRecord._oData.district_id;
                        }
 
-                       elCell.innerHTML = "<a 
onclick=\"javascript:filter_grouping("+path_values.year+","+district_id+","+ 
text +","+details+");\" href=\"#\">" + text + "</a>";
+                       elCell.innerHTML = "<a 
onclick=\"javascript:filter_grouping("+path_values.year+","+path_values.month+","+district_id+","+
 text +","+details+");\" href=\"#\">" + text + "</a>";
                }       
        
/********************************************************************************/
                var myFormatLink_Count = function(elCell, oRecord, oColumn, 
oData)




reply via email to

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