'; echo '
'; /*try { $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'ID', 'L_APPOITMENT_USER', 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY', 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI', 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row', 'default_db__x3A__BI_audit_KW_requested_person:BI_audit_KW_requested_person', ] ])->getItems([ 'limit' => 10 ]); DBG::nicePrint($items, '$items BiAudit'); UI::inlineJS(__FILE__ . '.view.js', [ 'URL_FETCH_TEST' => $this->getLink('fetchEnergaRumKontrahenciPowiazaniaAjax'), 'URL_FETCH_TEST_KRS' => $this->getLink('fetchTestKrsAjax'), 'URL_FETCH_TEST_CEIDG' => $this->getLink('fetchTestCeidgAjax'), 'URL_FETCH_PRACOWNICY' => $this->getLink('fetchPracownicyAjax'), 'DBG' => V::get('DBG', 0, $_GET), ]); throw new Exception("TODO..."); } catch (Exception $e) { DBG::log($e); UI::alert('danger', $e->getMessage()); }*/ UI::inlineJS(__FILE__ . '.view.js', [ 'URL_FETCH_TEST' => $this->getLink('fetchEnergaRumKontrahenciPowiazaniaAjax'), 'URL_FETCH_TEST_KRS' => $this->getLink('fetchTestKrsAjax'), 'URL_FETCH_TEST_CEIDG' => $this->getLink('fetchTestCeidgAjax'), 'URL_FETCH_PRACOWNICY' => $this->getLink('fetchPracownicyAjax'), 'URL_FETCH_KONTRAHENCI' => $this->getLink('fetchKontrahenciAjax'), 'URL_FETCH_FAMILIES' => $this->getLink('fetchFamiliesAjax'), 'DBG' => V::get('DBG', 0, $_GET), 'VIEW_KONTRAHENCI' => $this->htmlViewFormBiAudit([], 'KONTRAHENCI'), 'VIEW_PRACOWNICY' => $this->htmlViewFormBiAudit([], 'PRACOWNICY'), 'VIEW_FAMILIES' => $this->getHtmlForScreen_Families([], 'FAMILIES'), ]); echo ''; // #smad-wrapper UI::dol(); } /* public function fetchEnergaRumKontrahenciPowiazaniaAjaxAction() { Response::sendTryCatchJson(array($this, 'fetchEnergaRumKontrahenciPowiazaniaAjax')); // , $args = 'JSON_FROM_REQUEST_BODY'); } public function fetchEnergaRumKontrahenciPowiazaniaAjax($args) { $id = V::get('ID', 1, $_REQUEST, 'int'); $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'ID', 'A_ADM_COMPANY', 'L_APPOITMENT_USER', 'A_CLASSIFIED', 'A_STATUS', 'A_STATUS_INFO', 'BI_analiza_depth', 'BI_analiza_reloadCache', 'FILE_STATUS', 'FILE_STATUS_info', 'L_APPOITMENT_USER', 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY', 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI', 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row', 'default_db__x3A__BI_audit_KW_requested_person:BI_audit_KW_requested_person', ], //'f_ID' => $id, ])->getItems([ 'limit' => 10 ]); // $items = [ // [ 'ID' => 1, 'L_APPOITMENT_INFO' => 'x', 'BI_analiza_depth' => 'a', 'FILE_STATUS' => 1, 'FILE_STATUS_info' => 'test1'], // [ 'ID' => 2, 'L_APPOITMENT_INFO' => 'y', 'BI_analiza_depth' => 'b', 'FILE_STATUS' => 0, 'FILE_STATUS_info' => 'test2'], // [ 'ID' => 3, 'L_APPOITMENT_INFO' => 'z', 'BI_analiza_depth' => 'c', 'FILE_STATUS' => 1, 'FILE_STATUS_info' => 'test3'], // ]; return [ 'type' => 'success', 'msg' => 'OK', '__req_args' => $_REQUEST, '__args' => $args, 'body' => [ 'items' => $items, 'view' => $this->showPowiazaniaEnergaRumKontrahenciPowiazania($items), ] ]; } public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) { $view = '
'; foreach ($items as $key => $row) { $view .= ''; } $view .= '
ID Adnotacje Głębokość analizy Status raportu Status raportu - informacje
'.$row["ID"].' '.$row["L_APPOITMENT_INFO"].' '.$row["BI_analiza_depth"].' '.$row["FILE_STATUS"].' '.$row["FILE_STATUS_info"].'
'; return $view; } */ public function fetchTestKrsAjaxAction() { Response::sendTryCatchJson(array($this, 'fetchTestKrsAjax')); // , $args = 'JSON_FROM_REQUEST_BODY'); } public function fetchTestKrsAjax($args) { $id = V::get('ID', 1, $_REQUEST, 'int'); $items = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_KRS')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'A_kod', 'A_kraj', 'A_miejscowosc', 'A_nrDomu', 'A_nrLokalu', 'A_poczta', 'A_ulica', 'ID', 'S_gmina', 'S_kraj', 'S_miejscowosc', 'S_powiat', 'S_wojewodztwo', 'dataDokumentu', 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/ID', 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/krs', 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/nazwa', 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/regon', 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/ID', 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/imiona', 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/nazwisko', 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/pesel', 'krs', 'nazwa', 'nip', 'regon', ], 'f_ID' => "{$id}", ])->getItems([ 'limit' => 10 ]); return [ 'type' => 'success', 'msg' => 'KRS', '__req_args' => $_REQUEST, '__args' => $args, 'body' => [ 'items' => $items, ] ]; } public function fetchTestCeidgAjaxAction() { Response::sendTryCatchJson(array($this, 'fetchTestCeidgAjax')); // , $args = 'JSON_FROM_REQUEST_BODY'); } public function fetchTestCeidgAjax($args) { $id = V::get('ID', 0, $_REQUEST, 'int'); $items = ACL::getAclByNamespace('default_db/BI_audit_CEIDG/BI_audit_CEIDG')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'ID', 'budynek', 'firma', 'gmina', 'identyfikatorWpisu', 'imie', 'kodPocztowy', 'kraj', 'lokal', 'miejscowosc', 'nazwisko', 'nip', 'poczta', 'powiat', 'regon', 'ulica', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ID', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/budynek', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/gmina', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/kodPocztowy', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/lokal', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/miejscowosc', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nazwa', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nip', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/poczta', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/powiat', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ulica', 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/wojewodztwo', 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/ID', 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/nip', 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/regon', ], // 'f_ID' => $id, ])->getItems([ 'limit' => 10 ]); return [ 'type' => 'success', 'msg' => 'CEIDG', '__req_args' => $_REQUEST, '__args' => $args, 'body' => [ 'items' => $items, ] ]; } /** * KONTRAHENCI */ //TODO: NIE wiem czemu nie mogę pobrać infoamcji o kontrahentach public function fetchKontrahenciAjaxAction() { Response::sendTryCatchJson(array($this, 'fetchKontrahenciAjax')); } public function fetchKontrahenciAjax($args) { //$id = V::get('ID', 1, $_REQUEST, 'int'); $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'ID', 'Nazwa_grupy_kapitalowej', 'Pelna_nazwa_kontrahenta', 'NIP', 'KRS', 'REGON', 'Miejscowosc', 'Kod_pocztowy', 'Telefon' ], //'f_ID' => $id, ])->getItems([ 'limit' => 10 ]); return [ 'type' => 'success', 'msg' => 'showKontrahenci', '__req_args' => $_REQUEST, '__args' => $args, 'body' => [ 'items' => $items, 'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI') ] ]; } public function showListKontrahenci($items) { $view = '
'; foreach ($items as $key => $row) { $view .= ' '; } $view .= '
ID Nazwa grupy kapitalowej Pelnanazwa kontrahenta NIP KRS Regon Miejscowosc Kod_pocztowy Telefon
'.$row["ID"].' '.$row["Nazwa_grupy_kapitalowej"].' '.$row["Pelna_nazwa_kontrahenta"].' '.$row["NIP"].' '.$row["KRS"].' '.$row["REGON"].' '.$row["Miejscowosc"].' '.$row["Kod_pocztowy"].' '.$row["Telefon"].'
'; return $view; } /** * BraveCare Families Test & Fetch & Show Screen * Nazwa = crm_families.FamilyName * Telefon = crm_families.MainPhoneNumber * Firma = crm_families.CompanyId => crm_companies[Id==CompanyId]->CompanyName * Partner Zagraniczny = crm_families.CoordId => crm_coordinators[Id==CoordId]->CoordinatorName * Stan = crm_families.IsActive (0='ZAMKNIĘTE', 1='OTWARTE') * Opis = Pole generowane na podstawie danych: * crm_families.Id => crm_ordercarrers[ FamilyId==crm_families.Id ] * crm_ordercarrers.FirstName + ' ' + crm_ordercarrers.SurName + ' ' + crm_ordercarrers.DateStart + ' ' + crm_ordercarrers.DateEnd */ public function fetchFamiliesAjaxAction() { // sleep(2); Response::sendTryCatchJson( array($this, 'fetchFamiliesAjax') ); } public function fetchFamiliesAjax($args) { $id = V::get('Id', 1, $_REQUEST, 'int'); $items = ACL::getAclByNamespace('default_db/crm_families')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'Id', 'FamilyName', 'MainPhoneNumber', 'CompanyId', 'CoordId', 'EMail' ], //'f_ID' => $id, ])->getItems([ 'limit' => 5 ]); /* // DEBUG: $debugLog = print_r( array_values($items), true ); error_log("-------------- fetchFamiliesAjax() --- Items(".count($items)."): ".$debugLog, 0); */ return [ 'type' => 'success', 'msg' => 'showFamilies', '__req_args' => $_REQUEST, '__args' => $args, 'body' => [ 'items' => $items, //'view' => $this->htmlViewFormBiAudit($items, 'FAMILIES') ] ]; } public function getHtmlForTable_Families($items) { $htmlForTable = '
'; /* foreach ($items as $key => $row) { $view .= ' '; } */ $htmlForTable .= '
Nazwisko Telefon Firma ID Partner Zagraniczny ID EMail
'.$row["ID"].' '.$row["FamilyName"].' '.$row["MainPhoneNumber"].' '.$row["CompanyId"].' '.$row["CoordId"].' '.$row["EMail"].'
'; return $htmlForTable; } /** * EOF BraveCare Families Test */ /** * Pracownicy */ public function fetchPracownicyAjaxAction() { // sleep(2); Response::sendTryCatchJson(array($this, 'fetchPracownicyAjax')); } public function fetchPracownicyAjax($args) { $id = V::get('ID', 1, $_REQUEST, 'int'); $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY')->buildQuery([ 'cols' => [ // TODO:? propertyName = [] 'ID', 'imiona', 'nazwisko', 'nip', 'pesel', 'regon', 'A_ADM_COMPANY', 'A_STATUS', 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*' ], //'f_ID' => $id, ])->getItems([ 'limit' => 10 ]); return [ 'type' => 'success', 'msg' => 'showPracownicy', '__req_args' => $_REQUEST, '__args' => $args, 'body' => [ 'items' => $items, 'view' => $this->htmlViewFormBiAudit($items, 'PRACOWNICY') ] ]; } public function showListPracownicy($items) { $view = '
'; foreach ($items as $key => $row) { $view .= ' '; } $view .= '
ID Imię/Imiona Nazwisko NIP Pesel Regon A_ADM_COMPANY A_STATUS Adresy
'.$row["ID"].' '.$row["imiona"].' '.$row["nazwisko"].' '.$row["nip"].' '.$row["pesel"].' '.$row["regon"].' '.$row["A_ADM_COMPANY"].' '.$row["A_STATUS"].' '.$row["default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy"].'
'; return $view; } // link do ackji w php: $saveFormUrl = $this->getLink('saveRaportAjax'); // przekazać link do JavaScript i tam: // window.fetch('{$saveFormUrl}', { ... }).then(...) - dokumentacja: https://github.com/github/fetch public function saveRaportAjaxAction() { // Response::sendTryCatchJson(array($this, 'saveRaportAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em Response::sendTryCatchJson(array($this, 'saveRaportAjax')); } public function saveRaportAjax($args) { // TODO: przejrzeć $args (jeśli JSON) lub $_POST // Tworzenie rekrodu w bazie - Raport - $idRaport = DB::getDB()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', [ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(), 'A_RECORD_CREATE_DATE' => 'NOW()', // 'A_STATUS' => 'WAITING', // jeśli trzeba to ustawić ]); // TODO: validate args ... // throw new Exception("Wrong field..."); // lub inny komunikat błędu - spowoduje wysłanie json-a { 'msg' => 'Wrong field...', 'type' => 'error' } // Tworzenie relacji Raport do Pracownicy $pracownicyIds = []; // TODO: array z nr ID na podstawie wysłanego formularza $refPowiazaniaToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY'); foreach ($pracownicyIds as $idPracownik) { DB::getPDO()->insert($refPowiazaniaToPracownicy, ['PRIMARY_KEY' => $idRaport, 'REMOTE_PRIMARY_KEY' => $idPracownik]); } // Tworzenie relacji Raport do Kontrahenci - analogicznie jak wyżej $kontrahenciIds = []; // TODO: array z nr ID na podstawie wysłanego formularza $refPowiazaniaToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI'); foreach ($kontrahenciIds as $idKontrahent) { DB::getPDO()->insert($refPowiazaniaToKontrahenci, ['PRIMARY_KEY' => $idRaport, 'REMOTE_PRIMARY_KEY' => $idKontrahent]); } // ... return [ 'msg' => "Utworzono raport", 'type' => "success", 'body' => [ 'id' => $idRaport, ] ]; } public function htmlViewFormBiAudit($items, $type) { $activeFormSteps = ''; switch($type) { case 'KONTRAHENCI': $activeFormSteps = 'complete'; $titleHeader = 'KONTRAHENCI'; break; case 'PRACOWNICY': $titleHeader = 'PRACOWNICY'; break; case 'FAMILIES': $titleHeader = 'FAMILIES'; break; } $viewEployees = '
 
Krok 1
PRACOWNICY
 
Krok 2
KONTRAHENCI
 
SZUKANIE POWIĄZAŃ
głębokość powiązań:

Wszyscy

Lorem Ipsum jest tekstem stosowanym jako przykładowy wypełniacz w przemyśle poligraficznym.
' . $this->showListDataByType($items, $type) . '
'; return $viewEployees; } public function showListDataByType($items, $type='PRACOWNICY') { switch ($type) { case 'PRACOWNICY': return $this->showListPracownicy($items); break; case 'KONTRAHENCI': return $this->showListKontrahenci($items); break; case 'FAMILIES': return $this->showListFamilies($items); break; } } /** * BraveCare Families Screen */ public function getHtmlForScreen_Families( $items, $type ) { //HTML for Screen - Families $this->getCss(); switch($type) { case 'FAMILIES': $titleHeader = 'KLIENCI (RODZINY)'; break; } $screen_Families = '
' . $titleHeader . ' Narzędzia v
TUTAJ JEST SEKCJA Z PRZYCISKAMI I FILTRAMI - Typ obiektu: ' . $type . ' - Liczba el. pobranych z BD: '. count($items) . ' ELEMENTY: ' . print_r( array_values($items), true ) . '
' . $this->getHtmlForTableByType($items, $type) . '
'; return $screen_Families; } public function getHtmlForTableByType( $items, $type='FAMILIES' ) { switch( $type ) { case 'FAMILIES': return $this->getHtmlForTable_Families($items); break; } } /* EOF BraveCare Families - getHtmlForScreen_Families() */ public function getCss(){ ?>