diff --git a/client_add_modal.php b/client_add_modal.php index 3d4241b0..061f4649 100644 --- a/client_add_modal.php +++ b/client_add_modal.php @@ -265,6 +265,16 @@ +
+ +
+
+ +
+ +
+
+ diff --git a/client_edit_modal.php b/client_edit_modal.php index 9344f28d..16953846 100644 --- a/client_edit_modal.php +++ b/client_edit_modal.php @@ -127,6 +127,16 @@ +
+ +
+
+ +
+ +
+
+ diff --git a/clients.php b/clients.php index a4e12a74..6c6dc8ba 100644 --- a/clients.php +++ b/clients.php @@ -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'])); diff --git a/database_updates.php b/database_updates.php index b16095fc..1d121b63 100644 --- a/database_updates.php +++ b/database_updates.php @@ -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 { diff --git a/database_version.php b/database_version.php index 69296470..a464a0e4 100644 --- a/database_version.php +++ b/database_version.php @@ -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"); diff --git a/db.sql b/db.sql index c06529e8..08a37b9d 100644 --- a/db.sql +++ b/db.sql @@ -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 diff --git a/inc_all_client.php b/inc_all_client.php index c87598f0..49827e0f 100644 --- a/inc_all_client.php +++ b/inc_all_client.php @@ -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']); diff --git a/inc_client_top_head.php b/inc_client_top_head.php index 1e759482..2db0418e 100644 --- a/inc_client_top_head.php +++ b/inc_client_top_head.php @@ -65,6 +65,9 @@
Balance
float-right">
Monthly Recurring
Net Terms
Days
+ +
Tax ID
+ diff --git a/models/client.php b/models/client.php index 51dfa878..6a73f2ce 100644 --- a/models/client.php +++ b/models/client.php @@ -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']); diff --git a/post.php b/post.php index 3b0b236d..e0130870 100644 --- a/post.php +++ b/post.php @@ -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