|
@@ -164,7 +164,7 @@ class Reports extends Component
|
|
|
$monthIndex = [9 => 0, 10 => 1, 11 => 2, 12 => 3, 1 => 4, 2 => 5, 3 => 6, 4 => 7, 5 => 8, 6 => 9, 7 => 10, 8 => 11];
|
|
$monthIndex = [9 => 0, 10 => 1, 11 => 2, 12 => 3, 1 => 4, 2 => 5, 3 => 6, 4 => 7, 5 => 8, 6 => 9, 7 => 10, 8 => 11];
|
|
|
$monthNames = ['Set', 'Ott', 'Nov', 'Dic', 'Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago'];
|
|
$monthNames = ['Set', 'Ott', 'Nov', 'Dic', 'Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago'];
|
|
|
|
|
|
|
|
- $vats = $this->getVatMap();
|
|
|
|
|
|
|
+ $vats = getVatMap();
|
|
|
|
|
|
|
|
$incomeData = array_fill(0, 12, 0);
|
|
$incomeData = array_fill(0, 12, 0);
|
|
|
$expenseData = array_fill(0, 12, 0);
|
|
$expenseData = array_fill(0, 12, 0);
|
|
@@ -209,7 +209,7 @@ class Reports extends Component
|
|
|
$amount = $record->amount;
|
|
$amount = $record->amount;
|
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
|
$vat = $vats[$record->vat_id];
|
|
$vat = $vats[$record->vat_id];
|
|
|
- $amount += $amount / 100 * $vat;
|
|
|
|
|
|
|
+ $amount += $amount * $vat;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
foreach ($matches[0] as $match) {
|
|
foreach ($matches[0] as $match) {
|
|
@@ -251,7 +251,7 @@ class Reports extends Component
|
|
|
$amount = $record->amount;
|
|
$amount = $record->amount;
|
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
|
$vat = $vats[$record->vat_id];
|
|
$vat = $vats[$record->vat_id];
|
|
|
- $amount += $amount / 100 * $vat;
|
|
|
|
|
|
|
+ $amount += $amount * $vat;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
foreach ($matches[0] as $match) {
|
|
foreach ($matches[0] as $match) {
|
|
@@ -291,7 +291,7 @@ class Reports extends Component
|
|
|
$excluded_causals = \App\Models\Causal::where('no_records', true)->orWhere('money', true)->pluck('id')->toArray();
|
|
$excluded_causals = \App\Models\Causal::where('no_records', true)->orWhere('money', true)->pluck('id')->toArray();
|
|
|
$excluded_members = \App\Models\Member::where('exclude_from_records', true)->pluck('id')->toArray();
|
|
$excluded_members = \App\Models\Member::where('exclude_from_records', true)->pluck('id')->toArray();
|
|
|
|
|
|
|
|
- $vats = $this->getVatMap();
|
|
|
|
|
|
|
+ $vats = getVatMap();
|
|
|
|
|
|
|
|
$incomeData = [];
|
|
$incomeData = [];
|
|
|
$expenseData = [];
|
|
$expenseData = [];
|
|
@@ -344,7 +344,7 @@ class Reports extends Component
|
|
|
$amount = $record->amount;
|
|
$amount = $record->amount;
|
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
|
$vat = $vats[$record->vat_id];
|
|
$vat = $vats[$record->vat_id];
|
|
|
- $amount += $amount / 100 * $vat;
|
|
|
|
|
|
|
+ $amount += $amount * $vat;
|
|
|
}
|
|
}
|
|
|
$amount *= ($matching_months / $total_months);
|
|
$amount *= ($matching_months / $total_months);
|
|
|
|
|
|
|
@@ -381,7 +381,7 @@ class Reports extends Component
|
|
|
$amount = $record->amount;
|
|
$amount = $record->amount;
|
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
|
$vat = $vats[$record->vat_id];
|
|
$vat = $vats[$record->vat_id];
|
|
|
- $amount += $amount / 100 * $vat;
|
|
|
|
|
|
|
+ $amount += $amount * $vat;
|
|
|
}
|
|
}
|
|
|
$amount *= ($matching_months / $total_months);
|
|
$amount *= ($matching_months / $total_months);
|
|
|
|
|
|
|
@@ -411,7 +411,7 @@ class Reports extends Component
|
|
|
$dateRange = $this->getSeasonDateRange($this->seasonFilter);
|
|
$dateRange = $this->getSeasonDateRange($this->seasonFilter);
|
|
|
Log::info('=== getYearlySummary called ===');
|
|
Log::info('=== getYearlySummary called ===');
|
|
|
|
|
|
|
|
- $vats = $this->getVatMap();
|
|
|
|
|
|
|
+ $vats = getVatMap();
|
|
|
|
|
|
|
|
$excluded_causals = \App\Models\Causal::where('no_records', true)->orWhere('money', true)->pluck('id')->toArray();
|
|
$excluded_causals = \App\Models\Causal::where('no_records', true)->orWhere('money', true)->pluck('id')->toArray();
|
|
|
$excluded_members = \App\Models\Member::where('exclude_from_records', true)->pluck('id')->toArray();
|
|
$excluded_members = \App\Models\Member::where('exclude_from_records', true)->pluck('id')->toArray();
|
|
@@ -457,7 +457,7 @@ class Reports extends Component
|
|
|
$amount = $record->amount;
|
|
$amount = $record->amount;
|
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
|
$vat = $vats[$record->vat_id];
|
|
$vat = $vats[$record->vat_id];
|
|
|
- $amount += $amount / 100 * $vat;
|
|
|
|
|
|
|
+ $amount += $amount * $vat;
|
|
|
}
|
|
}
|
|
|
$amount *= ($matching_months / $total_months);
|
|
$amount *= ($matching_months / $total_months);
|
|
|
|
|
|
|
@@ -494,7 +494,7 @@ class Reports extends Component
|
|
|
$amount = $record->amount;
|
|
$amount = $record->amount;
|
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
if (isset($vats[$record->vat_id]) && $vats[$record->vat_id] > 0) {
|
|
|
$vat = $vats[$record->vat_id];
|
|
$vat = $vats[$record->vat_id];
|
|
|
- $amount += $amount / 100 * $vat;
|
|
|
|
|
|
|
+ $amount += $amount * $vat;
|
|
|
}
|
|
}
|
|
|
$amount *= ($matching_months / $total_months);
|
|
$amount *= ($matching_months / $total_months);
|
|
|
|
|
|
|
@@ -1004,21 +1004,4 @@ class Reports extends Component
|
|
|
'datasets' => $datasets
|
|
'datasets' => $datasets
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- function getVatMap()
|
|
|
|
|
- {
|
|
|
|
|
- static $map = null;
|
|
|
|
|
-
|
|
|
|
|
- if ($map === null) {
|
|
|
|
|
- $map = [];
|
|
|
|
|
-
|
|
|
|
|
- $vats = \App\Models\Vat::select('id', 'value')->get();
|
|
|
|
|
- foreach ($vats as $vat) {
|
|
|
|
|
- $rate = (float)$vat->value;
|
|
|
|
|
- $map[$vat->id] = $rate > 0 ? 1.0 + ($rate / 100.0) : 1.0;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return $map;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|