123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- Lib::loadClass('RouteToolBase');
- Lib::loadClass('UI');
- Lib::loadClass('Response');
- Lib::loadClass('Theme');
- require_once dirname(__FILE__) . '/../auth.php'; // Theme_Auth_panel_biall_net
- // index.php?_route=UrlAction_ViewFV - uruchamia defaultAction
- class RouteTool_ViewFV extends RouteToolBase {
- function defaultAction() {
- try {
- $nr = V::get('nr', 0, $_GET, 'int'); // ID_BILLING_NUMBERS
- if (empty($nr)) throw new Exception("Brak nr faktury");
- $idUser = Theme_Auth_panel_biall_net::getUserID();
- $body = DB::getPDO(931)->fetchValue("
- select BODY_HTML
- from HIST_CONTACTS
- where ID_BILLING_USERS = :id_user
- and ID_BILLING_NUMBERS = :nr
- order by ID DESC
- limit 1
- ", [
- ':id_user' => $idUser,
- ':nr' => $nr,
- ]);
- // `- 7769215` dla dużych numerów - błędnie wprowadzonych np. 9880 klient(13374) BUG nr 8635412
- // 8635412 - BUG ID_BILLING_NUMBERS in HIST_CONTACTS
- // 866197 - correct ID_BILLING_NUMBERS
- // MAX BILLING_NUMBERS.ID = 874100
- if (empty($body)) {
- $body = DB::getPDO(931)->fetchValue("
- select BODY_HTML
- from HIST_CONTACTS
- where ID_BILLING_USERS = :id_user
- and ID_BILLING_NUMBERS = :nr
- order by ID DESC
- limit 1
- ", [
- ':id_user' => $idUser,
- ':nr' => $nr + 7769215,
- ]);
- }
- if (empty($body)) throw new Exception("Brak faktury");
- die($body);
- } catch (Exception $e) {
- UI::gora();
- Theme::top();
- echo UI::h('div', [ 'class' => "container" ], [
- UI::h('div', [ 'class' => 'alert alert-danger' ], $e->getMessage()),
- ]);
- UI::dol();
- }
- }
- }
|