fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11067] property: tenant claim


From: Sigurd Nes
Subject: [Fmsystem-commits] [11067] property: tenant claim
Date: Tue, 23 Apr 2013 11:04:52 +0000

Revision: 11067
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11067
Author:   sigurdne
Date:     2013-04-23 11:04:51 +0000 (Tue, 23 Apr 2013)
Log Message:
-----------
property: tenant claim

Modified Paths:
--------------
    trunk/property/inc/class.soadmin_entity.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.uitenant_claim.inc.php
    trunk/property/js/yahoo/uitenant.edit.js

Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php     2013-04-19 14:07:33 UTC 
(rev 11066)
+++ trunk/property/inc/class.soadmin_entity.inc.php     2013-04-23 11:04:51 UTC 
(rev 11067)
@@ -450,17 +450,68 @@
                                        'enable_bulk'                           
=> $this->db->f('enable_bulk'),
                                        'jasperupload'                          
=> $this->db->f('jasperupload'),
                                        'parent_id'                             
        => $this->db->f('parent_id'),
-                                       'level'                                 
        => $this->db->f('level')
+                                       'level'                                 
        => $this->db->f('level'),
+                                       'location_id'                           
=> $this->db->f('location_id')
+                                       );
+                       }
 
+
+                       return $category;
+               }
+
+               /**
+               * Get entity category based on location_id
+               * @param int $location_id the system location id
+               * @return array info about the entity category
+               */
+               function get_single_category($location_id)
+               {
+                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                       
+                       $type_arr = explode('.',  $loc_arr['location']);
+                       
+                       if(!count($type_arr) == 3)
+                       {
+                               return array();
+                       }
+
+                       $type = $type_arr[1];
+
+                       $sql = "SELECT * FROM fm_{$type}_category WHERE 
location_id =" . (int)$location_id;
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $category = array();
+                       if ($this->db->next_record())
+                       {
+                               $category = array
+                               (
+                                       'id'                                    
        => $this->db->f('id'),
+                                       'name'                                  
        => $this->db->f('name',true),
+                                       'descr'                                 
        => $this->db->f('descr',true),
+                                       'prefix'                                
        => $this->db->f('prefix',true),
+                                       'lookup_tenant'                         
=> $this->db->f('lookup_tenant'),
+                                       'tracking'                              
        => $this->db->f('tracking'),
+                                       'location_level'                        
=> $this->db->f('location_level'),
+                                       'location_link_level'           => 
$this->db->f('location_link_level'),
+                                       'fileupload'                            
=> $this->db->f('fileupload'),
+                                       'loc_link'                              
        => $this->db->f('loc_link'),
+                                       'start_project'                         
=> $this->db->f('start_project'),
+                                       'start_ticket'                          
=> $this->db->f('start_ticket'),
+                                       'is_eav'                                
        => $this->db->f('is_eav'),
+                                       'enable_bulk'                           
=> $this->db->f('enable_bulk'),
+                                       'jasperupload'                          
=> $this->db->f('jasperupload'),
+                                       'parent_id'                             
        => $this->db->f('parent_id'),
+                                       'level'                                 
        => $this->db->f('level'),
+                                       'location_id'                           
=> $location_id
                                        );
 
-                               $category['location_id'] = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                        }
 
-
                        return $category;
                }
 
+
                function read_category_name($entity_id,$cat_id)
                {
                        $sql = "SELECT * FROM fm_{$this->type}_category WHERE 
entity_id =" . (int)$entity_id . ' AND id = ' . (int)$cat_id;

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-04-19 14:07:33 UTC (rev 
11066)
+++ trunk/property/inc/class.soproject.inc.php  2013-04-23 11:04:51 UTC (rev 
11067)
@@ -930,7 +930,7 @@
                        }
 
                        $this->db->query("SELECT DISTINCT fm_workorder.id AS 
workorder_id, fm_workorder.title, fm_workorder.vendor_id, 
fm_workorder.addition,"
-                               . " fm_workorder_status.descr as status, 
fm_workorder_status.closed, fm_workorder.account_id AS b_account_id"
+                               . " fm_workorder_status.descr as status, 
fm_workorder_status.closed, fm_workorder.account_id AS b_account_id, 
fm_workorder.charge_tenant"
                                . " FROM fm_workorder"
                                . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
                                . " {$this->join} fm_workorder_budget ON 
fm_workorder.id = fm_workorder_budget.order_id"
@@ -950,6 +950,7 @@
                                        'closed'                                
=> !!$this->db->f('closed'),
                                        'b_account_id'                  => 
$this->db->f('b_account_id'),
                                        'addition_percentage'   => 
(int)$this->db->f('addition'),
+                                       'calculation'                   => 
$this->db->f('calculation'),
                                        'combined_cost'                 => 0,
                                        'budget'                                
=> 0,
                                        'obligation'                    => 0,

Modified: trunk/property/inc/class.uitenant_claim.inc.php
===================================================================
--- trunk/property/inc/class.uitenant_claim.inc.php     2013-04-19 14:07:33 UTC 
(rev 11066)
+++ trunk/property/inc/class.uitenant_claim.inc.php     2013-04-23 11:04:51 UTC 
(rev 11067)
@@ -670,6 +670,8 @@
                        //_debug_array($values);
 
                        $project_values = 
$this->boproject->read_single($values['project_id'], array(), true);
+                       
+                       $project_values['workorder_budget'] = 
$this->boproject->get_orders(array('project_id'=> 
$values['project_id'],'year'=> 0));
 
                        $soinvoice      = CreateObject('property.soinvoice');
 
@@ -683,9 +685,7 @@
                                else
                                {
                                        $vouchers = 
$soinvoice->read_invoice(array('workorder_id' => $workorder['workorder_id'], 
'user_lid' => 'all'));
-
                                        $workorder['voucher_id'] = 
isset($vouchers[0]['voucher_id']) ? $vouchers[0]['voucher_id'] : '';
-                                       $workorder['actual_cost'] =  
isset($vouchers[0]['approved_amount']) ? $vouchers[0]['approved_amount'] : '';
                                }
                        }
 
