get settings vars updates added default net_terms to settings and some php var fixes in dashboard
This commit is contained in:
@@ -161,7 +161,7 @@
|
||||
</div>
|
||||
<select class="form-control selectpicker show-tick" name="net_terms">
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<option <?php if($config_default_net_terms == $net_term_value){ echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//Rebuild URL
|
||||
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $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']);
|
||||
@@ -92,9 +92,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$client_email = $row['client_email'];
|
||||
$client_website = $row['client_website'];
|
||||
$client_net_terms = $row['client_net_terms'];
|
||||
if($client_net_terms == 0){
|
||||
$client_net_terms = $config_default_net_terms;
|
||||
}
|
||||
$client_hours = $row['client_hours'];
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' ");
|
||||
|
||||
3
cron.php
3
cron.php
@@ -28,6 +28,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
||||
$config_smtp_port = $row['config_smtp_port'];
|
||||
$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'];
|
||||
|
||||
if($config_enable_cron == 1){
|
||||
|
||||
@@ -165,7 +166,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
||||
//update the recurring invoice with the new dates
|
||||
mysqli_query($mysqli,"UPDATE recurring SET recurring_last_sent = CURDATE(), recurring_next_date = DATE_ADD(CURDATE(), INTERVAL 1 $recurring_frequency), recurring_updated_at = NOW() WHERE recurring_id = $recurring_id");
|
||||
|
||||
if($config_recurring_email_auto_send == 1){
|
||||
if($config_recurring_auto_send_invoice == 1){
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.invoice_id = $new_invoice_id
|
||||
|
||||
@@ -19,7 +19,8 @@ $sql_payment_years = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_year
|
||||
|
||||
//GET unique years from expenses, payments and revenues
|
||||
$sql_payment_years = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years FROM expenses UNION DISTINCT SELECT YEAR(payment_date) FROM payments UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues ORDER BY all_years DESC");
|
||||
|
||||
//Define var so it doesnt throw errors in logs
|
||||
$largest_income_month = 0;
|
||||
|
||||
//Get Total income
|
||||
$sql_total_payments_to_invoices = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments_to_invoices FROM payments WHERE YEAR(payment_date) = $year AND company_id = $session_company_id");
|
||||
@@ -116,11 +117,10 @@ $sql_latest_expenses = mysqli_query($mysqli,"SELECT * FROM expenses, vendors, ca
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<!-- Area Chart Example-->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><i class="fas fa-fw fa-chart-area"></i> Cash Flow</div>
|
||||
<div class="card-body">
|
||||
<canvas id="myAreaChart" width="100%" height="20"></canvas>
|
||||
<canvas id="cashFlow" width="100%" height="20"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -294,7 +294,7 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||
|
||||
// Area Chart Example
|
||||
var ctx = document.getElementById("myAreaChart");
|
||||
var ctx = document.getElementById("cashFlow");
|
||||
var myLineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
|
||||
@@ -51,8 +51,9 @@ $config_default_transfer_to_account = $row['config_default_transfer_to_account']
|
||||
$config_default_calendar = $row['config_default_calendar'];
|
||||
$config_default_payment_method = $row['config_default_payment_method'];
|
||||
$config_default_expense_payment_method = $row['config_default_expense_payment_method'];
|
||||
$config_default_net_terms = $row['config_default_net_terms'];
|
||||
|
||||
$config_recurring_email_auto_send = $row['config_recurring_email_auto_send'];
|
||||
$config_recurring_auto_send_invoice = $row['config_recurring_auto_send_invoice'];
|
||||
|
||||
$config_api_key = $row['config_api_key'];
|
||||
$config_enable_cron = $row['config_enable_cron'];
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
$total_found_rows = $num_rows[0];
|
||||
$total_pages = ceil($total_found_rows / 10);
|
||||
|
||||
if ($total_found_rows > 10) {
|
||||
if ($total_found_rows > 10) {
|
||||
$i=0;
|
||||
|
||||
?>
|
||||
|
||||
@@ -37,7 +38,7 @@ if ($total_found_rows > 10) {
|
||||
if($p > 1){
|
||||
echo "<li class='page-item $prev_class'><a class='page-link' href='?$url_query_strings&p=$prev_page'>Prev</a></li>";
|
||||
}
|
||||
|
||||
|
||||
while($i < $total_pages){
|
||||
$i++;
|
||||
if(($i == 1) OR (($p <= 3) AND ($i <= 6)) OR (($i > $total_pages - 6) AND ($p > $total_pages - 3 )) OR (is_int($i / $pages_split)) OR (($p > 3) AND ($i >= $p - 2) AND ($i <= $p + 3)) OR ($i == $total_pages)){
|
||||
|
||||
9
post.php
9
post.php
@@ -245,8 +245,9 @@ if(isset($_POST['edit_default_settings'])){
|
||||
$config_default_transfer_from_account = intval($_POST['config_default_transfer_from_account']);
|
||||
$config_default_transfer_to_account = intval($_POST['config_default_transfer_to_account']);
|
||||
$config_default_calendar = intval($_POST['config_default_calendar']);
|
||||
$config_default_net_terms = intval($_POST['config_default_net_terms']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_default_expense_account = $config_default_expense_account, config_default_payment_account = $config_default_payment_account, config_default_payment_method = '$config_default_payment_method', config_default_expense_payment_method = '$config_default_expense_payment_method', config_default_transfer_from_account = $config_default_transfer_from_account, config_default_transfer_to_account = $config_default_transfer_to_account, config_default_calendar = $config_default_calendar WHERE company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_default_expense_account = $config_default_expense_account, config_default_payment_account = $config_default_payment_account, config_default_payment_method = '$config_default_payment_method', config_default_expense_payment_method = '$config_default_expense_payment_method', config_default_transfer_from_account = $config_default_transfer_from_account, config_default_transfer_to_account = $config_default_transfer_to_account, config_default_calendar = $config_default_calendar, config_default_net_terms = $config_default_net_terms WHERE company_id = $session_company_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Default Settings updated";
|
||||
|
||||
@@ -363,8 +364,9 @@ if(isset($_POST['add_client'])){
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
$website = strip_tags(mysqli_real_escape_string($mysqli,$_POST['website']));
|
||||
$net_terms = intval($_POST['net_terms']);
|
||||
$hours = strip_tags(mysqli_real_escape_string($mysqli,$_POST['hours']));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO clients SET client_name = '$name', client_type = '$type', client_address = '$address', client_city = '$city', client_state = '$state', client_zip = '$zip', client_phone = '$phone', client_email = '$email', client_website = '$website', client_net_terms = $net_terms, client_created_at = NOW(), company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO clients SET client_name = '$name', client_type = '$type', client_address = '$address', client_city = '$city', client_state = '$state', client_zip = '$zip', client_phone = '$phone', client_email = '$email', client_website = '$website', client_net_terms = $net_terms, client_hours = '$hours', client_created_at = NOW(), company_id = $session_company_id");
|
||||
|
||||
$client_id = mysqli_insert_id($mysqli);
|
||||
|
||||
@@ -391,8 +393,9 @@ if(isset($_POST['edit_client'])){
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
$website = strip_tags(mysqli_real_escape_string($mysqli,$_POST['website']));
|
||||
$net_terms = intval($_POST['net_terms']);
|
||||
$hours = strip_tags(mysqli_real_escape_string($mysqli,$_POST['hours']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE clients SET client_name = '$name', client_type = '$type', client_address = '$address', client_city = '$city', client_state = '$state', client_zip = '$zip', client_phone = '$phone', client_email = '$email', client_website = '$website', client_net_terms = $net_terms, client_updated_at = NOW() WHERE client_id = $client_id");
|
||||
mysqli_query($mysqli,"UPDATE clients SET client_name = '$name', client_type = '$type', client_address = '$address', client_city = '$city', client_state = '$state', client_zip = '$zip', client_phone = '$phone', client_email = '$email', client_website = '$website', client_net_terms = $net_terms, client_hours = '$hours', client_updated_at = NOW() WHERE client_id = $client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Client $name updated";
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-5">
|
||||
<div class="form-group">
|
||||
<label>Default Calendar</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
@@ -181,6 +181,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-5">
|
||||
<label>Default Net Terms</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control selectpicker show-tick" name="config_default_net_terms">
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if($config_default_net_terms == $net_term_value){ echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<button type="submit" name="edit_default_settings" class="btn btn-primary">Save</button>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user