Skip to content

Commit 054aff2

Browse files
larastan ci
1 parent 4f1e2b0 commit 054aff2

File tree

2 files changed

+1
-129
lines changed

2 files changed

+1
-129
lines changed

Modules/Prospect/Entities/Prospect.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getFormattedBudgetAttribute()
5353

5454
$numberFormat = $this->currency == 'INR' ? 'en_IN' : 'en_US';
5555
$formatter = new \NumberFormatter($numberFormat, \NumberFormatter::DECIMAL);
56-
$formattedBudget = $formatter->format($budget);
56+
$formattedBudget = $formatter->format($this->budget);
5757

5858
return $formattedBudget;
5959
}

Modules/Report/Services/Finance/RevenueReportService.php

-128
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Modules\Invoice\Entities\Invoice;
1010
use Modules\Invoice\Services\CurrencyService;
1111
use Modules\Invoice\Services\InvoiceService;
12-
use Modules\Revenue\Entities\RevenueProceed;
1312

1413
class RevenueReportService
1514
{
@@ -152,133 +151,6 @@ private function getAvgCurrencyRates($startDate, $endDate)
152151
return $results;
153152
}
154153

155-
/**
156-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
157-
*/
158-
private function getParticularAmountForDomestic(array $particular, object $startDate, object $endDate): array
159-
{
160-
$invoices = $this->invoiceService->getInvoicesBetweenDates($startDate, $endDate, 'indian');
161-
$totalAmount = 0;
162-
$results = [];
163-
164-
foreach ($invoices as $invoice) {
165-
$dateKey = $invoice->sent_on->format($this->dataKeyFormat);
166-
$totalAmount += (int) $invoice->amount;
167-
$results[$dateKey] = ($results[$dateKey] ?? 0) + (int) $invoice->amount;
168-
}
169-
170-
$results['total'] = $totalAmount;
171-
172-
return $results;
173-
}
174-
/**
175-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
176-
*/
177-
private function getParticularAmountForExport(array $particular, object $startDate, object $endDate): array
178-
{
179-
$totalAmount = 0;
180-
$results = [];
181-
$invoices = $this->invoiceService->getInvoicesBetweenDates($startDate, $endDate, 'non-indian');
182-
183-
foreach ($invoices as $invoice) {
184-
$dateKey = $invoice->sent_on->format($this->dataKeyFormat);
185-
$exchangeRate = $this->avgCurrencyRates[$dateKey][strtolower($invoice->currency)] ?? $this->defaultCurrencyRates;
186-
$amount = (float) ($invoice->amount) * (float) ($exchangeRate);
187-
$results[$dateKey] = ($results[$dateKey] ?? 0) + $amount;
188-
$totalAmount += $amount;
189-
}
190-
$results['total'] = $totalAmount;
191-
192-
return $results;
193-
}
194-
/**
195-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
196-
*/
197-
private function getParticularAmountForCommissionReceived(array $particular, object $startDate, object $endDate): array
198-
{
199-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
200-
}
201-
202-
/**
203-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
204-
*/
205-
private function getParticularAmountForCashBack(array $particular, object $startDate, object $endDate): array
206-
{
207-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
208-
}
209-
210-
/**
211-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
212-
*/
213-
private function getParticularAmountForDiscountReceived(array $particular, object $startDate, object $endDate): array
214-
{
215-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
216-
}
217-
218-
/**
219-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
220-
*/
221-
private function getParticularAmountForInterestOnFd(array $particular, object $startDate, object $endDate): array
222-
{
223-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
224-
}
225-
226-
/**
227-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
228-
*/
229-
private function getParticularAmountForForeignExchangeLoss(array $particular, object $startDate, object $endDate): array
230-
{
231-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
232-
}
233-
234-
/**
235-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
236-
*/
237-
private function getParticularAmountForStripeIndia(array $particular, object $startDate, object $endDate): array
238-
{
239-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
240-
}
241-
242-
/**
243-
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
244-
*/
245-
private function getParticularAmountForStripeInternational(array $particular, object $startDate, object $endDate): array
246-
{
247-
return $this->getAmountsForRevenueProceeds(Str::snake($particular['name']), $startDate, $endDate);
248-
}
249-
250-
private function getAmountsForRevenueProceeds($category, $startDate, $endDate)
251-
{
252-
$revenues = RevenueProceed::where('category', $category)
253-
->where('received_at', '>=', $startDate)
254-
->where('received_at', '<=', $endDate)
255-
->get();
256-
257-
$totalAmount = 0;
258-
$results = [];
259-
260-
$exchangeRate = 1; // For INR
261-
262-
foreach ($revenues as $revenue) {
263-
$amount = $revenue->amount;
264-
$year = substr($revenue->year, -2);
265-
$month = sprintf('%02d', $revenue->month);
266-
$dateKey = $month . '-' . $year;
267-
268-
if (strtolower($revenue->currency) != 'inr') {
269-
$exchangeRate = $this->avgCurrencyRates[$dateKey][strtolower($revenue->currency)] ?? $this->defaultCurrencyRates;
270-
}
271-
272-
$amount *= $exchangeRate;
273-
$results[$dateKey] = ($results[$dateKey] ?? 0) + $amount;
274-
$totalAmount += $amount;
275-
}
276-
277-
$results['total'] = $totalAmount;
278-
279-
return $results;
280-
}
281-
282154
private static function handleInvoiceDataForClient($invoice, $amountMonthWise)
283155
{
284156
$invoiceAmount = round($invoice->total_amount_in_inr, 2);

0 commit comments

Comments
 (0)