mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 11:24:52 +00:00
Removed default currency and default country under settings added a company currency to the company table. Now currency default and country default uses company country and currency, updated the currency symbol to use companies currency under dashboard, expenses, profit loss reports
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
<select class="form-control select2" name="currency_code" required>
|
<select class="form-control select2" name="currency_code" required>
|
||||||
<option value="">- Currency -</option>
|
<option value="">- Currency -</option>
|
||||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||||
<option <?php if($config_default_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
<option <?php if($session_company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
<select class="form-control select2" name="country">
|
<select class="form-control select2" name="country">
|
||||||
<option value="">- Country -</option>
|
<option value="">- Country -</option>
|
||||||
<?php foreach($countries_array as $country_name) { ?>
|
<?php foreach($countries_array as $country_name) { ?>
|
||||||
<option <?php if($config_default_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option>
|
<option <?php if($session_company_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
<select class="form-control select2" name="currency_code" required>
|
<select class="form-control select2" name="currency_code" required>
|
||||||
<option value="">- Currency -</option>
|
<option value="">- Currency -</option>
|
||||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||||
<option <?php if($config_default_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
<option <?php if($session_company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<select class="form-control select2" name="currency_code" required>
|
<select class="form-control select2" name="currency_code" required>
|
||||||
<option value="">- Currency -</option>
|
<option value="">- Currency -</option>
|
||||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||||
<option <?php if($config_default_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
<option <?php if($session_company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
$session_company_name = $row['company_name'];
|
$session_company_name = $row['company_name'];
|
||||||
|
$session_company_country = $row['company_country'];
|
||||||
$session_company_currency = $row['company_currency'];
|
$session_company_currency = $row['company_currency'];
|
||||||
|
|
||||||
include("get_settings.php");
|
include("get_settings.php");
|
||||||
|
|||||||
@@ -92,10 +92,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
$company_email = $row['company_email'];
|
$company_email = $row['company_email'];
|
||||||
$company_website = $row['company_website'];
|
$company_website = $row['company_website'];
|
||||||
$company_logo = $row['company_logo'];
|
$company_logo = $row['company_logo'];
|
||||||
|
$company_currency = $row['company_currency'];
|
||||||
|
|
||||||
$company_initials = initials($company_name);
|
$company_initials = initials($company_name);
|
||||||
|
|
||||||
$company_currency_code = $row['config_default_currency'];
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<a class="small-box bg-danger" href="expenses.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31">
|
<a class="small-box bg-danger" href="expenses.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($total_expenses,2); ?></h3>
|
<h3><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($total_expenses,2); ?></h3>
|
||||||
<p>Expenses</p>
|
<p>Expenses</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -152,7 +152,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-success">
|
<div class="small-box bg-success">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($profit,2); ?></h3>
|
<h3><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($profit,2); ?></h3>
|
||||||
<p>Profit</p>
|
<p>Profit</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -166,7 +166,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-info">
|
<div class="small-box bg-info">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($recurring_monthly_total,2); ?></h3>
|
<h3><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($recurring_monthly_total,2); ?></h3>
|
||||||
<p>Monthly Recurring</p>
|
<p>Monthly Recurring</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -180,7 +180,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-info">
|
<div class="small-box bg-info">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($recurring_yearly_total,2); ?></h3>
|
<h3><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($recurring_yearly_total,2); ?></h3>
|
||||||
<p>Yearly Recurring</p>
|
<p>Yearly Recurring</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -359,7 +359,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
$balance = '0.00';
|
$balance = '0.00';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="text-right"><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($balance,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($balance,2); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<td><?php echo $payment_date; ?></td>
|
<td><?php echo $payment_date; ?></td>
|
||||||
<td><?php echo $client_name; ?></td>
|
<td><?php echo $client_name; ?></td>
|
||||||
<td><?php echo "$invoice_prefix$invoice_number"; ?></td>
|
<td><?php echo "$invoice_prefix$invoice_number"; ?></td>
|
||||||
<td class="text-right"><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($payment_amount,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_amount,2); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<td><?php echo $expense_date; ?></td>
|
<td><?php echo $expense_date; ?></td>
|
||||||
<td><?php echo $vendor_name; ?></td>
|
<td><?php echo $vendor_name; ?></td>
|
||||||
<td><?php echo $category_name; ?></td>
|
<td><?php echo $category_name; ?></td>
|
||||||
<td class="text-right"><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($expense_amount,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_amount,2); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
11
db.sql
11
db.sql
@@ -1,8 +1,8 @@
|
|||||||
-- MariaDB dump 10.19 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64)
|
-- MariaDB dump 10.19 Distrib 10.5.13-MariaDB, for debian-linux-gnu (x86_64)
|
||||||
--
|
--
|
||||||
-- Host: localhost Database: pittpc_crm
|
-- Host: localhost Database: pittpc_crm
|
||||||
-- ------------------------------------------------------
|
-- ------------------------------------------------------
|
||||||
-- Server version 10.5.12-MariaDB-1:10.5.12+maria~focal
|
-- Server version 10.5.13-MariaDB-1:10.5.13+maria~focal
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
@@ -119,6 +119,8 @@ CREATE TABLE `campaigns` (
|
|||||||
`campaign_id` int(11) NOT NULL AUTO_INCREMENT,
|
`campaign_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`campaign_name` varchar(255) NOT NULL,
|
`campaign_name` varchar(255) NOT NULL,
|
||||||
`campaign_subject` varchar(255) NOT NULL,
|
`campaign_subject` varchar(255) NOT NULL,
|
||||||
|
`campaign_from_name` varchar(200) NOT NULL,
|
||||||
|
`campaign_from_email` varchar(200) NOT NULL,
|
||||||
`campaign_content` longtext NOT NULL,
|
`campaign_content` longtext NOT NULL,
|
||||||
`campaign_status` varchar(20) NOT NULL,
|
`campaign_status` varchar(20) NOT NULL,
|
||||||
`campaign_sent_count` int(11) DEFAULT NULL,
|
`campaign_sent_count` int(11) DEFAULT NULL,
|
||||||
@@ -238,6 +240,7 @@ CREATE TABLE `companies` (
|
|||||||
`company_email` varchar(200) DEFAULT NULL,
|
`company_email` varchar(200) DEFAULT NULL,
|
||||||
`company_website` varchar(200) DEFAULT NULL,
|
`company_website` varchar(200) DEFAULT NULL,
|
||||||
`company_logo` varchar(250) DEFAULT NULL,
|
`company_logo` varchar(250) DEFAULT NULL,
|
||||||
|
`company_currency` varchar(200) NOT NULL,
|
||||||
`company_created_at` datetime NOT NULL,
|
`company_created_at` datetime NOT NULL,
|
||||||
`company_updated_at` datetime DEFAULT NULL,
|
`company_updated_at` datetime DEFAULT NULL,
|
||||||
`company_archived_at` datetime DEFAULT NULL,
|
`company_archived_at` datetime DEFAULT NULL,
|
||||||
@@ -824,8 +827,6 @@ CREATE TABLE `settings` (
|
|||||||
`config_smtp_password` varchar(200) DEFAULT NULL,
|
`config_smtp_password` varchar(200) DEFAULT NULL,
|
||||||
`config_mail_from_email` varchar(200) DEFAULT NULL,
|
`config_mail_from_email` varchar(200) DEFAULT NULL,
|
||||||
`config_mail_from_name` varchar(200) DEFAULT NULL,
|
`config_mail_from_name` varchar(200) DEFAULT NULL,
|
||||||
`config_default_country` varchar(200) DEFAULT NULL,
|
|
||||||
`config_default_currency` varchar(200) NOT NULL,
|
|
||||||
`config_default_transfer_from_account` int(11) DEFAULT NULL,
|
`config_default_transfer_from_account` int(11) DEFAULT NULL,
|
||||||
`config_default_transfer_to_account` int(11) DEFAULT NULL,
|
`config_default_transfer_to_account` int(11) DEFAULT NULL,
|
||||||
`config_default_payment_account` int(11) DEFAULT NULL,
|
`config_default_payment_account` int(11) DEFAULT NULL,
|
||||||
@@ -1098,4 +1099,4 @@ CREATE TABLE `vendors` (
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2021-11-08 18:05:26
|
-- Dump completed on 2021-11-19 20:43:27
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
<select class="form-control select2" name="currency_code" required>
|
<select class="form-control select2" name="currency_code" required>
|
||||||
<option value="">- Currency -</option>
|
<option value="">- Currency -</option>
|
||||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||||
<option <?php if($company_currency_code == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
<option <?php if($company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $receipt_attached; ?> <a class="text-dark" href="#" data-toggle="modal" data-target="#editExpenseModal<?php echo $expense_id; ?>"><?php echo $expense_date; ?></a></td>
|
<td><?php echo $receipt_attached; ?> <a class="text-dark" href="#" data-toggle="modal" data-target="#editExpenseModal<?php echo $expense_id; ?>"><?php echo $expense_date; ?></a></td>
|
||||||
<td class="text-right"><?php echo get_currency_symbol($config_default_currency); ?><?php echo number_format($expense_amount,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_amount,2); ?></td>
|
||||||
<td><?php echo $vendor_name; ?></td>
|
<td><?php echo $vendor_name; ?></td>
|
||||||
<td><?php echo truncate($expense_description,50); ?></td>
|
<td><?php echo truncate($expense_description,50); ?></td>
|
||||||
<td><?php echo $category_name; ?></td>
|
<td><?php echo $category_name; ?></td>
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ $config_mail_from_email = $row['config_mail_from_email'];
|
|||||||
$config_mail_from_name = $row['config_mail_from_name'];
|
$config_mail_from_name = $row['config_mail_from_name'];
|
||||||
|
|
||||||
//Defaults
|
//Defaults
|
||||||
$config_default_country = $row['config_default_country'];
|
|
||||||
$config_default_currency = $row['config_default_currency'];
|
|
||||||
$config_default_transfer_from_account = $row['config_default_transfer_from_account'];
|
$config_default_transfer_from_account = $row['config_default_transfer_from_account'];
|
||||||
$config_default_transfer_to_account = $row['config_default_transfer_to_account'];
|
$config_default_transfer_to_account = $row['config_default_transfer_to_account'];
|
||||||
$config_default_payment_account = $row['config_default_payment_account'];
|
$config_default_payment_account = $row['config_default_payment_account'];
|
||||||
|
|||||||
12
post.php
12
post.php
@@ -333,7 +333,7 @@ if(isset($_POST['add_company'])){
|
|||||||
$website = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['website'])));
|
$website = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['website'])));
|
||||||
$currency_code = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['currency_code'])));
|
$currency_code = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['currency_code'])));
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_created_at = NOW()");
|
mysqli_query($mysqli,"INSERT INTO companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_currency = '$currency_code', company_created_at = NOW()");
|
||||||
|
|
||||||
$config_api_key = keygen();
|
$config_api_key = keygen();
|
||||||
$config_base_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
|
$config_base_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
|
||||||
@@ -386,7 +386,7 @@ if(isset($_POST['add_company'])){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO settings SET company_id = $company_id, config_default_country = '$country', config_default_currency = '$currency_code', config_invoice_prefix = 'INV-', config_invoice_next_number = 1, config_recurring_prefix = 'REC-', config_recurring_next_number = 1, config_invoice_overdue_reminders = '1,3,7', config_quote_prefix = 'QUO-', config_quote_next_number = 1, config_api_key = '$config_api_key', config_recurring_auto_send_invoice = 1, config_default_net_terms = 7, config_send_invoice_reminders = 0, config_enable_cron = 0, config_ticket_next_number = 1, config_base_url = '$config_base_url'");
|
mysqli_query($mysqli,"INSERT INTO settings SET company_id = $company_id, config_invoice_prefix = 'INV-', config_invoice_next_number = 1, config_recurring_prefix = 'REC-', config_recurring_next_number = 1, config_invoice_overdue_reminders = '1,3,7', config_quote_prefix = 'QUO-', config_quote_next_number = 1, config_api_key = '$config_api_key', config_recurring_auto_send_invoice = 1, config_default_net_terms = 7, config_send_invoice_reminders = 0, config_enable_cron = 0, config_ticket_next_number = 1, config_base_url = '$config_base_url'");
|
||||||
|
|
||||||
//logging
|
//logging
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Company', log_action = 'Create', log_description = '$name', log_created_at = NOW()");
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Company', log_action = 'Create', log_description = '$name', log_created_at = NOW()");
|
||||||
@@ -461,9 +461,7 @@ if(isset($_POST['edit_company'])){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_updated_at = NOW() WHERE company_id = $company_id");
|
mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_currency = '$currency_code', company_updated_at = NOW() WHERE company_id = $company_id");
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE settings SET config_default_currency = '$currency_code', config_default_country = '$country' WHERE company_id = $company_id");
|
|
||||||
|
|
||||||
//logging
|
//logging
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Company', log_action = 'Modified', log_description = '$name', log_created_at = NOW()");
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Company', log_action = 'Modified', log_description = '$name', log_created_at = NOW()");
|
||||||
@@ -688,8 +686,6 @@ if(isset($_POST['edit_ticket_settings'])){
|
|||||||
|
|
||||||
if(isset($_POST['edit_default_settings'])){
|
if(isset($_POST['edit_default_settings'])){
|
||||||
|
|
||||||
$country = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['country'])));
|
|
||||||
$currency_code = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['currency_code'])));
|
|
||||||
$expense_account = intval($_POST['expense_account']);
|
$expense_account = intval($_POST['expense_account']);
|
||||||
$payment_account = intval($_POST['payment_account']);
|
$payment_account = intval($_POST['payment_account']);
|
||||||
$payment_method = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['payment_method'])));
|
$payment_method = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['payment_method'])));
|
||||||
@@ -699,7 +695,7 @@ if(isset($_POST['edit_default_settings'])){
|
|||||||
$calendar = intval($_POST['calendar']);
|
$calendar = intval($_POST['calendar']);
|
||||||
$net_terms = intval($_POST['net_terms']);
|
$net_terms = intval($_POST['net_terms']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE settings SET config_default_country = '$country', config_default_currency = '$currency_code', config_default_expense_account = $expense_account, config_default_payment_account = $payment_account, config_default_payment_method = '$payment_method', config_default_expense_payment_method = '$expense_payment_method', config_default_transfer_from_account = $transfer_from_account, config_default_transfer_to_account = $transfer_to_account, config_default_calendar = $calendar, config_default_net_terms = $net_terms WHERE company_id = $session_company_id");
|
mysqli_query($mysqli,"UPDATE settings SET config_default_expense_account = $expense_account, config_default_payment_account = $payment_account, config_default_payment_method = '$payment_method', config_default_expense_payment_method = '$expense_payment_method', config_default_transfer_from_account = $transfer_from_account, config_default_transfer_to_account = $transfer_to_account, config_default_calendar = $calendar, config_default_net_terms = $net_terms WHERE company_id = $session_company_id");
|
||||||
|
|
||||||
//Logging
|
//Logging
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modified', log_description = 'Defaults', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modified', log_description = 'Defaults', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($payment_amount_for_quarter_one,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_amount_for_quarter_one,2); ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($payment_amount_for_quarter_two,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_amount_for_quarter_two,2); ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($payment_amount_for_quarter_three,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_amount_for_quarter_three,2); ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -153,9 +153,9 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($payment_amount_for_quarter_four,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_amount_for_quarter_four,2); ?></td>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($total_payments_for_all_four_quarters,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($total_payments_for_all_four_quarters,2); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -188,7 +188,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($payment_total_amount_for_quarter_one,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_total_amount_for_quarter_one,2); ?></th>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($payment_total_amount_for_quarter_two,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_total_amount_for_quarter_two,2); ?></th>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($payment_total_amount_for_quarter_three,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_total_amount_for_quarter_three,2); ?></th>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -256,9 +256,9 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($payment_total_amount_for_quarter_four,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($payment_total_amount_for_quarter_four,2); ?></th>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($total_payments_for_all_four_quarters,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($total_payments_for_all_four_quarters,2); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@@ -286,7 +286,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($expense_amount_for_quarter_one,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_amount_for_quarter_one,2); ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($expense_amount_for_quarter_two,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_amount_for_quarter_two,2); ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($expense_amount_for_quarter_three,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_amount_for_quarter_three,2); ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -330,9 +330,9 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($expense_amount_for_quarter_four,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_amount_for_quarter_four,2); ?></td>
|
||||||
|
|
||||||
<td class="text-right">$<?php echo number_format($total_expenses_for_all_four_quarters,2); ?></td>
|
<td class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($total_expenses_for_all_four_quarters,2); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -357,7 +357,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($expense_total_amount_for_quarter_one,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_total_amount_for_quarter_one,2); ?></th>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($expense_total_amount_for_quarter_two,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_total_amount_for_quarter_two,2); ?></th>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($expense_total_amount_for_quarter_three,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_total_amount_for_quarter_three,2); ?></th>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -401,9 +401,9 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($expense_total_amount_for_quarter_four,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($expense_total_amount_for_quarter_four,2); ?></th>
|
||||||
|
|
||||||
<th class="text-right">$<?php echo number_format($total_expenses_for_all_four_quarters,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($total_expenses_for_all_four_quarters,2); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
@@ -415,11 +415,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<th>Net Profit</th>
|
<th>Net Profit</th>
|
||||||
<th class="text-right">$<?php echo number_format($net_profit_quarter_one,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($net_profit_quarter_one,2); ?></th>
|
||||||
<th class="text-right">$<?php echo number_format($net_profit_quarter_two,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($net_profit_quarter_two,2); ?></th>
|
||||||
<th class="text-right">$<?php echo number_format($net_profit_quarter_three,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($net_profit_quarter_three,2); ?></th>
|
||||||
<th class="text-right">$<?php echo number_format($net_profit_quarter_four,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($net_profit_quarter_four,2); ?></th>
|
||||||
<th class="text-right">$<?php echo number_format($net_profit_year,2); ?></th>
|
<th class="text-right"><?php echo get_currency_symbol($session_company_currency); ?><?php echo number_format($net_profit_year,2); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -8,36 +8,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Country</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-flag"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="country">
|
|
||||||
<option value="">- Country -</option>
|
|
||||||
<?php foreach($countries_array as $country) { ?>
|
|
||||||
<option <?php if($config_default_country == $country){ echo "selected"; } ?>><?php echo $country; ?></option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Currency</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-money-bill"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="currency_code" required>
|
|
||||||
<option value="">- Currency -</option>
|
|
||||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
|
||||||
<option <?php if($config_default_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Transfer From Account</label>
|
<label>Transfer From Account</label>
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ if(isset($_POST['add_company_settings'])){
|
|||||||
$website = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['website'])));
|
$website = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['website'])));
|
||||||
$currency_code = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['currency_code'])));
|
$currency_code = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['currency_code'])));
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_logo = '$path', company_created_at = NOW()");
|
mysqli_query($mysqli,"INSERT INTO companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_logo = '$path', company_currency = '$currency_code', company_created_at = NOW()");
|
||||||
|
|
||||||
$company_id = mysqli_insert_id($mysqli);
|
$company_id = mysqli_insert_id($mysqli);
|
||||||
$config_api_key = keygen();
|
$config_api_key = keygen();
|
||||||
@@ -521,7 +521,7 @@ if(isset($_POST['add_company_settings'])){
|
|||||||
//Create Permissions
|
//Create Permissions
|
||||||
mysqli_query($mysqli,"INSERT INTO permissions SET permission_level = 5, permission_default_company = $company_id, permission_companies = $company_id, user_id = $user_id");
|
mysqli_query($mysqli,"INSERT INTO permissions SET permission_level = 5, permission_default_company = $company_id, permission_companies = $company_id, user_id = $user_id");
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO settings SET company_id = $company_id, config_default_country = '$country', config_default_currency = '$currency_code', config_invoice_prefix = 'INV-', config_invoice_next_number = 1, config_recurring_prefix = 'REC-', config_recurring_next_number = 1, config_invoice_overdue_reminders = '1,3,7', config_quote_prefix = 'QUO-', config_quote_next_number = 1, config_api_key = '$config_api_key', config_recurring_auto_send_invoice = 1, config_default_net_terms = 7, config_send_invoice_reminders = 0, config_enable_cron = 0, config_ticket_next_number = 1, config_base_url = '$config_base_url'");
|
mysqli_query($mysqli,"INSERT INTO settings SET company_id = $company_id, config_invoice_prefix = 'INV-', config_invoice_next_number = 1, config_recurring_prefix = 'REC-', config_recurring_next_number = 1, config_invoice_overdue_reminders = '1,3,7', config_quote_prefix = 'QUO-', config_quote_next_number = 1, config_api_key = '$config_api_key', config_recurring_auto_send_invoice = 1, config_default_net_terms = 7, config_send_invoice_reminders = 0, config_enable_cron = 0, config_ticket_next_number = 1, config_base_url = '$config_base_url'");
|
||||||
|
|
||||||
//Create Some Data
|
//Create Some Data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user