Esempio n. 1
0
function totalTableFooter($field, $returnType)
{
    global $conn, $from_date, $to_date, $additionalReq, $LocalCalls;
    global $isNoCityCalls, $LongDistanceCalls, $MobileCallsR;
    global $InternationalCalls, $debug, $cacheflush, $GUI_LANG;
    global $REGEXP, $NOT_REGEXP;
    global $TTFfirst;
    switch ($field) {
        case "4":
            // Всего: общее количество звонков
            $q = "SELECT COUNT(*)\n\t\tfrom calls\n\t\twhere\n\t\t((calls.timeofcall>='" . $from_date . "') AND (calls.timeofcall<='" . $to_date . "')\n\t\t" . $additionalReq . "\n\t\t" . VectorOfCall(MathVector(0)) . "\n\t\t)";
            break;
        case "5":
            // Всего: городские
            $q = "SELECT SUM(calls.duration),COUNT(*)\n\t\tfrom calls\n\t\twhere\n\t\t((calls.timeofcall>='" . $from_date . "') AND (calls.timeofcall<='" . $to_date . "')\n\t\t" . $additionalReq . "\n\t\t" . VectorOfCall(MathVector(14)) . "\n\t\t)";
            $Qcomment = $GUI_LANG['City'];
            break;
        case "6":
            // Всего: межгород
            $q = "SELECT SUM(calls.duration),COUNT(*)\n\t\tfrom calls\n\t\twhere\n\t\t((calls.timeofcall>='" . $from_date . "') AND (calls.timeofcall<='" . $to_date . "')\n\t\t" . $additionalReq . "\n\t\t" . VectorOfCall(MathVector(13)) . "\n\t\t)";
            $Qcomment = $GUI_LANG['Trunk'];
            break;
        case "7":
            // Всего:  мобильная связь
            $q = "SELECT SUM(calls.duration),COUNT(*)\n\t\tfrom calls\n\t\twhere ((calls.timeofcall>='" . $from_date . "') AND (calls.timeofcall<='" . $to_date . "')\n\t\t" . $additionalReq . "\n\t\t" . VectorOfCall(MathVector(11)) . "\n\t\t)";
            $Qcomment = $GUI_LANG['Mobile'];
            break;
        case "8":
            // Всего: международная связь
            $q = "SELECT SUM(calls.duration),COUNT(*)\n\t\tfrom calls\n\t\twhere ((calls.timeofcall>='" . $from_date . "') AND (calls.timeofcall<='" . $to_date . "')\n\t\t" . $additionalReq . "\n\t\t" . VectorOfCall(MathVector(7)) . "\n\t\t)";
            $Qcomment = $GUI_LANG['LongDistance'];
            break;
    }
    if ($cacheflush) {
        $res = $conn->CacheFlush($q);
    }
    $local_cacheflush = "";
    $res = $conn->CacheExecute($q);
    if ($debug) {
        echo "<hr>" . $q . "<br><hr>";
    }
    if ($returnType == 1) {
        $results = $res->fields[0];
        if (!$TTFfirst) {
            $TTFfirst = TRUE;
        }
    } else {
        $total = $res->fields;
        if ($total[0]) {
            if ($returnType == 0 && $TTFfirst) {
                $results = "<BR>\n";
            }
            $results .= "{$Qcomment}: ";
            if ($returnType == 0) {
                $results .= sumTotal($total[0], 1);
            } else {
                $results .= sumTotal($total[0], 2);
            }
            if ($total[1]) {
                $results .= ". " . $GUI_LANG['OfCalls'] . ": ";
            }
            if ($returnType == 0) {
                $results .= "<b>";
            }
            $results .= $total[1];
            if ($returnType == 0) {
                $results .= "</b>\n";
            }
            if (!$TTFfirst) {
                $TTFfirst = TRUE;
            }
        }
    }
    return $results;
}
Esempio n. 2
0
        echo "&nbsp;</td>";
        print "</tr>\n";
        if ($pages > 1 or $debug) {
            echo "<tr " . $COLORS['TotalTrBgcolor'] . "><td>" . $GUI_LANG['Altogether'] . ":&nbsp;&nbsp;</td>";
            echo "<td colspan=3>";
            echo totalTableFooter('5', 0);
            echo totalTableFooter('6', 0);
            echo totalTableFooter('7', 0);
            echo totalTableFooter('8', 0);
            echo "&nbsp;</td>";
            print "</tr>\n";
        }
        print "</table>\n\n </td></tr></table>";
    } else {
        array($TTF);
        $TTF[3] = $GUI_LANG['GeneralDuration'] . ": " . sumTotal($InAll[3], 2);
        if ($pages > 1 or $debug) {
            array($TTFa);
            $TTFa[5] = totalTableFooter('5', 2);
            $TTFa[6] = totalTableFooter('6', 2);
            $TTFa[7] = totalTableFooter('7', 2);
            $TTFa[8] = totalTableFooter('8', 2);
        }
        TTFprint();
    }
    if (!empty($export)) {
        $expor_excel->GeraArquivo();
    }
    // ------------------------------------------------------------------------------------------------------
} else {
    print "<br><font size=+1>" . $GUI_LANG['NoSuchData'] . "</font>";
Esempio n. 3
0
        }
        if (empty($MobLine)) {
            $expor_excel->MontaConteudo($linha + 3, 4, sumTotal($InAll[5], 0));
        }
        if (empty($NationalLine)) {
            $expor_excel->MontaConteudo($linha + 3, 5, sumTotal($InAll[6], 0));
        }
        if ($pages > 1 or $debug) {
            $expor_excel->MontaConteudo($linha + 4, 0, $GUI_LANG['Altogether'] . ":");
            $expor_excel->MontaConteudo($linha + 4, 1, totalTableFooter('4', 1));
            if (empty($CityLine)) {
                $expor_excel->MontaConteudo($linha + 4, 2, sumTotal(totalTableFooter('5', 1), 0));
            }
            if (empty($TrunkLine)) {
                $expor_excel->MontaConteudo($linha + 4, 3, sumTotal(totalTableFooter('6', 1), 0));
            }
            if (empty($MobLine)) {
                $expor_excel->MontaConteudo($linha + 4, 4, sumTotal(totalTableFooter('7', 1), 0));
            }
            if (empty($NationalLine)) {
                $expor_excel->MontaConteudo($linha + 4, 5, sumTotal(totalTableFooter('8', 1), 0));
            }
        }
    }
    if (!empty($export)) {
        $expor_excel->GeraArquivo();
    }
    // ------------------------------------------------------------------------------------------------------
} else {
    echo "<font size=+1>" . $GUI_LANG['NoSuchData'] . "</font>";
}
Esempio n. 4
0
				<th>OCs Emitidos</th>
				<th>OCs Aprov.</th>
				<th>% OCs Aprov.</th>
				<th>Planos Emitidos</th>
				<th>Planos Aprov.</th>
				<th>% Planos Aprov.</th>
				<th>Ref. Est.</th>
				<th>Ref. Cri.</th>
				<th>Ref. Ate.</th>
				<th>Ref. Cli.</th>
				<th>Total Refacao</th>
				<th>% Refacao</th>
			</tr>
			<?php 
foreach ($result as $item) {
    if (sumTotal($item)) {
        ?>

			<tr>
				<td><?php 
        echo $item['nome'];
        ?>
</td>
				<td><?php 
        echo $item['pitG'];
        ?>
</td>
				<td><?php 
        echo $item['pitA'];
        ?>
</td>