ViewFV.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. Lib::loadClass('RouteToolBase');
  3. Lib::loadClass('UI');
  4. Lib::loadClass('Response');
  5. Lib::loadClass('Theme');
  6. require_once dirname(__FILE__) . '/../auth.php'; // Theme_Auth_panel_biall_net
  7. // index.php?_route=UrlAction_ViewFV - uruchamia defaultAction
  8. class RouteTool_ViewFV extends RouteToolBase {
  9. function defaultAction() {
  10. try {
  11. $nr = V::get('nr', 0, $_GET, 'int'); // ID_BILLING_NUMBERS
  12. if (empty($nr)) throw new Exception("Brak nr faktury");
  13. $idUser = User::getID();
  14. $body = DB::getPDO(931)->fetchValue("
  15. select BODY_HTML
  16. from HIST_CONTACTS
  17. where ID_BILLING_USERS = :id_user
  18. and ID_BILLING_NUMBERS = :nr
  19. order by ID DESC
  20. limit 1
  21. ", [
  22. ':id_user' => $idUser,
  23. ':nr' => $nr,
  24. ]);
  25. if (empty($body)) throw new Exception("Brak faktury");
  26. die($body);
  27. } catch (Exception $e) {
  28. UI::gora();
  29. Theme::top();
  30. echo UI::h('div', [ 'class' => "container" ], [
  31. UI::h('div', [ 'class' => 'alert alert-danger' ], $e->getMessage()),
  32. ]);
  33. UI::dol();
  34. }
  35. }
  36. }