2026-02-14 07:57:18 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require_once ("tcpdf/tcpdf.php");
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
// ======================
|
|
|
|
|
// Print Selected Permits
|
|
|
|
|
// ======================
|
2026-02-14 07:57:18 -05:00
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
class Print_Selected_Permits extends Base {
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
// Variables.
|
|
|
|
|
|
|
|
|
|
private $output_type = "normal";
|
|
|
|
|
|
|
|
|
|
// ==================
|
|
|
|
|
// Class Constructor.
|
|
|
|
|
// ==================
|
|
|
|
|
|
|
|
|
|
public function __construct($output_type = "normal") {
|
|
|
|
|
|
|
|
|
|
set_error_handler(array($this, "displayError"));
|
|
|
|
|
|
|
|
|
|
date_default_timezone_set(self::TIMEZONE);
|
|
|
|
|
|
|
|
|
|
$this->output_type = $output_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================
|
|
|
|
|
// Print the Report
|
|
|
|
|
// ================
|
|
|
|
|
|
|
|
|
|
public function print() {
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$report = new Permit_Print();
|
2026-02-14 07:57:18 -05:00
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$report->selected_permits = explode(",", $_SESSION[self::REPORTS_POST]["selected_permits"]);
|
2026-02-14 07:57:18 -05:00
|
|
|
$report->output_type = $this->output_type;
|
|
|
|
|
|
|
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
|
|
if ($this->output_type == "string") {
|
|
|
|
|
return $report->render();
|
|
|
|
|
} else {
|
|
|
|
|
$report->render();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==========================
|
|
|
|
|
// Class to Generate the .pdf
|
|
|
|
|
// ==========================
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
class Permit_Print extends TCPDF {
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
public $selected_permits = array();
|
|
|
|
|
public $permit_serial = 0;
|
2026-02-14 07:57:18 -05:00
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
// Process each Selected Work Order
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
foreach ($this->selected_permits as $this->permit_serial) {
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
// Get the data for the report
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$Permit = new Permits();
|
2026-02-14 07:57:18 -05:00
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$permit = $Permit->getPermit($this->permit_serial);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
// Set report defaults
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->title = "Print Permit Record";
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri");
|
|
|
|
|
$this->SetMargins(10, 26, 10);
|
|
|
|
|
$this->SetHeaderMargin(10);
|
|
|
|
|
$this->SetFooterMargin(10);
|
|
|
|
|
$this->setCellPaddings(0, 0, 0, 0);
|
|
|
|
|
$this->setCellMargins(2, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
$this->addPage("P", "LETTER");
|
|
|
|
|
|
|
|
|
|
// -------------------
|
2026-04-04 19:14:39 -04:00
|
|
|
// Permit Record Details
|
2026-02-14 07:57:18 -05:00
|
|
|
// -------------------
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$permit = $permit->record ?? "";
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Permit Facts ID:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_permit_facts_id, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Entry Date:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_entry_date_verbose, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Permit Number:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_permit_number, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Permit Date:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_permit_date_verbose, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Project Address:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_permit_project_addr, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Subdivision Name:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_sub_div_name, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Project Type:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_project_type, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Company", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_company, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Address:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, "{$permit->permit_address} {$permit->permit_city}, {$permit->permit_state} {$permit->permit_zip}", 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Phone:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->$permit->permit_phone_verbose, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Project City:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_phone_verbose, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Project State:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_project_state, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Size:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_intersection_namepermit_size, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Units:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_size, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Building Type:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_building_type, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Value:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_building_type, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "County:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_county, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Work Type", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, "$permit->permit_work_type", 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Lot:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_lot, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Dist/LL", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, "$permit->permit_dist_ll", 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "CTL:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_ct1, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->Ln(6);
|
|
|
|
|
|
|
|
|
|
$this->Line($this->GetX(), $this->GetY(), $this->GetX() + 195, $this->GetY());
|
|
|
|
|
|
|
|
|
|
$this->Ln(2);
|
|
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Owner Name:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_owner_name, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Address", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, "{$permit->permit_owner_address} {$permit->permit_owner_city}, {$permit->permit_owner_state} {$permit->permit_owner_zip}", 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Owner Phone:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_owner_phone, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "Address", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_owner_phone, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$this->Ln(2);
|
|
|
|
|
|
|
|
|
|
$this->Line($this->GetX(), $this->GetY(), $this->GetX() + 195, $this->GetY());
|
|
|
|
|
|
|
|
|
|
$this->Ln(2);
|
|
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "YTD Permits:", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_ytd_permits, 0, 0, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
$this->SetFont("Calibri", "B", 10);
|
|
|
|
|
$this->Cell(25, 0, "YTD Value", 0, 0, "L", false, "", 3);
|
|
|
|
|
$this->SetFont("Calibri", "", 10);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(65, 0, $permit->permit_ytd_value, 0, 1, "L", false, "", 3);
|
2026-02-14 07:57:18 -05:00
|
|
|
// ----------------------------
|
|
|
|
|
// Rectangle around the Details
|
|
|
|
|
// ----------------------------
|
|
|
|
|
|
|
|
|
|
$this->RoundedRect(10, 24, 195, $this->GetY() - 22, 1.50, "1111");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
|
// Return the pdf
|
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
|
|
if ($this->output_type == "string") {
|
2026-04-04 19:14:39 -04:00
|
|
|
return $this->Output("PermitRecord.pdf", "S");
|
2026-02-14 07:57:18 -05:00
|
|
|
} else {
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Output("PermitRecord.pdf");
|
2026-02-14 07:57:18 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ======
|
|
|
|
|
// Header
|
|
|
|
|
// ======
|
|
|
|
|
|
|
|
|
|
public function Header() {
|
|
|
|
|
|
|
|
|
|
$this->setCellPaddings(0, 0, 0, 0);
|
|
|
|
|
$this->setCellMargins(2, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
$this->Image("images/dec-international-logo.png", 10, 10, 20, 8);
|
|
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "B", 16);
|
|
|
|
|
|
|
|
|
|
$this->Cell(0, 6, "DEC International", 0, 0, "C");
|
|
|
|
|
$this->Ln(6);
|
2026-04-04 19:14:39 -04:00
|
|
|
$this->Cell(0, 6, "Permit Record", 0, 1, "C");
|
2026-02-14 07:57:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ======
|
|
|
|
|
// Footer
|
|
|
|
|
// ======
|
|
|
|
|
|
|
|
|
|
public function Footer() {
|
|
|
|
|
|
|
|
|
|
$this->SetFont("Calibri", "I", 8);
|
|
|
|
|
|
|
|
|
|
$X = $this->GetX();
|
|
|
|
|
|
|
|
|
|
$this->Cell(0, 10, "DEC International", 0, false, "C");
|
|
|
|
|
|
|
|
|
|
$this->SetX($X);
|
|
|
|
|
|
|
|
|
|
$this->Cell(40, 10, "Page " . $this->getAliasNumPage() . "/" . $this->getAliasNbPages(), 0, false, "L");
|
|
|
|
|
$this->Cell(0, 10, date("n/j/Y 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|