fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10709] Property: update accounting reporting


From: Sigurd Nes
Subject: [Fmsystem-commits] [10709] Property: update accounting reporting
Date: Wed, 23 Jan 2013 18:55:02 +0000

Revision: 10709
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10709
Author:   sigurdne
Date:     2013-01-23 18:55:00 +0000 (Wed, 23 Jan 2013)
Log Message:
-----------
Property: update accounting reporting

Modified Paths:
--------------
    trunk/property/inc/class.boworkorder.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/js/yahoo/workorder.index.js

Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php        2013-01-23 10:39:53 UTC 
(rev 10708)
+++ trunk/property/inc/class.boworkorder.inc.php        2013-01-23 18:55:00 UTC 
(rev 10709)
@@ -39,6 +39,7 @@
                var $filter;
                var $sort;
                var $order;
+               var $filter_year;
                var $cat_id;
                var $order_sent_adress; // in case we want to resend the order 
as an reminder
                var $allrows;
@@ -69,11 +70,14 @@
                                $this->use_session = true;
                        }
 
+                       $default_filter_year    = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_filter_year'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_filter_year']
 == 'current_year' ? date('Y') : 'all';
+
                        $start                          = 
phpgw::get_var('start', 'int', 'REQUEST', 0);
                        $query                          = 
phpgw::get_var('query');
                        $sort                           = 
phpgw::get_var('sort');
                        $order                          = 
phpgw::get_var('order');
                        $filter                         = 
phpgw::get_var('filter', 'int');
+                       $filter_year            = phpgw::get_var('filter_year', 
'string', 'REQUEST', $default_filter_year);
                        $cat_id                         = 
phpgw::get_var('cat_id', 'int');
                        $status_id                      = 
phpgw::get_var('status_id');
                        $wo_hour_cat_id         = 
phpgw::get_var('wo_hour_cat_id', 'int');
@@ -89,6 +93,7 @@
                        $this->obligation       = $obligation;
 
                        $this->start            = $start ? $start : 0;
+                       $this->filter_year      = $filter_year;
 
                        if(array_key_exists('district_id',$_POST) || 
array_key_exists('district_id',$_GET) )
                        {
@@ -470,7 +475,7 @@
                                
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$data['allrows'],
                                
'b_group'=>$this->b_group,'ecodimb'=>$this->ecodimb, 
'paid'=>$this->paid,'b_account' => $this->b_account,
                                'district_id' => 
$this->district_id,'dry_run'=>$data['dry_run'], 'criteria' => 
$this->get_criteria($this->criteria_id),
-                               'obligation' => $this->obligation) );
+                               'obligation' => $this->obligation, 
'filter_year' => $this->filter_year) );
 
                        $this->total_records = $this->so->total_records;
 

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-01-23 10:39:53 UTC (rev 
10708)
+++ trunk/property/inc/class.soproject.inc.php  2013-01-23 18:55:00 UTC (rev 
10709)
@@ -710,7 +710,7 @@
 
 */
 
-                                       $_get_accounting = false;
+                                       $_get_accounting = true;
                                        if($_get_accounting)
                                        {
 
@@ -738,7 +738,7 @@
                                                . " {$this->join} 
fm_workorder_budget ON (fm_workorder.id = fm_workorder_budget.order_id)"// AND 
year = '{$filter_year}')"
 //                                             . " {$this->join} 
fm_workorder_budget ON (fm_workorder.id = fm_workorder_budget.order_id )"
 //                                             . " {$this->left_join} 
fm_orders_paid_or_pending_view ON (fm_workorder.id = 
fm_orders_paid_or_pending_view.order_id {$sql_filter_period})"
-                                               . " {$this->left_join} 
fm_orders_paid_or_pending_view ON (fm_workorder.id = 
fm_orders_paid_or_pending_view.order_id AND( periode < {$filter_year}13 OR 
periode IS NULL))"
+                                               . " {$this->left_join} 
fm_orders_paid_or_pending_view ON (fm_workorder.id = 
fm_orders_paid_or_pending_view.order_id AND( periode > {$filter_year}00 AND 
periode < {$filter_year}13 OR periode IS NULL))"
 //                                             . " WHERE project_id = 
