mirror of https://github.com/itflow-org/itflow
Reverted last change and applied the fix to Expense by Category in dashboard which was showing transfers as expenses which was incorrect
This commit is contained in:
parent
e1be58f1e5
commit
92a68cf926
|
|
@ -458,7 +458,7 @@ var myPieChart = new Chart(ctx, {
|
|||
data: {
|
||||
labels: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expenses.category_id = categories.category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expenses.category_id = categories.category_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_name = $row['category_name'];
|
||||
echo "\"$category_name\",";
|
||||
|
|
@ -470,7 +470,7 @@ var myPieChart = new Chart(ctx, {
|
|||
datasets: [{
|
||||
data: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expenses.category_id = categories.category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expenses.category_id = categories.category_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_id = $row['category_id'];
|
||||
|
||||
|
|
@ -482,53 +482,6 @@ var myPieChart = new Chart(ctx, {
|
|||
|
||||
?>
|
||||
|
||||
],
|
||||
backgroundColor: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expenses.category_id = categories.category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_color = $row['category_color'];
|
||||
echo "\"$category_color\",";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
],
|
||||
}],
|
||||
},
|
||||
});
|
||||
|
||||
// Pie Chart Example
|
||||
var ctx = document.getElementById("expenseByVendorPieChart");
|
||||
var myPieChart = new Chart(ctx, {
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: [
|
||||
<?php
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendors.vendor_id FROM vendors, expenses WHERE expenses.vendor_id = vendors.vendor_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_name = $row['vendor_name'];
|
||||
echo "\"$vendor_name\",";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
],
|
||||
datasets: [{
|
||||
data: [
|
||||
<?php
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendors.vendor_id FROM vendors, expenses WHERE expenses.vendor_id = vendors.vendor_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE vendor_id = $vendor_id AND YEAR(expense_date) = $year");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_year = $row['expense_amount_for_year'];
|
||||
echo "$expense_amount_for_year,";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
],
|
||||
backgroundColor: [
|
||||
<?php
|
||||
|
|
@ -545,4 +498,51 @@ var myPieChart = new Chart(ctx, {
|
|||
},
|
||||
});
|
||||
|
||||
// Pie Chart Example
|
||||
var ctx = document.getElementById("expenseByVendorPieChart");
|
||||
var myPieChart = new Chart(ctx, {
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: [
|
||||
<?php
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendors.vendor_id FROM vendors, expenses WHERE expenses.vendor_id = vendors.vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_name = $row['vendor_name'];
|
||||
echo "\"$vendor_name\",";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
],
|
||||
datasets: [{
|
||||
data: [
|
||||
<?php
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendors.vendor_id FROM vendors, expenses WHERE expenses.vendor_id = vendors.vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE vendor_id = $vendor_id AND YEAR(expense_date) = $year");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_year = $row['expense_amount_for_year'];
|
||||
echo "$expense_amount_for_year,";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
],
|
||||
backgroundColor: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expenses.category_id = categories.category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_color = $row['category_color'];
|
||||
echo "\"$category_color\",";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
],
|
||||
}],
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue