Browse Source

+ podglad fv

Piotr Labudda 4 years ago
parent
commit
03ddfc6200
2 changed files with 47 additions and 1 deletions
  1. 5 1
      theme/panel_biall_net.php
  2. 42 0
      tools/ViewFV.php

+ 5 - 1
theme/panel_biall_net.php

@@ -92,7 +92,11 @@ class Theme_panel_biall_net extends ThemeDefault {
 						'DATA WYSTAWIENIA' => $billDoc->get('BILL_DATE'),
 						'STATUS' => ($billDoc->_paid_status) ? "Opłacona" : "Nieopłacona",
 						'WARTOŚĆ BRUTTO' => $billDoc->get('WARTOSC'),
-						'AKCJA' => "",
+						'AKCJA' => UI::h('a', [
+							'href' => Router::getRoute('UrlAction_ViewFV')->getLink('', [ 'nr' => $billDoc->get('ID_BILLING_NUMBERS') ]),
+							'target' => "_blank",
+							'class' => "",
+						], "Podglgąd"),
 
 						'_data' => $billDoc,
 					]);

+ 42 - 0
tools/ViewFV.php

@@ -0,0 +1,42 @@
+<?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 = User::getID();
+			$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,
+			]);
+			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();
+		}
+	}
+
+}