'{$project['project_id']}' {$sql_workder_date_filter} OR (project_id = 
'{$project['project_id']}' AND fm_workorder_status.closed IS NULL)"
                                                . " WHERE (project_id = 
'{$project['project_id']}' AND fm_workorder_budget.year = {$filter_year} ) OR 
(project_id = '{$project['project_id']}' AND fm_workorder_status.closed IS 
NULL)"
                                                . " GROUP BY fm_workorder.id, 
billable_hours, closed";

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2013-01-23 10:39:53 UTC 
(rev 10708)
+++ trunk/property/inc/class.soworkorder.inc.php        2013-01-23 18:55:00 UTC 
(rev 10709)
@@ -147,6 +147,7 @@
                        $district_id    = isset($data['district_id']) ? 
$data['district_id'] : '';
                        $dry_run                = isset($data['dry_run']) ? 
$data['dry_run'] : '';
                        $criteria               = isset($data['criteria']) && 
$data['criteria'] ? $data['criteria'] : array();
+                       $filter_year    = isset($data['filter_year']) ? 
$data['filter_year'] : '';
 
                        $GLOBALS['phpgw']->config->read();
                        $sql = 
$this->bocommon->fm_cache('sql_workorder'.!!$search_vendor . '_' . 
!!$wo_hour_cat_id . '_' . !!$b_group);
@@ -343,6 +344,8 @@
 
                                $joinmethod .= " {$this->left_join} fm_vendor 
ON (fm_workorder.vendor_id = fm_vendor.id))";
                                $paranthesis .='(';
+                               $joinmethod .= " {$this->left_join} 
fm_workorder_budget ON (fm_workorder.id = fm_workorder_budget.order_id))";
+                               $paranthesis .='(';
 
                                //----- wo_hour_status
 
@@ -613,6 +616,13 @@
 
                        }
 
+                       if ($filter_year && $filter_year != 'all')
+                       {
+                               $filter_year = (int)$filter_year;
+                               $filtermethod .= " $where 
(fm_workorder_budget.year={$filter_year})";
+                               $where= 'AND';
+                       }
+
                        $querymethod = '';
                        if($query)
                        {
@@ -777,7 +787,13 @@
                                . " GROUP BY fm_workorder.id,closed, 
fm_location1.mva";
 
 
-                               $_get_accounting = false;
+                               $_paid_filter = '';
+                               if ($filter_year && $filter_year != 'all')
+                               {
+                                       $_paid_filter = " AND (periode > 
{$filter_year}00 AND periode < {$filter_year}13 OR periode IS NULL)";
+                               }
+
+                               $_get_accounting = true;
                                if($_get_accounting)
                                {
                                $this->db->query($sql_cost,__LINE__,__FILE__);
@@ -793,7 +809,7 @@
                                        );
 
                                        $this->db2->query('SELECT 
sum(fm_orders_paid_or_pending_view.amount) as actual_cost'
-                                       . ' FROM fm_orders_paid_or_pending_view 
WHERE order_id = '. $this->db->f('order_id'),__LINE__,__FILE__);
+                                       . ' FROM fm_orders_paid_or_pending_view 
WHERE order_id = '. $this->db->f('order_id') . $_paid_filter,__LINE__,__FILE__);
                                        $this->db2->next_record();
                                        
$_actual_cost_arr[$this->db->f('order_id')]['actual_cost'] = 
$this->db2->f('actual_cost');
                                }
@@ -801,7 +817,6 @@
                                unset($_order_list);
                                }
 
