Initial comming of full program to main branch
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
// ====================
|
||||
// Export Permits - CSV
|
||||
// ====================
|
||||
|
||||
class Export_AllPermitsByBuilderCSV 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);
|
||||
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsByBuilder())->getAllPermitsByBuilder($permit_area, $projecttype);
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="AllPermitsByBuilder.csv"');
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
$header = array('Builder/Company', 'Permits', 'Value', 'Current Year YTD', 'Current YTD Value', 'Last 12 Months', 'Address', 'Phone');
|
||||
|
||||
// Add CSV headers
|
||||
fputcsv($output, $header, ',', '"', '\\');
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$builder = $permit->rdi_company;
|
||||
$permitcount = $permit->rdi_permit_count;
|
||||
$permit_value = $permit->rdi_value;
|
||||
$currentyearytd = $permit->rdi_ytd_permits;
|
||||
$permit_ytd_value = $permit->rdi_ytd_value;
|
||||
$rdi12monthprevpermits = $permit->rdi_12mth_prev_permits;
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city} {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
$phone = $permit->rdi_phone_verbose;
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$permit_data = array($builder, $permitcount, $permit_value, $currentyearytd, $permit_ytd_value, $rdi12monthprevpermits, $address, $phone);
|
||||
|
||||
fputcsv($output, $permit_data, ',', '"', '\\');
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
// ==================
|
||||
// Export Permits
|
||||
// ==================
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
class Export_AllPermitsByBuilderExcel 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);
|
||||
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsByBuilder())->getAllPermitsByBuilder($permit_area, $projecttype);
|
||||
|
||||
// Create the Spreadsheet.
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
$spreadsheet->getProperties()->setCreator("DEC International")
|
||||
->setTitle("Permits")
|
||||
->setSubject("Permits")
|
||||
->setDescription("Permits")
|
||||
->setKeywords("Permits")
|
||||
->setCategory("Permits");
|
||||
|
||||
// Create the Base Sheet.
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
$spreadsheet->getActiveSheet()->setTitle("Permits");
|
||||
|
||||
// Format the Cells and Create the Headings.
|
||||
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("A")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("B")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("C")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("D")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("E")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("F")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("G")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("H")->setAutoSize(true);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFont()->setBold(true);
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB("D3D3D3");
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue("A1", "Builder/Company")
|
||||
->setCellValue("B1", "Permits")
|
||||
->setCellValue("C1", "Value")
|
||||
->setCellValue("D1", "Current Year YTD")
|
||||
->setCellValue("E1", "Current Year YTD Value")
|
||||
->setCellValue("F1", "Last 12 Months")
|
||||
->setCellValue("G1", "Address")
|
||||
->setCellValue("H1", "Phone");
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A:A")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
|
||||
$spreadsheet->getActiveSheet()->getStyle("C:C")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("D:D")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("E:E")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("F:F")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("G:G")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("H:H")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
|
||||
$spreadsheet->getActiveSheet()->freezePane("A2");
|
||||
|
||||
// Create the Detail Rows.
|
||||
|
||||
$row = 2;
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permit->rdi_company);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("B" . $row, (string) $permit->rdi_permit_count);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("C" . $row, (string) $permit_value);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("D" . $row, (string) $permit->rdi_ytd_permits);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("E" . $row, (string) $permit->rdi_ytd_value);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("F" . $row, (string) $permit->rdi_12mth_prev_permits);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("G" . $row, (string) $address);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("H" . $row, (string) $permit->rdi_phone_verbose);
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
// Download the spreadsheet.
|
||||
|
||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
header("Content-disposition: attachment; filename=AllPermitsByBuilder.xlsx");
|
||||
header("Cache-Control: max-age=0");
|
||||
|
||||
$excelWriter = new Xlsx($spreadsheet);
|
||||
|
||||
@ob_clean();
|
||||
|
||||
$excelWriter->save('php://output');
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
// ====================
|
||||
// Export Permits - CSV
|
||||
// ====================
|
||||
|
||||
class Export_AllPermitsBySubdivision_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);
|
||||
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype);
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="All_PermitsBySubdivision.csv"');
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Add CSV headers
|
||||
fputcsv($output, ['County', 'Subdivision', 'Address', 'City', 'Builder', 'Permit Date', 'Square Footage', 'Value'], ',', '"', '\\');
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
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;
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$permit_data = array($county_name, $subdivision, $address, $city, $builder, $permit_date, $square_footage, $value);
|
||||
|
||||
fputcsv($output, $permit_data, ',', '"', '\\');
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
// =================================
|
||||
// Export All Permits By Subdivision
|
||||
// =================================
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
class Export_AllPermitsBySubdivision_Excel 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);
|
||||
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype);
|
||||
|
||||
// Create the Spreadsheet.
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
$spreadsheet->getProperties()->setCreator("DEC International")->setTitle("PermitsBySubdivision")->setSubject("PermitsBySubdivision")
|
||||
->setDescription("PermitsBySubdivision")->setKeywords("PermitsBySubdivision")->setCategory("PermitsBySubdivision");
|
||||
|
||||
// Create the Base Sheet.
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
$spreadsheet->getActiveSheet()->setTitle("Permits");
|
||||
|
||||
// Format the Cells and Create the Headings.
|
||||
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("A")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("B")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("C")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("D")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("E")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("F")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("G")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("H")->setAutoSize(true);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFont()->setBold(true);
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB("D3D3D3");
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue("A1", "County")
|
||||
->setCellValue("B1", "Subdivision")
|
||||
->setCellValue("C1", "Address")
|
||||
->setCellValue("D1", "City")
|
||||
->setCellValue("E1", "Builder")
|
||||
->setCellValue("F1", "Permit Date")
|
||||
->setCellValue("G1", "Square Footage")
|
||||
->setCellValue("H1", "Value");
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A:A")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("B:B")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("C:C")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("D:D")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("E:E")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("F:F")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("G:G")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
|
||||
$spreadsheet->getActiveSheet()->getStyle("H:H")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
|
||||
|
||||
$spreadsheet->getActiveSheet()->freezePane("A2");
|
||||
|
||||
// Create the Detail Rows.
|
||||
|
||||
$row = 2;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_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("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);
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
$filename = str_replace(' ', '_', $subscription->record->subscription_title) . "_" . date("Y-m-d_h:i:s");
|
||||
|
||||
// Download the spreadsheet
|
||||
|
||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
header("Content-disposition: attachment; filename={$filename}.xlsx");
|
||||
header("Cache-Control: max-age=0");
|
||||
|
||||
$excelWriter = new Xlsx($spreadsheet);
|
||||
|
||||
@ob_clean();
|
||||
|
||||
$excelWriter->save('php://output');
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
// ========================================
|
||||
// Export Selected Permits By Builder - CSV
|
||||
// ========================================
|
||||
|
||||
class Export_SelectedPermitsByBuilderCSV 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_permits = filter_input(INPUT_POST, "selected_permits") ?: "";
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_reference", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsByBuilder())->getSelectedPermits($permit_area, $projecttype, $selected_permits);
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="Export_SelectedPermitsByBuilder.csv"');
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
$header = array('Builder/Company', 'Permits', 'Value', 'Current Year YTD', 'Current YTD Value', 'Last 12 Months', 'Address', 'Phone');
|
||||
|
||||
// Add CSV headers
|
||||
fputcsv($output, $header, ',', '"', '\\');
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$builder = $permit->rdi_company;
|
||||
$permitcount = $permit->rdi_permit_count;
|
||||
$permit_value = $permit->rdi_value;
|
||||
$currentyearytd = $permit->rdi_ytd_permits;
|
||||
$permit_ytd_value = $permit->rdi_ytd_value;
|
||||
$rdi12monthprevpermits = $permit->rdi_12mth_prev_permits;
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city} {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
$phone = $permit->rdi_phone_verbose;
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$permit_data = array($builder, $permitcount, $permit_value, $currentyearytd, $permit_ytd_value, $rdi12monthprevpermits, $address, $phone);
|
||||
|
||||
fputcsv($output, $permit_data, ',', '"', '\\');
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
// ==================================
|
||||
// Export Selected Permits By Builder
|
||||
// ==================================
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
class Export_SelectedPermitsByBuilderExcel 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_permits = filter_input(INPUT_POST, "selected_permits") ?: "";
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
$permits = (new PermitsByBuilder())->getSelectedPermits($permit_area, $projecttype, $selected_permits);
|
||||
|
||||
// Create the Spreadsheet.
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
$spreadsheet->getProperties()->setCreator("DEC International")
|
||||
->setTitle("Permits")
|
||||
->setSubject("Permits")
|
||||
->setDescription("Permits")
|
||||
->setKeywords("Permits")
|
||||
->setCategory("Permits");
|
||||
|
||||
// Create the Base Sheet.
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
$spreadsheet->getActiveSheet()->setTitle("Permits");
|
||||
|
||||
// Format the Cells and Create the Headings.
|
||||
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("A")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("B")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("C")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("D")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("E")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("F")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("G")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("H")->setAutoSize(true);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFont()->setBold(true);
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB("D3D3D3");
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue("A1", "Builder/Company")
|
||||
->setCellValue("B1", "Permits")
|
||||
->setCellValue("C1", "Value")
|
||||
->setCellValue("D1", "Current Year YTD")
|
||||
->setCellValue("E1", "Current Year YTD Value")
|
||||
->setCellValue("F1", "Last 12 Months")
|
||||
->setCellValue("G1", "Address")
|
||||
->setCellValue("H1", "Phone");
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A:A")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
|
||||
$spreadsheet->getActiveSheet()->getStyle("C:C")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("D:D")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("E:E")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("F:F")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("G:G")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("H:H")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
|
||||
$spreadsheet->getActiveSheet()->freezePane("A2");
|
||||
|
||||
// Create the Detail Rows.
|
||||
|
||||
$row = 2;
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permit->rdi_company);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("B" . $row, (string) $permit->rdi_permit_count);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("C" . $row, (string) $permit_value);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("D" . $row, (string) $permit->rdi_ytd_permits);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("E" . $row, (string) $permit->rdi_ytd_value);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("F" . $row, (string) $permit->rdi_12mth_prev_permits);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("G" . $row, (string) $address);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("H" . $row, (string) $permit->rdi_phone_verbose);
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
// Download the spreadsheet.
|
||||
|
||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
header("Content-disposition: attachment; filename=AllPermitsByBuilder.xlsx");
|
||||
header("Cache-Control: max-age=0");
|
||||
|
||||
$excelWriter = new Xlsx($spreadsheet);
|
||||
|
||||
@ob_clean();
|
||||
|
||||
$excelWriter->save('php://output');
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
// ====================
|
||||
// Export Permits - CSV
|
||||
// ====================
|
||||
|
||||
class Export_SelectedPermitsBySubdivision_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_permits = filter_input(INPUT_POST, "selected_permits") ?: "";
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getSelectedPermits($selected_permits);
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$county_serial = $permit->rdi_county;
|
||||
|
||||
$county_name = (new Counties())->getCounty($county_serial);
|
||||
$permit->county_name_verbose = $county_name->record->county_name;
|
||||
}
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="Selected_PermitsBySubdivision.csv"');
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Add CSV headers
|
||||
fputcsv($output, ['County', 'Subdivision', 'Address', 'City', 'Builder', 'Permit Date', 'Square Footage', 'Value'], ',', '"', '\\');
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$county_name = $permit->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;
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$permit_data = array($county_name, $subdivision, $address, $city, $builder, $permit_date, $square_footage, $value);
|
||||
|
||||
fputcsv($output, $permit_data, ',', '"', '\\');
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
// ======================================
|
||||
// Export Selected Permits By Subdivision
|
||||
// ======================================
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
class Export_SelectedPermitsBySubdivision_Excel 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_permits = filter_input(INPUT_POST, "selected_permits") ?: "";
|
||||
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getSelectedPermits($selected_permits);
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$county_serial = $permit->rdi_county;
|
||||
|
||||
$county_name = (new Counties())->getCounty($county_serial);
|
||||
$permit->county_name_verbose = $county_name->record->county_name;
|
||||
}
|
||||
|
||||
// Create the Spreadsheet
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
$spreadsheet->getProperties()->setCreator("DEC International")->setTitle("PermitsBySubdivision")->setSubject("PermitsBySubdivision")
|
||||
->setDescription("PermitsBySubdivision")->setKeywords("PermitsBySubdivision")->setCategory("PermitsBySubdivision");
|
||||
|
||||
// Create the Base Sheet.
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
$spreadsheet->getActiveSheet()->setTitle("Permits");
|
||||
|
||||
// Format the Cells and Create the Headings.
|
||||
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("A")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("B")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("C")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("D")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("E")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("F")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("G")->setAutoSize(true);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension("H")->setAutoSize(true);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFont()->setBold(true);
|
||||
$spreadsheet->getActiveSheet()->getStyle("A1:H1")->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB("D3D3D3");
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue("A1", "County")
|
||||
->setCellValue("B1", "Subdivision")
|
||||
->setCellValue("C1", "Address")
|
||||
->setCellValue("D1", "City")
|
||||
->setCellValue("E1", "Builder")
|
||||
->setCellValue("F1", "Permit Date")
|
||||
->setCellValue("G1", "Square Footage")
|
||||
->setCellValue("H1", "Value");
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle("A:A")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("B:B")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("C:C")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("D:D")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("E:E")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("F:F")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
|
||||
$spreadsheet->getActiveSheet()->getStyle("G:G")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
|
||||
$spreadsheet->getActiveSheet()->getStyle("H:H")->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
|
||||
|
||||
$spreadsheet->getActiveSheet()->freezePane("A2");
|
||||
|
||||
// Create the Detail Rows.
|
||||
|
||||
$row = 2;
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permit->county_name_verbose);
|
||||
$spreadsheet->getActiveSheet()->setCellValue("B" . $row, (string) $permit->rdi_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);
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
$filename = str_replace(' ', '_', $subscription->record->subscription_title) . "_" . date("Y-m-d_h:i:s");
|
||||
|
||||
// Download the spreadsheet
|
||||
|
||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
header("Content-disposition: attachment; filename={$filename}.xlsx");
|
||||
header("Cache-Control: max-age=0");
|
||||
|
||||
$excelWriter = new Xlsx($spreadsheet);
|
||||
|
||||
@ob_clean();
|
||||
|
||||
$excelWriter->save('php://output');
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// ===============
|
||||
// Debug an Object
|
||||
// ===============
|
||||
|
||||
public function debug($object = "") {
|
||||
|
||||
echo "<pre>";
|
||||
print_r($object);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ==========================
|
||||
// Print Selected Work Orders
|
||||
// ==========================
|
||||
|
||||
class Print_All_PermitsByBuilder 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 AllPermitsByBuilder_Print();
|
||||
|
||||
$report->subscription_serial = $_SESSION[self::REPORTS_POST]["subscription_serial"] ?? 0;
|
||||
$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 AllPermitsByBuilder_Print extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $subscription_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);
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($this->subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "All Permit Records";
|
||||
|
||||
$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("L", "LETTER");
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$permits = (new PermitsByBuilder())->getAllPermitsByBuilder($permit_area, $projecttype);
|
||||
|
||||
// -------
|
||||
// Permits
|
||||
// -------
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
if ($permits->count() > 0) {
|
||||
|
||||
$this->Ln(7);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(52, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Current", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Current Year", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Last", "", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(52, 0, "Company/Builder", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "Permits", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Year YTD", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "YTD Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "12 Months", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "Phone", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$this->stripeLine($rowCount, 257);
|
||||
$rowCount++;
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$this->Cell(52, 0, $permit->rdi_company, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, $permit->rdi_permit_count, 0, 0, "C", false, "", 3);
|
||||
$this->Cell(20, 0, $permit_value, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->rdi_ytd_permits, 0, 0, "C", false, "", 3);
|
||||
$this->Cell(20, 0, $permit_ytd_value, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->rdi_12mth_prev_permits, 0, 0, "C", false, "", 3);
|
||||
$this->Cell(85, 0, $address, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, $permit->rdi_phone_verbose, 0, 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln(4);
|
||||
|
||||
if ($rowCount == 38) {
|
||||
|
||||
$this->AddPage("L", "LETTER");
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(52, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Current", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Current Year", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Last", "", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(52, 0, "Company/Builder", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "Permits", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Year YTD", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "YTD Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "12 Months", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "Phone", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
$rowCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("AllPermitByBuilderRecords.pdf", "S");
|
||||
} else {
|
||||
$this->Output("AllPermitByBuilderRecords.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, 25, 12);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(0, 6, "DEC International", 0, 0, "C");
|
||||
$this->Ln(6);
|
||||
$this->Cell(0, 6, "All Permit By Builder Records", 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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ==========================
|
||||
// Print Selected Work Orders
|
||||
// ==========================
|
||||
|
||||
class Print_All_PermitsBySubdivision 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 AllPermitsBySubdivision_Print();
|
||||
|
||||
$report->subscription_serial = $_SESSION[self::REPORTS_POST]["subscription_serial"] ?? 0;
|
||||
$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 AllPermitsBySubdivision_Print extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $subscription_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);
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($this->subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "All Permit By Subdivision Records";
|
||||
|
||||
$this->SetFont("Calibri");
|
||||
$this->SetMargins(5, 26, 10);
|
||||
$this->SetHeaderMargin(10);
|
||||
$this->SetFooterMargin(10);
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->addPage("L", "LETTER");
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getAllPermitsBySubdivision($permit_area, $projecttype);
|
||||
|
||||
// -------
|
||||
// Permits
|
||||
// -------
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
if ($permits->count() > 0) {
|
||||
|
||||
$this->Ln(7);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(15, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Square ", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(15, 0, "County", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "Subdivision", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "Builder/Company", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Permit Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Footage", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$this->stripeLine($rowCount, 268);
|
||||
$rowCount++;
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_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(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(20, 0, $permit_value, 0, 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln(4);
|
||||
|
||||
if ($rowCount == 38) {
|
||||
|
||||
$this->AddPage("L", "LETTER");
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(15, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(75, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Square ", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(15, 0, "County", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "Subdivision", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(75, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "Builder/Company", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Permit Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Footage", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
$rowCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("AllPermitBySubdivisionRecords.pdf", "S");
|
||||
} else {
|
||||
$this->Output("AllPermitBySubdivisionRecords.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, 25, 12);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(0, 6, "DEC International", 0, 0, "C");
|
||||
$this->Ln(6);
|
||||
$this->Cell(0, 6, "All Permit By Subdivision Records", 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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// =================================
|
||||
// Print Selected Permits By Builder
|
||||
// =================================
|
||||
|
||||
class Print_Selected_PermitsByBuilder 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 Permit_Print();
|
||||
|
||||
$report->selected_permits = $_SESSION[self::REPORTS_POST]["selected_permits"];
|
||||
$report->subscription_serial = $_SESSION[self::REPORTS_POST]["subscription_serial"];
|
||||
$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 Permit_Print extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $selected_permits = array();
|
||||
public $permit_serial = 0;
|
||||
public $subscription_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);
|
||||
|
||||
$subscription = (new Subscriptions())->getSubscription($this->subscription_serial);
|
||||
|
||||
$permit_area = $subscription->record->subscription_area;
|
||||
$projecttype = $subscription->record->subscription_projecttype;
|
||||
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "Selected Permit Records";
|
||||
|
||||
$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("L", "LETTER");
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$permits = (new PermitsByBuilder())->getSelectedPermits($permit_area, $projecttype, $this->selected_permits);
|
||||
|
||||
// -------
|
||||
// Permits
|
||||
// -------
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
if ($permits->count() > 0) {
|
||||
|
||||
$this->Ln(7);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(52, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Current", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Current Year", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Last", "", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(52, 0, "Company/Builder", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "Permits", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Year YTD", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "YTD Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "12 Months", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "Phone", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$this->stripeLine($rowCount, 257);
|
||||
$rowCount++;
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$permit_ytd_value = "$" . number_format((int) $permit->rdi_ytd_value, 2);
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$this->Cell(52, 0, $permit->rdi_company, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, $permit->rdi_permit_count, 0, 0, "C", false, "", 3);
|
||||
$this->Cell(20, 0, $permit_value, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->rdi_ytd_permits, 0, 0, "C", false, "", 3);
|
||||
$this->Cell(20, 0, $permit_ytd_value, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, $permit->rdi_12mth_prev_permits, 0, 0, "C", false, "", 3);
|
||||
$this->Cell(85, 0, $address, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, $permit->rdi_phone_verbose, 0, 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln(4);
|
||||
|
||||
if ($rowCount == 38) {
|
||||
|
||||
$this->AddPage("L", "LETTER");
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(52, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Current", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Current Year", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Last", "", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(52, 0, "Company/Builder", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(10, 0, "Permits", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Year YTD", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "YTD Value", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "12 Months", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(25, 0, "Phone", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
$rowCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("AllPermitByBuilderRecords.pdf", "S");
|
||||
} else {
|
||||
$this->Output("AllPermitByBuilderRecords.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, "Permit 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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,257 @@
|
||||
<?php
|
||||
|
||||
require_once ("tcpdf/tcpdf.php");
|
||||
|
||||
// ==========================
|
||||
// Print Selected Work Orders
|
||||
// ==========================
|
||||
|
||||
class Print_Selected_PermitsBySubdivision 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 SelectedPermitsBySubdivision_Print();
|
||||
|
||||
$report->selected_permits = $_SESSION[self::REPORTS_POST]["selected_permits"];
|
||||
$report->subscription_serial = $_SESSION[self::REPORTS_POST]["subscription_serial"];
|
||||
$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 SelectedPermitsBySubdivision_Print extends TCPDF {
|
||||
|
||||
// Variables
|
||||
|
||||
public $selected_permits = array();
|
||||
public $permit_serial = 0;
|
||||
public $subscription_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);
|
||||
|
||||
// $subscription = (new Subscriptions())->getSubscription($this->subscription_serial);
|
||||
// Set report defaults
|
||||
|
||||
$this->title = "All Permit By Subdivision Records";
|
||||
|
||||
$this->SetFont("Calibri");
|
||||
$this->SetMargins(5, 26, 10);
|
||||
$this->SetHeaderMargin(10);
|
||||
$this->SetFooterMargin(10);
|
||||
$this->setCellPaddings(0, 0, 0, 0);
|
||||
$this->setCellMargins(2, 0, 0, 0);
|
||||
|
||||
$this->addPage("L", "LETTER");
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
// Get the data for the report
|
||||
|
||||
$permits = (new PermitsBySubdivision())->getSelectedPermits($this->selected_permits);
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$county_serial = $permit->rdi_county;
|
||||
|
||||
$county_name = (new Counties())->getCounty($county_serial);
|
||||
$permit->county_name_verbose = $county_name->record->county_name;
|
||||
}
|
||||
|
||||
// -------
|
||||
// Permits
|
||||
// -------
|
||||
|
||||
$permit_ytd_value = 0.00;
|
||||
$permit_value = 0.00;
|
||||
|
||||
if ($permits->count() > 0) {
|
||||
|
||||
$this->Ln(7);
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(15, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Square ", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(15, 0, "County", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "Subdivision", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(85, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "Builder/Company", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Permit Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Footage", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
|
||||
foreach ($permits as $permit) {
|
||||
|
||||
$this->stripeLine($rowCount, 268);
|
||||
$rowCount++;
|
||||
|
||||
$address = "{$permit->rdi_address} {$permit->rdi_city}, {$permit->rdi_state} {$permit->rdi_zip}";
|
||||
|
||||
$permit_value = "$" . number_format((int) $permit->rdi_value, 2);
|
||||
|
||||
$this->Cell(15, 0, $permit->county_name_verbose, 0, 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, $permit->rdi_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(20, 0, $permit_value, 0, 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln(4);
|
||||
|
||||
if ($rowCount == 38) {
|
||||
|
||||
$this->AddPage("L", "LETTER");
|
||||
|
||||
$this->SetFont("Calibri", "B", 10);
|
||||
|
||||
$this->Cell(15, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(75, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Square ", "", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "", "", 0, "L", false, "", 3);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(15, 0, "County", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(40, 0, "Subdivision", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(75, 0, "Address", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(60, 0, "Builder/Company", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Permit Date", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(15, 0, "Footage", "B", 0, "L", false, "", 3);
|
||||
$this->Cell(20, 0, "Value", "B", 0, "L", false, "", 3);
|
||||
|
||||
$this->SetFont("Calibri", "", 10);
|
||||
|
||||
$this->Ln(6);
|
||||
$rowCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Return the pdf
|
||||
// --------------
|
||||
|
||||
if ($this->output_type == "string") {
|
||||
return $this->Output("Selected_Permits_By_Subdivision_Records.pdf", "S");
|
||||
} else {
|
||||
$this->Output("Selected_Permits_By_Subdivision_Records.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, 25, 12);
|
||||
|
||||
$this->SetFont("Calibri", "B", 16);
|
||||
|
||||
$this->Cell(0, 6, "DEC International", 0, 0, "C");
|
||||
$this->Ln(6);
|
||||
$this->Cell(0, 6, "All Permit By Subdivision Records", 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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,310 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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