' // } function top() { // first tag after body: top menu or header include dirname(__FILE__) . '/view/top.php'; } function footer() { // before include dirname(__FILE__) . '/view/footer.php'; } function login($data) { if (is_array($data) && !empty($data)) { extract($data); } $remindPasswdLink = Router::getRoute('UrlAction_RemindPasswd')->getLink(); include dirname(__FILE__) . '/view/login.php'; } function remind($data) { if (is_array($data) && !empty($data)) { extract($data); } $loginLink = Request::getPathUri(); include dirname(__FILE__) . '/view/remind.php'; } function remindSent($data = []) { if (is_array($data) && !empty($data)) { extract($data); } include dirname(__FILE__) . '/view/remindSent.php'; } function remindSetNewPassword($data = []) { if (is_array($data) && !empty($data)) { extract($data); } $loginLink = Request::getPathUri(); include dirname(__FILE__) . '/view/remindSetNewPass.php'; } function remindNewPasswordSet($data) { if (is_array($data) && !empty($data)) { extract($data); } $loginLink = Request::getPathUri(); include dirname(__FILE__) . '/view/remindNewPassSetConfirm.php'; } function logout($data) { if (is_array($data) && !empty($data)) { extract($data); } include dirname(__FILE__) . '/view/logout.php'; } function home($data) { // TODO: home page view // trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/home uid(".User::getID().") ses: { ID: {$_SESSION['ID']}, ADM_NAME: {$_SESSION['ADM_NAME']} }", E_USER_NOTICE); if (is_array($data) && !empty($data)) { extract($data); } if (!User::logged()) { UI::alert('danger', "Brak dostępu"); return; } Lib::loadClass('Windykacja_StatsModel'); Lib::loadClass('Windykacja_FunkcjeL1'); $billDocs = Windykacja_StatsModel::getBillDocsByDate(Theme_Auth_panel_biall_net::getUserID()); $billDocs->sort_docs(); $billDocs->set_saldo_for_all_docs(); $billDocs->set_paid_status_for_all(); // Windykacja_BillingDoc._paid_status: 1 (Opłacona) | 0 (Nieopłacona) $listBillDocs = $billDocs->get_docs(); // [ day => [ Windykacja_EventDoc, ... ], ... ] $fvList = array_reduce($listBillDocs, function ($ret, $dayDocList) { foreach ($dayDocList as $billDoc) { if ('FVAT' == $billDoc->_type) { // $nr = "Faktura Vat Nr " . $billDoc->get('NUMBER') . " / " . $billDoc->get('ID_BILLING_PREFIXES'); $nr = "Nr " . $billDoc->get('NUMBER') . " / " . $billDoc->get('ID_BILLING_PREFIXES'); array_unshift($ret, [ 'NUMER FAKTURY' => $nr, 'DATA WYSTAWIENIA' => $billDoc->get('BILL_DATE'), 'STATUS' => ($billDoc->_paid_status) ? "Opłacona" : "Nieopłacona", 'WARTOŚĆ BRUTTO' => $billDoc->get('WARTOSC'), 'AKCJA' => UI::h('a', [ 'href' => Router::getRoute('UrlAction_ViewFV')->getLink('', [ 'nr' => $billDoc->get('ID_BILLING_NUMBERS') ]), 'target' => "_blank", 'class' => "", ], "Podglgąd"), '_data' => $billDoc, ]); } else if ('KORV' == $billDoc->_type) { // DBG::nicePrint($billDoc, "TODO: DOC KORV"); // how to print? } else { // skip // DBG::nicePrint($billDoc, "TODO: DOC TYPE '{$billDoc->_type}'?"); } } return $ret; }, []); // DBG::nicePrint($billDocs, '$billDocs'); // DBG::nicePrint($listBillDocs, '$listBillDocs'); // DBG::nicePrint($fvList, '$fvList'); $company = Windykacja_StatsModel::getOwnerCompany(Theme_Auth_panel_biall_net::getUserID()); $saldo = $billDocs->get_saldo(); $nr_konta = Windykacja_FunkcjeL1::bankowy_make_nrach($company['NR_RACH_MASS_PAY'], Theme_Auth_panel_biall_net::getUserID(), 0); if (!empty($_SESSION['PANEL_BN_USERS'])) { $idUser = Theme_Auth_panel_biall_net::getUserID(); // echo UI::h('pre', [], var_export($_SESSION['PANEL_BN_USERS'], true)); echo UI::h('form', [ 'method' => "POST" ], [ UI::h('div', [ 'class' => "row" ], [ UI::h('div', [ 'class' => "col-md-offset-3 col-md-6" ], [ UI::h('div', [ 'class' => "form-group" ], [ UI::h('label', [ 'class' => "label-control" ], "Klient"), UI::h('select', [ 'name' => "id", 'class' => "form-control", 'onChange' => "this.form.submit()" ], array_map(function ($item) use ($idUser) { // 'ID' => '13684', // 'LOGIN' => 'paulina.kinowska@wp.pl', // 'P_NAME' => 'Paulina', // 'P_NAME_SECOND' => 'Kinowska', // 'BILLING_OWNER' => '3', return UI::h('option', array_merge( [ 'value' => $item['ID'] ], ($idUser == $item['ID']) ? [ 'selected' => "selected" ] : [] ), $item['P_NAME'] . " " . $item['P_NAME_SECOND']); }, $_SESSION['PANEL_BN_USERS'])), UI::h('input', [ 'type' => "hidden", 'name' => "_route", 'value' => "UrlAction_ChangeUser" ]), UI::h('input', [ 'type' => "hidden", 'name' => "_postTask", 'value' => "_changeUser" ]), ]), ]), ]), ]); } include dirname(__FILE__) . '/view/home.php'; } }