Cleaned up UI a bit invoice, side_menu, client, started working on bank transfers

This commit is contained in:
root
2019-04-06 17:45:52 -04:00
parent 83ab654824
commit 0fc29c0271
16 changed files with 245 additions and 298 deletions

View File

@@ -1,4 +1,4 @@
<div class="modal fade" id="addClientModal" tabindex="-1"> <div class="modal" id="addClientModal" tabindex="-1">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">

View File

@@ -16,7 +16,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-calendar"></i></span> <span class="input-group-text"><i class="fa fa-calendar"></i></span>
</div> </div>
<input type="date" class="form-control" name="date" required> <input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d",time()); ?>" required>
</div> </div>
</div> </div>
<div class="form-group col-md"> <div class="form-group col-md">

View File

@@ -19,7 +19,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-calendar"></i></span> <span class="input-group-text"><i class="fa fa-calendar"></i></span>
</div> </div>
<input type="date" class="form-control" name="date" required> <input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d",time()); ?>" required>
</div> </div>
</div> </div>
<div class="form-group col-md"> <div class="form-group col-md">

View File

@@ -26,7 +26,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-dollar-sign"></i></span> <span class="input-group-text"><i class="fa fa-dollar-sign"></i></span>
</div> </div>
<input type="number" class="form-control" step="0.01" min="0" name="amount" value="<?php echo $invoice_amount; ?>" required> <input type="number" class="form-control" step="0.01" min="0" name="amount" value="<?php echo number_format($balance,2); ?>" required>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -44,36 +44,70 @@ if(isset($_GET['client_id'])){
$num_notes = $row['num']; $num_notes = $row['num'];
?> ?>
<div class="row">
<div class="col-8"> <ol class="breadcrumb d-print-none">
<h2><?php echo $client_name; ?></h2> <li class="breadcrumb-item">
</div> <a href="clients.php">Clients</a>
<div class="col-4"> </li>
<div class="dropdown dropleft text-center"> <li class="breadcrumb-item active"><?php echo $client_name; ?></li>
<button class="btn btn-primary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> </ol>
<i class="fas fa-ellipsis-h"></i>
</button> <div class="card mb-3 border-0">
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <div class="card-body mb-4">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientContactModal">New Contact</a> <div class="row">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientLocationModal">New Location</a> <div class="col border-left border-right ">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAssetModal">New Asset</a> <h2 class="text-secondary"><?php echo $client_name; ?></h2>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientVendorModal">New Vendor</a> </div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientLoginModal">New Login</a> <div class="col border-right">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientNetworkModal">New Network</a> <h4 class="text-secondary">Address</h4>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientDomainModal">New Domain</a> <a href="//maps.<?php echo $session_map_source; ?>.com/?q=<?php echo "$client_address $client_zip"; ?>" target="_blank">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientApplicationModal">New Application</a> <?php echo $client_address; ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceModal">New Invoice</a> <br>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addQuoteModal">New Quote</a> <?php echo "$client_city $client_state $client_zip"; ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAttachmentModal">New Attachment</a> </a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientNoteModal">New Note</a> </div>
<div class="dropdown-divider"></div> <div class="col border-right">
<a class="dropdown-item" href="client_print.php?client_id=<?php echo $client_id; ?>">Print</a> <h4 class="text-secondary">Contact</h4>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editClientModal<?php echo $client_id; ?>">Edit</a> <i class="fa fa-envelope mx-1"></i> <a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a>
<a class="dropdown-item" href="post.php?delete_client=<?php echo $client_id; ?>">Delete</a> <br>
<i class="fa fa-phone mx-1"></i> <?php echo $client_phone; ?>
<br>
<i class="fa fa-globe mx-1"></i> <a target="_blank" href="//<?php echo $client_website; ?>"><?php echo $client_website; ?></a>
</div>
<div class="col border-right">
<h4 class="text-secondary">Standings</h4>
<h6>Paid to Date <small class="text-secondary ml-5">$0.00</small>
<h6>Balance <small class="text-secondary ml-5">$0.00</small>
</div>
<div class="col-1">
<div class="dropdown dropleft text-center">
<button class="btn btn-primary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientContactModal">New Contact</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientLocationModal">New Location</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAssetModal">New Asset</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientVendorModal">New Vendor</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientLoginModal">New Login</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientNetworkModal">New Network</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientDomainModal">New Domain</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientApplicationModal">New Application</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceModal">New Invoice</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addQuoteModal">New Quote</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAttachmentModal">New Attachment</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientNoteModal">New Note</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="client_print.php?client_id=<?php echo $client_id; ?>">Print</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editClientModal<?php echo $client_id; ?>">Edit</a>
<a class="dropdown-item" href="post.php?delete_client=<?php echo $client_id; ?>">Delete</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="card"> <div class="card">

View File

@@ -6,8 +6,8 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Title</th> <th>Title</th>
<th>Phone</th>
<th>Email</th> <th>Email</th>
<th>Phone</th>
<th class="text-center">Actions</th> <th class="text-center">Actions</th>
</tr> </tr>
</thead> </thead>
@@ -28,8 +28,9 @@
<tr> <tr>
<td><?php echo "$client_contact_name"; ?></td> <td><?php echo "$client_contact_name"; ?></td>
<td><?php echo "$client_contact_title"; ?></td> <td><?php echo "$client_contact_title"; ?></td>
<td><?php echo "$client_contact_phone"; ?></td>
<td><a href="mailto:<?php echo $client_contact_email; ?>"><?php echo "$client_contact_email"; ?></a></td> <td><a href="mailto:<?php echo $client_contact_email; ?>"><?php echo "$client_contact_email"; ?></a></td>
<td><?php echo "$client_contact_phone"; ?></td>
<td> <td>
<div class="dropdown dropleft text-center"> <div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

View File

@@ -1,23 +0,0 @@
<table class="table">
<tr>
<td><i class="fa fa-map-marker"></i></td>
<td>
<a href="//maps.<?php echo $session_map_source; ?>.com/?q=<?php echo "$client_address $client_zip"; ?>" target="_blank">
<?php echo $client_address; ?>
<br>
<?php echo "$client_city $client_state $client_zip"; ?>
</a>
</td>
<tr>
<td><i class="fa fa-phone"></i></td>
<td><?php echo $client_phone; ?></td>
</tr>
<tr>
<td><i class="fa fa-envelope"></i></td>
<td><a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe"></i></td>
<td><a href="http://<?php echo $client_website; ?>"><?php echo $client_website; ?></a></td>
</tr>
</table>

View File

@@ -1,27 +1,25 @@
<ul class="nav nav-pills"> <ul class="nav nav-pills nav-fill">
<li class="nav-item">
<a class="nav-link active" href="?client_id=<?php echo $client_id; ?>&tab=details">Details</a>
</li>
<?php if($num_contacts > 0){ ?> <?php if($num_contacts > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=contacts"> <a class="nav-link active" href="?client_id=<?php echo $client_id; ?>&tab=contacts">
Contacts Contacts<br>
<span class="badge badge-pill badge-dark"><?php echo $num_contacts; ?></span> <span class="badge badge-pill badge-light"><?php echo $num_contacts; ?></span>
</a> </a>
</li> </li>
<?php } ?> <?php } ?>
<?php if($num_locations > 0){ ?> <?php if($num_locations > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=locations"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=locations">
Locations Locations<br>
<span class="badge badge-pill badge-dark"><?php echo $num_locations; ?></span> <span class="badge badge-pill badge-fark"><?php echo $num_locations; ?></span>
</a> </a>
</li> </li>
<?php } ?> <?php } ?>
<?php if($num_assets > 0){ ?> <?php if($num_assets > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=assets"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=assets">
Assets Assets<br>
<span class="badge badge-pill badge-dark"><?php echo $num_assets; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_assets; ?></span>
</a> </a>
</li> </li>
@@ -29,15 +27,15 @@
<?php if($num_vendors > 0){ ?> <?php if($num_vendors > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=vendors"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=vendors">
Vendors Vendors<br>
<span class="badge badge-pill badge-dark"><?php echo $num_vendors; ?></span> <span class="badge badge-pill badge-secondary"><?php echo $num_vendors; ?></span>
</a> </a>
</li> </li>
<?php } ?> <?php } ?>
<?php if($num_logins > 0){ ?> <?php if($num_logins > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=logins"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=logins">
Logins Logins<br>
<span class="badge badge-pill badge-dark"><?php echo $num_logins; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_logins; ?></span>
</a> </a>
</li> </li>
@@ -45,7 +43,7 @@
<?php if($num_networks > 0){ ?> <?php if($num_networks > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=networks"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=networks">
Networks Networks<br>
<span class="badge badge-pill badge-dark"><?php echo $num_networks; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_networks; ?></span>
</a> </a>
</li> </li>
@@ -53,7 +51,7 @@
<?php if($num_domains > 0){ ?> <?php if($num_domains > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=domains"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=domains">
Domains Domains<br>
<span class="badge badge-pill badge-dark"><?php echo $num_domains; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_domains; ?></span>
</a> </a>
</li> </li>
@@ -61,7 +59,7 @@
<?php if($num_applications > 0){ ?> <?php if($num_applications > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=applications"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=applications">
Applications Applications<br>
<span class="badge badge-pill badge-dark"><?php echo $num_applications; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_applications; ?></span>
</a> </a>
</li> </li>
@@ -69,7 +67,7 @@
<?php if($num_invoices > 0){ ?> <?php if($num_invoices > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=invoices"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=invoices">
Invoices Invoices<br>
<span class="badge badge-pill badge-dark"><?php echo $num_invoices; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_invoices; ?></span>
</a> </a>
</li> </li>
@@ -77,7 +75,7 @@
<?php if($num_quotes > 0){ ?> <?php if($num_quotes > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=quotes"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=quotes">
Quotes Quotes<br>
<span class="badge badge-pill badge-dark"><?php echo $num_quotes; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_quotes; ?></span>
</a> </a>
</li> </li>
@@ -85,7 +83,7 @@
<?php if($num_attachments > 0){ ?> <?php if($num_attachments > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=attachments"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=attachments">
Attachments Attachments<br>
<span class="badge badge-pill badge-dark"><?php echo $num_attachments; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_attachments; ?></span>
</a> </a>
</li> </li>
@@ -93,7 +91,7 @@
<?php if($num_notes > 0){ ?> <?php if($num_notes > 0){ ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=notes"> <a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=notes">
Notes Notes<br>
<span class="badge badge-pill badge-dark"><?php echo $num_notes; ?></span> <span class="badge badge-pill badge-dark"><?php echo $num_notes; ?></span>
</a> </a>
</li> </li>

View File

@@ -1,10 +1,7 @@
<?php <?php
if(isset($_GET['tab'])){ if(isset($_GET['tab'])){
if($_GET['tab'] == "details"){ if($_GET['tab'] == "contacts"){
include("client_details.php");
}
elseif($_GET['tab'] == "contacts"){
include("client_contacts.php"); include("client_contacts.php");
} }
elseif($_GET['tab'] == "locations"){ elseif($_GET['tab'] == "locations"){
@@ -45,7 +42,7 @@ if(isset($_GET['tab'])){
} }
} }
else{ else{
include("client_details.php"); include("client_contacts.php");
} }
?> ?>

View File

@@ -11,13 +11,12 @@
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0"> <table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
<thead> <thead class="thead-dark">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th> <th>Email</th>
<th class="text-right">Unpaid</th> <th>Phone</th>
<th class="text-right">Balance</th>
<th class="text-center">Actions</th> <th class="text-center">Actions</th>
</tr> </tr>
</thead> </thead>
@@ -42,15 +41,8 @@
?> ?>
<tr> <tr>
<td><a href="client.php?client_id=<?php echo $client_id; ?>"><?php echo "$client_name"; ?></a></td> <td><a href="client.php?client_id=<?php echo $client_id; ?>"><?php echo "$client_name"; ?></a></td>
<td>
<a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$client_address $client_zip"; ?>" target="_blank">
<?php echo "$client_address"; ?>
<br>
<?php echo "$client_city $client_state $client_zip"; ?>
</a>
</td>
<td><?php echo "$client_phone"; ?></td>
<td><a href="mailto:<?php echo$email; ?>"><?php echo "$client_email"; ?></a></td> <td><a href="mailto:<?php echo$email; ?>"><?php echo "$client_email"; ?></a></td>
<td><?php echo "$client_phone"; ?></td>
<td class="text-right text-monospace">$0.00</td> <td class="text-right text-monospace">$0.00</td>
<td> <td>
<div class="dropdown dropleft text-center"> <div class="dropdown dropleft text-center">

View File

@@ -1,66 +0,0 @@
<div class="modal fade" id="editInvoiceModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-file"></i> Edit Invoice</h5>
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
<div class="modal-body">
<div class="form-group">
<label>Invoice Date</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d",$invoice_date); ?>" required>
</div>
</div>
<div class="form-group">
<label>Payment Due</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="due" value="<?php echo date("Y-m-d",$invoice_due); ?>" required>
</div>
</div>
<div class="form-group">
<label>Income Category</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-tag"></i></span>
</div>
<select class="form-control" name="category" required>
<option value="">- Category -</option>
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Income'");
while($row = mysqli_fetch_array($sql)){
$category_id = $row['category_id'];
$category_name = $row['category_name'];
?>
<option <?php if($category_id == $invoice_category_id){ ?> selected <?php } ?> value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" name="edit_invoice" class="btn btn-primary">Save</button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -68,14 +68,17 @@ if(isset($_GET['invoice_id'])){
?> ?>
<div class="row d-print-none">
<div class="col-md-11"> <ol class="breadcrumb d-print-none">
<h3>Invoice # <li class="breadcrumb-item">
<small class="text-muted">INV-<?php echo $invoice_number; ?></small> <a href="index.html">Invoices</a>
<span class="badge badge-<?php echo $invoice_badge_color; ?>"><?php echo $invoice_status; ?></span> </li>
</h3> <li class="breadcrumb-item active">INV-<?php echo $invoice_number; ?></li>
</div> <span class="ml-3 p-2 badge badge-<?php echo $invoice_badge_color; ?>"><?php echo $invoice_status; ?></span>
<div class="col-md-1"> </ol>
<div class="row mb-4 d-print-none">
<div class="col-md-12">
<div class="dropdown dropleft text-center"> <div class="dropdown dropleft text-center">
<button class="btn btn-primary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button class="btn btn-primary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-h"></i> <i class="fas fa-ellipsis-h"></i>
@@ -94,7 +97,7 @@ if(isset($_GET['invoice_id'])){
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-4">
<div class="col-sm"> <div class="col-sm">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
@@ -139,127 +142,127 @@ if(isset($_GET['invoice_id'])){
<?php $sql4 = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY invoice_item_id ASC"); ?> <?php $sql4 = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY invoice_item_id ASC"); ?>
<div class="row mb-3"> <div class="row mb-4">
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
Items Items
</div> </div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th class="d-print-none"></th> <th class="d-print-none"></th>
<th>Product</th> <th>Item</th>
<th>Description</th> <th>Description</th>
<th class="text-center">Qty</th> <th class="text-right">Unit Cost</th>
<th class="text-right">Price</th> <th class="text-center">Quantity</th>
<th class="text-right">Tax</th> <th class="text-right">Tax</th>
<th class="text-right">Total</th> <th class="text-right">Line Total</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
while($row = mysqli_fetch_array($sql4)){ while($row = mysqli_fetch_array($sql4)){
$invoice_item_id = $row['invoice_item_id']; $invoice_item_id = $row['invoice_item_id'];
$invoice_item_name = $row['invoice_item_name']; $invoice_item_name = $row['invoice_item_name'];
$invoice_item_description = $row['invoice_item_description']; $invoice_item_description = $row['invoice_item_description'];
$invoice_item_quantity = $row['invoice_item_quantity']; $invoice_item_quantity = $row['invoice_item_quantity'];
$invoice_item_price = $row['invoice_item_price']; $invoice_item_price = $row['invoice_item_price'];
$invoice_item_subtotal = $row['invoice_item_price']; $invoice_item_subtotal = $row['invoice_item_price'];
$invoice_item_tax = $row['invoice_item_tax']; $invoice_item_tax = $row['invoice_item_tax'];
$invoice_item_total = $row['invoice_item_total']; $invoice_item_total = $row['invoice_item_total'];
$total_tax = $invoice_item_tax + $total_tax; $total_tax = $invoice_item_tax + $total_tax;
$sub_total = $invoice_item_price * $invoice_item_quantity + $sub_total; $sub_total = $invoice_item_price * $invoice_item_quantity + $sub_total;
?> ?>
<tr> <tr>
<td class="text-center d-print-none"><a class="btn btn-danger btn-sm" href="post.php?delete_invoice_item=<?php echo $invoice_item_id; ?>"><i class="fa fa-trash"></i></a></td> <td class="text-center d-print-none"><a class="btn btn-danger btn-sm" href="post.php?delete_invoice_item=<?php echo $invoice_item_id; ?>"><i class="fa fa-trash"></i></a></td>
<td><?php echo $invoice_item_name; ?></td> <td><?php echo $invoice_item_name; ?></td>
<td><?php echo $invoice_item_description; ?></td> <td><?php echo $invoice_item_description; ?></td>
<td class="text-center"><?php echo $invoice_item_quantity; ?></td> <td class="text-right">$<?php echo number_format($invoice_item_price,2); ?></td>
<td class="text-right">$<?php echo number_format($invoice_item_price,2); ?></td> <td class="text-center"><?php echo $invoice_item_quantity; ?></td>
<td class="text-right">$<?php echo number_format($invoice_item_tax,2); ?></td> <td class="text-right">$<?php echo number_format($invoice_item_tax,2); ?></td>
<td class="text-right">$<?php echo number_format($invoice_item_total,2); ?></td> <td class="text-right">$<?php echo number_format($invoice_item_total,2); ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr class="d-print-none"> <tr class="d-print-none">
<form action="post.php" method="post"> <form action="post.php" method="post">
<td class="text-center"><button type="submit" class="btn btn-primary btn-sm" name="add_invoice_item"><i class="fa fa-check"></i></button></td> <td class="text-center"><button type="submit" class="btn btn-primary btn-sm" name="add_invoice_item"><i class="fa fa-check"></i></button></td>
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>"> <input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
<td><input type="text" class="form-control" name="name"></td> <td><input type="text" class="form-control" name="name"></td>
<td><textarea class="form-control" rows="1" name="description"></textarea></td> <td><textarea class="form-control" rows="1" name="description"></textarea></td>
<td><input type="text" class="form-control" name="qty"></td> <td><input type="text" class="form-control" style="text-align: right;" name="price"></td>
<td class="text-right"><input type="text" class="form-control" name="price"></td> <td><input type="text" class="form-control" style="text-align: center;" name="qty"></td>
<td> <td>
<select class="form-control" name="tax"> <select dir="rtl" class="form-control" name="tax">
<option value="0.00">None</option> <option value="0.00">None</option>
<option value="0.07">State Tax 7%</option> <option value="0.07">State Tax 7%</option>
</select> </select>
</td> </td>
<td></td> <td></td>
</form> </form>
</tr> </tr>
<tr> </tbody>
<td class="d-print-none"></td> </table>
<td colspan="4"></td>
<td><strong>SubTotal</strong></td>
<td class="text-right">$<?php echo number_format($sub_total,2); ?></td>
</tr>
<?php if($discount > 0){ ?>
<tr>
<td class="d-print-none"></td>
<td colspan="4"></td>
<td><strong>Discount</strong></td>
<td class="text-right">$<?php echo number_format($invoice_discount,2); ?></td>
</tr>
<?php } ?>
<?php if($total_tax > 0){ ?>
<tr>
<td class="d-print-none"></td>
<td colspan="4"></td>
<td><strong>Tax</strong></td>
<td class="text-right">$<?php echo number_format($total_tax,2); ?></td>
</tr>
<?php } ?>
<?php if($amount_paid > 0){ ?>
<tr>
<td class="d-print-none"></td>
<td colspan="4"></td>
<td><strong class="text-success">Paid</strong></td>
<td class="text-right text-success">-$<?php echo number_format($amount_paid,2); ?></td>
</tr>
<?php } ?>
<tr>
<td class="d-print-none"></td>
<td colspan="4"></td>
<td><strong>Total</strong></td>
<td class="text-right">$<?php echo number_format($balance,2); ?></td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-3">
<div class="col-sm"> <div class="row mb-4">
<div class="col-5">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
Notes Notes
</div> </div>
<div class="card-body"> <div class="card-body mb-5">
<p><?php echo $invoice_note; ?></p> <p><?php echo $invoice_note; ?></p>
</div> </div>
</div> </div>
</div> </div>
<div class="col-3 offset-4">
<table class="table table-borderless">
<tbody>
<tr class="border-bottom">
<td>Subtotal</td>
<td class="text-right">$<?php echo number_format($sub_total,2); ?></td>
</tr>
<?php if($discount > 0){ ?>
<tr class="border-bottom">
<td>Discount</td>
<td class="text-right">$<?php echo number_format($invoice_discount,2); ?></td>
</tr>
<?php } ?>
<?php if($total_tax > 0){ ?>
<tr class="border-bottom">
<td>Tax</td>
<td class="text-right">$<?php echo number_format($total_tax,2); ?></td>
</tr>
<?php } ?>
<?php if($amount_paid > 0){ ?>
<tr class="border-bottom">
<td><div class="text-success">Paid to Date</div></td>
<td class="text-right text-success">$<?php echo number_format($amount_paid,2); ?></td>
</tr>
<?php } ?>
<tr class="border-bottom">
<td><strong>Balance Due</strong></td>
<td class="text-right"><strong>$<?php echo number_format($balance,2); ?></strong></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row mb-3">
<div class="col-sm d-print-none"> <div class="col-sm d-print-none">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">

View File

@@ -42,9 +42,6 @@
$unixtime_invoice_due = strtotime($invoice_due); $unixtime_invoice_due = strtotime($invoice_due);
if($unixtime_invoice_due < time()){ if($unixtime_invoice_due < time()){
$overdue_color = "text-danger"; $overdue_color = "text-danger";
$invoice_status = "Overdue";
}else{
$overdue_color = "text-success";
} }
if($invoice_status == "Sent"){ if($invoice_status == "Sent"){
@@ -89,7 +86,7 @@
<?php <?php
include("edit_invoice_modal.php"); //include("edit_invoice_modal.php");
include("add_invoice_copy_modal.php"); include("add_invoice_copy_modal.php");
} }

View File

@@ -338,6 +338,13 @@ if(isset($_POST['add_transfer'])){
$account_from = intval($_POST['account_from']); $account_from = intval($_POST['account_from']);
$account_to = intval($_POST['account_to']); $account_to = intval($_POST['account_to']);
mysqli_query($mysqli,"INSERT INTO expenses SET expense_date = '$date', expense_amount = '$amount', vendor_id = 0, account_id = $account_from");
mysqli_query($mysqli,"INSERT INTO invoice_payments SET invoice_payment_date = '$date', invoice_payment_amount = '$amount', account_id = $account_to, invoice_id = 0");
mysqli_query($mysqli,"INSERT INTO transfers SET transfer_date = '$date', transfer_amount = '$amount', transfer_account_from = $account_from, transfer_account_to = $account_to"); mysqli_query($mysqli,"INSERT INTO transfers SET transfer_date = '$date', transfer_amount = '$amount', transfer_account_from = $account_from, transfer_account_to = $account_to");
$_SESSION['alert_message'] = "Transfer added"; $_SESSION['alert_message'] = "Transfer added";
@@ -515,23 +522,30 @@ if(isset($_POST['add_invoice_payment'])){
//Calculate the Invoice balance //Calculate the Invoice balance
$invoice_balance = $invoice_amount - $total_payments_amount; $invoice_balance = $invoice_amount - $total_payments_amount;
//Determine if invoice has been paid if($amount > $invoice_balance){
if($invoice_balance == 0){ $_SESSION['alert_message'] = "Payment is more than the balance";
$invoice_status = "Paid";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}else{ }else{
$invoice_status = "Partial";
} //Determine if invoice has been paid then set the status accordingly
if($invoice_balance == 0){
$invoice_status = "Paid";
}else{
$invoice_status = "Partial";
}
//Update Invoice Status //Update Invoice Status
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = '$invoice_status' WHERE invoice_id = $invoice_id"); mysqli_query($mysqli,"UPDATE invoices SET invoice_status = '$invoice_status' WHERE invoice_id = $invoice_id");
//Add Payment to History //Add Payment to History
mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = '$invoice_status', invoice_history_description = 'INVOICE payment added', invoice_id = $invoice_id"); mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = '$invoice_status', invoice_history_description = 'INVOICE payment added', invoice_id = $invoice_id");
$_SESSION['alert_message'] = "Payment added";
header("Location: " . $_SERVER["HTTP_REFERER"]);
$_SESSION['alert_message'] = "Payment added";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
} }
if(isset($_POST['edit_invoice_note'])){ if(isset($_POST['edit_invoice_note'])){

View File

@@ -1,61 +1,61 @@
<!-- Sidebar --> <!-- Sidebar -->
<ul class="sidebar navbar-nav d-print-none"> <ul class="sidebar navbar-nav d-print-none">
<li class="nav-item"> <li class="nav-item active">
<a class="nav-link" href="dashboard.php"> <a class="nav-link" href="dashboard.php">
<i class="fas fa-fw fa-tachometer-alt"></i> <i class="fas fa-fw fa-tachometer-alt mx-2"></i>
<span>Dashboard</span> <span>Dashboard</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="clients.php"> <a class="nav-link" href="clients.php">
<i class="fas fa-fw fa-users"></i> <i class="fas fa-fw fa-users mx-2"></i>
<span>Clients</span></a> <span>Clients</span></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="vendors.php"> <a class="nav-link" href="vendors.php">
<i class="fas fa-fw fa-briefcase"></i> <i class="fas fa-fw fa-briefcase mx-2"></i>
<span>Vendors</span> <span>Vendors</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="invoices.php"> <a class="nav-link" href="invoices.php">
<i class="fas fa-fw fa-file-invoice-dollar"></i> <i class="fas fa-fw fa-file-invoice-dollar mx-2"></i>
<span>Invoices</span> <span>Invoices</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="quotes.php"> <a class="nav-link" href="quotes.php">
<i class="fas fa-fw fa-file-invoice"></i> <i class="fas fa-fw fa-file-invoice mx-2"></i>
<span>Quotes</span> <span>Quotes</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="expenses.php"> <a class="nav-link" href="expenses.php">
<i class="fas fa-fw fa-shopping-cart"></i> <i class="fas fa-fw fa-shopping-cart mx-2"></i>
<span>Expenses</span> <span>Expenses</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="accounts.php"> <a class="nav-link" href="accounts.php">
<i class="fas fa-fw fa-piggy-bank"></i> <i class="fas fa-fw fa-piggy-bank mx-2"></i>
<span>Accounts</span> <span>Accounts</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="transfers.php"> <a class="nav-link" href="transfers.php">
<i class="fas fa-fw fa-exchange-alt"></i> <i class="fas fa-fw fa-exchange-alt mx-2"></i>
<span>Transfers</span> <span>Transfers</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="mileage.php"> <a class="nav-link" href="mileage.php">
<i class="fas fa-fw fa-car"></i> <i class="fas fa-fw fa-car mx-2"></i>
<span>Mileage</span> <span>Mileage</span>
</a> </a>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-fw fa-chart-area"></i> <i class="fas fa-fw fa-chart-area mx-2"></i>
<span>Reports</span> <span>Reports</span>
</a> </a>
<div class="dropdown-menu" aria-labelledby="pagesDropdown"> <div class="dropdown-menu" aria-labelledby="pagesDropdown">
@@ -68,7 +68,7 @@
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-fw fa-cogs"></i> <i class="fas fa-fw fa-cog mx-2"></i>
<span>Settings</span> <span>Settings</span>
</a> </a>
<div class="dropdown-menu" aria-labelledby="pagesDropdown"> <div class="dropdown-menu" aria-labelledby="pagesDropdown">

View File

@@ -1,4 +1,4 @@
<nav class="navbar navbar-expand navbar-dark bg-dark static-top"> <nav class="navbar navbar-expand navbar-dark bg-primary static-top">
<a class="navbar-brand mr-1" href="index.html"><?php echo "$config_company_name";?></a> <a class="navbar-brand mr-1" href="index.html"><?php echo "$config_company_name";?></a>
@@ -11,7 +11,7 @@
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" placeholder="Search for..." aria-label="Search" aria-describedby="basic-addon2"> <input type="text" class="form-control" placeholder="Search for..." aria-label="Search" aria-describedby="basic-addon2">
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-primary" type="button"> <button class="btn btn-dark" type="button">
<i class="fas fa-search"></i> <i class="fas fa-search"></i>
</button> </button>
</div> </div>
@@ -22,7 +22,7 @@
<ul class="navbar-nav ml-auto ml-md-0"> <ul class="navbar-nav ml-auto ml-md-0">
<li class="nav-item dropdown no-arrow"> <li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img height="28" width="28" src="<?php echo "$session_avatar"; ?>" class="img-fluid rounded-circle"> <?php echo "$session_name"; ?> <img height="32" width="32" src="<?php echo "$session_avatar"; ?>" class="img-fluid rounded-circle"> <strong><?php echo "$session_name"; ?></strong>
</a> </a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown"> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<a class="dropdown-item" data-toggle="modal" data-target="#changeAvatarModal" href="#"> <a class="dropdown-item" data-toggle="modal" data-target="#changeAvatarModal" href="#">