diff --git a/check_login.php b/check_login.php index 815f7504..096b3aa7 100644 --- a/check_login.php +++ b/check_login.php @@ -1,5 +1,9 @@ $sb, 'o' => $o))); +$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o))); if(isset($_GET['p'])){ $p = intval($_GET['p']); diff --git a/cron.php b/cron.php index edef2d11..626f0c60 100644 --- a/cron.php +++ b/cron.php @@ -29,6 +29,7 @@ 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_base_url = $row['config_base_url']; if($config_enable_cron == 1){ @@ -36,7 +37,7 @@ while($row = mysqli_fetch_array($sql_companies)){ //DOMAINS EXPIRING - $domainAlertArray = [1, 14, 30, 90]; + $domainAlertArray = [1,7,14,30,90,120]; foreach($domainAlertArray as $day){ @@ -61,8 +62,7 @@ while($row = mysqli_fetch_array($sql_companies)){ } - //PAST DUE INVOICES - + //PAST DUE INVOICE ALERTS $invoiceAlertArray = [$config_invoice_overdue_reminders]; foreach($invoiceAlertArray as $day){ @@ -91,7 +91,7 @@ while($row = mysqli_fetch_array($sql_companies)){ } } - + //LOW BALANCE ALERTS $sql = mysqli_query($mysqli,"SELECT * FROM accounts WHERE company_id = $company_id ORDER BY account_id DESC"); @@ -103,12 +103,16 @@ while($row = mysqli_fetch_array($sql_companies)){ $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE 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 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 account_id = $account_id"); $row = mysqli_fetch_array($sql_expenses); $total_expenses = $row['total_expenses']; - $balance = $opening_balance + $total_payments - $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"); @@ -219,14 +223,14 @@ while($row = mysqli_fetch_array($sql_companies)){ $mail->send(); - mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Auto Emailed Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id"); + mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Emailed Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id"); //Update Invoice Status to Sent mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Sent', invoice_updated_at = NOW(), client_id = $client_id WHERE invoice_id = $new_invoice_id"); }catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; - mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Draft', history_description = 'Failed to send Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id"); + mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Draft', history_description = 'Cron Failed to send Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id"); } //End Mail Try } //End if Autosend is on } //End Recurring Invoices Loop diff --git a/get_settings.php b/get_settings.php index 66262ada..0ffcac93 100644 --- a/get_settings.php +++ b/get_settings.php @@ -2,8 +2,8 @@ //General Settings -$sql = mysqli_query($mysqli,"SELECT * FROM settings WHERE company_id = $session_company_id"); -$row = mysqli_fetch_array($sql); +$sql_settings = mysqli_query($mysqli,"SELECT * FROM settings WHERE company_id = $session_company_id"); +$row = mysqli_fetch_array($sql_settings); $config_start_page = $row['config_start_page']; diff --git a/guest_view_invoice.php b/guest_view_invoice.php index 19e5ad52..66a570ae 100644 --- a/guest_view_invoice.php +++ b/guest_view_invoice.php @@ -104,7 +104,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){ - Pay Online + Pay Online (Comming Soon) diff --git a/header.php b/header.php index 2f6efff2..790e6ace 100644 --- a/header.php +++ b/header.php @@ -8,10 +8,6 @@
diff --git a/settings-alerts.php b/settings-alerts.php new file mode 100644 index 00000000..c5b85aac --- /dev/null +++ b/settings-alerts.php @@ -0,0 +1,62 @@ + + + + +
+
+
Alerts and Reminders
+
+
+
+ +
+ value="1" id="customSwitch"> + +
+ + + +
+ +
+
+ +
+ +
+
+ + + +
+ value="1" id="customSwitch2"> + +
+ + + +
+ +
+
+ +
+ +
+
+ + + +
+ value="1" id="customSwitch3"> + +
+ +
+ + +
+
+
+ + - + diff --git a/settings-defaults.php b/settings-defaults.php index c27cbd31..37cc9ec3 100644 --- a/settings-defaults.php +++ b/settings-defaults.php @@ -3,7 +3,7 @@
-
+
Defaults Settings
diff --git a/settings-general.php b/settings-general.php index d1294fdb..12435249 100644 --- a/settings-general.php +++ b/settings-general.php @@ -25,16 +25,6 @@
-
- -
-
- -
- -
-
-
diff --git a/settings-invoice.php b/settings-invoice.php index b0c9d0f1..885b96c7 100644 --- a/settings-invoice.php +++ b/settings-invoice.php @@ -25,7 +25,7 @@
- +
diff --git a/settings-mail.php b/settings-mail.php index 3ceebea3..d2c9f862 100644 --- a/settings-mail.php +++ b/settings-mail.php @@ -24,7 +24,7 @@
- +
diff --git a/settings-nav.php b/settings-nav.php index f09a1a1e..a803ba3a 100644 --- a/settings-nav.php +++ b/settings-nav.php @@ -3,7 +3,7 @@ @@ -55,6 +55,14 @@ Ticket + +