[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6877] property: reporting on totalt amounts
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6877] property: reporting on totalt amounts |
Date: |
Sun, 30 Jan 2011 13:41:51 +0000 |
Revision: 6877
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6877
Author: sigurdne
Date: 2011-01-30 13:41:51 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
property: reporting on totalt amounts
Modified Paths:
--------------
trunk/property/inc/class.boinvoice.inc.php
trunk/property/inc/class.botts.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.sotts.inc.php
trunk/property/inc/class.uiinvoice.inc.php
trunk/property/inc/class.uitts.inc.php
trunk/property/js/yahoo/invoice.index.js
trunk/property/js/yahoo/invoice.paid.index.js
trunk/property/js/yahoo/tts.index.js
Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/inc/class.boinvoice.inc.php 2011-01-30 13:41:51 UTC (rev
6877)
@@ -34,6 +34,9 @@
class property_boinvoice
{
+ public $total_records = 0;
+ public $sum_amount = 0;
+
function property_boinvoice($session=false)
{
$this->so =
CreateObject('property.soinvoice',true);
@@ -144,7 +147,7 @@
}
$this->total_records = $this->so->total_records;
-
+ $this->sum_amount = $this->so->sum_amount;
return $invoice;
}
Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/inc/class.botts.inc.php 2011-01-30 13:41:51 UTC (rev
6877)
@@ -49,7 +49,9 @@
var $user_id;
var $part_of_town_id;
var $district_id;
- var $total_records;
+ public $total_records = 0;
+ public $sum_budget = 0;
+ public $sum_actual_cost = 0;
var $public_functions = array
(
@@ -304,7 +306,11 @@
'start_date'=>$start_date,'end_date'=>$end_date,
'allrows'=>$this->allrows,'user_id' =>
$this->user_id,'external'=>$external, 'dry_run' => $dry_run,
'location_code' => $this->location_code,
'p_num' => $this->p_num));
+
$this->total_records = $this->so->total_records;
+ $this->sum_budget = $this->so->sum_budget;
+ $this->sum_actual_cost = $this->so->sum_actual_cost;
+
if(!$external)
{
$entity = $this->get_origin_entity_type();
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/inc/class.soinvoice.inc.php 2011-01-30 13:41:51 UTC (rev
6877)
@@ -34,8 +34,9 @@
class property_soinvoice
{
- var $total_records = 0;
- var $role = array();
+ public $total_records = 0;
+ public $sum_amount = 0;
+ public $role = array();
protected $invoice_approval = 2;
function __construct()
@@ -189,6 +190,12 @@
$this->db->query($sql2,__LINE__,__FILE__);
$this->total_records = $this->db->num_rows();
+ $sql3 = "SELECT sum(belop) as sum_amount FROM $table
$join_tables $filtermethod $querymethod";
+ $this->db->query($sql3,__LINE__,__FILE__);
+ $this->db->next_record();
+ $this->sum_amount =
$this->db->f('sum_amount');
+
+
if(!$allrows)
{
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/inc/class.sotts.inc.php 2011-01-30 13:41:51 UTC (rev
6877)
@@ -38,6 +38,9 @@
{
var $uicols_related = array();
var $acl_location = '.ticket';
+ public $total_records = 0;
+ public $sum_budget = 0;
+ public $sum_actual_cost = 0;
public $soap_functions = array
(
@@ -393,10 +396,12 @@
//_debug_array($sql);
- $sql2 = "SELECT count(*) as cnt FROM ({$sql}) as t";
+ $sql2 = "SELECT count(*) as cnt, sum(budget) as
sum_budget, sum(actual_cost) as sum_actual_cost FROM ({$sql}) as t";
$this->db->query($sql2,__LINE__,__FILE__);
$this->db->next_record();
- $this->total_records = $this->db->f('cnt');
+ $this->total_records = $this->db->f('cnt');
+ $this->sum_budget =
$this->db->f('sum_budget');
+ $this->sum_actual_cost =
$this->db->f('sum_actual_cost');
unset($sql2);
$tickets = array();
Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/inc/class.uiinvoice.inc.php 2011-01-30 13:41:51 UTC (rev
6877)
@@ -1026,7 +1026,8 @@
'sort' =>
$datatable['sorting']['order'],
'dir' =>
$datatable['sorting']['sort'],
'currentPage' =>
$datatable['sorting']['currentPage'],
- 'records' =>
array()
+ 'records' =>
array(),
+ 'sum_amount' =>
$this->bo->sum_amount
);
// values for datatable
if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row']))
Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/inc/class.uitts.inc.php 2011-01-30 13:41:51 UTC (rev
6877)
@@ -1055,12 +1055,19 @@
);
}
+
+ $uicols_formatter = array
+ (
+ 'estimate' => 'FormatterRight',
+ 'actual_cost' => 'FormatterRight'
+ );
+
unset($parameters);
for ($i=0;$i<$count_uicols_name;$i++)
{
// if($uicols['input_type'][$i]!='hidden')
{
-
$datatable['headers']['header'][$i]['formatter'] =
!isset($uicols['formatter'][$i]) || $uicols['formatter'][$i]==''? '""' :
$uicols['formatter'][$i];
+
$datatable['headers']['header'][$i]['formatter'] =
isset($uicols_formatter[$uicols['name'][$i]]) &&
$uicols_formatter[$uicols['name'][$i]] ? $uicols_formatter[$uicols['name'][$i]]
: '""';
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
$datatable['headers']['header'][$i]['visible'] = true;
@@ -1119,7 +1126,10 @@
'startIndex' =>
$datatable['pagination']['records_start'],
'sort' =>
$datatable['sorting']['order'],
'dir' =>
$datatable['sorting']['sort'],
- 'records' =>
array()
+ 'records' =>
array(),
+ 'show_sum' =>
$this->acl->check('.ticket.order', PHPGW_ACL_READ, 'property'),
+ 'sum_budget' =>
$this->bo->sum_budget,
+ 'sum_actual_cost' =>
$this->bo->sum_actual_cost
);
// values for datatable
Modified: trunk/property/js/yahoo/invoice.index.js
===================================================================
--- trunk/property/js/yahoo/invoice.index.js 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/js/yahoo/invoice.index.js 2011-01-30 13:41:51 UTC (rev
6877)
@@ -280,11 +280,13 @@
this.addFooterDatatable = function()
{
//call getSumPerPage(name of column) in property.js
- tmp_sum = getSumPerPage('amount_lnk',2);
+// tmp_sum = getSumPerPage('amount_lnk',2);
+ tmp_sum = YAHOO.util.Number.format(values_ds.sum_amount,
{decimalPlaces:2, decimalSeparator:",", thousandsSeparator:" "});
//Create ROW
newTR = document.createElement('tr');
- td_empty(15);
+ td_empty(14);
+ td_sum('Total');
td_sum(tmp_sum);
td_empty(7);
//RowChecked
Modified: trunk/property/js/yahoo/invoice.paid.index.js
===================================================================
--- trunk/property/js/yahoo/invoice.paid.index.js 2011-01-30 13:41:13 UTC
(rev 6876)
+++ trunk/property/js/yahoo/invoice.paid.index.js 2011-01-30 13:41:51 UTC
(rev 6877)
@@ -49,6 +49,8 @@
{
elCell.innerHTML = YAHOO.util.Number.format(oData,
{decimalPlaces:2, decimalSeparator:",", thousandsSeparator:" "});
}
+
+ var tableYUI;
/********************************************************************************
* Delete all message un DIV 'message'
*/
@@ -56,6 +58,10 @@
{
if(flag_particular_setting=='init')
{
+
+ tableYUI =
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+ tableYUI.setAttribute("id","tableYUI");
+
//necesary for don't show any records in
datatable
oMenuButton_1.set("label", ("<em>All</em>"));
oMenuButton_1.set("value", 'all');
@@ -76,10 +82,35 @@
*/
this.myParticularRenderEvent = function()
{
- //nothing don't delete
+ tableYUI.deleteTFoot();
+ addFooterDatatable();
}
+
/********************************************************************************
+ *
+ */
+ this.addFooterDatatable = function()
+ {
+ //call getSumPerPage(name of column) in property.js
+// tmp_sum = getSumPerPage('amount_lnk',2);
+ tmp_sum = YAHOO.util.Number.format(values_ds.sum_amount,
{decimalPlaces:2, decimalSeparator:",", thousandsSeparator:" "});
+ //Create ROW
+ newTR = document.createElement('tr');
+ td_empty(14);
+ td_sum('Total');
+ td_sum(tmp_sum);
+ td_empty(12);
+
+ //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;
+ }
+
+
//----------------------------------------------------------
YAHOO.util.Event.addListener(window, "load", function()
{
Modified: trunk/property/js/yahoo/tts.index.js
===================================================================
--- trunk/property/js/yahoo/tts.index.js 2011-01-30 13:41:13 UTC (rev
6876)
+++ trunk/property/js/yahoo/tts.index.js 2011-01-30 13:41:51 UTC (rev
6877)
@@ -39,7 +39,13 @@
date_search : 1 //if search has link "Data search"
}
+ var tableYUI;
+ var FormatterRight = function(elCell, oRecord, oColumn, oData)
+ {
+ elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+ }
+
this.onChangeSelect = function()
{
var myselect=document.getElementById("sel_user_id");
@@ -59,6 +65,9 @@
{
if(flag_particular_setting=='init')
{
+ tableYUI =
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+ tableYUI.setAttribute("id","tableYUI");
+
//category
index =
locate_in_array_options(0,"value",path_values.cat_id);
if(index)
@@ -100,9 +109,46 @@
this.myParticularRenderEvent = function()
{
- //nothing
+ if(values_ds.show_sum)
+ {
+ tableYUI.deleteTFoot();
+ addFooterDatatable();
+ }
}
+ this.addFooterDatatable = function()
+ {
+ tmp_sum_budget = YAHOO.util.Number.format(values_ds.sum_budget,
{decimalPlaces:0, decimalSeparator:",", thousandsSeparator:" "});
+ tmp_sum_actual_cost =
YAHOO.util.Number.format(values_ds.sum_actual_cost, {decimalPlaces:2,
decimalSeparator:",", thousandsSeparator:" "});
+
+ count_empty = 0;
+ for(i=0;i<myColumnDefs.length;i++)
+ {
+ if (myColumnDefs[i].key == 'estimate')
+ {
+ count_empty = i;
+ break;
+ }
+ }
+
+ count_empty_end = myColumnDefs.length - count_empty - 2;
+
+ //Create ROW
+ newTR = document.createElement('tr');
+ td_empty(count_empty);
+ td_sum(tmp_sum_budget);
+ td_sum(tmp_sum_actual_cost);
+ 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;
+ }
+
+
/****************************************************************************************/
//----------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6877] property: reporting on totalt amounts,
Sigurd Nes <=