<?php
 $EASY_AUTHENTICATE=true; include("_config/addCfg.php"); include("_includes/addInc.php"); $reportSource=$S['adminReport']['source']; if ($reportSource) { @include($MODULE_REL_PATH."_lang/".$S['global']['lang']."/_customLoad/reports/".$reportSource."/columns.lang.php"); } $selectedPivot=$S['adminReport']['pivots']['selectedPivot']; $rows=$S['adminReport']['pivots']['pivotsList'][$selectedPivot]['rows']; $cols=$S['adminReport']['pivots']['pivotsList'][$selectedPivot]['cols']; $data=$S['adminReport']['pivots']['pivotsList'][$selectedPivot]['data']; if (!$rows) $rows= []; if (!$cols) $cols= []; $rows=array_reverse($rows, true); $cols=array_reverse($cols, true); $rowsTotals= []; foreach($rows as $thisRow=>$nothing) { foreach($data as $thisData=>$operation) { $rowsTotals[$thisRow.'|'.$thisData]=sprintf($_LANG['reportsManagement']['admin']['pivots']['totals']['defaultSubTotalText'], $_LANG['reportsManagement']['pivotTables']['operations'][$operation], $_LANG['reports']['columnNames'][$reportSource][$thisData], $_LANG['reports']['columnNames'][$reportSource][$thisRow]); } } foreach($data as $thisData=>$operation) { $rowsTotals['#GRAND_TOTALS#|'.$thisData]=sprintf($_LANG['reportsManagement']['admin']['pivots']['totals']['defaultGrandTotalText'], $_LANG['reportsManagement']['pivotTables']['operations'][$operation], $_LANG['reports']['columnNames'][$reportSource][$thisData]); } $colsTotals= []; foreach($cols as $thisCol=>$nothing) { foreach($data as $thisData=>$operation) { $colsTotals[$thisCol.'|'.$thisData]=sprintf($_LANG['reportsManagement']['admin']['pivots']['totals']['defaultSubTotalText'], $_LANG['reportsManagement']['pivotTables']['operations'][$operation], $_LANG['reports']['columnNames'][$reportSource][$thisData], $_LANG['reports']['columnNames'][$reportSource][$thisCol]); } } foreach($data as $thisData=>$operation) { $colsTotals['#GRAND_TOTALS#|'.$thisData]=sprintf($_LANG['reportsManagement']['admin']['pivots']['totals']['defaultGrandTotalText'], $_LANG['reportsManagement']['pivotTables']['operations'][$operation], $_LANG['reports']['columnNames'][$reportSource][$thisData]); } $totalsStatus=$S['adminReport']['pivots']['pivotsList'][$selectedPivot]['totals']; if (!$totalsStatus['disable']) { $totalsStatus['disable']= []; $totalsStatus['disable']['rows']= []; $totalsStatus['disable']['cols']= []; } if (!$totalsStatus['names']) { $totalsStatus['names']= []; $totalsStatus['names']['rows']= []; $totalsStatus['names']['cols']= []; } $smarty->assign("colsTotals", $colsTotals); $smarty->assign("rowsTotals", $rowsTotals); $smarty->assign("pivotKey", $selectedPivot); $smarty->assign("totalsStatus", $totalsStatus); $smarty->display("pivotTable_displayTotals.tpl"); ?>