Files
atlhousingreport/reports/Print_Selected_RDIs.php
T

311 lines
11 KiB
PHP
Raw Normal View History

<?php
require_once ("tcpdf/tcpdf.php");
// ==========================
// Print Selected Work Orders
// ==========================
class Print_Selected_RDIs extends Base {
// 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() {
$report = new RDI_Print();
$report->selected_rdis = explode(",", $_SESSION[self::REPORTS_POST]["selected_rdis"]);
$report->output_type = $this->output_type;
ob_clean();
if ($this->output_type == "string") {
return $report->render();
} else {
$report->render();
}
}
}
// ==========================
// Class to Generate the .pdf
// ==========================
class RDI_Print extends TCPDF {
// Variables
public $selected_rdis = array();
public $rdi_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);
// Process each Selected Work Order
foreach ($this->selected_rdis as $this->rdi_serial) {
// Get the data for the report
$RDI = new RDI();
$rdi = $RDI->getRDI($this->rdi_serial);
// Set report defaults
$this->title = "Print RDI Record";
$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");
// -------------------
// RDI Record Details
// -------------------
$rdi = $rdi->record ?? "";
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Permit Facts ID:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_permit_facts_id, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Entry Date:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_entry_date_verbose, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Permit Number:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_permit_number, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Permit Date:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_permit_date_verbose, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Project Address:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_rdi_project_addr, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Subdivision Name:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_sub_div_name, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Project Type:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_project_type, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Company", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_company, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Address:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, "{$rdi->rdi_address} {$rdi->rdi_city}, {$rdi->rdi_state} {$rdi->rdi_zip}", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Phone:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->$rdi->rdi_phone_verbose, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Project City:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_phone_verbose, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Project State:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_project_state, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Size:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_intersection_namerdi_size, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Units:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_size, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Building Type:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_building_type, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Value:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_building_type, 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "County:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_county, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Work Type", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, "$rdi->rdi_work_type", 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Lot:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_lot, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Dist/LL", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, "$rdi->rdi_dist_ll", 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "CTL:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_ct1, 0, 0, "L", false, "", 3);
$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);
$this->Cell(65, 0, $rdi->rdi_owner_name, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Address", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, "{$rdi->rdi_owner_address} {$rdi->rdi_owner_city}, {$rdi->rdi_owner_state} {$rdi->rdi_owner_zip}", 0, 1, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Owner Phone:", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_owner_phone, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "Address", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_owner_phone, 0, 1, "L", false, "", 3);
$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);
$this->Cell(65, 0, $rdi->rdi_ytd_permits, 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "B", 10);
$this->Cell(25, 0, "YTD Value", 0, 0, "L", false, "", 3);
$this->SetFont("Calibri", "", 10);
$this->Cell(65, 0, $rdi->rdi_ytd_value, 0, 1, "L", false, "", 3);
// ----------------------------
// Rectangle around the Details
// ----------------------------
$this->RoundedRect(10, 24, 195, $this->GetY() - 22, 1.50, "1111");
}
// --------------
// Return the pdf
// --------------
if ($this->output_type == "string") {
return $this->Output("RDIRecord.pdf", "S");
} else {
$this->Output("RDIRecord.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, 10, 20, 8);
$this->SetFont("Calibri", "B", 16);
$this->Cell(0, 6, "DEC International", 0, 0, "C");
$this->Ln(6);
$this->Cell(0, 6, "RDI Record", 0, 1, "C");
}
// ======
// 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);
}
}
?>