fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7578] property: sum estimate at list


From: Sigurd Nes
Subject: [Fmsystem-commits] [7578] property: sum estimate at list
Date: Mon, 12 Sep 2011 18:27:02 +0000

Revision: 7578
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7578
Author:   sigurdne
Date:     2011-09-12 18:27:01 +0000 (Mon, 12 Sep 2011)
Log Message:
-----------
property: sum estimate at list

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/js/yahoo/request.index.js

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2011-09-12 13:51:23 UTC (rev 
7577)
+++ trunk/property/inc/class.borequest.inc.php  2011-09-12 18:27:01 UTC (rev 
7578)
@@ -41,6 +41,8 @@
                var $sort;
                var $order;
                var $cat_id;
+               public $sum_budget = 0;
+               public $sum_residual_demand = 0;
 
                var $public_functions = array
                        (
@@ -395,10 +397,11 @@
                                'filter' => $this->filter,'district_id' => 
$this->district_id,'cat_id' => $this->cat_id,'status_id' => $this->status_id,
                                'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr'],
                                'dry_run'=>$data['dry_run'], 'p_num' => 
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date));
-                       $this->total_records = $this->so->total_records;
 
-                       $this->uicols   = $this->so->uicols;
-                       $cols_extra             = $this->so->cols_extra;
+                       $this->total_records    = $this->so->total_records;
+                       $this->sum_budget               = $this->so->sum_budget;
+                       $this->uicols                   = $this->so->uicols;
+                       $cols_extra                             = 
$this->so->cols_extra;
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-09-12 13:51:23 UTC (rev 
7577)
+++ trunk/property/inc/class.sorequest.inc.php  2011-09-12 18:27:01 UTC (rev 
7578)
@@ -36,7 +36,9 @@
 
        class property_sorequest
        {
-               function property_sorequest()
+               public $sum_budget = 0;
+
+               function __construct()
                {
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->soproject        = 
CreateObject('property.soproject');
@@ -297,8 +299,8 @@
                        $cols_return[]                          = 'budget';
                        $uicols['input_type'][]         = 'text';
                        $uicols['name'][]                       = 'budget';
-                       $uicols['descr'][]                      = 
lang('budget');
-                       $uicols['statustext'][]         = lang('Request 
budget');
+                       $uicols['descr'][]                      = lang('cost 
estimate');
+                       $uicols['statustext'][]         = lang('total cost 
estimate');
                        $uicols['exchange'][]           = '';
                        $uicols['align'][]                      = '';
                        $uicols['datatype'][]           = '';
@@ -442,11 +444,13 @@
                        $this->cols_extra       = $this->bocommon->cols_extra;
 
                        $this->db->fetchmode = 'ASSOC';
-                       $sql2 = 'SELECT count(*) as cnt ' . 
substr($sql,strripos($sql,'from'));
+
+                       $sql2 = 'SELECT count(*) as cnt, sum(budget) as 
sum_budget ' . substr($sql,strripos($sql,'from'));
                        $this->db->query($sql2,__LINE__,__FILE__);
                        $this->db->next_record();
                        $this->total_records = $this->db->f('cnt');
-
+                       $this->sum_budget       = $this->db->f('sum_budget');
+                       
                        //address@hidden 23/10/08 avoid retrieve data in first 
time, only render definition for headers (var myColumnDefs)
                        if($dry_run)
                        {

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2011-09-12 13:51:23 UTC (rev 
7577)
+++ trunk/property/inc/class.uirequest.inc.php  2011-09-12 18:27:01 UTC (rev 
7578)
@@ -736,7 +736,10 @@
                                        'sort'                          => 
$datatable['sorting']['order'],
                                        'dir'                           => 
$datatable['sorting']['sort'],
                                        'currentPage'           => 
$datatable['sorting']['currentPage'],
-                                       'records'                       => 
array()
+                                       'records'                       => 
array(),
+                                       'sum_budget'            => 
$this->bo->sum_budget,
+                                       'sum_residual_demand'=> 
$this->bo->sum_residual_demand
+
                                );
 
                        // values for datatable

Modified: trunk/property/js/yahoo/request.index.js
===================================================================
--- trunk/property/js/yahoo/request.index.js    2011-09-12 13:51:23 UTC (rev 
7577)
+++ trunk/property/js/yahoo/request.index.js    2011-09-12 18:27:01 UTC (rev 
7578)
@@ -46,10 +46,15 @@
                elCell.innerHTML = "<div 
align=\"right\">"+YAHOO.util.Number.format(oData, {thousandsSeparator:" 
"})+"</div>";
        }
 
+       var tableYUI;
+
        this.particular_setting = function()
        {
                if(flag_particular_setting=='init')
                {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+
 //     console.log(path_values);
                        //district
                        index = 
locate_in_array_options(0,"value",path_values.district_id);
@@ -145,9 +150,46 @@
 
        this.myParticularRenderEvent = function()
        {
-       //don't delete it
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
        }
 
+
+       this.addFooterDatatable = function()
+       {
+               tmp_sum_budget = YAHOO.util.Number.format(values_ds.sum_budget, 
{decimalPlaces:0, decimalSeparator:",", thousandsSeparator:" "});
+//             tmp_sum_residual_demand = 
YAHOO.util.Number.format(values_ds.sum_residual_demand, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+
+               count_empty = 0;
+               for(i=0;i<myColumnDefs.length;i++)
+               {
+                       if (myColumnDefs[i].key == 'budget')
+                       {
+                               count_empty = i;
+                               break;
+                       }
+               }
+
+               count_empty_end = myColumnDefs.length - count_empty;
+
+               //Create ROW
+               newTR = document.createElement('tr');
+
+               td_empty(count_empty);
+               td_sum(tmp_sum_budget);
+       //      td_sum(tmp_sum_residual_demand);
+               td_empty(count_empty_end);
+               //Add to Table
+
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR.cloneNode(true));
+
+               //clean value for values_ds.message
+               //values_ds.message = null;
+       }
+
+
  
/****************************************************************************************/
 
        this.myexecuteTEMP = function()
@@ -164,9 +206,6 @@
 
        }
 
-
-
-
 
/****************************************************************************************/
 
        YAHOO.util.Event.addListener(window, "load", function()




reply via email to

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