fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9741] property: calculation


From: Sigurd Nes
Subject: [Fmsystem-commits] [9741] property: calculation
Date: Thu, 05 Jul 2012 06:42:26 +0000

Revision: 9741
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9741
Author:   sigurdne
Date:     2012-07-05 06:42:25 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
property: calculation

Modified Paths:
--------------
    trunk/property/inc/class.boworkorder.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiworkorder.inc.php

Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php        2012-07-04 15:31:22 UTC 
(rev 9740)
+++ trunk/property/inc/class.boworkorder.inc.php        2012-07-05 06:42:25 UTC 
(rev 9741)
@@ -805,4 +805,14 @@
                        }
                        return $ser_list;
                }
+
+               /**
+               * Recalculate actual cost from payment history for all 
workorders
+               *
+               * @return void
+               */
+               function recalculate()
+               {
+                       $this->so->recalculate();
+               }
        }

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2012-07-04 15:31:22 UTC (rev 
9740)
+++ trunk/property/inc/class.menu.inc.php       2012-07-05 06:42:25 UTC (rev 
9741)
@@ -402,6 +402,11 @@
                                                        'text'  => 
lang('Workorder Detail Categories'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'wo_hours') )
                                                ),
+                                               'workorder_recalculate' => array
+                                               (
+                                                       'text'  => 
lang('Workorder recalculate actual cost'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.recalculate') )
+                                               ),
                                                'ticket'        => array
                                                (
                                                        'text'  => 
lang('helpdesk'),

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2012-07-04 15:31:22 UTC 
(rev 9740)
+++ trunk/property/inc/class.soworkorder.inc.php        2012-07-05 06:42:25 UTC 
(rev 9741)
@@ -1512,4 +1512,23 @@
                                $this->db->transaction_commit();
                        }
                }
+
+               /**
+               * Recalculate actual cost from payment history for all 
workorders
+               *
+               * @return void
+               */
+
+               function recalculate()
+               {
+                       $this->db->query("SELECT id FROM 
fm_workorder",__LINE__,__FILE__);
+
+                       $orders = array();
+                       while ($this->db->next_record())
+                       {
+                               $orders[$this->db->f('id')] = true;
+                       }
+
+                       
execMethod('property.soXport.update_actual_cost_from_archive',$orders);
+               }
        }

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2012-07-04 15:31:22 UTC 
(rev 9740)
+++ trunk/property/inc/class.uiworkorder.inc.php        2012-07-05 06:42:25 UTC 
(rev 9741)
@@ -66,7 +66,8 @@
                                'delete'                => true,
                                'view_file'             => true,
                                'columns'               => true,
-                               'add_invoice'   => true
+                               'add_invoice'   => true,
+                               'recalculate'   => true
                        );
 
                function property_uiworkorder()
@@ -2393,6 +2394,48 @@
 
                }
 
+               function recalculate()
+               {
+                       if ( !$GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin')
+                               && !$GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'property'))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>8, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+
+                       $link_data = array
+                       (
+                               'menuaction' => 'property.uiworkorder.index'
+                       );
+
+                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       {
+                               $this->bo->recalculate();
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+                       $data = array
+                               (
+                                       'done_action'                           
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                                       'delete_action'                         
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.recalculate')),
+                                       'lang_confirm_msg'                      
=> lang('do you really want to recalculate all actual cost for all workorders'),
+                                       'lang_yes'                              
        => lang('yes'),
+                                       'lang_yes_statustext'           => 
lang('recalculate'),
+                                       'lang_no_statustext'            => 
lang('Back to the list'),
+                                       'lang_no'                               
        => lang('no')
+                               );
+
+                       $appname                                        = 
lang('workorder');
+                       $function_msg                           = lang('delete 
workorder');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+               
+               }
+
                protected function _generate_tabs($tabs_ = array(), $suppress = 
array(), $selected = 'general')
                {
                        $tabs = array




reply via email to

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