replaced revenues/payments with transactions
This commit is contained in:
@@ -29,14 +29,14 @@ class ExpensesByCategory extends AbstractWidget
|
||||
$expenses_amount = $open_bill = $overdue_bill = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['bills', 'payments'])->type(['expense'])->enabled()->get();
|
||||
$categories = Category::with(['bills', 'expense_transactions'])->type(['expense'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$amount = 0;
|
||||
|
||||
// Payments
|
||||
foreach ($category->payments as $payment) {
|
||||
$amount += $payment->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->expense_transactions as $transaction) {
|
||||
$amount += $transaction->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$expenses_amount += $amount;
|
||||
@@ -149,14 +149,14 @@ class ExpensesByCategory extends AbstractWidget
|
||||
$expenses_amount = $open_bill = $overdue_bill = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['bills', 'payments'])->type(['expense'])->enabled()->get();
|
||||
$categories = Category::with(['bills', 'expense_transactions'])->type(['expense'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$amount = 0;
|
||||
|
||||
// Payments
|
||||
foreach ($category->payments as $payment) {
|
||||
$amount += $payment->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->expense_transactions as $transaction) {
|
||||
$amount += $transaction->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$expenses_amount += $amount;
|
||||
|
||||
@@ -30,14 +30,14 @@ class IncomesByCategory extends AbstractWidget
|
||||
$incomes_amount = $open_invoice = $overdue_invoice = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['invoices', 'revenues'])->type(['income'])->enabled()->get();
|
||||
$categories = Category::with(['invoices', 'income_transacions'])->type(['income'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$amount = 0;
|
||||
|
||||
// Revenues
|
||||
foreach ($category->revenues as $revenue) {
|
||||
$amount += $revenue->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->income_transacions as $transacion) {
|
||||
$amount += $transacion->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$incomes_amount += $amount;
|
||||
@@ -151,14 +151,14 @@ class IncomesByCategory extends AbstractWidget
|
||||
$incomes_amount = $open_invoice = $overdue_invoice = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['invoices', 'revenues'])->type(['income'])->enabled()->get();
|
||||
$categories = Category::with(['invoices', 'income_transacions'])->type(['income'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$amount = 0;
|
||||
|
||||
// Revenues
|
||||
foreach ($category->revenues as $revenue) {
|
||||
$amount += $revenue->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->income_transacions as $transacion) {
|
||||
$amount += $transacion->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$incomes_amount += $amount;
|
||||
|
||||
@@ -27,14 +27,14 @@ class TotalExpenses extends AbstractWidget
|
||||
$expenses_amount = $open_bill = $overdue_bill = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['bills', 'payments'])->type(['expense'])->enabled()->get();
|
||||
$categories = Category::with(['bills', 'expense_transactions'])->type(['expense'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$amount = 0;
|
||||
|
||||
// Payments
|
||||
foreach ($category->payments as $payment) {
|
||||
$amount += $payment->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->expense_transactions as $transaction) {
|
||||
$amount += $transaction->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$expenses_amount += $amount;
|
||||
|
||||
@@ -27,14 +27,14 @@ class TotalIncomes extends AbstractWidget
|
||||
$incomes_amount = $open_invoice = $overdue_invoice = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['invoices', 'revenues'])->type(['income'])->enabled()->get();
|
||||
$categories = Category::with(['invoices', 'income_transacions'])->type(['income'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$amount = 0;
|
||||
|
||||
// Revenues
|
||||
foreach ($category->revenues as $revenue) {
|
||||
$amount += $revenue->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->income_transacions as $transacion) {
|
||||
$amount += $transacion->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$incomes_amount += $amount;
|
||||
|
||||
@@ -82,16 +82,16 @@ class TotalProfit extends AbstractWidget
|
||||
$expenses_amount = $open_bill = $overdue_bill = 0;
|
||||
|
||||
// Get categories
|
||||
$categories = Category::with(['bills', 'invoices', 'payments', 'revenues'])->type(['income', 'expense'])->enabled()->get();
|
||||
$categories = Category::with(['bills', 'expense_transactions', 'invoices', 'income_transacions'])->type(['income', 'expense'])->enabled()->get();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
switch ($category->type) {
|
||||
case 'income':
|
||||
$amount = 0;
|
||||
|
||||
// Revenues
|
||||
foreach ($category->revenues as $revenue) {
|
||||
$amount += $revenue->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->income_transacions as $transacion) {
|
||||
$amount += $transacion->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$incomes_amount += $amount;
|
||||
@@ -109,9 +109,9 @@ class TotalProfit extends AbstractWidget
|
||||
case 'expense':
|
||||
$amount = 0;
|
||||
|
||||
// Payments
|
||||
foreach ($category->payments as $payment) {
|
||||
$amount += $payment->getAmountConvertedToDefault();
|
||||
// Transactions
|
||||
foreach ($category->expense_transactions as $transaction) {
|
||||
$amount += $transaction->getAmountConvertedToDefault();
|
||||
}
|
||||
|
||||
$expenses_amount += $amount;
|
||||
|
||||
Reference in New Issue
Block a user