diff --git a/clients.php b/clients.php
index cc571285..a4e12a74 100644
--- a/clients.php
+++ b/clients.php
@@ -122,6 +122,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
$contact_email = htmlentities($row['contact_email']);
$client_website = htmlentities($row['client_website']);
+ $client_rate = floatval($row['client_rate']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = intval($row['client_net_terms']);
$client_referral = htmlentities($row['client_referral']);
@@ -242,6 +243,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Paid
Monthly
+
+
Hourly Rate
diff --git a/database_updates.php b/database_updates.php
index 2f5507ae..a4105ee2 100644
--- a/database_updates.php
+++ b/database_updates.php
@@ -934,11 +934,17 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.4.7'");
}
- //if (CURRENT_DATABASE_VERSION == '0.4.7') {
- // Insert queries here required to update to DB version 0.4.8
+ if (CURRENT_DATABASE_VERSION == '0.4.7') {
+
+ mysqli_query($mysqli, "ALTER TABLE `clients` ADD `client_rate` DECIMAL(15,2) NULL DEFAULT NULL AFTER `client_referral`");
+ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.4.8'");
+ }
+
+//if (CURRENT_DATABASE_VERSION == '0.4.8') {
+ // Insert queries here required to update to DB version 0.4.9
// Then, update the database to the next sequential version
- // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.4.8'");
+ // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.4.9'");
//}
} else {
diff --git a/database_version.php b/database_version.php
index 2cda263e..a02019fa 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.7");
+DEFINE("LATEST_DATABASE_VERSION", "0.4.8");
diff --git a/db.sql b/db.sql
index ffe4a695..58a2d9e8 100644
--- a/db.sql
+++ b/db.sql
@@ -220,6 +220,7 @@ CREATE TABLE `clients` (
`client_type` varchar(200) DEFAULT NULL,
`client_website` varchar(200) DEFAULT NULL,
`client_referral` varchar(200) DEFAULT NULL,
+ `client_rate` decimal(15,2) DEFAULT NULL,
`client_currency_code` varchar(200) NOT NULL,
`client_net_terms` int(10) NOT NULL,
`client_notes` text DEFAULT NULL,
@@ -1468,4 +1469,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-03-18 15:21:29
+-- Dump completed on 2023-03-28 15:29:24
diff --git a/get_settings.php b/get_settings.php
index 2b577caa..f610cc42 100644
--- a/get_settings.php
+++ b/get_settings.php
@@ -922,4 +922,3 @@ $asset_status_array = array(
'Lost/Stolen',
'Retired'
);
-
diff --git a/inc_all_client.php b/inc_all_client.php
index 08d02675..c87598f0 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_rate = floatval($row['client_rate']);
$client_notes = htmlentities($row['client_notes']);
$client_created_at = htmlentities($row['client_created_at']);
$primary_contact = intval($row['primary_contact']);
diff --git a/inc_client_top_head.php b/inc_client_top_head.php
index cd01e7e3..1e759482 100644
--- a/inc_client_top_head.php
+++ b/inc_client_top_head.php
@@ -60,6 +60,7 @@
Billing
+
Hourly Rate
Paid
Balance
float-right">
Monthly Recurring
diff --git a/models/client.php b/models/client.php
index f0715d20..51dfa878 100644
--- a/models/client.php
+++ b/models/client.php
@@ -3,6 +3,7 @@ $name = sanitizeInput($_POST['name']);
$type = sanitizeInput($_POST['type']);
$website = sanitizeInput($_POST['website']);
$referral = sanitizeInput($_POST['referral']);
+$rate = floatval($_POST['rate']);
$currency_code = sanitizeInput($_POST['currency_code']);
$net_terms = intval($_POST['net_terms']);
$notes = sanitizeInput($_POST['notes']);
diff --git a/post.php b/post.php
index 69cff598..b58e6fc1 100644
--- a/post.php
+++ b/post.php
@@ -1471,7 +1471,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_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_notes = '$notes', client_accessed_at = NOW()");
$client_id = mysqli_insert_id($mysqli);
@@ -1567,7 +1567,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_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_notes = '$notes' WHERE client_id = $client_id");
//Tags
//Delete existing tags