mirror of https://github.com/itflow-org/itflow
General refactoring/tidy spacing
This commit is contained in:
parent
39a3ea89c4
commit
00dd605d8d
File diff suppressed because it is too large
Load Diff
|
|
@ -1,15 +1,15 @@
|
||||||
<?php include("inc_all_reports.php");
|
<?php include("inc_all_reports.php");
|
||||||
|
|
||||||
if (isset($_GET['year'])) {
|
if (isset($_GET['year'])) {
|
||||||
$year = intval($_GET['year']);
|
$year = intval($_GET['year']);
|
||||||
}else{
|
}else{
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['year'])) {
|
if (isset($_GET['year'])) {
|
||||||
$year = intval($_GET['year']);
|
$year = intval($_GET['year']);
|
||||||
}else{
|
}else{
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_expense_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(expense_date) AS expense_year FROM expenses WHERE expense_category_id > 0 AND company_id = $session_company_id ORDER BY expense_year DESC");
|
$sql_expense_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(expense_date) AS expense_year FROM expenses WHERE expense_category_id > 0 AND company_id = $session_company_id ORDER BY expense_year DESC");
|
||||||
|
|
@ -19,196 +19,196 @@ $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-coins"></i> Expense Summary</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-coins"></i> Expense Summary</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary d-print-none" onclick="window.print();"><i class="fas fa-fw fa-print"></i> Print</button>
|
<button type="button" class="btn btn-primary d-print-none" onclick="window.print();"><i class="fas fa-fw fa-print"></i> Print</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="card-body">
|
||||||
<div class="card-body">
|
<form class="mb-3">
|
||||||
<form class="mb-3">
|
<select onchange="this.form.submit()" class="form-control" name="year">
|
||||||
<select onchange="this.form.submit()" class="form-control" name="year">
|
<?php
|
||||||
<?php
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_expense_years)) {
|
while ($row = mysqli_fetch_array($sql_expense_years)) {
|
||||||
$expense_year = $row['expense_year'];
|
$expense_year = $row['expense_year'];
|
||||||
?>
|
?>
|
||||||
<option <?php if ($year == $expense_year) { ?> selected <?php } ?> > <?php echo $expense_year; ?></option>
|
<option <?php if ($year == $expense_year) { ?> selected <?php } ?> > <?php echo $expense_year; ?></option>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<canvas id="cashFlow" width="100%" height="20"></canvas>
|
<canvas id="cashFlow" width="100%" height="20"></canvas>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead class="text-dark">
|
<thead class="text-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Category</th>
|
<th>Category</th>
|
||||||
<th class="text-right">January</th>
|
<th class="text-right">January</th>
|
||||||
<th class="text-right">February</th>
|
<th class="text-right">February</th>
|
||||||
<th class="text-right">March</th>
|
<th class="text-right">March</th>
|
||||||
<th class="text-right">April</th>
|
<th class="text-right">April</th>
|
||||||
<th class="text-right">May</th>
|
<th class="text-right">May</th>
|
||||||
<th class="text-right">June</th>
|
<th class="text-right">June</th>
|
||||||
<th class="text-right">July</th>
|
<th class="text-right">July</th>
|
||||||
<th class="text-right">August</th>
|
<th class="text-right">August</th>
|
||||||
<th class="text-right">September</th>
|
<th class="text-right">September</th>
|
||||||
<th class="text-right">October</th>
|
<th class="text-right">October</th>
|
||||||
<th class="text-right">November</th>
|
<th class="text-right">November</th>
|
||||||
<th class="text-right">December</th>
|
<th class="text-right">December</th>
|
||||||
<th class="text-right">Total</th>
|
<th class="text-right">Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
$category_name = htmlentities($row['category_name']);
|
$category_name = htmlentities($row['category_name']);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $category_name; ?></td>
|
<td><?php echo $category_name; ?></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$total_expense_for_all_months = 0;
|
$total_expense_for_all_months = 0;
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$expense_amount_for_month = $row['expense_amount_for_month'];
|
$expense_amount_for_month = $row['expense_amount_for_month'];
|
||||||
$total_expense_for_all_months = $expense_amount_for_month + $total_expense_for_all_months;
|
$total_expense_for_all_months = $expense_amount_for_month + $total_expense_for_all_months;
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<td class="text-right"><a class="text-dark" href="expenses.php?q=<?php echo $category_name; ?>&dtf=<?php echo "$year-$month"; ?>-01&dtt=<?php echo "$year-$month"; ?>-31"><?php echo numfmt_format_currency($currency_format, $expense_amount_for_month, $session_company_currency); ?></a></td>
|
<td class="text-right"><a class="text-dark" href="expenses.php?q=<?php echo $category_name; ?>&dtf=<?php echo "$year-$month"; ?>-01&dtt=<?php echo "$year-$month"; ?>-31"><?php echo numfmt_format_currency($currency_format, $expense_amount_for_month, $session_company_currency); ?></a></td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right"><a class="text-dark" href="expenses.php?q=<?php echo $category_name; ?>&dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31"><?php echo numfmt_format_currency($currency_format, $total_expense_for_all_months, $session_company_currency); ?></a></th>
|
<th class="text-right"><a class="text-dark" href="expenses.php?q=<?php echo $category_name; ?>&dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31"><?php echo numfmt_format_currency($currency_format, $total_expense_for_all_months, $session_company_currency); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$expense_total_amount_for_month = $row['expense_total_amount_for_month'];
|
$expense_total_amount_for_month = $row['expense_total_amount_for_month'];
|
||||||
$total_expense_for_all_months = $expense_total_amount_for_month + $total_expense_for_all_months;
|
$total_expense_for_all_months = $expense_total_amount_for_month + $total_expense_for_all_months;
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right"><a class="text-dark" href="expenses.php?dtf=<?php echo "$year-$month"; ?>-01&dtt=<?php echo "$year-$month"; ?>-31"><?php echo numfmt_format_currency($currency_format, $expense_total_amount_for_month, $session_company_currency); ?></a></th>
|
<th class="text-right"><a class="text-dark" href="expenses.php?dtf=<?php echo "$year-$month"; ?>-01&dtt=<?php echo "$year-$month"; ?>-31"><?php echo numfmt_format_currency($currency_format, $expense_total_amount_for_month, $session_company_currency); ?></a></th>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<th class="text-right"><a class="text-dark" href="expenses.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31"><?php echo numfmt_format_currency($currency_format, $total_expense_for_all_months, $session_company_currency); ?></th>
|
<th class="text-right"><a class="text-dark" href="expenses.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31"><?php echo numfmt_format_currency($currency_format, $total_expense_for_all_months, $session_company_currency); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php include("footer.php"); ?>
|
<?php include("footer.php"); ?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Set new default font family and font color to mimic Bootstrap's default styling
|
// Set new default font family and font color to mimic Bootstrap's default styling
|
||||||
Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
|
Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
|
||||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||||
|
|
||||||
// Area Chart Example
|
// Area Chart Example
|
||||||
var ctx = document.getElementById("cashFlow");
|
var ctx = document.getElementById("cashFlow");
|
||||||
var myLineChart = new Chart(ctx, {
|
var myLineChart = new Chart(ctx, {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: {
|
data: {
|
||||||
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: "Expense",
|
label: "Expense",
|
||||||
lineTension: 0.3,
|
lineTension: 0.3,
|
||||||
fill: false,
|
fill: false,
|
||||||
borderColor: "#dc3545",
|
borderColor: "#dc3545",
|
||||||
pointBackgroundColor: "#dc3545",
|
pointBackgroundColor: "#dc3545",
|
||||||
pointBorderColor: "#dc3545",
|
pointBorderColor: "#dc3545",
|
||||||
pointHoverRadius: 5,
|
pointHoverRadius: 5,
|
||||||
pointHoverBackgroundColor: "#dc3545",
|
pointHoverBackgroundColor: "#dc3545",
|
||||||
pointHitRadius: 50,
|
pointHitRadius: 50,
|
||||||
pointBorderWidth: 2,
|
pointBorderWidth: 2,
|
||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$largest_expense_month = 0;
|
$largest_expense_month = 0;
|
||||||
|
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND expenses.company_id = $session_company_id");
|
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND expenses.company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$expenses_for_month = $row['expense_amount_for_month'];
|
$expenses_for_month = $row['expense_amount_for_month'];
|
||||||
|
|
||||||
if ($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month) {
|
if ($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month) {
|
||||||
$largest_expense_month = $expenses_for_month;
|
$largest_expense_month = $expenses_for_month;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<?php echo "$expenses_for_month,"; ?>
|
<?php echo "$expenses_for_month,"; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
},
|
|
||||||
options: {
|
|
||||||
scales: {
|
|
||||||
xAxes: [{
|
|
||||||
time: {
|
|
||||||
unit: 'date'
|
|
||||||
},
|
},
|
||||||
gridLines: {
|
options: {
|
||||||
display: false
|
scales: {
|
||||||
},
|
xAxes: [{
|
||||||
ticks: {
|
time: {
|
||||||
maxTicksLimit: 12
|
unit: 'date'
|
||||||
|
},
|
||||||
|
gridLines: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
ticks: {
|
||||||
|
maxTicksLimit: 12
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
min: 0,
|
||||||
|
max: <?php $max = max(1000, $largest_expense_month, $largest_income_month, $largest_invoice_month); echo roundUpToNearestMultiple($max); ?>,
|
||||||
|
maxTicksLimit: 5
|
||||||
|
},
|
||||||
|
gridLines: {
|
||||||
|
color: "rgba(0, 0, 0, .125)",
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}],
|
});
|
||||||
yAxes: [{
|
|
||||||
ticks: {
|
|
||||||
min: 0,
|
|
||||||
max: <?php $max = max(1000, $largest_expense_month, $largest_income_month, $largest_invoice_month); echo roundUpToNearestMultiple($max); ?>,
|
|
||||||
maxTicksLimit: 5
|
|
||||||
},
|
|
||||||
gridLines: {
|
|
||||||
color: "rgba(0, 0, 0, .125)",
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ if (isset($_GET['year'])) {
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_payment_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(payment_date) AS payment_year FROM payments WHERE company_id = $session_company_id UNION SELECT DISTINCT YEAR(revenue_date) AS payment_year FROM revenues WHERE company_id = $session_company_id ORDER BY payment_year DESC");
|
$sql_payment_years = mysqli_query($mysqli, "SELECT DISTINCT YEAR(payment_date) AS payment_year FROM payments WHERE company_id = $session_company_id UNION SELECT DISTINCT YEAR(revenue_date) AS payment_year FROM revenues WHERE company_id = $session_company_id ORDER BY payment_year DESC");
|
||||||
|
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Income' AND company_id = $session_company_id ORDER BY category_name ASC");
|
$sql_categories = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND company_id = $session_company_id ORDER BY category_name ASC");
|
||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
$largest_income_month = 0;
|
$largest_income_month = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue