diff --git a/assets.php b/assets.php index ef696a8e..dda159ec 100644 --- a/assets.php +++ b/assets.php @@ -66,9 +66,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
-

Assets

+

Client Assets

-
@@ -77,7 +76,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
- +
diff --git a/cron.php b/cron.php index 5ce7c974..f213e623 100644 --- a/cron.php +++ b/cron.php @@ -30,8 +30,6 @@ while($row = mysqli_fetch_array($sql_companies)){ $config_mail_from_email = $row['config_mail_from_email']; $config_mail_from_name = $row['config_mail_from_name']; $config_recurring_auto_send_invoice = $row['config_recurring_auto_send_invoice']; - $config_enable_alert_low_balance = $row['config_enable_alert_low_balance']; - $config_account_balance_threshold = $row['config_account_balance_threshold']; $config_base_url = $row['config_base_url']; if($config_enable_cron == 1){ @@ -163,38 +161,6 @@ while($row = mysqli_fetch_array($sql_companies)){ } } - - //LOW BALANCE ALERTS - if($config_enable_alert_low_balance == 1){ - - $sql = mysqli_query($mysqli,"SELECT * FROM accounts WHERE company_id = $company_id ORDER BY account_id DESC"); - - while($row = mysqli_fetch_array($sql)){ - $account_id = $row['account_id']; - $account_name = $row['account_name']; - $opening_balance = $row['opening_balance']; - - $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); - $row = mysqli_fetch_array($sql_payments); - $total_payments = $row['total_payments']; - - $sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id"); - $row = mysqli_fetch_array($sql_revenues); - $total_revenues = $row['total_revenues']; - - $sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id"); - $row = mysqli_fetch_array($sql_expenses); - $total_expenses = $row['total_expenses']; - - $balance = $opening_balance + $total_payments + $total_revenues - $total_expenses; - - if($balance < $config_account_balance_threshold){ - mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Account Low Balance', alert_message = 'Threshold of $config_account_balance_threshold triggered low balance of $balance on account $account_name', alert_date = NOW(), company_id = $company_id"); - } - - } - - } //Send Recurring Invoices that match todays date and are active diff --git a/db.sql b/db.sql index 441811cc..88033f8e 100644 --- a/db.sql +++ b/db.sql @@ -847,8 +847,6 @@ CREATE TABLE `settings` ( `config_ticket_prefix` varchar(200) DEFAULT NULL, `config_ticket_next_number` int(11) DEFAULT NULL, `config_enable_cron` tinyint(1) DEFAULT NULL, - `config_enable_alert_low_balance` tinyint(1) DEFAULT NULL, - `config_account_balance_threshold` decimal(15,2) DEFAULT NULL, `config_recurring_auto_send_invoice` tinyint(1) DEFAULT NULL, `config_enable_alert_domain_expire` tinyint(1) DEFAULT NULL, `config_send_invoice_reminders` tinyint(1) DEFAULT NULL, @@ -1100,4 +1098,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-12-08 22:12:04 +-- Dump completed on 2021-12-08 22:31:20 diff --git a/get_settings.php b/get_settings.php index 99dcd81f..0e3d32a7 100644 --- a/get_settings.php +++ b/get_settings.php @@ -46,9 +46,6 @@ $config_ticket_next_number = $row['config_ticket_next_number']; //Alerts $config_enable_cron = $row['config_enable_cron']; -$config_enable_alert_low_balance = $row['config_enable_alert_low_balance']; -$config_account_balance_threshold = $row['config_account_balance_threshold']; - $config_recurring_auto_send_invoice = $row['config_recurring_auto_send_invoice']; $config_enable_alert_domain_expire = $row['config_enable_alert_domain_expire']; $config_send_invoice_reminders = $row['config_send_invoice_reminders']; diff --git a/post.php b/post.php index a95a3ee2..7c4e5a99 100644 --- a/post.php +++ b/post.php @@ -709,12 +709,10 @@ if(isset($_POST['edit_alert_settings'])){ $config_enable_cron = intval($_POST['config_enable_cron']); $config_enable_alert_domain_expire = intval($_POST['config_enable_alert_domain_expire']); - $config_enable_alert_low_balance = intval($_POST['config_enable_alert_low_balance']); $config_send_invoice_reminders = intval($_POST['config_send_invoice_reminders']); $config_invoice_overdue_reminders = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_invoice_overdue_reminders'])); - $config_account_balance_threshold = floatval($_POST['config_account_balance_threshold']); - mysqli_query($mysqli,"UPDATE settings SET config_send_invoice_reminders = $config_send_invoice_reminders, config_invoice_overdue_reminders = '$config_invoice_overdue_reminders', config_enable_cron = $config_enable_cron, config_enable_alert_domain_expire = $config_enable_alert_domain_expire, config_enable_alert_low_balance = $config_enable_alert_low_balance, config_account_balance_threshold = '$config_account_balance_threshold' WHERE company_id = $session_company_id"); + mysqli_query($mysqli,"UPDATE settings SET config_send_invoice_reminders = $config_send_invoice_reminders, config_invoice_overdue_reminders = '$config_invoice_overdue_reminders', config_enable_cron = $config_enable_cron, config_enable_alert_domain_expire = $config_enable_alert_domain_expire WHERE company_id = $session_company_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modified', log_description = 'Alerts', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id"); diff --git a/settings-alerts.php b/settings-alerts.php index 74195818..37e3cd08 100644 --- a/settings-alerts.php +++ b/settings-alerts.php @@ -14,25 +14,6 @@
-
- value="1" id="customSwitch2"> - -
- - - -
- -
-
- -
- -
-
- - -
value="1" id="customSwitch3">