mirror of https://github.com/itflow-org/itflow
Print Client: Only Display Table if records > 0 moved queries to the top for clean look
This commit is contained in:
parent
f32ff94629
commit
f49665b6d4
131
client_print.php
131
client_print.php
|
|
@ -20,12 +20,46 @@ if(isset($_GET['client_id'])){
|
|||
}
|
||||
$client_website = $row['client_website'];
|
||||
|
||||
//Query each table and store them in their array
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM client_contacts WHERE client_id = $client_id ORDER BY client_contact_id DESC");
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM client_locations WHERE client_id = $client_id ORDER BY client_location_id DESC");
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM client_assets WHERE client_id = $client_id ORDER BY client_asset_id DESC");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM client_vendors WHERE client_id = $client_id ORDER BY client_vendor_id DESC");
|
||||
$sql_logins = mysqli_query($mysqli,"SELECT * FROM client_logins WHERE client_id = $client_id ORDER BY client_login_id DESC");
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM client_networks WHERE client_id = $client_id ORDER BY client_network_id DESC");
|
||||
$sql_domains = mysqli_query($mysqli,"SELECT * FROM client_domains WHERE client_id = $client_id ORDER BY client_domain_id DESC");
|
||||
$sql_applications = mysqli_query($mysqli,"SELECT * FROM client_applications WHERE client_id = $client_id ORDER BY client_application_id DESC");
|
||||
$sql_invoices = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id ORDER BY invoices.invoice_date DESC");
|
||||
$sql_notes = mysqli_query($mysqli,"SELECT * FROM client_notes WHERE client_id = $client_id ORDER BY client_note_id DESC");
|
||||
|
||||
//Get Counts
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_contact_id') AS num FROM client_contacts WHERE client_id = $client_id"));
|
||||
$num_contacts = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_location_id') AS num FROM client_locations WHERE client_id = $client_id"));
|
||||
$num_locations = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_asset_id') AS num FROM client_assets WHERE client_id = $client_id"));
|
||||
$num_assets = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_vendor_id') AS num FROM client_vendors WHERE client_id = $client_id"));
|
||||
$num_vendors = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_login_id') AS num FROM client_logins WHERE client_id = $client_id"));
|
||||
$num_logins = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_network_id') AS num FROM client_networks WHERE client_id = $client_id"));
|
||||
$num_networks = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_domain_id') AS num FROM client_domains WHERE client_id = $client_id"));
|
||||
$num_domains = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_application_id') AS num FROM client_applications WHERE client_id = $client_id"));
|
||||
$num_applications = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE client_id = $client_id"));
|
||||
$num_invoices = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_note_id') AS num FROM client_notes WHERE client_id = $client_id"));
|
||||
$num_notes = $row['num'];
|
||||
|
||||
?>
|
||||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Clients</a>
|
||||
<a href="clients.php">Clients</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="client.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
||||
|
|
@ -33,7 +67,7 @@ if(isset($_GET['client_id'])){
|
|||
<li class="breadcrumb-item active">Print</li>
|
||||
</ol>
|
||||
|
||||
<button class="btn btn-primary d-print-none mb-2" onclick="window.print();"><i class="fa fa-print"></i> Print</button>
|
||||
<button class="btn btn-primary btn-sm d-print-none mb-2" onclick="window.print();"><i class="fa fa-print"></i> Print</button>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-9">
|
||||
|
|
@ -68,26 +102,26 @@ if(isset($_GET['client_id'])){
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-unstyled">
|
||||
<li>Contacts</li>
|
||||
<li>Locations</li>
|
||||
<li>Assets</li>
|
||||
<li>Vendors</li>
|
||||
<li>Logins</li>
|
||||
<li>Networks</li>
|
||||
<li>Domains</li>
|
||||
<li>Applications</li>
|
||||
<li>Invoices</li>
|
||||
<li>Quotes</li>
|
||||
<li>Attachements</li>
|
||||
<li>Notes</li>
|
||||
<?php if($num_contacts > 0){ ?> <li>Contacts</li> <?php } ?>
|
||||
<?php if($num_locations > 0){ ?> <li>Locations</li> <?php } ?>
|
||||
<?php if($num_assets > 0){ ?> <li>Assets</li> <?php } ?>
|
||||
<?php if($num_vendors > 0){ ?> <li>Vendors</li> <?php } ?>
|
||||
<?php if($num_logins > 0){ ?> <li>Logins</li> <?php } ?>
|
||||
<?php if($num_networks > 0){ ?> <li>Networks</li> <?php } ?>
|
||||
<?php if($num_domains > 0){ ?> <li>Domains</li> <?php } ?>
|
||||
<?php if($num_applications > 0){ ?> <li>Applications</li> <?php } ?>
|
||||
<?php if($num_invoices > 0){ ?> <li>Invoices</li> <?php } ?>
|
||||
<?php if($num_quotes > 0){ ?> <li>Quotes</li> <?php } ?>
|
||||
<?php if($num_attachments > 0){ ?> <li>Attachments</li> <?php } ?>
|
||||
<?php if($num_notes > 0){ ?> <li>Notes</li> <?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_contacts WHERE client_id = $client_id ORDER BY client_contact_id DESC"); ?>
|
||||
|
||||
<?php if($num_contacts > 0){ ?>
|
||||
<h4>Contacts</h4>
|
||||
<table class="table table-bordered table-compact table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -101,7 +135,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_contacts)){
|
||||
$client_contact_id = $row['client_contact_id'];
|
||||
$client_contact_name = $row['client_contact_name'];
|
||||
$client_contact_title = $row['client_contact_title'];
|
||||
|
|
@ -125,10 +159,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_locations WHERE client_id = $client_id ORDER BY client_location_id DESC"); ?>
|
||||
|
||||
<?php if($num_locations > 0){ ?>
|
||||
<h4>Locations</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -141,7 +175,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_locations)){
|
||||
$client_location_id = $row['client_location_id'];
|
||||
$client_location_name = $row['client_location_name'];
|
||||
$client_location_address = $row['client_location_address'];
|
||||
|
|
@ -168,10 +202,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_assets WHERE client_id = $client_id ORDER BY client_asset_id DESC"); ?>
|
||||
|
||||
<?php if($num_assets > 0){ ?>
|
||||
<h4>Assets</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -185,7 +219,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
$client_asset_id = $row['client_asset_id'];
|
||||
$client_asset_type = $row['client_asset_type'];
|
||||
$client_asset_name = $row['client_asset_name'];
|
||||
|
|
@ -207,10 +241,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_vendors WHERE client_id = $client_id ORDER BY client_vendor_id DESC"); ?>
|
||||
|
||||
<?php if($num_vendors > 0){ ?>
|
||||
<h4>Vendors</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -223,7 +257,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$client_vendor_id = $row['client_vendor_id'];
|
||||
$client_vendor_name = $row['client_vendor_name'];
|
||||
$client_vendor_description = $row['client_vendor_description'];
|
||||
|
|
@ -242,10 +276,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_logins WHERE client_id = $client_id ORDER BY client_login_id DESC"); ?>
|
||||
|
||||
<?php if($num_logins > 0){ ?>
|
||||
<h4>Logins</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -258,7 +292,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_logins)){
|
||||
$client_login_id = $row['client_login_id'];
|
||||
$client_login_description = $row['client_login_description'];
|
||||
$client_login_username = $row['client_login_username'];
|
||||
|
|
@ -277,10 +311,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_networks WHERE client_id = $client_id ORDER BY client_network_id DESC"); ?>
|
||||
|
||||
<?php if($num_networks > 0){ ?>
|
||||
<h4>Networks</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -294,7 +328,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_networks)){
|
||||
$client_network_id = $row['client_network_id'];
|
||||
$client_network_name = $row['client_network_name'];
|
||||
$client_network = $row['client_network'];
|
||||
|
|
@ -316,10 +350,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_domains WHERE client_id = $client_id ORDER BY client_domain_id DESC"); ?>
|
||||
|
||||
<?php if($num_domains > 0){ ?>
|
||||
<h4>Domains</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -333,7 +367,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_domains)){
|
||||
$client_domain_id = $row['client_domain_id'];
|
||||
$client_domain_name = $row['client_domain_name'];
|
||||
$client_domain_registrar = $row['client_domain_registrar'];
|
||||
|
|
@ -354,10 +388,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_applications WHERE client_id = $client_id ORDER BY client_application_id DESC"); ?>
|
||||
|
||||
<?php if($num_applications > 0){ ?>
|
||||
<h4>Applications</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -370,7 +404,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_applications)){
|
||||
$client_application_id = $row['client_application_id'];
|
||||
$client_application_name = $row['client_application_name'];
|
||||
$client_application_type = $row['client_application_type'];
|
||||
|
|
@ -389,14 +423,10 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id ORDER BY invoices.invoice_date DESC");
|
||||
|
||||
?>
|
||||
|
||||
<?php if($num_invoices > 0){ ?>
|
||||
<h4>Invoices</h4>
|
||||
<table class="table table-bordered table-sm mb-4">
|
||||
<thead>
|
||||
|
|
@ -411,7 +441,7 @@ if(isset($_GET['client_id'])){
|
|||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_invoices)){
|
||||
$invoice_id = $row['invoice_id'];
|
||||
$invoice_number = $row['invoice_number'];
|
||||
$invoice_status = $row['invoice_status'];
|
||||
|
|
@ -437,16 +467,16 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_notes WHERE client_id = $client_id ORDER BY client_note_id DESC"); ?>
|
||||
|
||||
<?php if($num_notes > 0){ ?>
|
||||
<h4>Notes</h4>
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
while($row = mysqli_fetch_array($sql_notes)){
|
||||
$client_note_id = $row['client_note_id'];
|
||||
$client_note_subject = $row['client_note_subject'];
|
||||
$client_note_body = $row['client_note_body'];
|
||||
|
|
@ -456,9 +486,10 @@ while($row = mysqli_fetch_array($sql)){
|
|||
<hr>
|
||||
<p class="mb-4"><?php echo "$client_note_body"; ?></p>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue