|
9 | 9 | use Modules\Invoice\Entities\Invoice;
|
10 | 10 | use Modules\Invoice\Services\CurrencyService;
|
11 | 11 | use Modules\Invoice\Services\InvoiceService;
|
12 |
| -use Modules\Revenue\Entities\RevenueProceed; |
13 | 12 |
|
14 | 13 | class RevenueReportService
|
15 | 14 | {
|
@@ -152,133 +151,6 @@ private function getAvgCurrencyRates($startDate, $endDate)
|
152 | 151 | return $results;
|
153 | 152 | }
|
154 | 153 |
|
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 |
| - |
282 | 154 | private static function handleInvoiceDataForClient($invoice, $amountMonthWise)
|
283 | 155 | {
|
284 | 156 | $invoiceAmount = round($invoice->total_amount_in_inr, 2);
|
|
0 commit comments