-
                        }
 
                        $this->db->query('SELECT id, percent FROM 
fm_ecomva',__LINE__,__FILE__);

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2013-01-23 10:39:53 UTC 
(rev 10708)
+++ trunk/property/inc/class.uiworkorder.inc.php        2013-01-23 18:55:00 UTC 
(rev 10709)
@@ -55,6 +55,7 @@
                var $sub;
                var $currentapp;
                var $criteria_id;
+               var     $filter_year;
 
                var $public_functions = array
                        (
@@ -105,6 +106,7 @@
                        $this->district_id                      = 
$this->bo->district_id;
                        $this->criteria_id                      = 
$this->bo->criteria_id;
                        $this->obligation                       = 
$this->bo->obligation;
+                       $this->filter_year                      = 
$this->bo->filter_year;
                }
 
                function save_sessiondata()
@@ -268,6 +270,7 @@
                                        ."status_id:'{$this->status_id}',"
                                        ."second_display:1,"
                                        ."criteria_id:'{$this->criteria_id}',"
+                                       ."filter_year:'{$this->filter_year}',"
                                        ."cat_id:'{$this->cat_id}'";
 
                                $values_combo_box[0]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
@@ -290,10 +293,13 @@
                                $default_value = array 
('id'=>'','name'=>lang('no criteria'));
                                array_unshift 
($values_combo_box[4],$default_value);
 
-                               $values_combo_box[5]  = 
$this->bo->get_user_list($this->filter);
-                               array_unshift 
($values_combo_box[5],array('id'=>$GLOBALS['phpgw_info']['user']['account_id'],'name'=>lang('mine
 orders')));
+                               $values_combo_box[5]  = 
execMethod('property.boproject.get_filter_year_list',$this->filter_year);
+                               array_unshift ($values_combo_box[5],array 
('id'=>'all','name'=> lang('all') . ' ' . lang('year')));
+
+                               $values_combo_box[6]  = 
$this->bo->get_user_list($this->filter);
+                               array_unshift 
($values_combo_box[6],array('id'=>$GLOBALS['phpgw_info']['user']['account_id'],'name'=>lang('mine
 orders')));
                                $default_value = array 
('id'=>'','name'=>lang('no user'));
-                               array_unshift 
($values_combo_box[5],$default_value);
+                               array_unshift 
($values_combo_box[6],$default_value);
 
 
                                $datatable['actions']['form'] = array
@@ -314,6 +320,7 @@
                                                                
'wo_hour_cat_id'        => $this->wo_hour_cat_id,
                                                                'paid'          
                => $this->paid,
                                                                'district_id'   
    => $this->district_id,
+                                                               'filter_year'   
        => $this->filter_year
                                                        )
                                                ),
                                                'fields'        => array
@@ -365,16 +372,15 @@
                                                                        'style' 
=> 'filter',
                                                                        
'tab_index' => 5
                                                                ),
-                                                       /*      array
-                                                               ( //boton       
USER
-                                                                       'id' => 
'btn_user_id',
-                                                                       'name' 
=> 'filter',
-                                                                       'value' 
=> lang('User'),
+                                                               array
+                                                               ( //boton       
filter_year
+                                                                       'id' => 
'btn_filter_year',
+                                                                       'name' 
=> 'filter_year',
+                                                                       'value' 
=> lang('year'),
                                                                        'type' 
=> 'button',
                                                                        'style' 
=> 'filter',
-                                                                       
'tab_index' => 5
+                                                                       
'tab_index' => 6
                                                                ),
-                                                       */
                                                                        array
                                                                        ( 
//boton       USER
                                                                                
//      'id' => 'btn_user_id',
@@ -383,9 +389,9 @@
                                                                                
'value' => lang('User'),
                                                                                
'type' => 'select',
                                                                                
'style' => 'filter',
-                                                                               
'values' => $values_combo_box[5],
+                                                                               
'values' => $values_combo_box[6],
                                                                                
'onchange'=> 'onChangeSelect("filter");',
-                                                                               
'tab_index' => 6
+                                                                               
'tab_index' => 7
                                                                        ),
                                                                //for link 
"columns", next to Export button
                                                                array
@@ -398,21 +404,21 @@
                                                                                
'menuaction' => 'property.uiworkorder.columns'
                                                                        
))."','','width=300,height=600,scrollbars=1')",
                                                                        'value' 
=> lang('columns'),
-                                                                       
'tab_index' => 12
+                                                                       
'tab_index' => 13
                                                                ),
                                                                array
                                                                (
                                                                        'type'  
=> 'button',
                                                                        'id'    
=> 'btn_export',
                                                                        'value' 
=> lang('download'),
-                                                                       
'tab_index' => 11
+                                                                       
'tab_index' => 12
                                                                ),
                                                                array
                                                                (
                                                                        'type'  
=> 'button',
                                                                        'id'    
=> 'btn_new',
                                                                        'value' 
=> lang('add'),
-                                                                       
'tab_index' => 10
+                                                                       
'tab_index' => 11
                                                                ),
                                                                array
                                                                (
@@ -440,7 +446,7 @@
                                                                                
'menuaction' => 'property.uiproject.date_search')
                                                                        
)."','','width=350,height=250')",
                                                                        'value' 
