作者:samsulpendi
项目:Instant_Appointmen
function countTotals(&$totals, $totalsFields, $data)
{
for ($i = 0; $i < count($totalsFields); $i++) {
if ($totalsFields[$i]['totalsType'] == 'COUNT') {
$totals[$totalsFields[$i]['fName']] += $data[$totalsFields[$i]['fName']] != "";
} else {
if ($totalsFields[$i]['viewFormat'] == "Time") {
$time = GetTotalsForTime($data[$totalsFields[$i]['fName']]);
$totals[$totalsFields[$i]['fName']] += $time[2] + $time[1] * 60 + $time[0] * 3600;
} else {
$totals[$totalsFields[$i]['fName']] += $data[$totalsFields[$i]['fName']] + 0;
}
}
}
}
作者:aagust
项目:padl-tn
function countTotals(&$totals, $totalsFields, $data)
{
for ($i = 0; $i < count($totalsFields); $i++) {
if ($totalsFields[$i]['totalsType'] == 'COUNT') {
$totals[$totalsFields[$i]['fName']]["value"] += $data[$totalsFields[$i]['fName']] != "";
} else {
if ($totalsFields[$i]['viewFormat'] == "Time") {
$time = GetTotalsForTime($data[$totalsFields[$i]['fName']]);
$totals[$totalsFields[$i]['fName']]["value"] += $time[2] + $time[1] * 60 + $time[0] * 3600;
} else {
$totals[$totalsFields[$i]['fName']]["value"] += $data[$totalsFields[$i]['fName']] + 0;
}
}
if ($totalsFields[$i]['totalsType'] == 'AVERAGE') {
if (!is_null($data[$totalsFields[$i]['fName']]) && $data[$totalsFields[$i]['fName']] !== "") {
$totals[$totalsFields[$i]['fName']]['numRows']++;
}
}
}
}
作者:helbertfurbin
项目:sgmofinanceir
/**
* Counts totals, depending on theirs type
*
* @param array $totals
* @param array $data
*/
function countTotals(&$totals, &$data)
{
for($i = 0; $i < count($this->totalsFields); $i ++)
{
if($this->totalsFields[$i]['totalsType'] == 'COUNT')
{
if(0 != strlen($data[$this->totalsFields[$i]['fName']]))
$totals[$this->totalsFields[$i]['fName']]++;
}
else if($this->totalsFields[$i]['viewFormat'] == "Time")
{
$time = GetTotalsForTime($data[$this->totalsFields[$i]['fName']]);
$totals[$this->totalsFields[$i]['fName']] += $time[2]+$time[1]*60 + $time[0]*3600;
}
else
$totals[$this->totalsFields[$i]['fName']]+=($data[$this->totalsFields[$i]['fName']]+ 0);
if($this->totalsFields[$i]['totalsType'] == 'AVERAGE')
{
if(!is_null($data[$this->totalsFields[$i]['fName']]) && $data[$this->totalsFields[$i]['fName']]!=="")
$this->totalsFields[$i]['numRows']++;
}
}
}