first commit
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
// ====================
|
||||
// Export Permits - CSV
|
||||
// ====================
|
||||
|
||||
class Export_PermitFactsToCSV extends Base {
|
||||
|
||||
// Variables
|
||||
|
||||
private $current_user_serial = 0;
|
||||
private $current_user_id = "";
|
||||
private $current_user_name = "";
|
||||
private $current_user_email = "";
|
||||
|
||||
// ==================
|
||||
// Class Constructor.
|
||||
// ==================
|
||||
|
||||
public function __construct() {
|
||||
|
||||
set_error_handler(array($this, "displayError"));
|
||||
|
||||
date_default_timezone_set(self::TIMEZONE);
|
||||
|
||||
$this->current_user_serial = $_SESSION[self::USER_SERIAL] ?? 0;
|
||||
$this->current_user_id = $_SESSION[self::USER_ID] ?? "";
|
||||
$this->current_user_name = $_SESSION[self::USER_NAME] ?? "";
|
||||
$this->current_user_email = $_SESSION[self::USER_EMAIL] ?? "";
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Export the Data
|
||||
// ===============
|
||||
|
||||
public function export() {
|
||||
|
||||
$subscription_serial = $_SESSION['subscription_serial'];
|
||||
$usersubscription_serial = $_SESSION['usersubscription_serial'];
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
if ($subscription->count() === 0) {
|
||||
$this->logError("Invalid Subscription ({$subscription_serial}): " . __METHOD__);
|
||||
}
|
||||
|
||||
$userssubscription = (new Users())->getUserSubscription($usersubscription_serial);
|
||||
|
||||
$user_subscription_start_date = $userssubscription->record->usersubscription_start_date;
|
||||
$user_subscription_end_date = $userssubscription->record->usersubscription_end_date;
|
||||
|
||||
$permits = (new PermitFacts())->getPermitFactsPage($user_subscription_start_date, $user_subscription_end_date);
|
||||
|
||||
$filename = "{$subscription->record->subscription_full_title}.csv";
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header("Content-Disposition: attachment; filename=\"{$filename}\"");
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Add CSV headers
|
||||
|
||||
$header_array_legacy = [
|
||||
'PermitFactsID', 'EntryDate', 'PermitNum', 'PermitDate', 'ProjectAddr', 'ProjectName',
|
||||
'ProjectType', 'ProjectCity', 'ProjectState', 'ProjectZip', 'Company', 'Address',
|
||||
'City', 'State', 'Zip', 'Phone', 'Size', 'Value', 'WorkType',
|
||||
'BldgType', 'County', 'Lot_BLK', 'Dist_LL', 'OwnerName', 'OwnerAddress',
|
||||
'OwnerCity', 'OwnerState', 'OwnerZip', 'OwnerPhone'
|
||||
];
|
||||
|
||||
fputcsv($output, $header_array_legacy, ',', '"', '\\');
|
||||
|
||||
$header_array = [
|
||||
'permitfact_legacy_id', 'permitfact_entry_date_verbose', 'permitfact_permit_number', 'permitfact_permit_date_verbose', 'permitfact_project_address', 'permitfact_project_name',
|
||||
'permitfact_project_type_verbose', 'project_city_verbose', 'permitfact_project_state', 'permitfact_project_zip', 'permitfact_company', 'permitfact_address',
|
||||
'permitfact_city_verbose', 'permitfact_state', 'permitfact_zip', 'permitfact_phone', 'permitfact_size', 'permitfact_value', 'permitfact_work_type_verbose',
|
||||
'permitfact_building_type_verbose', 'permitfact_county_name_verbose', 'permitfact_lot_block', 'permitfact_dist_ll', 'permitfact_owner_name', 'permitfact_owner_address',
|
||||
'owner_city_verbose', 'permitfact_owner_state', 'permitfact_owner_zip', 'permitfact_owner_phone'
|
||||
];
|
||||
|
||||
foreach ($permits->record as $permit) {
|
||||
|
||||
$row = [];
|
||||
|
||||
foreach ($header_array as $field) {
|
||||
|
||||
// Cast SimpleXML nodes safely; empty nodes become ""
|
||||
$row[] = isset($permit->$field) ? trim((string) $permit->$field) : '';
|
||||
}
|
||||
|
||||
fputcsv($output, $row, ',', '"', '\\');
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
// ==================================
|
||||
// Export Recreationa lLicenses - CSV
|
||||
// ==================================
|
||||
|
||||
class Export_SelectedRecreationalLicenses_CSV extends Base {
|
||||
|
||||
// ==================
|
||||
// Class Constructor.
|
||||
// ==================
|
||||
|
||||
public function __construct() {
|
||||
|
||||
set_error_handler(array($this, "displayError"));
|
||||
|
||||
date_default_timezone_set(self::TIMEZONE);
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Export the Data
|
||||
// ===============
|
||||
|
||||
public function export() {
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
$selected_licenses = filter_input(INPUT_POST, "selected_licenses") ?: "";
|
||||
|
||||
$licenses = (new FWCLicenses())->getSelectedLicenses($selected_licenses);
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="Selected_RecreationalLicenses.csv"');
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Add CSV headers
|
||||
fputcsv($output, ['lastname', 'firstname', 'Gender', 'ethnicity', 'county', 'city', 'licence_type', 'start_date', 'expire_date'], ',', '"', '\\');
|
||||
|
||||
foreach ($licenses as $license) {
|
||||
|
||||
$last_name = $license->license_last_name;
|
||||
$first_name = $license->license_first_name;
|
||||
$address = "{$license->license_street1} {$license->license_city}, {$license->license_state} {$license->license_zip_code}";
|
||||
$phone_number = $this->formatPhoneNumber($license->license_phone_number);
|
||||
$email_address = $license->license_email_address;
|
||||
$gender = $license->license_gender;
|
||||
$ethnicity = $license->license_ethnicity;
|
||||
$county = $license->license_county;
|
||||
|
||||
$license_data = array($last_name, $first_name, $address, $phone_number, $email_address, $gender, $ethnicity, $county);
|
||||
|
||||
fputcsv($output, $license_data, ',', '"', '\\');
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,343 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ===============================
|
||||
// Print Recreational Licenses PDF
|
||||
// ===============================
|
||||
|
||||
class Print_SearchedResidentialLicensesPDF 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 SearchedResidentialLicenses_Print();
|
||||
|
||||
$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 SearchedResidentialLicenses_Print extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $report_header_title = "";
|
||||
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);
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($this->subscription_serial);
|
||||
|
||||
if ($subscription->count() === 0) {
|
||||
$this->logError("Invalid Subscription ({$this->subscription_serial}): " . __METHOD__);
|
||||
}
|
||||
|
||||
$userssubscription = (new Users())->getUserSubscription($this->usersubscription_serial);
|
||||
|
||||
$user_subscription_start_date = $userssubscription->record->usersubscription_start_date;
|
||||
$user_subscription_end_date = $userssubscription->record->usersubscription_end_date;
|
||||
|
||||
// Set report defaults
|
||||
$this->report_header_title = $subscription->record->subscription_full_title;
|
||||
$this->title = $subscription->record->subscription_full_title;
|
||||
|
||||
$this->SetFont("Calibri");
|
||||
$this->SetMargins(2, 26, 10);
|
||||
$this->SetHeaderMargin(10);
|
||||
$this->SetFooterMargin(10);
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
// $this->addPage("L", "LETTER");
|
||||
|
||||
$card = function (float $x, float $y, float $w, float $h, array $d) {
|
||||
|
||||
// Card background + border
|
||||
$this->SetDrawColor(210, 210, 210);
|
||||
$this->SetFillColor(250, 250, 250);
|
||||
$this->Rect($x, $y, $w, $h, 'DF');
|
||||
|
||||
// Header bar
|
||||
$headerH = 10;
|
||||
$this->SetFillColor(30, 93, 168); // Bootstrap-ish primary
|
||||
$this->Rect($x, $y, $w, $headerH, 'F');
|
||||
|
||||
// Header text
|
||||
$this->SetTextColor(255, 255, 255);
|
||||
$this->SetFont('helvetica', 'B', 11);
|
||||
$this->SetXY($x + 3, $y + 2.5);
|
||||
$this->Cell($w - 6, 0, "Project Name: {$d['permitfact_project_name']}", 0, 0, 'L', false);
|
||||
|
||||
// Body
|
||||
$this->SetTextColor(20, 20, 20);
|
||||
$this->SetFont('helvetica', '', 9);
|
||||
|
||||
$padX = 3;
|
||||
$padY = 3;
|
||||
|
||||
$curY = $y + $headerH + $padY;
|
||||
|
||||
$bodyX = $x + $padX;
|
||||
$bodyW = $w - ($padX * 2);
|
||||
|
||||
$colGap = 6;
|
||||
$colW = ($bodyW - $colGap) / 2;
|
||||
|
||||
$leftX = $bodyX;
|
||||
$rightX = $bodyX + $colW + $colGap;
|
||||
|
||||
$labelW = 22; // tweak to taste
|
||||
|
||||
$row2 = function (string $l1, string $v1, string $l2, string $v2) use (&$curY, $leftX, $rightX, $colW, $labelW) {
|
||||
$yStart = $curY;
|
||||
|
||||
// LEFT cell
|
||||
$this->SetXY($leftX, $yStart);
|
||||
$this->SetFont('helvetica', 'B', 9);
|
||||
$this->Cell($labelW, 0, $l1, 0, 0, 'L');
|
||||
$this->Cell(2, 0, '', 0, 0); // spacer
|
||||
$this->SetFont('helvetica', '', 9);
|
||||
$this->MultiCell($colW - $labelW, 0, $v1, 0, 'L', false, 1);
|
||||
$yAfterLeft = $this->GetY();
|
||||
|
||||
// RIGHT cell (reset to same starting Y)
|
||||
$this->SetXY($rightX, $yStart);
|
||||
$this->SetFont('helvetica', 'B', 9);
|
||||
$this->Cell($labelW, 0, $l2, 0, 0, 'L');
|
||||
$this->SetFont('helvetica', '', 9);
|
||||
$this->MultiCell($colW - $labelW, 0, $v2, 0, 'L', false, 1);
|
||||
$yAfterRight = $this->GetY();
|
||||
|
||||
// Advance cursor to max height used
|
||||
$curY = max($yAfterLeft, $yAfterRight) + 1;
|
||||
};
|
||||
|
||||
// Two-column rows (swap these however you like)
|
||||
$row2('Permit Number: ', $d['permitfact_permit_number'], 'Permit Date:', $d['permitfact_permit_date']);
|
||||
$row2('Project Address: ', $d['permitfact_project_address'], 'Project Type:', $d['permitfact_project_type']);
|
||||
$row2('City/State/Zip:', $d['permitfact_project_city_state_zip'], 'Work Type:', $d['permitfact_work_type']);
|
||||
$row2('Project County:', $d['permitfact_county_name'], 'Building Type:', $d['permitfact_building_type']);
|
||||
$row2('', '', 'Value:', $d['permitfact_value']);
|
||||
$row2('Company:', $d['permitfact_company'], 'Entry Date:', $d['permitfact_entry_date']);
|
||||
$row2('Address:', $d['permitfact_company_address'], '', '');
|
||||
$row2('City/State/Zip:', $d['permitfact_company_city_state_zip'], '', '');
|
||||
$row2('Company Phone:', $d['permitfact_company_phone'], '', '');
|
||||
$row2('', '', '', '');
|
||||
$row2('Owner:', $d['permitfact_owner_name'], '', '');
|
||||
$row2('Owner Phone:', $d['permitfact_owner_phone'], '', '');
|
||||
|
||||
// $row2('Project Name:', $d['permitfact_project_name'], 'Entry Date:', $d['permitfact_entry_date']);
|
||||
};
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$permits = (new PermitFacts())->getPermitFactsPage($user_subscription_start_date, $user_subscription_end_date);
|
||||
|
||||
$this->AddPage('L', 'LETTER');
|
||||
|
||||
$marginL = 10;
|
||||
$marginT = 20; // below header area
|
||||
$pageW = $this->getPageWidth();
|
||||
$pageH = $this->getPageHeight();
|
||||
|
||||
$usableW = $pageW - ($marginL * 2);
|
||||
$usableH = $pageH - $marginT - 12; // leave footer space
|
||||
|
||||
$gapY = 6;
|
||||
|
||||
// Two rows per page
|
||||
$cardW = $usableW;
|
||||
$cardH = ($usableH - $gapY) / 2;
|
||||
|
||||
$index = 0;
|
||||
|
||||
foreach ($permits->record as $permit) {
|
||||
|
||||
// Add a new page every 2 cards
|
||||
if ($index > 0 && $index % 2 === 0) {
|
||||
$this->AddPage('L', 'LETTER');
|
||||
}
|
||||
|
||||
$slot = $index % 2;
|
||||
|
||||
$x = $marginL;
|
||||
$y = $marginT + ($slot * ($cardH + $gapY));
|
||||
|
||||
// Map your XML fields to the card placeholders (use verbose)
|
||||
$valueRaw = trim((string) $permit->permitfact_value);
|
||||
$value = ($valueRaw !== '') ? '$' . number_format((float) $valueRaw, 2) : '';
|
||||
|
||||
$d = [
|
||||
// Left Side of Card
|
||||
'permitfact_serial' => trim((string) $permit->permitfact_serial),
|
||||
'permitfact_project_name' => trim((string) $permit->permitfact_project_name),
|
||||
'permitfact_permit_number' => trim((string) $permit->permitfact_permit_number),
|
||||
'permitfact_project_address' => trim((string) $permit->permitfact_project_address),
|
||||
'permitfact_project_city_state_zip' => trim((string) $permit->project_city_verbose) . ', ' . trim((string) $permit->permitfact_project_state) . ' ' . trim((string) $permit->permitfact_project_zip),
|
||||
'permitfact_county_name' => trim((string) $permit->permitfact_county_name_verbose),
|
||||
'permitfact_company' => trim((string) $permit->permitfact_company),
|
||||
'permitfact_company_address' => trim((string) $permit->permitfact_address),
|
||||
'permitfact_company_city_state_zip' => trim((string) $permit->permitfact_city_verbose) . ', ' . trim((string) $permit->permitfact_state) . ' ' . trim((string) $permit->permitfact_zip),
|
||||
'permitfact_company_phone' => $this->formatPhoneNumber(trim((string) $permit->permitfact_phone)),
|
||||
'permitfact_owner_name' => trim((string) $permit->permitfact_owner_name),
|
||||
'permitfact_owner_phone' => $this->formatPhoneNumber(trim((string) $permit->permitfact_owner_phone)),
|
||||
// Right Side of Card
|
||||
'permitfact_permit_date' => trim((string) $permit->permitfact_permit_date_verbose),
|
||||
'permitfact_entry_date' => trim((string) $permit->permitfact_entry_date_verbose),
|
||||
'permitfact_project_type' => trim((string) $permit->permitfact_project_type_verbose),
|
||||
'permitfact_value' => $value,
|
||||
'permitfact_building_type' => trim((string) $permit->permitfact_building_type_verbose),
|
||||
'permitfact_work_type' => trim((string) $permit->permitfact_work_type_verbose),
|
||||
];
|
||||
|
||||
$card($x, $y, $cardW, $cardH, $d);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
|
||||
// -----------------
|
||||
// Render the Report
|
||||
// -----------------
|
||||
|
||||
$this->SetFont('helvetica', '', 9);
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("{$subscription->record->subscription_full_title}.pdf", "S");
|
||||
} else {
|
||||
$this->Output("{$subscription->record->subscription_full_title}.pdf");
|
||||
}
|
||||
}
|
||||
|
||||
// ======
|
||||
// Header
|
||||
// ======
|
||||
|
||||
public function Header() {
|
||||
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->Image("images/dec-international-logo.png", 250, 8, 20, 8);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(4, 0, "", 0, 0, "L");
|
||||
$this->Cell(0, 0, $this->report_header_title . " Report", 0, 0, "L");
|
||||
|
||||
$this->Ln(10);
|
||||
}
|
||||
|
||||
// ======
|
||||
// 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);
|
||||
}
|
||||
|
||||
// =======================
|
||||
// Format Raw Phone Number
|
||||
// =======================
|
||||
|
||||
public function formatPhoneNumber(string $phonenumber): string {
|
||||
|
||||
// Remove everything except digits
|
||||
$digits = preg_replace('/\D+/', '', $phonenumber);
|
||||
|
||||
// Handle leading country code (US)
|
||||
if (strlen($digits) === 11 && str_starts_with($digits, '1')) {
|
||||
$digits = substr($digits, 1);
|
||||
}
|
||||
|
||||
// // Must be exactly 10 digits to format
|
||||
// if (strlen($digits) !== 10) {
|
||||
// return $phonenumber; // return original if invalid
|
||||
// }
|
||||
|
||||
return substr($digits, 0, 3) . '-' .
|
||||
substr($digits, 3, 3) . '-' .
|
||||
substr($digits, 6, 4);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,323 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ============================
|
||||
// Print a User Summary Sheet
|
||||
// ============================
|
||||
|
||||
class Print_UserSummary 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($user_serial = 0, $output_type = "normal") {
|
||||
|
||||
$report = new User_Summary();
|
||||
|
||||
$report->user_serial = $_SESSION[self::REPORTS_POST]["user_serial"] ?? $user_serial;
|
||||
|
||||
$report->output_type = $output_type;
|
||||
|
||||
ob_clean();
|
||||
|
||||
if ($output_type == "string") {
|
||||
return $report->render();
|
||||
} else {
|
||||
$report->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// Class to Generate the .pdf
|
||||
// ==========================
|
||||
|
||||
class User_Summary 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
|
||||
|
||||
$user = (new Users())->getUser($this->user_serial);
|
||||
|
||||
if ($user->count() == 0) {
|
||||
$this->logError("Invalid User ({$this->user_serial}). " . __METHOD__);
|
||||
}
|
||||
|
||||
$usernotes = (new Notes())->getAllNotes($this->user_serial);
|
||||
$subscriptions = (new Subscriptions())->getUsersSubscriptions($this->user_serial);
|
||||
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "User Summary Sheet";
|
||||
|
||||
$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");
|
||||
|
||||
// ----------------------
|
||||
// User Summary Details
|
||||
// ----------------------
|
||||
|
||||
$user = $user->record ?? "";
|
||||
|
||||
$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");
|
||||
|
||||
// -----
|
||||
// Notes
|
||||
// -----
|
||||
|
||||
$this->Ln(7);
|
||||
|
||||
$this->SetFont("Calibri", "B", 12);
|
||||
$this->Cell(0, 0, "Notes", 0, 1, "L", false, "", 3);
|
||||
$this->Ln(3);
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(30, 0, "Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "Origin", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(110, 0, "Note", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
|
||||
if ($usernotes->count() == 0) {
|
||||
|
||||
$this->Cell(0, 0, "There are no Notes...", 0, 1, "L", false, "", 3);
|
||||
} else {
|
||||
|
||||
foreach ($usernotes as $note) {
|
||||
|
||||
$this->Cell(30, 0, $note->note_timestamp_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, $note->note_origin, 0, 0, "L", false, "", 3);
|
||||
$this->MultiCell(110, 0, $note->note_text, 0, "L", false, 1, "", "", true);
|
||||
|
||||
if ($this->GetY() > 265) {
|
||||
|
||||
$this->AddPage("P", "LETTER");
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(30, 0, "Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "Origin", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(110, 0, "Note", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------
|
||||
// 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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("UserSummarySheet.pdf", "S");
|
||||
} else {
|
||||
$this->Output("UserSummarySheet.pdf");
|
||||
}
|
||||
}
|
||||
|
||||
// ======
|
||||
// Header
|
||||
// ======
|
||||
|
||||
public function Header() {
|
||||
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->ImageSVG('images/dec-logo.svg', 10, 0, 25, 25);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(0, 6, "User Summary Sheet", 0, 1, "C");
|
||||
}
|
||||
|
||||
// ======
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user