Added new Field Client Tax ID Number, currently only vieable on the client top head, and under edit. It is also searchable

This commit is contained in:
johnnyq 2023-04-11 16:20:48 -04:00
parent d27c83ab66
commit f127719cbe
10 changed files with 41 additions and 7 deletions

View File

@ -265,6 +265,16 @@
</div>
</div>
<div class="form-group">
<label>Tax ID</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
</div>
<input type="text" class="form-control" name="tax_id_number" placeholder="Tax ID Number">
</div>
</div>
<?php } else { ?>
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
<input type="hidden" name="net_terms" value="0">

View File

@ -127,6 +127,16 @@
</div>
</div>
<div class="form-group">
<label>Tax ID</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
</div>
<input type="text" class="form-control" name="tax_id_number" placeholder="Tax ID Number" value="<?php echo $tax_id_number; ?>">
</div>
</div>
<?php } else { ?>
<input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>">
<input type="hidden" name="net_terms" value="<?php echo $net_term_value; ?>">

View File

@ -17,7 +17,7 @@ $sql = mysqli_query(
LEFT JOIN client_tags ON client_tags.client_tag_client_id = clients.client_id
LEFT JOIN tags ON tags.tag_id = client_tags.client_tag_tag_id
WHERE (client_name LIKE '%$q%' OR client_type LIKE '%$q%' OR client_referral LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_name LIKE '%$q%' OR contact_phone LIKE '%$phone_query%'
OR contact_mobile LIKE '%$phone_query%' OR location_address LIKE '%$q%' OR location_city LIKE '%$q%' OR location_state LIKE '%$q%' OR location_zip LIKE '%$q%' OR tag_name LIKE '%$q%')
OR contact_mobile LIKE '%$phone_query%' OR location_address LIKE '%$q%' OR location_city LIKE '%$q%' OR location_state LIKE '%$q%' OR location_zip LIKE '%$q%' OR tag_name LIKE '%$q%' OR client_tax_id_number LIKE '%$q%')
AND client_archived_at IS NULL
AND DATE(client_created_at) BETWEEN '$dtf' AND '$dtt'
GROUP BY clients.client_id
@ -125,6 +125,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$client_rate = floatval($row['client_rate']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = intval($row['client_net_terms']);
$client_tax_id_number = htmlentities($row['client_tax_id_number']);
$client_referral = htmlentities($row['client_referral']);
$client_notes = htmlentities($row['client_notes']);
$client_created_at = date('Y-m-d', strtotime($row['client_created_at']));

View File

@ -946,11 +946,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.4.9'");
}
//if (CURRENT_DATABASE_VERSION == '0.4.9') {
if (CURRENT_DATABASE_VERSION == '0.4.9') {
// Insert queries here required to update to DB version 0.5.0
mysqli_query($mysqli, "ALTER TABLE `clients` ADD `client_tax_id_number` VARCHAR(255) NULL DEFAULT NULL AFTER `client_net_terms`");
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.0'");
}
//if (CURRENT_DATABASE_VERSION == '0.5.0') {
// Insert queries here required to update to DB version 0.5.1
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.0'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.1'");
//}
} else {

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "0.4.9");
DEFINE("LATEST_DATABASE_VERSION", "0.5.0");

3
db.sql
View File

@ -223,6 +223,7 @@ CREATE TABLE `clients` (
`client_rate` decimal(15,2) DEFAULT NULL,
`client_currency_code` varchar(200) NOT NULL,
`client_net_terms` int(10) NOT NULL,
`client_tax_id_number` varchar(255) DEFAULT NULL,
`client_notes` text DEFAULT NULL,
`client_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`client_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
@ -1470,4 +1471,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2023-03-28 15:29:24
-- Dump completed on 2023-04-11 16:19:58

View File

@ -34,6 +34,7 @@ if (isset($_GET['client_id'])) {
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$client_tax_id_number = htmlentities($row['client_tax_id_number']);
$client_rate = floatval($row['client_rate']);
$client_notes = htmlentities($row['client_notes']);
$client_created_at = htmlentities($row['client_created_at']);

View File

@ -65,6 +65,9 @@
<h6 class="ml-1 text-secondary">Balance <div class="<?php if ($balance > 0) { echo "text-danger"; }else{ echo "text-dark"; } ?> float-right"> <?php echo numfmt_format_currency($currency_format, $balance, $client_currency_code); ?></div></h6>
<h6 class="ml-1 text-secondary">Monthly Recurring <div class="text-dark float-right"> <?php echo numfmt_format_currency($currency_format, $recurring_monthly, $client_currency_code); ?></div></h6>
<h6 class="ml-1 text-secondary">Net Terms <div class="text-dark float-right"><?php echo $client_net_terms; ?> <small class="text-secondary">Days</small></div></h6>
<?php if(!empty($client_tax_id_number)) { ?>
<h6 class="ml-1 text-secondary">Tax ID <div class="text-dark float-right"><?php echo $client_tax_id_number; ?></div></h6>
<?php } ?>
</div>
<?php } ?>

View File

@ -6,4 +6,5 @@ $referral = sanitizeInput($_POST['referral']);
$rate = floatval($_POST['rate']);
$currency_code = sanitizeInput($_POST['currency_code']);
$net_terms = intval($_POST['net_terms']);
$tax_id_number = sanitizeInput($_POST['tax_id_number']);
$notes = sanitizeInput($_POST['notes']);

View File

@ -1500,7 +1500,7 @@ if(isset($_POST['add_client'])){
$extended_log_description = '';
mysqli_query($mysqli,"INSERT INTO clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_notes = '$notes', client_accessed_at = NOW()");
mysqli_query($mysqli,"INSERT INTO clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_tax_id_number = '$tax_id_number', client_notes = '$notes', client_accessed_at = NOW()");
$client_id = mysqli_insert_id($mysqli);
@ -1596,7 +1596,7 @@ if(isset($_POST['edit_client'])){
$client_id = intval($_POST['client_id']);
mysqli_query($mysqli,"UPDATE clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_notes = '$notes' WHERE client_id = $client_id");
mysqli_query($mysqli,"UPDATE clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_tax_id_number = '$tax_id_number', client_notes = '$notes' WHERE client_id = $client_id");
//Tags
//Delete existing tags