panel_biall_net.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. Lib::loadClass('Router');
  3. class Theme_panel_biall_net extends ThemeDefault {
  4. // function head() { // echo 'html tag inside <head>'
  5. // }
  6. function top() { // first tag after body: top menu or header
  7. include dirname(__FILE__) . '/view/top.php';
  8. }
  9. function footer() { // before </body>
  10. include dirname(__FILE__) . '/view/footer.php';
  11. }
  12. function login($data) {
  13. if (is_array($data) && !empty($data)) {
  14. extract($data);
  15. }
  16. $remindPasswdLink = Router::getRoute('UrlAction_RemindPasswd')->getLink();
  17. include dirname(__FILE__) . '/view/login.php';
  18. }
  19. function remind($data) {
  20. if (is_array($data) && !empty($data)) {
  21. extract($data);
  22. }
  23. $loginLink = Request::getPathUri();
  24. include dirname(__FILE__) . '/view/remind.php';
  25. }
  26. function remindSent($data = []) {
  27. if (is_array($data) && !empty($data)) {
  28. extract($data);
  29. }
  30. include dirname(__FILE__) . '/view/remindSent.php';
  31. }
  32. function remindSetNewPassword($data = []) {
  33. if (is_array($data) && !empty($data)) {
  34. extract($data);
  35. }
  36. $loginLink = Request::getPathUri();
  37. include dirname(__FILE__) . '/view/remindSetNewPass.php';
  38. }
  39. function remindNewPasswordSet($data) {
  40. if (is_array($data) && !empty($data)) {
  41. extract($data);
  42. }
  43. $loginLink = Request::getPathUri();
  44. include dirname(__FILE__) . '/view/remindNewPassSetConfirm.php';
  45. }
  46. function logout($data) {
  47. if (is_array($data) && !empty($data)) {
  48. extract($data);
  49. }
  50. include dirname(__FILE__) . '/view/logout.php';
  51. }
  52. function home($data) { // TODO: home page view
  53. if (is_array($data) && !empty($data)) {
  54. extract($data);
  55. }
  56. if (!User::logged()) {
  57. UI::alert('danger', "Brak dostępu");
  58. return;
  59. }
  60. Lib::loadClass('Windykacja_StatsModel');
  61. Lib::loadClass('Windykacja_FunkcjeL1');
  62. $billDocs = Windykacja_StatsModel::getBillDocsByDate(User::getID());
  63. $billDocs->sort_docs();
  64. $billDocs->set_saldo_for_all_docs();
  65. $billDocs->set_paid_status_for_all(); // Windykacja_BillingDoc._paid_status: 1 (Opłacona) | 0 (Nieopłacona)
  66. $listBillDocs = $billDocs->get_docs(); // [ day => [ Windykacja_EventDoc, ... ], ... ]
  67. $fvList = array_reduce($listBillDocs, function ($ret, $dayDocList) {
  68. foreach ($dayDocList as $billDoc) {
  69. if ('FVAT' == $billDoc->_type) {
  70. // $nr = "Faktura Vat Nr " . $billDoc->get('NUMBER') . " / " . $billDoc->get('ID_BILLING_PREFIXES');
  71. $nr = "Nr " . $billDoc->get('NUMBER') . " / " . $billDoc->get('ID_BILLING_PREFIXES');
  72. array_unshift($ret, [
  73. 'NUMER FAKTURY' => $nr,
  74. 'DATA WYSTAWIENIA' => $billDoc->get('BILL_DATE'),
  75. 'STATUS' => ($billDoc->_paid_status) ? "Opłacona" : "Nieopłacona",
  76. 'WARTOŚĆ BRUTTO' => $billDoc->get('WARTOSC'),
  77. 'AKCJA' => "",
  78. '_data' => $billDoc,
  79. ]);
  80. } else if ('KORV' == $billDoc->_type) {
  81. // DBG::nicePrint($billDoc, "TODO: DOC KORV"); // how to print?
  82. } else { // skip
  83. // DBG::nicePrint($billDoc, "TODO: DOC TYPE '{$billDoc->_type}'?");
  84. }
  85. }
  86. return $ret;
  87. }, []);
  88. // DBG::nicePrint($billDocs, '$billDocs');
  89. // DBG::nicePrint($listBillDocs, '$listBillDocs');
  90. // DBG::nicePrint($fvList, '$fvList');
  91. $company = Windykacja_StatsModel::getOwnerCompany(User::getID());
  92. $saldo = $billDocs->get_saldo();
  93. $nr_konta = Windykacja_FunkcjeL1::bankowy_make_nrach($company['NR_RACH_MASS_PAY'], User::getID(), 0);
  94. include dirname(__FILE__) . '/view/home.php';
  95. }
  96. }