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);
?>
| suma | $vSalesByYear) : ?> $vSalesByMonth) : ?>||
|---|---|---|
|
|