@@ -151,6 +151,46 @@ private function getAvgCurrencyRates($startDate, $endDate)
151
151
return $ results ;
152
152
}
153
153
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
+
154
194
private static function handleInvoiceDataForClient ($ invoice , $ amountMonthWise )
155
195
{
156
196
$ invoiceAmount = round ($ invoice ->total_amount_in_inr , 2 );
0 commit comments