Skip to content

Commit d5dfe71

Browse files
error fixes on report screen
1 parent 054aff2 commit d5dfe71

File tree

2 files changed

+40
-35
lines changed

2 files changed

+40
-35
lines changed

Modules/Report/Config/config.php

-35
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,6 @@
1919
'name' => 'Export',
2020
'head' => 'Direct Income',
2121
],
22-
23-
'stripe_india' => [
24-
'name' => 'Stripe India',
25-
'head' => 'Direct Income',
26-
],
27-
28-
'stripe_international' => [
29-
'name' => 'Stripe International',
30-
'head' => 'Direct Income',
31-
],
32-
33-
'commission_received' => [
34-
'name' => 'Commission Received',
35-
'head' => 'Direct Income',
36-
],
37-
38-
'cash_back' => [
39-
'name' => 'Cash Back',
40-
'head' => 'Indirect income',
41-
],
42-
43-
'discount_received' => [
44-
'name' => 'Discount Received',
45-
'head' => 'Indirect income',
46-
],
47-
48-
'interest_on_f_d' => [
49-
'name' => 'Interest on FD',
50-
'head' => 'Indirect income',
51-
],
52-
53-
'foreign_exchange_loss' => [
54-
'name' => 'Foreign Exchange Loss',
55-
'head' => 'Bank Charges',
56-
],
5722
],
5823
],
5924
],

Modules/Report/Services/Finance/RevenueReportService.php

+40
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,46 @@ private function getAvgCurrencyRates($startDate, $endDate)
151151
return $results;
152152
}
153153

154+
/**
155+
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
156+
*/
157+
private function getParticularAmountForDomestic(array $particular, object $startDate, object $endDate): array
158+
{
159+
$invoices = $this->invoiceService->getInvoicesBetweenDates($startDate, $endDate, 'indian');
160+
$totalAmount = 0;
161+
$results = [];
162+
163+
foreach ($invoices as $invoice) {
164+
$dateKey = $invoice->sent_on->format($this->dataKeyFormat);
165+
$totalAmount += (int) $invoice->amount;
166+
$results[$dateKey] = ($results[$dateKey] ?? 0) + (int) $invoice->amount;
167+
}
168+
169+
$results['total'] = $totalAmount;
170+
171+
return $results;
172+
}
173+
/**
174+
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
175+
*/
176+
private function getParticularAmountForExport(array $particular, object $startDate, object $endDate): array
177+
{
178+
$totalAmount = 0;
179+
$results = [];
180+
$invoices = $this->invoiceService->getInvoicesBetweenDates($startDate, $endDate, 'non-indian');
181+
182+
foreach ($invoices as $invoice) {
183+
$dateKey = $invoice->sent_on->format($this->dataKeyFormat);
184+
$exchangeRate = $this->avgCurrencyRates[$dateKey][strtolower($invoice->currency)] ?? $this->defaultCurrencyRates;
185+
$amount = (float) ($invoice->amount) * (float) ($exchangeRate);
186+
$results[$dateKey] = ($results[$dateKey] ?? 0) + $amount;
187+
$totalAmount += $amount;
188+
}
189+
$results['total'] = $totalAmount;
190+
191+
return $results;
192+
}
193+
154194
private static function handleInvoiceDataForClient($invoice, $amountMonthWise)
155195
{
156196
$invoiceAmount = round($invoice->total_amount_in_inr, 2);

0 commit comments

Comments
 (0)