fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8964] property: budget


From: Sigurd Nes
Subject: [Fmsystem-commits] [8964] property: budget
Date: Tue, 06 Mar 2012 11:13:41 +0000

Revision: 8964
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8964
Author:   sigurdne
Date:     2012-03-06 11:13:41 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
property: budget

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.index.js

Modified: trunk/property/inc/class.bobudget.inc.php
===================================================================
--- trunk/property/inc/class.bobudget.inc.php   2012-03-06 07:38:37 UTC (rev 
8963)
+++ trunk/property/inc/class.bobudget.inc.php   2012-03-06 11:13:41 UTC (rev 
8964)
@@ -145,8 +145,8 @@
                                'district_id' => $this->district_id,'year' => 
$this->year,'grouping' => $this->grouping,'revision' => $this->revision,
                                'cat_id' => $this->cat_id, 'dimb_id' => 
$this->dimb_id));
 
-                       $this->total_records = $this->so->total_records;
-
+                       $this->total_records            = 
$this->so->total_records;
+                       $this->sum_budget_cost          = 
$this->so->sum_budget_cost;
                        foreach ($budget as & $entry)
                        {
 //                             $entry['entry_date']    = 
$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);

Modified: trunk/property/inc/class.sobudget.inc.php
===================================================================
--- trunk/property/inc/class.sobudget.inc.php   2012-03-06 07:38:37 UTC (rev 
8963)
+++ trunk/property/inc/class.sobudget.inc.php   2012-03-06 11:13:41 UTC (rev 
8964)
@@ -152,11 +152,26 @@
                        }
 
 
-                       $sql = "SELECT fm_budget.*, fm_budget.category as 
cat_id, ecodimb, descr,fm_b_account.category as grouping FROM fm_budget 
$this->join fm_b_account ON fm_budget.b_account_id = fm_b_account.id 
$filtermethod $querymethod";
+                       $sql = "SELECT fm_budget.*, fm_budget.category as 
cat_id, ecodimb, descr,fm_b_account.category as grouping FROM fm_budget 
{$this->join} fm_b_account ON fm_budget.b_account_id = fm_b_account.id 
$filtermethod $querymethod";
 
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
 
+                       
if($GLOBALS['phpgw_info']['server']['db_type']=='postgres')
+                       {
+                               $sql_count = 'SELECT count(id) as cnt, 
sum(budget_cost) AS sum_budget_cost FROM (SELECT DISTINCT fm_budget.id, 
budget_cost '. substr($sql,strripos($sql,'FROM')) .') AS t';
+                               $this->db->query($sql_count,__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->total_records            = 
$this->db->f('cnt');
+                               $this->sum_budget_cost          = 
$this->db->f('sum_budget_cost');
+                       }
+                       else
+                       {
+                               $sql_count = 'SELECT count(fm_budget.id) as 
cnt, sum(budget_cost) AS sum_budget_cost ' . substr($sql,strripos($sql,'FROM'));
+                               $this->db->query($sql_count,__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->total_records            = 
$this->db->f('cnt');
+                               $this->sum_budget_cost          = 
$this->db->f('sum_budget_cost');
+                       }
+
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -182,7 +197,7 @@
                                                'entry_date'            => 
$this->db->f('entry_date'),
                                                'ecodimb'                       
=> $this->db->f('ecodimb'),
                                                'cat_id'                        
=> $this->db->f('cat_id'),
-                                               //                      'user'  
                        => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
+                       //                      'user'                          
=> $GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
                                        );
                        }
                        return $budget;

Modified: trunk/property/inc/class.uibudget.inc.php
===================================================================
--- trunk/property/inc/class.uibudget.inc.php   2012-03-06 07:38:37 UTC (rev 
8963)
+++ trunk/property/inc/class.uibudget.inc.php   2012-03-06 11:13:41 UTC (rev 
8964)
@@ -459,7 +459,8 @@
                                        'startIndex'            => 
$datatable['pagination']['records_start'],
                                        'sort'                          => 
$datatable['sorting']['order'],
                                        'dir'                           => 
$datatable['sorting']['sort'],
-                                       'records'                       => 
array()
+                                       'records'                       => 
array(),
+                                       'sum_budget'            => 
$this->bo->sum_budget_cost
                                );
 
                        // values for datatable

Modified: trunk/property/js/yahoo/budget.index.js
===================================================================
--- trunk/property/js/yahoo/budget.index.js     2012-03-06 07:38:37 UTC (rev 
8963)
+++ trunk/property/js/yahoo/budget.index.js     2012-03-06 11:13:41 UTC (rev 
8964)
@@ -95,10 +95,8 @@
 
                this.addFooterDatatable = function()
                {
-               
                        //call getSumPerPage(name of column) in property.js
-                       tmp_sum = getSumPerPage('budget_cost',0);
-
+                       tmp_sum = 
YAHOO.util.Number.format(values_ds.sum_budget, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
                        //Create ROW
                        newTR = document.createElement('tr');
                        td_empty(9);




reply via email to

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