Compare commits
10 Commits
3de8593785
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ad65224d6 | |||
| 3cd9af2fcc | |||
| 21916796b4 | |||
| 8fa2c69094 | |||
| e5bc35af18 | |||
| c8f713707f | |||
| 72883612e8 | |||
| eac8845f5d | |||
| b2d214f4be | |||
| 3285360d75 |
+1
-1
@@ -128,7 +128,7 @@ class Base {
|
||||
$host = 'localhost';
|
||||
} else {
|
||||
$host = '192.168.1.190';
|
||||
$host = '100.67.215.67';
|
||||
// $host = '100.67.215.67';
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -102,7 +102,7 @@ class PermitsByBuilder extends Base {
|
||||
// Ensure valid order by column
|
||||
$allowed_order_columns = ["permit_permit_number", "permit_entry_date", "permit_permit_date", "permit_company", "permit_permit_count"];
|
||||
if (!in_array($permits_order_by, $allowed_order_columns)) {
|
||||
$permits_order_by = "order by view_permits.permit_company";
|
||||
$permits_order_by = " view_permits.permit_company";
|
||||
}
|
||||
|
||||
// Connect to DB
|
||||
|
||||
@@ -340,9 +340,6 @@ class PermitsBySubdivision extends Base {
|
||||
$statement->bindValue(":limit", $this->pagination_size, PDO::PARAM_INT);
|
||||
$statement->bindValue(":offset", $offset, PDO::PARAM_INT);
|
||||
|
||||
// echo $projecttype;
|
||||
// die();
|
||||
|
||||
$statement->execute();
|
||||
|
||||
$permits = $this->getTableXML("permits", $statement);
|
||||
@@ -368,44 +365,118 @@ class PermitsBySubdivision extends Base {
|
||||
// Fetch All Permits for Exports
|
||||
// =============================
|
||||
|
||||
public function getAllPermitsBySubDivision($permit_area, $projecttype) {
|
||||
public function getAllPermitsBySubdivision($permit_area, $projecttype, $searchcriteria = array()) {
|
||||
|
||||
$connection = $this->connect();
|
||||
$searchcriteria = is_array($searchcriteria) ? $searchcriteria : [];
|
||||
|
||||
$conditions = ["r.permit_project_type = :permit_project_type"];
|
||||
$parameters = [":permit_project_type" => [$projecttype, PDO::PARAM_STR]];
|
||||
|
||||
// County can be posted as [6, 7] or as a comma-separated string
|
||||
$countyValues = $searchcriteria["permit_county"] ?? [];
|
||||
if (!is_array($countyValues)) {
|
||||
$countyValues = explode(",", (string) $countyValues);
|
||||
}
|
||||
|
||||
$countyIds = [];
|
||||
foreach ($countyValues as $countyValue) {
|
||||
$countyValue = trim((string) $countyValue);
|
||||
if ($countyValue !== "" && ctype_digit($countyValue)) {
|
||||
$countyIds[] = (int) $countyValue;
|
||||
}
|
||||
}
|
||||
$countyIds = array_values(array_unique($countyIds));
|
||||
|
||||
if ($permit_area != "All") {
|
||||
$conditions[] = "r.permit_county in (
|
||||
select county_serial
|
||||
from view_counties
|
||||
where county_area = :permit_area )";
|
||||
$parameters[":permit_area"] = [$permit_area, PDO::PARAM_STR];
|
||||
}
|
||||
|
||||
if ($countyIds) {
|
||||
$countyPlaceholders = [];
|
||||
foreach ($countyIds as $index => $countyId) {
|
||||
$placeholder = ":permit_county_{$index}";
|
||||
$countyPlaceholders[] = $placeholder;
|
||||
$parameters[$placeholder] = [$countyId, PDO::PARAM_INT];
|
||||
}
|
||||
$conditions[] = "r.permit_county in (" . implode(", ", $countyPlaceholders) . ")";
|
||||
}
|
||||
|
||||
$textFilters = [
|
||||
"permit_company" => "permit_company",
|
||||
"permit_sub_div_name" => "permit_sub_div_name",
|
||||
"permit_project_city" => "permit_project_city",
|
||||
"permit_project_addr" => "permit_project_addr"
|
||||
];
|
||||
|
||||
foreach ($textFilters as $criteriaKey => $column) {
|
||||
$value = trim((string) ($searchcriteria[$criteriaKey] ?? ""));
|
||||
if ($value !== "") {
|
||||
$placeholder = ":{$criteriaKey}";
|
||||
$conditions[] = "r.{$column} like {$placeholder}";
|
||||
$parameters[$placeholder] = ["%{$value}%", PDO::PARAM_STR];
|
||||
}
|
||||
}
|
||||
|
||||
$normalizeDate = static function ($value) {
|
||||
$value = trim((string) $value);
|
||||
if ($value === "") {
|
||||
return null;
|
||||
}
|
||||
$timestamp = strtotime($value);
|
||||
return $timestamp === false ? null : date("Y-m-d", $timestamp);
|
||||
};
|
||||
|
||||
$dateRanges = [
|
||||
["permit_entry_date", "permit_entry_start_date", "permit_entry_end_date"],
|
||||
["permit_permit_date", "permit_permit_start_date", "permit_permit_end_date"]
|
||||
];
|
||||
|
||||
foreach ($dateRanges as [$column, $startKey, $endKey]) {
|
||||
$startDate = $normalizeDate($searchcriteria[$startKey] ?? "");
|
||||
$endDate = $normalizeDate($searchcriteria[$endKey] ?? "");
|
||||
|
||||
if ($startDate !== null) {
|
||||
$conditions[] = "r.{$column} >= :{$startKey}";
|
||||
$parameters[":{$startKey}"] = [$startDate, PDO::PARAM_STR];
|
||||
}
|
||||
if ($endDate !== null) {
|
||||
$conditions[] = "r.{$column} <= :{$endKey}";
|
||||
$parameters[":{$endKey}"] = [$endDate, PDO::PARAM_STR];
|
||||
}
|
||||
}
|
||||
|
||||
$where = implode(" and ", $conditions);
|
||||
|
||||
$bindParameters = static function ($statement) use ($parameters) {
|
||||
foreach ($parameters as $placeholder => [$value, $type]) {
|
||||
$statement->bindValue($placeholder, $value, $type);
|
||||
}
|
||||
};
|
||||
|
||||
// Count Query
|
||||
$SQL = "select count(*) as count
|
||||
from view_permits r
|
||||
join counties c on r.permit_county = c.county_serial
|
||||
where r.permit_project_type = :permit_project_type
|
||||
and r.permit_county in
|
||||
(select county_serial
|
||||
from view_counties
|
||||
where county_area = :permit_area)";
|
||||
where {$where}";
|
||||
|
||||
$statement = $connection->prepare($SQL);
|
||||
|
||||
$statement->bindValue(":permit_project_type", $projecttype, PDO::PARAM_STR);
|
||||
$statement->bindValue(":permit_area", $permit_area, PDO::PARAM_STR);
|
||||
|
||||
$bindParameters($statement);
|
||||
$statement->execute();
|
||||
|
||||
$recordset = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
$count = $recordset ? (int) $recordset["count"] : 0;
|
||||
|
||||
// === DATA QUERY ===
|
||||
$SQL = "select r.*, c.county_name as permit_county_name_verbose
|
||||
$SQL = "select r.*, c.county_name as county_name_verbose
|
||||
from view_permits r
|
||||
join counties c on r.permit_county = c.county_serial
|
||||
where r.permit_project_type = :permit_project_type
|
||||
and r.permit_county in
|
||||
(select county_serial
|
||||
from view_counties
|
||||
where county_area = :permit_area)";
|
||||
where {$where}
|
||||
order by c.county_name, r.permit_sub_div_name";
|
||||
|
||||
$statement = $connection->prepare($SQL);
|
||||
|
||||
$statement->bindValue(":permit_project_type", $projecttype, PDO::PARAM_STR);
|
||||
$statement->bindValue(":permit_area", $permit_area, PDO::PARAM_STR);
|
||||
|
||||
$bindParameters($statement);
|
||||
$statement->execute();
|
||||
|
||||
$permits = $this->getTableXML("permits", $statement);
|
||||
|
||||
@@ -529,9 +529,6 @@ class Process_ImportRequest {
|
||||
|
||||
$settings = new SimpleXMLElement((file_exists("./xml/settings.xml") ? file_get_contents("./xml/settings.xml") : "<settings/>"));
|
||||
|
||||
print_r($settings);
|
||||
die();
|
||||
|
||||
// Server Variables
|
||||
$host = (string) $settings->SmtpServer;
|
||||
$username = (string) $settings->SmtpUserName;
|
||||
|
||||
@@ -757,6 +757,19 @@ class Users extends Base {
|
||||
|
||||
return $this->getTable("loginactivity", $SQL);
|
||||
}
|
||||
|
||||
// ====================
|
||||
// Return a User Object
|
||||
// ====================
|
||||
|
||||
public function getActiveUsers() {
|
||||
|
||||
$SQL = "select view_users.*
|
||||
from view_users
|
||||
where view_users.user_active = true";
|
||||
|
||||
return $this->getTable("activeusers", $SQL);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -204,8 +204,6 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// ====================
|
||||
// Autocomplete Searches
|
||||
// ====================
|
||||
@@ -529,6 +527,23 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
// // ------------------------
|
||||
// // Export All Permits - PDF
|
||||
// // ------------------------
|
||||
//
|
||||
// $(".btnExportAllPDF").on("click", function (e) {
|
||||
//
|
||||
// e.preventDefault();
|
||||
//
|
||||
// window.open("", "PrintTab");
|
||||
//
|
||||
// $("input[name = 'action']", "#PrintAllPermitsBySubdivisionPDFForm").val("print");
|
||||
// $("input[name = 'subscription_serial']", "#PrintAllPermitsBySubdivisionPDFForm").val($sessionStorage.subscription_serial);
|
||||
// $("input[name = 'subscription_serial']", "#PrintAllPermitsBySubdivisionPDFForm").val($sessionStorage.subscription_serial);
|
||||
// $("#PrintAllPermitsBySubdivisionPDFForm").submit();
|
||||
//
|
||||
// });
|
||||
|
||||
// ------------------------
|
||||
// Export All Permits - PDF
|
||||
// ------------------------
|
||||
@@ -537,14 +552,55 @@ $(document).ready(function () {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const $printForm = $("#PrintAllPermitsBySubdivisionPDFForm");
|
||||
const $searchForm = $("#searchPermitsBySubdivision");
|
||||
|
||||
// Remove fields added by a previous PDF export.
|
||||
$printForm.find(".print-search-field").remove();
|
||||
|
||||
// Copy populated search criteria into the PDF form.
|
||||
$searchForm.find(":input[name]").not(":button, :submit, :reset").not("[name='action']").not("[name='subscription_serial']").each(function () {
|
||||
|
||||
const $input = $(this);
|
||||
const fieldName = $input.attr("name");
|
||||
|
||||
// Ignore unchecked checkboxes and radio buttons.
|
||||
if (($input.is(":checkbox") || $input.is(":radio")) && !$input.is(":checked")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let values = $input.val();
|
||||
|
||||
if (values === null || values === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Supports multiple-select inputs.
|
||||
if (!Array.isArray(values)) {
|
||||
values = [values];
|
||||
}
|
||||
|
||||
$.each(values, function (_, value) {
|
||||
|
||||
value = String(value).trim();
|
||||
|
||||
if (value === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
$("<input>", {type: "hidden", name: fieldName, value: value, class: "print-search-field"}).appendTo($printForm);
|
||||
});
|
||||
});
|
||||
|
||||
$printForm.find("[name='action']").val("print");
|
||||
$printForm.find("[name='subscription_serial']").val($sessionStorage.subscription_serial);
|
||||
|
||||
window.open("", "PrintTab");
|
||||
|
||||
$("input[name = 'action']", "#PrintAllPermitsBySubdivisionPDFForm").val("print");
|
||||
$("input[name = 'subscription_serial']", "#PrintAllPermitsBySubdivisionPDFForm").val($sessionStorage.subscription_serial);
|
||||
$("#PrintAllPermitsBySubdivisionPDFForm").submit();
|
||||
|
||||
$printForm.trigger("submit");
|
||||
});
|
||||
|
||||
|
||||
|
||||
// --------------------------
|
||||
// Export All Permits - Excel
|
||||
// --------------------------
|
||||
|
||||
@@ -32,7 +32,7 @@ class Export_AllPermitsBySubdivision_CSV extends Base {
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype);
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype, $_POST);
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="All_PermitsBySubdivision.csv"');
|
||||
@@ -47,19 +47,19 @@ class Export_AllPermitsBySubdivision_CSV extends Base {
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$county_name = $permit->rdi_county_name_verbose;
|
||||
$subdivision = $permit->rdi_sub_div_name;
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city} {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
$city = $permit->rdi_city;
|
||||
$builder = $permit->rdi_company;
|
||||
$permit_date = $permit->rdi_permit_date_verbose;
|
||||
$square_footage = $permit->rdi_size_verbose;
|
||||
$value = $permit->rdi_value_verbose;
|
||||
$county_name = $permit->county_name_verbose;
|
||||
$subdivision = $permit->permit_sub_div_name;
|
||||
$address = "{$permit->permit_address} {$permit->permit_city} {$permit->permit_state} {$permit->permit_zip}";
|
||||
$city = $permit->permit_city;
|
||||
$builder = $permit->permit_company;
|
||||
$permit_date = $permit->permit_permit_date_verbose;
|
||||
$square_footage = $permit->permit_size_verbose;
|
||||
$value = $permit->permit_value_verbose;
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->permit_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->permit_value, 2);
|
||||
|
||||
$permit_data = array($county_name, $subdivision, $address, $city, $builder, $permit_date, $square_footage, $value);
|
||||
$permit_data = array($county_name, $subdivision, $address, $city, $builder, $permit_date, $square_footage, $value);
|
||||
|
||||
fputcsv($output, $permit_data, ',', '"', '\\');
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class Export_AllPermitsBySubdivision_Excel extends Base {
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype);
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype, $_POST);
|
||||
|
||||
// Create the Spreadsheet.
|
||||
|
||||
@@ -89,16 +89,16 @@ class Export_AllPermitsBySubdivision_Excel extends Base {
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
$address = "{$permit->permit_address} {$permit->permit_city}, {$permit->permit_state} {$permit->permit_zip}";
|
||||
|
||||
$spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permit->rdi_county_name_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("B" . $row, (string) $permit->rdi_sub_div_name);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permit->county_name_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("B" . $row, (string) $permit->permit_sub_div_name);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("C" . $row, (string) $address);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("D" . $row, (string) $permit->rdi_city);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("E" . $row, (string) $permit->rdi_company);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("F" . $row, (string) $permit->rdi_permit_date_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("G" . $row, (string) $permit->rdi_size_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("H" . $row, (string) $permit->rdi_value_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("D" . $row, (string) $permit->permit_city);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("E" . $row, (string) $permit->permit_company);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("F" . $row, (string) $permit->permit_permit_date_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("G" . $row, (string) $permit->permit_size_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("H" . $row, (string) $permit->permit_value_verbose);
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ================================
|
||||
// Print Active Users Subscriptions
|
||||
// ================================
|
||||
|
||||
class Print_ActiveUserSubscriptions extends Base {
|
||||
|
||||
// ==================
|
||||
// Class Constructor.
|
||||
// ==================
|
||||
|
||||
public function __construct($output_type = "normal") {
|
||||
|
||||
set_error_handler(array($this, "displayError"));
|
||||
|
||||
date_default_timezone_set(self::TIMEZONE);
|
||||
}
|
||||
|
||||
// ================
|
||||
// Print the Report
|
||||
// ================
|
||||
|
||||
public function print($output_type = "normal") {
|
||||
|
||||
$report = new ActiveUserSubscriptions();
|
||||
|
||||
$report->output_type = $output_type;
|
||||
|
||||
ob_clean();
|
||||
|
||||
if ($output_type == "string") {
|
||||
return $report->render();
|
||||
} else {
|
||||
$report->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// Class to Generate the .pdf
|
||||
// ==========================
|
||||
|
||||
class ActiveUserSubscriptions extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $user_serial = 0;
|
||||
public $first_page = true;
|
||||
public $output_type = "normal";
|
||||
|
||||
// ================
|
||||
// Debug an Object.
|
||||
// ================
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
|
||||
// =================
|
||||
// Render the Report
|
||||
// =================
|
||||
|
||||
public function render() {
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$users = (new Users())->getActiveUsers();
|
||||
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "Active User Subscriptions";
|
||||
|
||||
$this->SetFont("Calibri");
|
||||
$this->SetMargins(10, 25, 10);
|
||||
$this->SetHeaderMargin(10);
|
||||
$this->SetFooterMargin(10);
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->addPage("P", "LETTER");
|
||||
|
||||
// --------------------------
|
||||
// Active Users Subscriptions
|
||||
// --------------------------
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
$user_serial = (integer) $user->user_serial;
|
||||
$user_name = (string) $user->user_name;
|
||||
$users_login = (string) $user->user_login_verbose ?: 'Never Logged In';
|
||||
|
||||
$subscriptions = (new Subscriptions())->getUsersActiveSubscriptions($user_serial);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Name:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_client_name, 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Created:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_created_verbose, 0, 1, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Main Email:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_email, 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Created By:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_creator, 0, 1, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "User Name:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_name, 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Changed", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_changed_verbose, 0, 1, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Roll:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_role, 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Changed By:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_changer, 0, 1, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Change Password:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$user_change_password = ($user->user_change_password == 1) ? "Yes" : "No";
|
||||
|
||||
$this->Cell(80, 0, $user_change_password, 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Last Login:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, $user->user_login_verbose, 0, 1, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
$this->Cell(80, 0, "", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
$this->Cell(25, 0, "Active Status:", 0, 0, "L", false, "", 3);
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$user_active = ($user->user_active == 1) ? "Active" : "Inactive";
|
||||
$this->Cell(80, 0, $user_active, 0, 1, "L", false, "", 3);
|
||||
|
||||
// ----------------------------------
|
||||
// Rectangle around the Users Details
|
||||
// ----------------------------------
|
||||
|
||||
$this->RoundedRect(10, 23, 190, $this->GetY() - 21, 1.50, "1111");
|
||||
|
||||
// -------------
|
||||
// Subscriptions
|
||||
// -------------
|
||||
$this->Ln(7);
|
||||
|
||||
$this->SetFont("Calibri", "B", 12);
|
||||
$this->Cell(0, 0, "Subscriptions", 0, 1, "L", false, "", 3);
|
||||
$this->Ln(3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(75, 0, "Description", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "End Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "Status", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
|
||||
if ($subscriptions->count() == 0) {
|
||||
|
||||
$this->Cell(0, 0, "There are no Active Subscriptions...", 0, 1, "L", false, "", 3);
|
||||
} else {
|
||||
|
||||
foreach ($subscriptions as $subscription) {
|
||||
|
||||
$this->Cell(75, 0, $subscription->subscription_title . " " . $subscription->subscription_description, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, $subscription->usersubscription_stop_date_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, $subscription->usersubscription_status, 0, 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln(4);
|
||||
|
||||
if ($this->GetY() > 265) {
|
||||
|
||||
$this->AddPage("P", "LETTER");
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(75, 0, "Description", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "End Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "Status", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->addPage("P", "LETTER");
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("ActiveUserSubscriptions.pdf", "S");
|
||||
} else {
|
||||
$this->Output("ActiveUserSubscriptions.pdf");
|
||||
}
|
||||
}
|
||||
|
||||
// ======
|
||||
// Header
|
||||
// ======
|
||||
|
||||
public function Header() {
|
||||
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->Image('images/dec-international-logo.png', 10, 7, 25, 10);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(0, 6, "Active Users Subscriptions", 0, 1, "C");
|
||||
|
||||
$this->Ln(5);
|
||||
}
|
||||
|
||||
// ======
|
||||
// Footer
|
||||
// ======
|
||||
|
||||
public function Footer() {
|
||||
|
||||
$this->SetFont("Calibri", "I", 8);
|
||||
|
||||
$X = $this->GetX();
|
||||
|
||||
$this->Cell(0, 10, "DEC-International, LLC", 0, false, "C");
|
||||
|
||||
$this->SetX($X);
|
||||
|
||||
$this->Cell(40, 10, "Page " . $this->getAliasNumPage() . "/" . $this->getAliasNbPages(), 0, false, "L");
|
||||
$this->Cell(0, 10, date("Y-m-d g:i A"), 0, false, "R");
|
||||
}
|
||||
|
||||
// =======================
|
||||
// Stripe the printed line
|
||||
// =======================
|
||||
|
||||
private function stripeLine($pRowCount = 0, $pRowWidth = 0) {
|
||||
|
||||
$this->SetFillColor(($pRowCount % 2) ? 220 : 255);
|
||||
$X = $this->GetX();
|
||||
$this->Cell($pRowWidth, 0, "", 0, 0, "L", true);
|
||||
$this->SetX($X);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -57,6 +57,7 @@ class AllPermitsBySubdivision_Print extends TCPDF {
|
||||
public $subscription_serial = 0;
|
||||
public $first_page = true;
|
||||
public $output_type = "normal";
|
||||
public $record_count = 0;
|
||||
|
||||
// ================
|
||||
// Debug an Object.
|
||||
@@ -99,7 +100,9 @@ class AllPermitsBySubdivision_Print extends TCPDF {
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype);
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype, $_POST);
|
||||
|
||||
$this->record_count = count($permits);
|
||||
|
||||
// -------
|
||||
// Permits
|
||||
@@ -141,16 +144,16 @@ class AllPermitsBySubdivision_Print extends TCPDF {
|
||||
$this->stripeLine($rowCount, 268);
|
||||
$rowCount++;
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
$address = "{$permit->permit_address} {$permit->permit_city}, {$permit->permit_state} {$permit->permit_zip}";
|
||||
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->permit_value, 2);
|
||||
|
||||
$this->Cell(15, 0, $permit->rdi_county_name_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, $permit->rdi_sub_div_name, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->county_name_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, $permit->permit_sub_div_name, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, $address, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, $permit->rdi_company, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, $permit->rdi_permit_date_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->rdi_size, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, $permit->permit_company, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, $permit->permit_permit_date_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->permit_size_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, $permit_value, 0, 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln(4);
|
||||
@@ -186,6 +189,8 @@ class AllPermitsBySubdivision_Print extends TCPDF {
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->Ln(6);
|
||||
$this->Cell(0, 0, "Records Returned: " . $this->record_count, "", 0, "R", false, "", 3);
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ===========================
|
||||
// Print a User Login Activity
|
||||
// ===========================
|
||||
|
||||
class Print_UserLoginActivity extends Base {
|
||||
|
||||
// ==================
|
||||
// Class Constructor.
|
||||
// ==================
|
||||
|
||||
public function __construct($output_type = "normal") {
|
||||
|
||||
set_error_handler(array($this, "displayError"));
|
||||
|
||||
date_default_timezone_set(self::TIMEZONE);
|
||||
}
|
||||
|
||||
// ================
|
||||
// Print the Report
|
||||
// ================
|
||||
|
||||
public function print($output_type = "normal") {
|
||||
|
||||
$report = new User_LoginActivity();
|
||||
|
||||
$report->output_type = $output_type;
|
||||
|
||||
ob_clean();
|
||||
|
||||
if ($output_type == "string") {
|
||||
return $report->render();
|
||||
} else {
|
||||
$report->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// Class to Generate the .pdf
|
||||
// ==========================
|
||||
|
||||
class User_LoginActivity extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $user_serial = 0;
|
||||
public $first_page = true;
|
||||
public $output_type = "normal";
|
||||
|
||||
// ================
|
||||
// Debug an Object.
|
||||
// ================
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
|
||||
// =================
|
||||
// Render the Report
|
||||
// =================
|
||||
|
||||
public function render() {
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$users = (new Users())->getUsers();
|
||||
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "All Users Login Activity";
|
||||
|
||||
$this->SetFont("Calibri");
|
||||
$this->SetMargins(10, 30, 10);
|
||||
$this->SetHeaderMargin(10);
|
||||
$this->SetFooterMargin(10);
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->addPage("P", "LETTER");
|
||||
|
||||
// ------------------------
|
||||
// Print the Users Activity
|
||||
// ------------------------
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
$this->stripeLine($rowCount, 60);
|
||||
|
||||
$rowCount++;
|
||||
|
||||
$user_name = (string) $user->user_name;
|
||||
$users_login = (string) $user->user_login_verbose ?: 'Never Logged In';
|
||||
|
||||
$this->Cell(20, 0, $user_name, 0, 0, "C", false, "", 0);
|
||||
$this->Cell(20, 0, $users_login, 0, 0, "L", false, "", 0);
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("UserLoginActivity.pdf", "S");
|
||||
} else {
|
||||
$this->Output("UserLoginActivity.pdf");
|
||||
}
|
||||
}
|
||||
|
||||
// ======
|
||||
// Header
|
||||
// ======
|
||||
|
||||
public function Header() {
|
||||
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->Image('images/dec-international-logo.png', 10, 7, 25, 10);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(0, 6, "Users Login Activity", 0, 1, "C");
|
||||
|
||||
$this->Ln(5);
|
||||
|
||||
$this->SetFont("Calibri", "B", 12);
|
||||
|
||||
$this->Cell(20, 0, "User Name", "B", 0, "C", false, "", 3);
|
||||
$this->Cell(50, 0, "Last Login", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
}
|
||||
|
||||
// ======
|
||||
// Footer
|
||||
// ======
|
||||
|
||||
public function Footer() {
|
||||
|
||||
$this->SetFont("Calibri", "I", 8);
|
||||
|
||||
$X = $this->GetX();
|
||||
|
||||
$this->Cell(0, 10, "DEC-International, LLC", 0, false, "C");
|
||||
|
||||
$this->SetX($X);
|
||||
|
||||
$this->Cell(40, 10, "Page " . $this->getAliasNumPage() . "/" . $this->getAliasNbPages(), 0, false, "L");
|
||||
$this->Cell(0, 10, date("Y-m-d g:i A"), 0, false, "R");
|
||||
}
|
||||
|
||||
// =======================
|
||||
// Stripe the printed line
|
||||
// =======================
|
||||
|
||||
private function stripeLine($pRowCount = 0, $pRowWidth = 0) {
|
||||
|
||||
$this->SetFillColor(($pRowCount % 2) ? 220 : 255);
|
||||
$X = $this->GetX();
|
||||
$this->Cell($pRowWidth, 0, "", 0, 0, "L", true);
|
||||
$this->SetX($X);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# -- Development --
|
||||
cd /var/www/html/clients/dec-international/ahrhousingreport
|
||||
#cd /var/www/html/clients/dec-international/atlhousingreport
|
||||
# -- Production --
|
||||
#cd /var/www/html/webapps/dec-international/ahrhousingreport
|
||||
cd /var/www/html/webapps/dec-international/atlhousingreport
|
||||
php ./scripts/ImportRequest_Worker.php
|
||||
|
||||
|
||||
@@ -24,11 +24,15 @@ $SQL = "create view view_permits as
|
||||
trends.permits_trend,
|
||||
|
||||
trends.prev_ytd_value as previous_ytd_value,
|
||||
trends.ytd_value
|
||||
trends.ytd_value,
|
||||
|
||||
counties.county_name as county_name_verbose
|
||||
|
||||
from permits
|
||||
|
||||
join view_company_permit_trends as trends
|
||||
on permits.permit_company = trends.permit_company";
|
||||
on permits.permit_company = trends.permit_company
|
||||
|
||||
join counties
|
||||
on permits.permit_county = counties.county_serial";
|
||||
?>
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
<div class="col-lg-4 mb-3">
|
||||
<label class="form-label" for="permit_county">County</label>
|
||||
<select class="form-control form-control-sm multiple-dropdown" multiple="multiple" name="permit_county" id="permit_county" size="1">
|
||||
<select class="form-control form-control-sm multiple-dropdown" multiple="multiple" name="permit_county[]" id="permit_county" size="1">
|
||||
<xsl:apply-templates select="//counties"/>
|
||||
</select>
|
||||
</div>
|
||||
@@ -364,7 +364,7 @@
|
||||
|
||||
<input type="hidden" name="action" value="print"/>
|
||||
<input type="hidden" name="report" value="Print_All_PermitsBySubdivision"/>
|
||||
<input type="hidden" name="subscription_serial" value="{{//subscriptions/record/subscription_serial}}"/>
|
||||
<input type="hidden" name="subscription_serial" value="{//subscriptions/record/subscription_serial}"/>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -372,10 +372,10 @@
|
||||
|
||||
<form style="display:inline;" id="PrintSelectedPermitsBySubdivisionForm" method="post" action="" target="PrintTab">
|
||||
|
||||
<input type="hidden" name="action" value="print"/>
|
||||
<input type="hidden" name="report" value="Print_Selected_PermitsBySubdivision"/>
|
||||
<input type="hidden" name="selected_permits" value=""/>
|
||||
<input type="hidden" name="subscription_serial" value="{{//subscriptions/record/subscription_serial}}"/>
|
||||
<input type="hidden" name="action" value="print"/>
|
||||
<input type="hidden" name="report" value="Print_Selected_PermitsBySubdivision"/>
|
||||
<input type="hidden" name="selected_permits" value=""/>
|
||||
<input type="hidden" name="subscription_serial" value="{//subscriptions/record/subscription_serial}"/>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user