|
|
@@ -8,7 +8,8 @@ Lib::loadClass('Response');
|
|
|
Lib::loadClass('ProcesHelper');
|
|
|
Lib::loadClass('Route_UrlAction');
|
|
|
Lib::loadClass('UI');
|
|
|
-Lib::loadClass('Core_AclHelper');
|
|
|
+Lib::loadClass('ACL');
|
|
|
+Lib::loadClass('TableAjax');
|
|
|
|
|
|
// - [ ] zaliczkaListaView:
|
|
|
// - [ ] btn "Dodaj Zaliczkę" $acl->addItem($item); // @require only 'worker' => [ 'id', 'login', 'name' ]
|
|
|
@@ -32,6 +33,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
$data = array();
|
|
|
$data['idUser'] = V::get('idUser', User::getID(), $_REQUEST, 'int');
|
|
|
$data['idZaliczka'] = V::get('idZaliczka', 0, $_REQUEST, 'int');// TODO: idZaliczka is always MAX(z.ID);
|
|
|
+ $data['tab'] = V::get('tab', 'wnoiski', $_REQUEST, 'word');
|
|
|
|
|
|
if (!$data['idZaliczka']) {
|
|
|
$this->zaliczkaListaView($data);
|
|
|
@@ -50,7 +52,9 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
}
|
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
+ DBG::log($e);
|
|
|
}
|
|
|
+ if (!empty($_POST)) echo UI::h('script', [], "history.replaceState(null, 'Zaliczka', window.location.href);");
|
|
|
if (1 != V::get('_print', '', $_GET)) UI::dol();
|
|
|
}
|
|
|
|
|
|
@@ -103,7 +107,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
if ('default_db/IN7_DZIENNIK_KORESP/ZaliczkaKoresp' == $args['schema']['@namespace']) {
|
|
|
return [
|
|
|
'type' => 'success',
|
|
|
- 'options' => array_values(Core_AclHelper::getAclByNamespace($args['schema']['@namespace'])->getItems([
|
|
|
+ 'options' => array_values(ACL::getAclByNamespace($args['schema']['@namespace'])->getItems([
|
|
|
'f_title' => V::get('query', '', $args)
|
|
|
]))
|
|
|
];
|
|
|
@@ -115,7 +119,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
// objectNamespace : "default_db/ZALICZKA_POZYCJA/ZaliczkaPozycja"
|
|
|
if (empty($args['childName'])) throw new Exception("Missing childName");
|
|
|
|
|
|
- $acl = Core_AclHelper::getAclByNamespace($args['objectNamespace']);
|
|
|
+ $acl = ACL::getAclByNamespace($args['objectNamespace']);
|
|
|
return [
|
|
|
'type' => 'success',
|
|
|
'options' => $acl->getEnumValues($args['childName'])
|
|
|
@@ -152,73 +156,214 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
|
|
|
public function zaliczkaListaView($data) {
|
|
|
$idUser = V::get('idUser', User::getID(), $data);
|
|
|
+ $tab = V::get('tab', 'wnioski', $data);
|
|
|
+ if (!in_array($tab, ['wnioski', 'zaliczki'])) $tab = 'wnioski';
|
|
|
|
|
|
- $ownerAcl = Core_AclHelper::getAclByNamespace("default_objects/AccessOwner");
|
|
|
+ $ownerAcl = ACL::getAclByNamespace("default_objects/AccessOwner");
|
|
|
$user = $ownerAcl->getItem($idUser);// [id, login, name]
|
|
|
if (!$user) throw new Exception("Nie znaleziono pracownika o nr '{$idUser}'");
|
|
|
|
|
|
- $acl = Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
+ $acl = ACL::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
|
|
|
UI::startContainer(['style' => "padding-top:20px"]);
|
|
|
UI::setTitle("Zaliczka");
|
|
|
|
|
|
- UI::table([
|
|
|
- 'caption' => "Zaliczki pracownika {$user['name']} " . '<br>' . UI::hButtonPost("Dodaj nową zaliczkę", [
|
|
|
- 'data' => [
|
|
|
- '_route' => "UrlAction_UserProNetMediaZaliczka",
|
|
|
- '_task' => "add",
|
|
|
- 'idUser' => $idUser,
|
|
|
- ],
|
|
|
- 'fields' => [
|
|
|
- [ 'name' => "kwota", 'type' => 'text', 'class' => 'form-control input-sm', 'style' => "width:200px", 'placeholder' => "kwota" ]
|
|
|
- ],
|
|
|
- 'class' => 'btn-sm btn-primary',
|
|
|
- 'form.style' => 'display:block; margin-top:4px'
|
|
|
+ echo UI::h('h2', [], "Zaliczki pracownika {$user['name']} ");
|
|
|
+ echo UI::hButtonPost("Dodaj wniosek o zaliczkę", [
|
|
|
+ 'data' => [
|
|
|
+ '_route' => "UrlAction_UserProNetMediaZaliczka",
|
|
|
+ '_task' => 'add',
|
|
|
+ 'idUser' => $idUser,
|
|
|
+ ],
|
|
|
+ 'class' => "btn-sm btn-primary",
|
|
|
+ 'form.style' => "display:block; margin-top:4px; padding:20px; background:#eee"
|
|
|
+ ], [
|
|
|
+ UI::h('input', [ 'name' => "kwota", 'type' => 'text', 'class' => 'form-control input-sm', 'style' => "width:200px;margin-right:4px", 'placeholder' => "kwota" ]),
|
|
|
+ UI::h('div', ['class'=>"input-group", 'style'=>"margin-right:4px"], [
|
|
|
+ UI::h('input', [ 'name' => "uwagi", 'type' => 'text', 'class' => 'form-control input-sm', 'style' => "width:400px", 'placeholder' => "uwagi" ]),
|
|
|
+ UI::h('span', ['class'=>"input-group-btn"], [
|
|
|
+ UI::h('button', ['class'=>"btn btn-sm btn-default", 'onClick' => "return false"], [
|
|
|
+ UI::h('i', [
|
|
|
+ 'class' => "glyphicon glyphicon-question-sign",
|
|
|
+ 'title' => "Czego dotyczy zaliczka?"
|
|
|
+ ])
|
|
|
+ ])
|
|
|
+ ]),
|
|
|
]),
|
|
|
- 'rows' => array_map(
|
|
|
- function ($row) use ($idUser) {
|
|
|
- $instance = DB::getPDO()->fetchValue("select INSTANCE_NAME from `ZALICZKA__#INSTANCE` where PRIMARY_KEY = {$row['id']}");
|
|
|
- $editLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&idZaliczka={$row['id']}";
|
|
|
- $editLabel = ('ZaliczkaAktywna' == $instance) ? "Rozlicz / Podgląd" : "Podgląd";
|
|
|
- $histLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=hist&idUser={$idUser}&idZaliczka={$row['id']}";
|
|
|
- return [
|
|
|
- 'Nr' => $row['id'],
|
|
|
- 'Typ' => $instance,
|
|
|
- 'Pracownik' => $row['L_APPOITMENT_USER'],
|
|
|
- 'Kwota' => $row['kwota'],
|
|
|
- 'Nierozliczona kwota' => $row['nierozliczona_kwota'],
|
|
|
- '#' => '<a href="' . $editLink . '">' . $editLabel . '</a>' . (V::get('DBG', '', $_GET)
|
|
|
- ? '<a href="' . $histLink . '">' . "DBG HIST" . '</a>'
|
|
|
- : ''
|
|
|
- ),
|
|
|
- ];
|
|
|
- },
|
|
|
- $acl->getItems([
|
|
|
- '#refFrom' => [
|
|
|
- 'namespace' => 'default_db__x3A__ADMIN_USERS/Worker',
|
|
|
- 'primaryKey' => $idUser
|
|
|
- ]
|
|
|
- ])
|
|
|
- ),
|
|
|
- 'empty_msg' => "Brak",
|
|
|
- 'disable_lp' => true,
|
|
|
]);
|
|
|
|
|
|
+ echo UI::h('ul', ['class' => "nav nav-tabs", 'style' => "margin-top:24px"], [
|
|
|
+ UI::h('li', ['role' => "presentation", 'class' => ('wnioski' == $tab) ? "active" : ''], [
|
|
|
+ UI::h('a', ['href'=>Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&tab=wnioski"], "Wnioski")
|
|
|
+ // UI::h('a', ['href'=>"#tab-wnioski", 'onClick' => "return p5__Zaliczka__showTab(this, 'tab-wnioski')"], "Wnioski")
|
|
|
+ ]),
|
|
|
+ UI::h('li', ['role' => "presentation", 'class' => ('zaliczki' == $tab) ? "active" : ''], [
|
|
|
+ UI::h('a', ['href'=>Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&tab=zaliczki"], "Zaliczki")
|
|
|
+ // UI::h('a', ['href'=>"#tab-zaliczki", 'onClick' => "return p5__Zaliczka__showTab(this, 'tab-zaliczki')"], "Zaliczki")
|
|
|
+ ]),
|
|
|
+ ]);
|
|
|
+ if ('wnioski' == $tab) {
|
|
|
+ $this->viewWidgetUserWnioski($idUser);
|
|
|
+ } else if ('zaliczki' == $tab) {
|
|
|
+ $this->viewWidgetUserZaliczki($idUser);
|
|
|
+ }
|
|
|
+ // UI::startTag('div', ['id'=>'tab-wnioski']);
|
|
|
+ // $this->viewWidgetUserWnioski();
|
|
|
+ // UI::endTag('div');// #tab-wnioski
|
|
|
+ // UI::startTag('div', ['id'=>'tab-zaliczki']);
|
|
|
+ // $this->viewWidgetUserZaliczki();
|
|
|
+ // UI::endTag('div');// #tab-zaliczki
|
|
|
UI::endContainer();
|
|
|
+ // echo UI::h('script', [], "
|
|
|
+ // (function (window) {
|
|
|
+ // var idxSelected = 0
|
|
|
+ // var tabs = [
|
|
|
+ // 'tab-wnioski',
|
|
|
+ // 'tab-zaliczki'
|
|
|
+ // ]
|
|
|
+ // var tabNodes = [
|
|
|
+ // window.document.getElementById('tab-wnioski'),
|
|
|
+ // window.document.getElementById('tab-zaliczki'),
|
|
|
+ // ]
|
|
|
+ //
|
|
|
+ // function p5__Zaliczka__showTab(n, tab) {
|
|
|
+ // var idxTab = tabs.indexOf(tab)
|
|
|
+ // if (-1 === idxTab) return
|
|
|
+ // n.parentNode.parentNode.childNodes.forEach(function (liNode) {
|
|
|
+ // if (liNode.nodeType !== 1) return // Node.ELEMENT_NODE == 1
|
|
|
+ // if (liNode.tagName !== 'LI') return
|
|
|
+ // liNode.classList.remove('active')
|
|
|
+ // })
|
|
|
+ // n.parentNode.classList.add('active')
|
|
|
+ // p5__Zaliczka__renderTabs(idxTab)
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // function p5__Zaliczka__renderTabs(idxTab) {
|
|
|
+ // tabNodes.forEach(function (tabNode) {
|
|
|
+ // tabNode.style.display = 'none'
|
|
|
+ // })
|
|
|
+ // tabNodes[idxTab].style.display = 'block'
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // p5__Zaliczka__renderTabs(idxSelected)
|
|
|
+ //
|
|
|
+ // window.p5__Zaliczka__showTab = p5__Zaliczka__showTab
|
|
|
+ // })(window)
|
|
|
+ // ");
|
|
|
+ }
|
|
|
+
|
|
|
+ public function viewWidgetUserWnioski($data = []) {
|
|
|
+ $idUser = V::get('idUser', User::getID(), $data);
|
|
|
+ if (!$idUser) throw new Exception("Błędny numer pracownika");
|
|
|
+ // $workerLogin = DB::getPDO()->fetchValue("select u.ADM_ACCOUNT from ADMIN_USERS u where u.ID={$idUser} limit 1");
|
|
|
+ // if (!$workerLogin) throw new Exception("Pracownik nie został odnaleziony - nr '{$idUser}'");
|
|
|
+ // $acl = ACL::getAclByNamespace("default_db/ZALICZKA_WNIOSEK/ZaliczkaWniosek");
|
|
|
+ $acl = ACL::getAclByNamespace("default_db/zaliczka_wniosek_info_view");
|
|
|
+ $syncUrl = Request::getPathUri() . 'index.php?_route=ViewTableAjax&namespace=' . $acl->getNamespace();
|
|
|
+ $tbl = new TableAjax($acl);
|
|
|
+ $tblLabel = $acl->getNamespace();
|
|
|
+ if ('default_db' == $acl->getSourceName()) {
|
|
|
+ $tblLabel = array();
|
|
|
+ $zasobObj = ProcesHelper::getZasobTableInfo($acl->getID());
|
|
|
+ if (!$zasobObj) throw new Exception("Zasob TABELA ID=" . $acl->getID() . " nie istnieje");
|
|
|
+ if (!empty($zasobObj->DESC_PL)) $tblLabel[] = $zasobObj->DESC_PL;
|
|
|
+ if (!empty($zasobObj->OPIS)) $tblLabel[] = $zasobObj->OPIS;
|
|
|
+ $tblLabel = implode(" - ", $tblLabel);
|
|
|
+ }
|
|
|
+ $tbl->setSyncUrl($syncUrl);
|
|
|
+ $tbl->setLabel($tblLabel);
|
|
|
+ $tbl->setRowFunctions([]);
|
|
|
+
|
|
|
+ $tbl->setFilterInit([
|
|
|
+ 'currSortCol' => "created",
|
|
|
+ 'currSortFlip' => "desc"
|
|
|
+ ]);
|
|
|
+ $tbl->setForceFilterInit([
|
|
|
+ 'ID_USER' => $idUser
|
|
|
+ // 'workerLogin' => $workerLogin
|
|
|
+ ]);
|
|
|
+ echo $tbl->render();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function viewWidgetUserZaliczki($data = []) {
|
|
|
+ $idUser = V::get('idUser', User::getID(), $data);
|
|
|
+ if (!$idUser) throw new Exception("Błędny numer pracownika");
|
|
|
+ $workerLogin = DB::getPDO()->fetchValue("select u.ADM_ACCOUNT from ADMIN_USERS u where u.ID={$idUser} limit 1");
|
|
|
+ if (!$workerLogin) throw new Exception("Pracownik nie został odnaleziony - nr '{$idUser}'");
|
|
|
+ $acl = ACL::getAclByNamespace("default_db/ZALICZKA_INFO_VIEW");// 'default_db/ZALICZKA/Zaliczka'
|
|
|
+ $syncUrl = Request::getPathUri() . 'index.php?_route=ViewTableAjax&namespace=' . $acl->getNamespace();
|
|
|
+ $tbl = new TableAjax($acl);
|
|
|
+ $tblLabel = $acl->getNamespace();
|
|
|
+ if ('default_db' == $acl->getSourceName()) {
|
|
|
+ $tblLabel = array();
|
|
|
+ $zasobObj = ProcesHelper::getZasobTableInfo($acl->getID());
|
|
|
+ if (!$zasobObj) throw new Exception("Zasob TABELA ID=" . $acl->getID() . " nie istnieje");
|
|
|
+ if (!empty($zasobObj->DESC_PL)) $tblLabel[] = $zasobObj->DESC_PL;
|
|
|
+ if (!empty($zasobObj->OPIS)) $tblLabel[] = $zasobObj->OPIS;
|
|
|
+ $tblLabel = implode(" - ", $tblLabel);
|
|
|
+ }
|
|
|
+ $tbl->setSyncUrl($syncUrl);
|
|
|
+ $tbl->setLabel($tblLabel);
|
|
|
+ $tbl->setRowFunctions([]);
|
|
|
+
|
|
|
+ $tbl->setFilterInit([
|
|
|
+ 'currSortCol' => "ID",
|
|
|
+ 'currSortFlip' => "desc"
|
|
|
+ ]);
|
|
|
+ $tbl->setForceFilterInit([
|
|
|
+ 'L_APPOITMENT_USER' => $workerLogin
|
|
|
+ ]);
|
|
|
+ echo $tbl->render();
|
|
|
+
|
|
|
+ // $acl = ACL::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
+ // UI::table([
|
|
|
+ // 'caption' => "Zaliczki",
|
|
|
+ // 'rows' => array_map(
|
|
|
+ // function ($row) use ($idUser) {
|
|
|
+ // $instance = DB::getPDO()->fetchValue("select INSTANCE_NAME from `ZALICZKA__#INSTANCE` where PRIMARY_KEY = {$row['id']}");
|
|
|
+ // $editLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&idZaliczka={$row['id']}";
|
|
|
+ // $editLabel = ('ZaliczkaAktywna' == $instance) ? "Rozlicz / Podgląd" : "Podgląd";
|
|
|
+ // $histLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=hist&idUser={$idUser}&idZaliczka={$row['id']}";
|
|
|
+ // return [
|
|
|
+ // 'Nr' => $row['id'],
|
|
|
+ // 'Typ' => $instance,
|
|
|
+ // 'Pracownik' => $row['L_APPOITMENT_USER'],
|
|
|
+ // 'Kwota' => $row['kwota'],
|
|
|
+ // 'Nierozliczona kwota' => $row['nierozliczona_kwota'],
|
|
|
+ // '#' => '<a href="' . $editLink . '">' . $editLabel . '</a>' . (V::get('DBG', '', $_GET)
|
|
|
+ // ? '<a href="' . $histLink . '">' . "DBG HIST" . '</a>'
|
|
|
+ // : ''
|
|
|
+ // ),
|
|
|
+ // ];
|
|
|
+ // },
|
|
|
+ // $acl->getItems([
|
|
|
+ // '#refFrom' => [
|
|
|
+ // 'namespace' => 'default_db__x3A__ADMIN_USERS/Worker',
|
|
|
+ // 'primaryKey' => $idUser
|
|
|
+ // ]
|
|
|
+ // ])
|
|
|
+ // ),
|
|
|
+ // 'empty_msg' => "Brak",
|
|
|
+ // 'disable_lp' => true,
|
|
|
+ // ]);
|
|
|
}
|
|
|
|
|
|
public function addAction() {
|
|
|
- $idUser = V::get('idUser', User::getID(), $_REQUEST);
|
|
|
+ $idUser = V::get('idUser', User::getID(), $_REQUEST, 'int');
|
|
|
$kwota = V::get('kwota', 0, $_REQUEST, 'price');
|
|
|
+ $uwagi = V::get('uwagi', '', $_REQUEST);
|
|
|
try {
|
|
|
- $acl = Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
+ if (!$idUser) throw new Exception("Błędny numer pracownika");
|
|
|
+ $workerLogin = DB::getPDO()->fetchValue("select u.ADM_ACCOUNT from ADMIN_USERS u where u.ID={$idUser} limit 1");
|
|
|
+ if (!$workerLogin) throw new Exception("Pracownik nie został odnaleziony - nr '{$idUser}'");
|
|
|
+ $acl = ACL::getAclByNamespace("default_db/ZALICZKA_WNIOSEK/ZaliczkaWniosek");
|
|
|
$id = $acl->addItem([
|
|
|
'kwota' => $kwota,
|
|
|
- 'worker' => [
|
|
|
- 'id' => $idUser
|
|
|
- ]
|
|
|
+ 'uwagi' => $uwagi,
|
|
|
+ 'workerLogin' => $workerLogin
|
|
|
]);
|
|
|
- if (!$id) throw new Exception("Nie udało się utworzyć zaliczki");
|
|
|
+ if (!$id) throw new Exception("Nie udało się utworzyć wniosku o zaliczkę");
|
|
|
} catch (Exception $e) {
|
|
|
UI::gora();
|
|
|
UI::startContainer();
|
|
|
@@ -234,7 +379,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- $redirectUrl = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&idZaliczka={$id}";
|
|
|
+ $redirectUrl = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}";// TODO:? &idWniosek={$id}
|
|
|
if (!headers_sent()) {
|
|
|
header("Location: {$redirectUrl}");
|
|
|
} else {
|
|
|
@@ -251,13 +396,27 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
public function reinstallAction() {
|
|
|
UI::gora();
|
|
|
try {
|
|
|
- Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka")->reinstall();
|
|
|
+ ACL::getAclByNamespace("default_db/ZALICZKA/Zaliczka")->reinstall();
|
|
|
+ ACL::getAclByNamespace("default_db/ZALICZKA_WNIOSEK/ZaliczkaWniosek")->reinstall();
|
|
|
UI::startContainer();
|
|
|
UI::alert('success', "Structure for 'default_db/ZALICZKA/Zaliczka' created in a database");
|
|
|
$backUrl = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka";
|
|
|
UI::tag('a', ['href'=>$backUrl, 'class'=>"btn btn-primary"], "wróć");
|
|
|
|
|
|
$databaseName = DB::getPDO()->getDatabaseName();
|
|
|
+ UI::table([
|
|
|
+ 'caption' => "Zaliczka Wniosek",
|
|
|
+ 'rows' => DB::getPDO()->fetchAll("
|
|
|
+ select t.TABLE_NAME, t.COLUMN_NAME, t.DATA_TYPE, t.COLUMN_TYPE
|
|
|
+ from `information_schema`.`COLUMNS` t
|
|
|
+ where t.TABLE_SCHEMA = '{$databaseName}'
|
|
|
+ and (t.TABLE_NAME like 'ZALICZKA_WNIOSEK'
|
|
|
+ or t.TABLE_NAME like 'ZALICZKA_WNIOSEK_HIST'
|
|
|
+ )
|
|
|
+ order by t.TABLE_NAME asc, t.COLUMN_NAME asc
|
|
|
+ ")
|
|
|
+ ]);
|
|
|
+
|
|
|
UI::table([
|
|
|
'caption' => "Zaliczka",
|
|
|
'rows' => DB::getPDO()->fetchAll("
|
|
|
@@ -304,6 +463,8 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
or t.TABLE_NAME like 'ZALICZKA_POZYCJA\_\_%'
|
|
|
or t.TABLE_NAME like 'ZALICZKA_POZYCJA_HIST'
|
|
|
or t.TABLE_NAME like 'ZaliczkaPozycja\_\_%'
|
|
|
+ or t.TABLE_NAME like 'ZALICZKA_WNIOSEK'
|
|
|
+ or t.TABLE_NAME like 'ZALICZKA_WNIOSEK_HIST'
|
|
|
)
|
|
|
group by t.TABLE_NAME
|
|
|
")
|
|
|
@@ -379,7 +540,10 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
, t.L_APPOITMENT_USER
|
|
|
, t.A_STATUS
|
|
|
, t.KWOTA
|
|
|
+ , t.UWAGI
|
|
|
, t.NIEROZLICZONA_KWOTA
|
|
|
+ , t.APPROVED_BY
|
|
|
+ , t.PAYMENT_METHOD
|
|
|
, sum(COALESCE(p.kwota, 0)) as rozliczona_kwota
|
|
|
from ZALICZKA t
|
|
|
join ADMIN_USERS u on(u.ADM_ACCOUNT = t.L_APPOITMENT_USER)
|
|
|
@@ -404,6 +568,30 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
where t.A_STATUS not in ('DELETED')
|
|
|
group by u.ADM_ACCOUNT
|
|
|
");
|
|
|
+ DB::getPDO()->execSql("
|
|
|
+ CREATE OR REPLACE VIEW `ZALICZKA_WNIOSEK_INFO_VIEW` AS
|
|
|
+ select t.ID
|
|
|
+ , t.A_RECORD_CREATE_DATE as created
|
|
|
+ , u.ID as ID_USER
|
|
|
+ , t.L_APPOITMENT_USER
|
|
|
+ , t.A_STATUS
|
|
|
+ , t.KWOTA
|
|
|
+ , t.UWAGI
|
|
|
+ , t.APPROVED_BY
|
|
|
+ , IF('WAITING' = t.A_STATUS, 'Oczekuje zatwierdzenia',
|
|
|
+ IF ('NORMAL' = t.A_STATUS, 'Zatwierdzony',
|
|
|
+ IF ('OFF_HARD' = t.A_STATUS, 'Odrzucony',
|
|
|
+ IF ('OFF_HARD' = t.A_STATUS, 'Anulowany',
|
|
|
+ 'nieznany'
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ) as status
|
|
|
+ from ZALICZKA_WNIOSEK t
|
|
|
+ join ADMIN_USERS u on(u.ADM_ACCOUNT = t.L_APPOITMENT_USER)
|
|
|
+-- where t.A_STATUS not in ('DELETED')
|
|
|
+ group by t.ID
|
|
|
+ ");
|
|
|
|
|
|
UI::table([
|
|
|
'caption' => "Table `ZALICZKA_USER_SALDO_VIEW`",
|
|
|
@@ -434,8 +622,14 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
left join ZALICZKA_POZYCJA p on(p.ID = refPoz.REMOTE_PRIMARY_KEY)
|
|
|
")
|
|
|
]);
|
|
|
+ UI::table([
|
|
|
+ 'caption' => "Table `ZALICZKA_WNIOSEK_INFO_VIEW`",
|
|
|
+ 'rows' => DB::getPDO()->fetchAll(" select * from `ZALICZKA_WNIOSEK_INFO_VIEW` ")
|
|
|
+ ]);
|
|
|
}
|
|
|
|
|
|
+ Router::getRoute('UrlAction_UserProNetMediaZaliczkaWniosekConfirm')->reinstall();
|
|
|
+ Router::getRoute('UrlAction_UserProNetMediaZaliczkaWniosekRemove')->reinstall();
|
|
|
|
|
|
UI::endContainer();
|
|
|
} catch (Exception $e) {
|
|
|
@@ -452,7 +646,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
UI::tag('div', ['id'=>"zaliczka-app", 'data-dbg'=>V::get('DBG', '', $_GET), 'data-sync-js-function'=>"syncZaliczkaState", 'data-fetch-data-js-function'=>"zaliczkaFetchData"]);
|
|
|
UI::emptyTag('br');
|
|
|
|
|
|
- $acl = Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
+ $acl = ACL::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
$schema = $acl->getSimpleSchemaTree();
|
|
|
// DBG::nicePrint($schema, '$schema');
|
|
|
|
|
|
@@ -475,7 +669,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
$idZaliczka = V::get('idZaliczka', 0, $_GET, 'int');
|
|
|
if ($idZaliczka <= 0) throw new Exception("Missing idZaliczka");
|
|
|
|
|
|
- $acl = Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
+ $acl = ACL::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
|
|
|
$zaliczka = $acl->getItem($idZaliczka);
|
|
|
if (!$zaliczka) throw new Exception("Zaliczka not found!");
|
|
|
|