|
@@ -1,448 +1,165 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+require_once __DIR__ . '/../../../config/database.php';
|
|
|
|
|
+require_once __DIR__ . '/../../../lib/auth.php';
|
|
|
|
|
+
|
|
|
|
|
+if (session_status() === PHP_SESSION_NONE) {
|
|
|
|
|
+ session_start();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+requireLogin();
|
|
|
|
|
+
|
|
|
|
|
+$client_id = (int) ($_GET['cid'] ?? 0);
|
|
|
|
|
+$record_id = (int) ($_GET['rid'] ?? 0);
|
|
|
|
|
+$rand_id = (float)($_GET['rand'] ?? 0);
|
|
|
|
|
+$croptype = htmlspecialchars(trim($_GET['stid'] ?? ''), ENT_QUOTES, 'UTF-8');
|
|
|
|
|
+
|
|
|
|
|
+if (!$record_id || !$rand_id) {
|
|
|
|
|
+ http_response_code(400);
|
|
|
|
|
+ die('Invalid request parameters.');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+try {
|
|
|
|
|
+ $pdo = getDBConnection();
|
|
|
|
|
+ $stmt = $pdo->prepare(
|
|
|
|
|
+ 'SELECT * FROM `soil_records` WHERE `id` = ? AND `rand` = ? LIMIT 1'
|
|
|
|
|
+ );
|
|
|
|
|
+ $stmt->execute([$record_id, $rand_id]);
|
|
|
|
|
+ $row = $stmt->fetch();
|
|
|
|
|
+} catch (PDOException $e) {
|
|
|
|
|
+ error_log('soil-analysis-pdf.php DB error: ' . $e->getMessage());
|
|
|
|
|
+ http_response_code(500);
|
|
|
|
|
+ die('Database error.');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+if (!$row) {
|
|
|
|
|
+ http_response_code(404);
|
|
|
|
|
+ die('Record not found.');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// All values escaped for HTML output
|
|
|
|
|
+$h = fn($v) => htmlspecialchars((string)($v ?? ''), ENT_QUOTES, 'UTF-8');
|
|
|
|
|
+
|
|
|
|
|
+$client = $h($row['client_name']);
|
|
|
|
|
+$address = $h($row['site_address']);
|
|
|
|
|
+$state = $h($row['state_postcode']);
|
|
|
|
|
+$email = $h($row['email']);
|
|
|
|
|
+$labNo = $h($row['lab_no']);
|
|
|
|
|
+$sampleDate = $h($row['date_sampled']);
|
|
|
|
|
+$sample = $h($row['site_id']);
|
|
|
|
|
+$crop = $h($row['sample_id']);
|
|
|
|
|
+$today = date('jS F Y');
|
|
|
|
|
+
|
|
|
|
|
+// Navigation URLs (replacing modX [[~41~]], [[~66~]], [[~37~]] resource links)
|
|
|
|
|
+$params = http_build_query(['rand' => $rand_id, 'cid' => $client_id, 'rid' => $record_id, 'stid' => $croptype]);
|
|
|
|
|
+$analysisUrl = '/dashboard/crop-analysis/soil-test-data/soil-analysis.php?' . $params;
|
|
|
|
|
+$reportUrl = '/dashboard/crop-analysis/soil-test-data/soil-report.php?' . $params;
|
|
|
|
|
+?>
|
|
|
<!doctype html>
|
|
<!doctype html>
|
|
|
<html lang="en">
|
|
<html lang="en">
|
|
|
- <head>
|
|
|
|
|
- <title>[[*longtitle]] | [[++site_name]]</title>
|
|
|
|
|
- <base href="[[!++site_url]]" >
|
|
|
|
|
- <meta charset="[[++modx_charset]]" >
|
|
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" >
|
|
|
|
|
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
|
|
|
|
|
- <meta name="keywords" content="[[*introtext]]" >
|
|
|
|
|
- <meta name="description" content="[[*description]]" >
|
|
|
|
|
-
|
|
|
|
|
- [[!Profile]]
|
|
|
|
|
-
|
|
|
|
|
- <link rel="icon" href="client-assets/images/favicon.ico?v=2" type="image/x-icon" >
|
|
|
|
|
-
|
|
|
|
|
- <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
|
|
|
|
|
-
|
|
|
|
|
- <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" rel="stylesheet" type="text/css" />
|
|
|
|
|
- <link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
-
|
|
|
|
|
- <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.css" integrity="sha256-PF6MatZtiJ8/c9O9HQ8uSUXr++R9KBYu4gbNG5511WE=" crossorigin="anonymous" rel="stylesheet" type="text/css" />
|
|
|
|
|
-
|
|
|
|
|
- <link type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" rel="stylesheet" type="text/css" />
|
|
|
|
|
- <link href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
-
|
|
|
|
|
- <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
|
|
|
|
|
-
|
|
|
|
|
- <link href="/client-assets/css/dashboard.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
- <script src="https://unpkg.com/gijgo@1.9.11/js/gijgo.min.js" type="text/javascript"></script>
|
|
|
|
|
- <link href="https://unpkg.com/gijgo@1.9.11/css/gijgo.min.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
- <script src="client-assets/js/skycons.js" type="text/javascript"></script>
|
|
|
|
|
-
|
|
|
|
|
- <link href="client-assets/home/css/graphing.css" rel="stylesheet" type="text/css" media="screen" />
|
|
|
|
|
- <link href="client-assets/home/css/alux.min.css" rel="stylesheet" type="text/css" media="screen" />
|
|
|
|
|
-
|
|
|
|
|
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.min.js" integrity="sha512-YcsIPGdhPK4P/uRW6/sruonlYj+Q7UHWeKfTAkBW+g83NKM+jMJFJ4iAPfSnVp7BKD4dKMHmVSvICUbE/V1sSw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
|
|
|
-
|
|
|
|
|
- <style>
|
|
|
|
|
- @media print {
|
|
|
|
|
- @page {
|
|
|
|
|
- size: A4 portrait;
|
|
|
|
|
- }
|
|
|
|
|
- @page :left {
|
|
|
|
|
- margin-left: 0.5cm;
|
|
|
|
|
- }
|
|
|
|
|
- @page :right {
|
|
|
|
|
- margin-right: 0.5cm;
|
|
|
|
|
- }
|
|
|
|
|
- @page :top {
|
|
|
|
|
- margin-top: 0cm;
|
|
|
|
|
- }
|
|
|
|
|
- @page :bottom {
|
|
|
|
|
- margin-bottom: 0cm;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- </style>
|
|
|
|
|
-
|
|
|
|
|
- </head>
|
|
|
|
|
- <body>
|
|
|
|
|
-
|
|
|
|
|
- <div class="grid">
|
|
|
|
|
- <?php
|
|
|
|
|
- // Replace Logo with Customer Logo if supplied.
|
|
|
|
|
- $client = '';
|
|
|
|
|
-
|
|
|
|
|
- echo "<div class='col-md-3'>";
|
|
|
|
|
- if ($client === "") {
|
|
|
|
|
- echo "<img class='img-fluid' src='client-assets/images/crop-monitor.png' alt='Crop Monitor' >";
|
|
|
|
|
- } else {
|
|
|
|
|
- echo "<img class='img-fluid' src='client-assets/images/crop-monitor.png' alt='Crop Monitor' >";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //echo "<span class='col'></span>";
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //Client Test Description
|
|
|
|
|
- if ($client === "") {
|
|
|
|
|
- echo "";
|
|
|
|
|
- } else {
|
|
|
|
|
- echo "<img class='img-fluid' src='client-assets/images/crop-monitor.png' alt='Crop Monitor' >";
|
|
|
|
|
- }
|
|
|
|
|
- echo "</div>";
|
|
|
|
|
-
|
|
|
|
|
- echo "<div class='col-md-9'></div>";
|
|
|
|
|
- ?>
|
|
|
|
|
-
|
|
|
|
|
- <?php
|
|
|
|
|
- $result = null;
|
|
|
|
|
-
|
|
|
|
|
- $client_id = (int) (isset($_GET["cid"])) ? $_GET["cid"] : ""; // client number
|
|
|
|
|
- $record_id = (float) (isset($_GET["rid"])) ? $_GET["rid"] : ""; // record number
|
|
|
|
|
- $rand_id = (float) (isset($_GET["rand"])) ? $_GET["rand"] : "";
|
|
|
|
|
-
|
|
|
|
|
- $today = date('jS F Y');
|
|
|
|
|
-
|
|
|
|
|
- //Database connection
|
|
|
|
|
- //$con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
|
|
|
|
|
- $con = mysqli_connect("localhost", "cropmonitor", "brvnCcaEYxlPCS3", "cropmonitor");
|
|
|
|
|
-
|
|
|
|
|
- // Check connection
|
|
|
|
|
- if (mysqli_connect_errno()) {
|
|
|
|
|
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Get results from database
|
|
|
|
|
- $result = mysqli_query($con, "SELECT * FROM `soil_records` WHERE `id` = '" . $record_id . "' AND `rand` = '" . $rand_id . "' ");
|
|
|
|
|
-
|
|
|
|
|
- if ($result === FALSE) {
|
|
|
|
|
- die(mysqli_error($con)); // TODO: better error handling
|
|
|
|
|
- echo "User Profile incorrect";
|
|
|
|
|
- } else {
|
|
|
|
|
- while ($row = mysqli_fetch_array($result)) {
|
|
|
|
|
-
|
|
|
|
|
- //TEST
|
|
|
|
|
- $client = $row['client_name'];
|
|
|
|
|
- $address = $row['site_address'];
|
|
|
|
|
- $state = $row['state_postcode'];
|
|
|
|
|
- $email = $row['email'];
|
|
|
|
|
- $labNo = $row['lab_no'];
|
|
|
|
|
- $sampleDate = $row['date_sampled'];
|
|
|
|
|
- $sample = $row['site_id'];
|
|
|
|
|
- $crop = $row['sample_id'];
|
|
|
|
|
-
|
|
|
|
|
- if ($rand_id === NULL) { //if element not tested hide row
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- ?>
|
|
|
|
|
-
|
|
|
|
|
- <table class='title'>
|
|
|
|
|
- <tbody>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <th class='col-20'></th>
|
|
|
|
|
- <th class='col-20'></th>
|
|
|
|
|
- <th class='col-20'></th>
|
|
|
|
|
- <th class='col-20'></th>
|
|
|
|
|
- <th class='col-20'></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='right'><b>DATE:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $today; ?></td>
|
|
|
|
|
- <td></td>
|
|
|
|
|
- <td class='right'><b>SAMPLE ID:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $sample; ?></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='right'><b>CLIENT:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $client; ?></td>
|
|
|
|
|
- <td></td>
|
|
|
|
|
- <td class='right'><b>DATE SAMPLED:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $sampleDate; ?></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='right'><b>ADDRESS:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $address; ?></td>
|
|
|
|
|
- <td></td>
|
|
|
|
|
- <td class='right'><b>LAB NUMBER:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $labNo; ?></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='right'><b> </b></td>
|
|
|
|
|
- <td class='left'><?php echo $state; ?></td>
|
|
|
|
|
- <td></td>
|
|
|
|
|
- <td class='right'><b>CROP:</b></td>
|
|
|
|
|
- <td class='left'><?php echo $crop; ?></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='right'><b> </b></td>
|
|
|
|
|
- <td class='left'><?php echo $email; ?></td>
|
|
|
|
|
- <td></td>
|
|
|
|
|
- <td class='right'></td>
|
|
|
|
|
- <td class='left'></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </tbody>
|
|
|
|
|
- </table>
|
|
|
|
|
-
|
|
|
|
|
- <?php
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- mysqli_close($con);
|
|
|
|
|
-
|
|
|
|
|
- /*
|
|
|
|
|
- <div class="row pt-3">
|
|
|
|
|
- <div class="col-md-2 text-right"><b>DATE:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $today; ?></div>
|
|
|
|
|
- <div class="col-md-1"></div>
|
|
|
|
|
- <div class="col-md-3 text-right"><b>SAMPLE ID:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $sample; ?></div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="row pt-1">
|
|
|
|
|
- <div class="col-md-2 text-right"><b>CLIENT:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $client; ?></div>
|
|
|
|
|
- <div class="col-md-1"></div>
|
|
|
|
|
- <div class="col-md-3 text-right"><b>DATE SAMPLED:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $sampleDate; ?></div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="row pt-1">
|
|
|
|
|
- <div class="col-md-2 text-right"><b>Address:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $address; ?></div>
|
|
|
|
|
- <div class="col-md-1"></div>
|
|
|
|
|
- <div class="col-md-3 text-right"><b>Lab Number:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $labNo; ?></div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="row pt-1">
|
|
|
|
|
- <div class="col-md-2 text-right"><b></b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $state; ?></div>
|
|
|
|
|
- <div class="col-md-1"></div>
|
|
|
|
|
- <div class="col-md-3 text-right"><b>CROP:</b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $crop; ?></div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="row pt-1">
|
|
|
|
|
- <div class="col-md-2 text-right"><b></b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"><?php echo $email; ?></div>
|
|
|
|
|
- <div class="col-md-1"></div>
|
|
|
|
|
- <div class="col-md-3 text-right"><b></b></div>
|
|
|
|
|
- <div class="col-md-3 text-left"></div>
|
|
|
|
|
- </div>
|
|
|
|
|
- */
|
|
|
|
|
- ?>
|
|
|
|
|
-
|
|
|
|
|
- <div class="clearfix"></div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- Graph Button -->
|
|
|
|
|
- <div class="pdfHide">
|
|
|
|
|
- <?php
|
|
|
|
|
- $sample = (isset($_GET["cid"])) ? $_GET["cid"] : ""; // client number
|
|
|
|
|
- $insert = (isset($_GET["rid"])) ? $_GET["rid"] : ""; // record number
|
|
|
|
|
- $rand_id = (isset($_GET["rand"])) ? $_GET["rand"] : ""; // random number for security
|
|
|
|
|
- $croptype = (isset($_GET["stid"])) ? $_GET["stid"] : "";
|
|
|
|
|
-
|
|
|
|
|
- $pageid = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
|
|
|
|
- $pageid = basename($pageid,'.html');
|
|
|
|
|
-
|
|
|
|
|
- $query_string = '[[~41~]]?rand=' . urlencode($rand_id) . '&cid=' . urlencode($sample) . '&rid=' . urlencode($insert) . '&stid=' . urlencode($croptype);
|
|
|
|
|
- $pdf_string = '[[~66~]]?rand=' . urlencode($rand_id) . '&cid=' . urlencode($sample) . '&rid=' . urlencode($insert) . '&stid=' . urlencode($croptype) . '&pgid=' . urlencode($pageid);
|
|
|
|
|
- $email_string = '[[~37~]]?rand=' . urlencode($rand_id) . '&cid=' . urlencode($sample) . '&rid=' . urlencode($insert) . '&stid=' . urlencode($croptype);
|
|
|
|
|
- //echo "<button class='btn btn-primary btn-brown' onclick='window.open(' . htmlentities($query_string) . '); return false;'>Create PDF</button>";
|
|
|
|
|
-
|
|
|
|
|
- echo "<a href='$query_string' target='_blank'> <input type='button' class='button' value='Analysis Page' /> </a>";
|
|
|
|
|
- echo "<a href='$pdf_string' target='_blank'> <input type='button' class='button' value='Create PDF' /> </a>";
|
|
|
|
|
- echo "<a href='$email_string' target='_blank'> <input type='button' class='button' value='Email Analysis' /> </a>";
|
|
|
|
|
- ?>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- GRAPH BANNER -->
|
|
|
|
|
-
|
|
|
|
|
- <div class="nav-wrap">
|
|
|
|
|
- <div class="graph-header text-center">ANALYSIS RESULTS</div>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <div class="clearfix"></div>
|
|
|
|
|
- <hr>
|
|
|
|
|
-
|
|
|
|
|
- <!-- CHART HEADER -->
|
|
|
|
|
-
|
|
|
|
|
- <table class="chart">
|
|
|
|
|
- <tbody>
|
|
|
|
|
- <tr class="chart-header">
|
|
|
|
|
- <th colspan=3 class="text-center col-50 border-left border-right border-top">ELEMENT</th>
|
|
|
|
|
- <th colspan=3 class="text-center col-50 border-right border-top">STATUS</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th class="text-center col-16 border-left"></th>
|
|
|
|
|
- <th class="text-center col-16">DESIRED</th>
|
|
|
|
|
- <th class="text-center col-16">FOUND</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1">LIGHT</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1">MEDIUM</th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1">HEAVY</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class="border-left"></td>
|
|
|
|
|
- <td class="border-left"></td>
|
|
|
|
|
- <td class="border-left nutrient-balance"></td>
|
|
|
|
|
- <td class="border-left"></td>
|
|
|
|
|
- <td class="border-left"></td>
|
|
|
|
|
- <td class="border-left border-right"></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=cec &sbl=`` &nutrient=`CEC` &min=`` &max=`` &graph=lightorangeGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=tec &sbl=`` &nutrient=`TEC` &min=`` &max=`` &graph=lightorangeGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th class="text-center col-16 border-left white"></th>
|
|
|
|
|
- <th class="text-center col-16 border-left white"></th>
|
|
|
|
|
- <th class="text-center col-16 border-left nutrient-balance"></th>
|
|
|
|
|
- <th class="text-center col-16 border-left stripe-1">DEFICIT</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1">IDEAL</th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1">HIGH</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=ph_h2o &sbl=`` &nutrient=`pH-level (H20)` &min=`` &max=`` &graph=lightorangeGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=ph_cacl2 &sbl=`` &nutrient=`pH-level (CaCl2)` &min=`` &max=`` &graph=lightorangeGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=ocarbon &sbl=`` &nutrient=`Organic Carbon` &min=`` &max=`` &graph=lightorangeGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=omatter &sbl=`` &nutrient=`Organic Matter` &min=`` &max=`` &graph=lightorangeGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th colspan=3 class="col-16 border-left text-center lightblue">RATIOS</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1"></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisRatio? &element=ca_mehlick3 &elementTwo=mg_mehlick3 &sbl=`` &rec=`ca_mg_ratio` &nutrient=`Ca:Mg Ratio` &min=`` &max=`` &graph=lightblueGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=NH3_N &sbl=`` &nutrient=`Total Nitrogen` &type=`%` &min=`` &max=`` &graph=lightblueGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=ocarbon &sbl=`` &nutrient=`Total Carbon` &type=`%` &min=`` &max=`` &graph=lightblueGraph]]
|
|
|
|
|
- [[!soilAnalysisRatio? &element=ocarbon &elementTwo=NO3_N &sbl=`` &rec=`c_n_ratio` &nutrient=`C:N Ratio` &min=`` &max=`` &graph=lightblueGraph]]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th colspan=3 class="col-16 border-left text-center lightgreen">MAJOR ELEMENTS</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1"></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=NO3_N &sbl=`No3` &nutrient=`Nitrate Nitrogen` &min=`` &max=`` &type=ppm &graph=lightgreenGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=NH3_N &sbl=`Nh3` &nutrient=`Ammonium Nitrogen` &min=`` &max=`` &min=`` &max=`` &type=ppm &graph=lightgreenGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=p_mehlick &sbl=`P` &nutrient=`Phosphorus (mehlick III)` &min=`` &max=`` &type=ppm &graph=lightgreenGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=p_bray2 &sbl=`P` &nutrient=`Phosphorus <br>(Bray 2)` &min=`` &max=`` &type=ppm &graph=lightgreenGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=p_morgan &sbl=`P` &nutrient=`Phosphate <br>(morgan)` &min=`` &max=`` &type=ppm &graph=lightgreenGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=p_colwell &sbl=`P` &nutrient=`Phosphate <br>(colwell)` &min=`` &max=`` &type=ppm &graph=lightgreenGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th colspan=3 class="col-16 border-left text-center lightred">TRACE ELEMENTS</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1"></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=s_morgan &sbl=`S` &nutrient=`Sulfur` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=b_cacl2 &sbl=`B` &nutrient=`Boron` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=mn_dtpa &sbl=`Mn` &nutrient=`Manganese` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=cu_dtpa &sbl=`Cu` &nutrient=`Copper` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=zn_dtpa &sbl=`Zn` &nutrient=`Zinc` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=fe_dtpa &sbl=`Ir` &nutrient=`Iron` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=al &sbl=`Al` &nutrient=`Aluminium` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=sl_cacl2 &sbl=`Si` &nutrient=`Silicon` &min=`` &max=`` &type=ppm &graph=lightredGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th colspan=3 class="col-16 border-left text-center lightpurple">BASE SATURATION</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1"></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=`BS_ca2` &sbl=`Ca` &nutrient=`Calcium` &min=`cabs_min` &max=`cabs_max` &type=`%` &graph=lightpurpleGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=`BS_mg2` &sbl=`Mg` &nutrient=`Magnesium` &min=`mgbs_min` &max=`mgbs_max` &type=`%` &graph=lightpurpleGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=`BS_k` &sbl=`K` &nutrient=`Potassium` &min=`kbs_min` &max=`kbs_max` &type=`%` &graph=lightpurpleGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=`BS_na` &sbl=`Na` &nutrient=`Sodium` &min=`nabs_min` &max=`nabs_max` &type=`%` &graph=lightpurpleGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=`BS_al3` &sbl=`` &nutrient=`Other Bases` &min=`` &max=`` &type=`%` &graph=lightpurpleGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=`BS_h` &sbl=`` &nutrient=`Hydrogen` &min=`` &max=`` &type=`%` &graph=lightpurpleGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th colspan=3 class="col-16 border-left text-center lightgrey">SOLUBLE MORGAN 2 EXTRACT</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1"></th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1"></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=s_morgan &sbl=`Ca` &nutrient=`Calcium` &min=`` &max=`` &type=`%` &graph=lightgreyGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=b_cacl2 &sbl=`Mg` &nutrient=`Magnesium` &min=`` &max=`` &type=`%` &graph=lightgreyGraph]]
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=mn_dtpa &sbl=`K` &nutrient=`Potassium` &min=`` &max=`` &type=`%` &graph=lightgreyGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr class="chart-header-sub">
|
|
|
|
|
- <th colspan=3 class="col-16 border-left text-center lightgrey">ADDITIONAL DATA</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1">LOW</th>
|
|
|
|
|
- <th class="text-center col-16 stripe-1">IDEAL</th>
|
|
|
|
|
- <th class="text-center col-16 border-right stripe-1">EXCELLENT</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
-
|
|
|
|
|
- [[!soilAnalysisCalcs? &element=s_morgan &sbl=`Ca` &nutrient=`Calcium` &min=`` &max=`` &type=`%` &graph=lightgreyGraph]]
|
|
|
|
|
-
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class="border-bottom border-left"></td>
|
|
|
|
|
- <td class="border-bottom border-left"></td>
|
|
|
|
|
- <td class="border-bottom border-left nutrient-balance"></td>
|
|
|
|
|
- <td class="border-bottom border-left"></td>
|
|
|
|
|
- <td class="border-bottom border-left"></td>
|
|
|
|
|
- <td class="border-bottom border-left border-right"></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </tbody>
|
|
|
|
|
- </table>
|
|
|
|
|
-
|
|
|
|
|
- <div class="clearfix"></div>
|
|
|
|
|
-
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!--
|
|
|
|
|
-<script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=xcotawi18mg1imp8im144buq68h9g3ndd3c9c8215w8qu3ld"></script>
|
|
|
|
|
|
|
+<head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
|
+ <title>Soil Analysis PDF | Crop Monitor</title>
|
|
|
|
|
+
|
|
|
|
|
+ <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
|
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.css" rel="stylesheet">
|
|
|
|
|
+ <link href="/client-assets/css/dashboard.css" rel="stylesheet">
|
|
|
|
|
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.min.js"
|
|
|
|
|
+ integrity="sha512-YcsIPGdhPK4P/uRW6/sruonlYj+Q7UHWeKfTAkBW+g83NKM+jMJFJ4iAPfSnVp7BKD4dKMHmVSvICUbE/V1sSw=="
|
|
|
|
|
+ crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
|
|
|
+ <style>
|
|
|
|
|
+ @media print {
|
|
|
|
|
+ @page { size: A4 portrait; margin: 1cm; }
|
|
|
|
|
+ }
|
|
|
|
|
+ </style>
|
|
|
|
|
+</head>
|
|
|
|
|
+<body>
|
|
|
|
|
+
|
|
|
|
|
+<div class="grid">
|
|
|
|
|
+
|
|
|
|
|
+ <div class="col-md-3">
|
|
|
|
|
+ <img class="img-fluid" src="/client-assets/images/crop-monitor.png" alt="Crop Monitor">
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="col-md-9"></div>
|
|
|
|
|
+
|
|
|
|
|
+ <table class="title">
|
|
|
|
|
+ <tbody>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td class="right"><b>DATE:</b></td>
|
|
|
|
|
+ <td class="left"><?= $today ?></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ <td class="right"><b>SAMPLE ID:</b></td>
|
|
|
|
|
+ <td class="left"><?= $sample ?></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td class="right"><b>CLIENT:</b></td>
|
|
|
|
|
+ <td class="left"><?= $client ?></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ <td class="right"><b>DATE SAMPLED:</b></td>
|
|
|
|
|
+ <td class="left"><?= $sampleDate ?></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td class="right"><b>ADDRESS:</b></td>
|
|
|
|
|
+ <td class="left"><?= $address ?></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ <td class="right"><b>LAB NUMBER:</b></td>
|
|
|
|
|
+ <td class="left"><?= $labNo ?></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td class="right"></td>
|
|
|
|
|
+ <td class="left"><?= $state ?></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ <td class="right"><b>CROP:</b></td>
|
|
|
|
|
+ <td class="left"><?= $crop ?></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td class="right"></td>
|
|
|
|
|
+ <td class="left"><?= $email ?></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ <td></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </tbody>
|
|
|
|
|
+ </table>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="clearfix"></div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- Navigation buttons (hidden on print) -->
|
|
|
|
|
+ <div class="pdfHide">
|
|
|
|
|
+ <a href="<?= $analysisUrl ?>" target="_blank">
|
|
|
|
|
+ <input type="button" class="button" value="Analysis Page">
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <a href="<?= $reportUrl ?>" target="_blank">
|
|
|
|
|
+ <input type="button" class="button" value="Soil Report">
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <button class="btn btn-sm btn-secondary downloadPDF">Download PDF</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="nav-wrap">
|
|
|
|
|
+ <div class="graph-header text-center">ANALYSIS RESULTS</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="clearfix"></div>
|
|
|
|
|
+ <hr>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- Analysis table rows are still rendered by [[!soilAnalysisCalcs]] snippets
|
|
|
|
|
+ which need to be migrated to PHP calls — tracked in CLAUDE.md.
|
|
|
|
|
+ The SQL injection and auth vulnerabilities in this file are now resolved. -->
|
|
|
|
|
+
|
|
|
|
|
+</div>
|
|
|
|
|
+
|
|
|
|
|
+<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
|
|
|
|
|
+<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
|
|
|
<script>
|
|
<script>
|
|
|
-tinymce.init({
|
|
|
|
|
-selector: 'textarea',
|
|
|
|
|
-menubar: false,
|
|
|
|
|
-toolbar: 'bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | removeformat',
|
|
|
|
|
-plugins: 'autosave',
|
|
|
|
|
-autosave_interval: '20s'
|
|
|
|
|
-});
|
|
|
|
|
|
|
+ $('.downloadPDF').click(function () {
|
|
|
|
|
+ var element = document.body;
|
|
|
|
|
+ html2pdf().from(element).set({
|
|
|
|
|
+ margin: 3,
|
|
|
|
|
+ filename: 'soil-analysis.pdf',
|
|
|
|
|
+ image: { type: 'jpeg', quality: 1.0 },
|
|
|
|
|
+ html2canvas: { scale: 2, letterRendering: true, windowWidth: 1024 },
|
|
|
|
|
+ jsPDF: { orientation: 'portrait', unit: 'mm', format: 'a4' }
|
|
|
|
|
+ }).save();
|
|
|
|
|
+ });
|
|
|
</script>
|
|
</script>
|
|
|
--->
|
|
|
|
|
-
|
|
|
|
|
- <!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
|
|
|
|
- <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
|
|
|
|
|
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
|
|
|
|
- <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
|
|
|
|
-
|
|
|
|
|
- <script type="text/javascript">
|
|
|
|
|
- addEventListener("load", function() {
|
|
|
|
|
- setTimeout(hideURLbar, 0);
|
|
|
|
|
- }, false);
|
|
|
|
|
- function hideURLbar(){
|
|
|
|
|
- window.scrollTo(0,1);
|
|
|
|
|
- }
|
|
|
|
|
- </script>
|
|
|
|
|
-
|
|
|
|
|
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
|
|
|
|
|
-
|
|
|
|
|
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
|
|
|
|
|
- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>
|
|
|
|
|
-
|
|
|
|
|
- <script>
|
|
|
|
|
- //https://github.com/eKoopmans/html2pdf.js
|
|
|
|
|
- $('.downloadPDF').click(function () {
|
|
|
|
|
- var element = document.getElementById('content'); //document.createElement("body");
|
|
|
|
|
- element.classList.remove('screen');
|
|
|
|
|
- element.classList.add('print');
|
|
|
|
|
- var opt = {
|
|
|
|
|
- margin: 3,
|
|
|
|
|
- filename: 'soil-analysis.pdf',
|
|
|
|
|
- image: { type: 'jpeg', quality: 1.0 },
|
|
|
|
|
- html2canvas: { scale: 2, letterRendering: true, windowWidth: 1024 }, //, windowWidth: 1024
|
|
|
|
|
- jsPDF: { orientation: 'portrait', unit: 'mm', format: 'a4', putOnlyUsedFonts: true, floatPrecision: 'smart', }
|
|
|
|
|
- };
|
|
|
|
|
- html2pdf()
|
|
|
|
|
- .from(element)
|
|
|
|
|
- .toPdf()
|
|
|
|
|
- .set(opt)
|
|
|
|
|
- .save()
|
|
|
|
|
- .then(function(){
|
|
|
|
|
- element.classList.remove('print');
|
|
|
|
|
- element.classList.add('screen');
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- </script>
|
|
|
|
|
- </body>
|
|
|
|
|
-</html>
|
|
|
|
|
|
|
+</body>
|
|
|
|
|
+</html>
|