Skip to content

Commit 469c5ef

Browse files
committed
Update client pdf export
- Fix HTML formatting for the cover div, other div styling is still broken - Adjust layout of cover info and add MSP logo - Add software purchase and expiry dates
1 parent 07cbe56 commit 469c5ef

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

post/user/client.php

+37-8
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,23 @@
597597
enforceUserPermission("module_sales", 1);
598598
enforceUserPermission("module_financial", 1);
599599

600+
$sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
601+
$row = mysqli_fetch_array($sql);
602+
$company_name = nullable_htmlentities($row['company_name']);
603+
$company_phone_country_code = nullable_htmlentities($row['company_phone_country_code']);
604+
$company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code));
605+
$company_email = nullable_htmlentities($row['company_email']);
606+
$company_website = nullable_htmlentities($row['company_website']);
607+
$company_logo = nullable_htmlentities($row['company_logo']);
608+
600609
$client_id = intval($_POST["client_id"]);
601610
$export_contacts = intval($_POST["export_contacts"]);
602611
$export_locations = intval($_POST["export_locations"]);
603612
$export_assets = intval($_POST["export_assets"]);
604613
$export_software = intval($_POST["export_software"]);
605614
$export_credentials = 0;
606615
if (lookupUserPermission("module_credential") >= 1) {
607-
$export_credentials = intval($_POST["export_credentials"]);
616+
$export_credentials = intval($_POST["export_credentials"] ?? 0);
608617
}
609618
$export_networks = intval($_POST["export_networks"]);
610619
$export_certificates = intval($_POST["export_certificates"]);
@@ -747,6 +756,10 @@
747756
$pdf->SetAuthor($session_company_name);
748757
$pdf->SetTitle("$client_name - IT Documentation");
749758

759+
// TODO: Add page numbers to footer, but can't work out how to do it without the ugly line
760+
// $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
761+
// $pdf->setFooterData();
762+
750763
// Enable auto page breaks with a margin from the bottom
751764
$pdf->SetAutoPageBreak(true, 15);
752765

@@ -779,17 +792,27 @@
779792
";
780793

781794
// Cover page section (for main content, not the TOC)
795+
$html .= '<div class="cover">';
796+
if (!empty($company_logo)) {
797+
$pdf->Image('uploads/settings/' . $company_logo, '', '', 35, 35, '', '', 'L', false, 300, '', false, false, 1, false, false, false);
798+
}
782799
$html .= "
783-
<div class='cover'>
784-
<h1>$client_name</h1>
785-
<h2>IT Documentation</h2>
786-
<p>Export Date: " . date("F j, Y") . "</p>
800+
<h1>IT Documentation</h1>
801+
<h2>$client_name</h2>
802+
<h4>Prepared by $session_name on " . date("F j, Y") . "</h4>
787803
</div>
788-
<hr>";
804+
";
805+
$html .= "
806+
<br>
807+
<h4>$session_company_name</h4>
808+
$company_phone<br>$company_email<br>
809+
<hr>
810+
";
789811

790812
// Client header information (non-table)
791813
$html .= "
792814
<div class='client-header'>
815+
<h3>$client_name</h3>
793816
<p><strong>Address:</strong> $location_address</p>
794817
<p><strong>City State Zip:</strong> $location_city $location_state $location_zip</p>
795818
<p><strong>Phone:</strong> $contact_phone</p>
@@ -1203,6 +1226,8 @@
12031226
<th>Type</th>
12041227
<th>License</th>
12051228
<th>License Key</th>
1229+
<th>Purchase Date</th>
1230+
<th>Expiration Date</th>
12061231
<th>Notes</th>
12071232
</tr>
12081233
</thead>
@@ -1212,13 +1237,17 @@
12121237
$software_type = nullable_htmlentities($row["software_type"]);
12131238
$software_license_type = nullable_htmlentities($row["software_license_type"]);
12141239
$software_key = nullable_htmlentities($row["software_key"]);
1240+
$software_purchase = nullable_htmlentities($row['software_purchase']);
1241+
$software_expire = nullable_htmlentities($row['software_expire']);
12151242
$software_notes = nullable_htmlentities($row["software_notes"]);
12161243
$html .= "
12171244
<tr style='page-break-inside: avoid;'>
12181245
<td>$software_name</td>
12191246
<td>$software_type</td>
12201247
<td>$software_license_type</td>
12211248
<td>$software_key</td>
1249+
<td>$software_purchase</td>
1250+
<td>$software_expire</td>
12221251
<td>$software_notes</td>
12231252
</tr>";
12241253
}
@@ -1326,7 +1355,7 @@
13261355
<thead>
13271356
<tr>
13281357
<th>Domain Name</th>
1329-
<th>Expire</th>
1358+
<th>Expiration Date</th>
13301359
</tr>
13311360
</thead>
13321361
<tbody>";
@@ -1383,4 +1412,4 @@
13831412
// Output the PDF document for download
13841413
$pdf->Output(strtoAZaz09($client_name) . "-IT_Documentation-" . date("Y-m-d") . ".pdf", "D");
13851414
exit;
1386-
}
1415+
}

0 commit comments

Comments
 (0)