close #1053 Added: Dashboard date filter

This commit is contained in:
Cüneyt Şentürk
2019-12-30 12:30:30 +03:00
parent 237b161fe0
commit bd0598b4d4
14 changed files with 152 additions and 56 deletions

View File

@ -14,7 +14,7 @@ class TotalProfit extends Widget
$current_income = $open_invoice = $overdue_invoice = 0;
$current_expenses = $open_bill = $overdue_bill = 0;
Transaction::isNotTransfer()->each(function ($transaction) use (&$current_income, &$current_expenses) {
$this->applyFilters(Transaction::isNotTransfer())->each(function ($transaction) use (&$current_income, &$current_expenses) {
$amount = $transaction->getAmountConvertedToDefault();
if ($transaction->type == 'income') {
@ -24,14 +24,14 @@ class TotalProfit extends Widget
}
});
Invoice::accrued()->notPaid()->each(function ($invoice) use (&$open_invoice, &$overdue_invoice) {
$this->applyFilters(Invoice::accrued()->notPaid(), ['date_field' => 'created_at'])->each(function ($invoice) use (&$open_invoice, &$overdue_invoice) {
list($open_tmp, $overdue_tmp) = $this->calculateDocumentTotals($invoice);
$open_invoice += $open_tmp;
$overdue_invoice += $overdue_tmp;
});
Bill::accrued()->notPaid()->each(function ($bill) use (&$open_bill, &$overdue_bill) {
$this->applyFilters(Bill::accrued()->notPaid(), ['date_field' => 'created_at'])->each(function ($bill) use (&$open_bill, &$overdue_bill) {
list($open_tmp, $overdue_tmp) = $this->calculateDocumentTotals($bill);
$open_bill += $open_tmp;