=> lang('Date search'),
-                                                                       
'tab_index' => 9
+                                                                       
'tab_index' => 10
                                                                ),
                                                                array
                                                                ( //boton     
SEARCH
@@ -448,7 +454,7 @@
                                                                        'name' 
=> 'search',
                                                                        'value' 
   => lang('search'),
                                                                        'type' 
=> 'button',
-                                                                       
'tab_index' => 8
+                                                                       
'tab_index' => 9
                                                                ),
                                                                array
                                                                ( // TEXT IMPUT
@@ -458,7 +464,7 @@
                                                                        'type' 
=> 'text',
                                                                        
'onkeypress' => 'return pulsar(event)',
                                                                        'size'  
  => 18,
-                                                                       
'tab_index' => 7
+                                                                       
'tab_index' => 8
                                                                ),
                                                        ),
                                                        'hidden_value' => array
@@ -487,13 +493,12 @@
                                                                ( //div values  
combo_box_4
                                                                        'id' => 
'values_combo_box_4',
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[4])
-                                                               )/*,
+                                                               ),
                                                                array
                                                                ( //div values  
combo_box_5
                                                                        'id' => 
'values_combo_box_5',
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[5])
-                                                               )*/
-
+                                                               )
                                                        )
                                                )
                                        )

Modified: trunk/property/js/yahoo/workorder.index.js
===================================================================
--- trunk/property/js/yahoo/workorder.index.js  2013-01-23 10:39:53 UTC (rev 
10708)
+++ trunk/property/js/yahoo/workorder.index.js  2013-01-23 18:55:00 UTC (rev 
10709)
@@ -2,14 +2,14 @@
 // Declaration of workorder.index vars
 //--------------------------------------------------------
        //define SelectButton
-       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4;
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4, oMenuButton_5;
        var selectsButtons = [
        {order:0, 
var_URL:'district_id',name:'btn_district_id',style:'districtbutton',dependiente:''},
        {order:1, 
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
        {order:2, 
var_URL:'status_id',name:'btn_status_id',style:'districtbutton',dependiente:''},
        {order:3, 
var_URL:'wo_hour_cat_id',name:'btn_wo_hour_cat_id',style:'partOFTownbutton',dependiente:''},
-//     {order:4, var_URL:'filter', 
name:'btn_user_id',style:'ownerIdbutton',dependiente:''},
-       {order:4, var_URL:'criteria_id', 
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
+       {order:4, var_URL:'criteria_id', 
name:'btn_criteria_id',style:'criteriabutton',dependiente:''},
+       {order:5, var_URL:'filter_year', 
name:'btn_filter_year',style:'districtbutton',dependiente:''}
        ]
 
        // define buttons
@@ -122,14 +122,13 @@
                        {
                                oMenuButton_4.set("label", ("<em>" + 
array_options[4][index][1] + "</em>"));
                        }
-/*
-                       //user
-                       index = 
locate_in_array_options(5,"value",path_values.filter);
+
+                       //year
+                       index = 
locate_in_array_options(5,"value",path_values.filter_year);
                        if(index)
                        {
                                oMenuButton_5.set("label", ("<em>" + 
array_options[5][index][1] + "</em>"));
                        }
-*/
 
                        //focus initial
                        //--focus for txt_query---




reply via email to

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