false ] ); } function allView() { ColumnDealsStatus::reinstall(); ColumnDealsStatus::run_update($force = true); DBG::nicePrint($msgs, '$msgs'); $items = DB::getPDO()->fetchAll(" select d.ID, d.A_STATUS, t.SERVICES_STATUS , d.*, t.* from `temp_DEALS_STATUS` t left join DEALS_TABLE d on ( d.ID = t.ID_DEALS ) "); } function defaultAction() { UI::layout( [ $this, 'defaultView' ], [ 'showMenu' => false ] ); } function defaultView() { $id = V::get('id', 0, $_GET, 'int'); if ($id <= 0) throw new Exception("Missing id company"); echo UI::h('div', [], [ "Klient {$id}: ", UI::h('a', [ 'href' => "index.php?MENU_INIT=USERS2_WINDYKACJA_STATUS&q={$id}&_f=&_oby=ID&_odir=DESC&_user_id={$id}", 'target' => "_blank", ], "Windykacja"), " | ", UI::h('a', [ 'href' => "index.php?MENU_INIT=POKAZ_OFERTY_AKTUALNE_FUNC&task=klient_umowy&id_user={$id}", 'target' => "_blank", ], "Umowy"), " | ", UI::h('a', [ 'href' => "index.php?FUNCTION_INIT=bm_make_faktura&ARG1_VAL={$id}", 'target' => "_blank", ], "Faktury"), ]); $totalDeals = DB::getPDO()->fetchValue(" select count(*) from DEALS_TABLE "); $totalActivatedDeals = DB::getPDO()->fetchValue(" select count(*) from DEALS_TABLE where A_STATUS = 'NORMAL' "); $itemDealsTable = DB::getPDO()->fetchAll(" select * from DEALS_TABLE where ID_BILLING_USERS = :id ", [ ':id' => $id ]); UI::table([ 'rows' => $itemDealsTable, 'caption' => "`DEALS_TABLE`: itemDealsTable, Client = {$id}, total rows = {$totalDeals} (activated: {$totalActivatedDeals})" ]); UI::table([ 'rows' => array_map(function ($item) { return array_merge([ 'ID' => '', 'A_STATUS' => '', 'P_DEALDATE' => '', 'P_DEALDATE_TERM' => '', 'USTALONA_DATA_PODLACZENIA' => '', 'DATA_WYK_PODLACZENIA' => '', 'TODO__DATA_WYK_PODLACZENIA' => DB::getPDO()->fetchValue(" ( select T_WHEN_CONNECTED, a.ID, s.ID_DEALS_TABLE from SES_USERS2_A a join SERVICES s on ( s.ID = a.ID_SERVICES ) where a.ID_BILLING_USERS = :id_client and s.ID_DEALS_TABLE = :id_deal ) union ( select T_WHEN_CONNECTED, a.ID, s.ID_DEALS_TABLE from SES_TV_A a join SERVICES s on ( s.ID = a.ID_SERVICES ) where a.ID_BILLING_USERS = :id_client and s.ID_DEALS_TABLE = :id_deal ) union ( select T_WHEN_CONNECTED, a.ID, s.ID_DEALS_TABLE from SES_VOIP_A a join SERVICES s on ( s.ID = a.ID_SERVICES ) where a.ID_BILLING_USERS = :id_client and s.ID_DEALS_TABLE = :id_deal ) order by T_WHEN_CONNECTED asc ", [ ':id_client' => $item['ID_BILLING_USERS'], ':id_deal' => $item['ID'], ]), 'DEALDESC' => '', ], $item); }, $itemDealsTable), 'caption' => "`DEALS_TABLE`: itemDealsTable, Client = {$id}, total rows = {$totalDeals} (activated: {$totalActivatedDeals})" ]); $itemServices = DB::getPDO()->fetchAll(" select * from SERVICES where ID_BILLING_USERS = :id ", [ ':id' => $id ]); UI::table([ 'rows' => $itemServices, 'caption' => "`SERVICES`: itemServices, Client = {$id}" ]); $itemSesNET = DB::getPDO()->fetchAll(" select * , '***' as P_SERVICE_QUOTA_PROFILE , '***' as N_AVG_TRAFFIC from SES_USERS2_A where ID_BILLING_USERS = :id ", [ ':id' => $id ]); UI::table([ 'rows' => $itemSesNET, 'caption' => "`SES_USERS2_A`: itemSesNET, Client = {$id}" ]); $itemSesTV = DB::getPDO()->fetchAll(" select * from SES_TV_A where ID_BILLING_USERS = :id ", [ ':id' => $id ]); UI::table([ 'rows' => $itemSesTV, 'caption' => "`SES_TV_A`: itemSesTV, Client = {$id}" ]); $itemSesVOIP = DB::getPDO()->fetchAll(" select * from SES_VOIP_A where ID_BILLING_USERS = :id ", [ ':id' => $id ]); UI::table([ 'rows' => $itemSesVOIP, 'caption' => "`SES_VOIP_A`: itemSesVOIP, Client = {$id}" ]); // `SES_*_A`: `T_WHEN_CONNECTED`, `T_WHO_CONNECTED` echo UI::h('div', [ 'style' => "padding:3px 12px; background-color:#eee" ], [ UI::h('h3', [], "Daty podłączenia (Aktywacji?):"), UI::h('div', [ 'style' => "padding: 12px; background-color:#eee" ], [ UI::h('div', [ 'style' => "background-color:#fff" ], [ UI::hTable([ 'rows' => array_map([ $this, 'whenConnectedTableRowView' ], $itemSesNET), 'caption' => "SES_USERS2_A" ]), UI::hTable([ 'rows' => array_map([ $this, 'whenConnectedTableRowView' ], $itemSesTV), 'caption' => "SES_TV_A" ]), UI::hTable([ 'rows' => array_map([ $this, 'whenConnectedTableRowView' ], $itemSesVOIP), 'caption' => "SES_VOIP_A" ]), ]), ]), ]); $itemDbTasks = DB::getPDO()->fetchAll(" select t.* from DEALS_TABLE d left join _DB_TASKS t on ( t.TRANSACTION_ID = concat('DEALS_TABLE-', d.ID) ) where d.ID_BILLING_USERS = :id ", [ ':id' => $id ]); UI::table([ 'rows' => $itemDbTasks, 'caption' => "`_DB_TASKS`: itemDbTasks, Client = {$id}" ]); DBG::nicePrint(null, "memory_get_usage: " . round(memory_get_usage() / 1024) . " KB"); die('.EOF'); } function whenConnectedTableRowView($item) { // ID, T_WHEN_CONNECTED, T_WHO_CONNECTED return array_merge([ 'ID' => '', 'ID_DEALS_TABLE' => DB::getPDO()->fetchValue(" select ID_DEALS_TABLE from SERVICES where ID = :id ", [ ':id' => $item['ID_SERVICES'] ]), 'T_WHEN_CONNECTED' => '', 'T_WHO_CONNECTED' => '', ], $item); } } class RelatedFeatureTagReader { function __construct() { $this->_parsedTags = []; } function findRelatedFeatureRecurse($tag, $parentTagId = 0, $parsedTags = []) { if (!is_array($tag)) return $parsedTags; // string DBG::nicePrint([ 'tag' => $tag[0], 'attrs' => $tag[1], '$parsedTags' => $parsedTags ], "findRelatedFeatureRecurse({$tag[0]})"); if (empty($tag)) return []; if ('RelatedFeature' === $tag[0]) { $parsedTags[] = [ 'tag' => $tag[0], 'attrs' => $tag[1], 'parentTagId' => $parentTagId ]; $parentTagId = count($parsedTags) - 1; } else if (!empty($tag[1]['xpath'])) $parsedTags[] = [ 'tag' => $tag[0], 'attrs' => $tag[1], 'parentTagId' => $parentTagId ]; if (empty($tag[2])) return $parsedTags; return array_reduce($tag[2], function ($ret, $childTag) use ($parentTagId) { return $this->findRelatedFeatureRecurse($childTag, $parentTagId, $ret); }, $parsedTags); } }