@@ -797,10 +797,17 @@
 
                                
if($project_values['workorder_budget'][$d]['selected']==1)
                                {
+                                       
+                                       
$project_values['workorder_budget'][$d]['budget_hidden'] = 
$project_values['workorder_budget'][$d]['budget'];
+                                       
$project_values['workorder_budget'][$d]['calculation_hidden'] = 
$project_values['workorder_budget'][$d]['calculation'];
+                                       
$project_values['workorder_budget'][$d]['actual_cost_hidden'] = 
$project_values['workorder_budget'][$d]['actual_cost'];
                                        
$project_values['workorder_budget'][$d]['selected']='<input type="checkbox" 
name="values[workorder][]" checked 
value="'.$project_values['workorder_budget'][$d]['workorder_id'].'">';
                                }
                                else
                                {
+                                       
$project_values['workorder_budget'][$d]['budget_hidden'] = 0;
+                                       
$project_values['workorder_budget'][$d]['calculation_hidden'] = 0;
+                                       
$project_values['workorder_budget'][$d]['actual_cost_hidden'] = 0;
                                        
$project_values['workorder_budget'][$d]['selected']='<input type="checkbox" 
name="values[workorder][]" 
value="'.$project_values['workorder_budget'][$d]['workorder_id'].'">';
                                }
                        }
@@ -823,11 +830,14 @@
                                (
                                        'name'                  => "0",
                                        'values'                =>      
json_encode(array(      array('key' => 'workorder_id',  'label'=>'Workorder',   
'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
-                                                                               
                                        array('key' => 'budget',        
'label'=>'Budget',      'sortable'=>true,'resizeable'=>true),
-                                                                               
                                        array('key' => 'calculation',   
'label'=>'Calculation', 'sortable'=>true,'resizeable'=>true),
-                                                                               
                                        array('key' => 
'actual_cost','label'=>lang('actual cost'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                        array('key' => 'budget',        
'label'=>'Budget',      
'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                        array('key' => 
'budget_hidden','hidden'=>true),
+                                                                               
                                        array('key' => 'calculation',   
'label'=>'Calculation', 
'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                        array('key' => 
'calculation_hidden','hidden'=>true),
+                                                                               
                                        array('key' => 
'actual_cost','label'=>lang('actual 
cost'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                        array('key' => 
'actual_cost_hidden','hidden'=>true),
                                                                                
                                        array('key' => 
'vendor_name','label'=>'Vendor','sortable'=>true,'resizeable'=>true),
-                                                                               
                                        array('key' => 
'charge_tenant','label'=>'Charge tenant','sortable'=>true,'resizeable'=>true),
+                                                                               
                                        array('key' => 
'charge_tenant','label'=>'Charge 
tenant','sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterCenter'),
                                                                                
                                        array('key' => 
'status','label'=>'Status','sortable'=>true,'resizeable'=>true),
                                                                                
                                        array('key' => 
'voucher_id','label'=>lang('voucher'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                        array('key' => 
'selected','label'=>'select',    'sortable'=>false,'resizeable'=>false)))

Modified: trunk/property/js/yahoo/uitenant.edit.js
===================================================================
--- trunk/property/js/yahoo/uitenant.edit.js    2013-04-19 14:07:33 UTC (rev 
11066)
+++ trunk/property/js/yahoo/uitenant.edit.js    2013-04-23 11:04:51 UTC (rev 
11067)
@@ -13,15 +13,19 @@
        this.addFooterDatatable = function(paginator,datatable)
        {
                //call getSumPerPage(name of column) in property.js
-               tmp_sum1 = getSumPerPage('budget',2,paginator,datatable);
-               tmp_sum2 = getSumPerPage('calculation',2,paginator,datatable);
+               tmp_sum1 = getSumPerPage('budget_hidden',0,paginator,datatable);
+               tmp_sum2 = 
getSumPerPage('calculation_hidden',0,paginator,datatable);
+               tmp_sum3 = 
getSumPerPage('actual_cost_hidden',0,paginator,datatable);
 
                //Create ROW
                newTR = document.createElement('tr');
                td_sum('Sum');
                td_sum(tmp_sum1);
+               td_empty(1);
                td_sum(tmp_sum2);
-               td_empty(7);
+               td_empty(1);
+               td_sum(tmp_sum3);
+               td_empty(6);
 
                //Add to Table
                myfoot = tableYUI.createTFoot();
@@ -37,6 +41,26 @@
                addFooterDatatable(myPaginator_0,myDataTable_0);
        }
 
/********************************************************************************/
+
+       var FormatterAmount0 = function(elCell, oRecord, oColumn, oData)
+       {
+               var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">"+amount+"</div>";
+       }       
+
+       var FormatterAmount2 = function(elCell, oRecord, oColumn, oData)
+       {
+               var amount = YAHOO.util.Number.format(oData, {decimalPlaces:2, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">"+amount+"</div>";
+       }       
+
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+
+
        YAHOO.util.Event.addListener(window, "load", function()
        {
                loader = new YAHOO.util.YUILoader();




reply via email to

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