getValuesWithExports($query); if($DBG){echo'
rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'
';} foreach ($rows as $kID => $vItem) { $itemJson = new stdClass(); $itemJson->id = $vItem->id; $itemJson->name = $vItem->param_out; if (!empty($vItem->exports)) { $itemJson->exports = $vItem->exports; } $jsonData[] = $itemJson; } echo json_encode($jsonData); } break; case 'id_companies': { Lib::loadClass('TypespecialVariable'); $typeSpecialCompanies = TypespecialVariable::getInstance(-1, '__COMPANIES'); $query = V::get('q', '', $_REQUEST); $rawRows = null; $rows = $typeSpecialCompanies->getValuesWithExports($query); if($DBG){echo'
rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'
';} foreach ($rows as $kID => $vItem) { $itemJson = new stdClass(); $itemJson->id = $vItem->id; $itemJson->name = $vItem->param_out; if (!empty($vItem->exports)) { $itemJson->exports = $vItem->exports; } $jsonData[] = $itemJson; } echo json_encode($jsonData); } break; } exit; } } SE_Layout::menu(); Lib::loadClass('TypespecialVariable'); $typeSpecialTelboxes = TypespecialVariable::getInstance(-1, '__TELBOXES_NAME'); $typeSpecialCompanies = null;// TypespecialVariable::getInstance(-1, '__COMPANIES'); $obroty = array(); if (!empty($id_telboxes) || $id_companies > 0) { $db = DB::getDB(); $sqlWhere = array(); //if (!empty($id_telboxes)) $sqlWhere[] = " d.`T_TELBOX_NEIGHBOUR_IN`='{$id_telboxes}' "; if (!empty($id_telboxes)) $sqlWhere[] = " o.`T_TELBOX_NEIGHBOUR_IN`='{$id_telboxes}' "; //if ($id_companies > 0) $sqlWhere[] = " d.`ID_BILLING_USERS`='{$id_companies}' "; $sqlWhere = (!empty($sqlWhere))? implode(" or ", $sqlWhere) : ''; $sql = "select o.`ID` -- , d.`T_TELBOX_NEIGHBOUR_IN` , o.`T_TELBOX_NEIGHBOUR_IN` , o.`ID_DEALS_TABLE` , o.`SALES_DATE` , o.`SALES_VALUE` from `DEALS_SALES` as o -- join `DEALS_TABLE` as d on (d.`ID`=o.`ID_DEALS_TABLE`) where {$sqlWhere} "; if(V::get('DBG','',$_GET)){echo'
 (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($sql);echo'
';} $res = $db->query($sql); while ($r = $db->fetch($res)) { $year = substr($r->SALES_DATE, 0, 4); $month = substr($r->SALES_DATE, 5, 2); $obroty[$r->ID_DEALS_TABLE][$year][$month] = $r->SALES_VALUE; } } $monthsOut = array(); for ($i = 0; $i < 12; $i++) $monthsOut[] = sprintf("%02d", $i + 1); ?>
Lokal Firma
showFormItem($tblID = -1, $fName, $selValue = $id_telboxes, $fldParams); ?> showFormItem($tblID = -1, $fName, $selValue = $id_companies, $fldParams); ?>
$vSalesByYear) : ?> $vSalesByMonth) : ?>
suma
...
$vSalesByMonth) { $jsonYearData = array(); foreach ($monthsOut as $vMonth) { if (isset($vSalesByMonth[$vMonth])) { $jsonYearData["{$kYearId}-{$vMonth}"] = (float)str_replace('.', ',', $vSalesByMonth[$vMonth]); } else { $jsonYearData["{$kYearId}-{$vMonth}"] = 0; } } //$jsonYearData = array_reverse($jsonYearData); //$jsonData[] = array_values($jsonYearData); foreach ($jsonYearData as $kLabel => $vValue) { $jsonLabels[] = $kLabel; // $jsonData[] = $vValue; $jsonTooltips[] = "Obrót " . number_format($vValue, 2, ',', ' ') . " w {$kLabel}"; } $jsonData[] = array_values($jsonYearData); } $wykresMinItemWidth = 20; $wykresTestWidth = count(array_keys($vSalesByYear)) * 12 * $wykresMinItemWidth; if ($wykresTestWidth > $wykresWidth - 60 - 20) { $wykresWidth = $wykresTestWidth + 60 + 20; } $jsonLabels = array_keys($vSalesByYear); $jsonColorsAll = array(); for ($i = 0, $mi = 0, $mc = count($jsonColors); $i < 12; $i++) { $jsonColorsAll[] = $jsonColors[$mi]; if (++$mi >= $mc) { $mi = 0; } } $jsonColors = $jsonColorsAll; ?>
[No canvas support]
$vSalesByMonth) { if (isset($vSalesByMonth[$vMonth])) { $jsonYearData["{$kYearId}-{$vMonth}"] = (float)str_replace('.', ',', $vSalesByMonth[$vMonth]); } else { $jsonYearData["{$kYearId}-{$vMonth}"] = 0; } } //$jsonYearData = array_reverse($jsonYearData); //$jsonData[] = array_values($jsonYearData); foreach ($jsonYearData as $kLabel => $vValue) { $jsonLabels[] = $kLabel; $jsonTooltips[] = "Obrót " . number_format($vValue, 2, ',', ' ') . " w {$kLabel}"; } $jsonData[] = array_values($jsonYearData); } $wykresMinItemWidth = 20; $wykresTestWidth = count(array_keys($vSalesByYear)) * 12 * $wykresMinItemWidth; if ($wykresTestWidth > $wykresWidth - 60 - 20) { $wykresWidth = $wykresTestWidth + 60 + 20; } $jsonLabels = array('styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień','październik','listopad','grudzień'); $jsonColorsAll = array(); for ($i = 0, $mi = 0, $mc = count($jsonColors); $i < count($jsonData); $i++) { $jsonColorsAll[] = $jsonColors[$mi]; if (++$mi >= $mc) { $mi = 0; } } $jsonColors = $jsonColorsAll; ?>
[No canvas support]