mirror of https://github.com/itflow-org/itflow
Add default values for largest income/invoice month to 0. This fixes undefined errors and makes the chart show properly
This commit is contained in:
parent
5d9930ad28
commit
91d0efbde7
|
|
@ -22,6 +22,10 @@ $sql_payment_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(payment_date) AS
|
||||||
|
|
||||||
$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
|
||||||
|
$largest_income_month = 0;
|
||||||
|
$largest_invoice_month = 0;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
|
|
@ -178,6 +182,7 @@ var myLineChart = new Chart(ctx, {
|
||||||
pointBorderWidth: 2,
|
pointBorderWidth: 2,
|
||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
for ($month = 1; $month<=12; $month++) {
|
for ($month = 1; $month<=12; $month++) {
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue