@@ -99,6 +99,14 @@ public enum PlutusFinancialReportSlicer {
99
99
break
100
100
}
101
101
}
102
+
103
+ let localizationsAP = [ " Pacif " , " Pacíf " , " Pazif " ]
104
+ for localization in localizationsAP {
105
+ if currencyCol. lowercased ( ) . contains ( localization. lowercased ( ) ) {
106
+ currency = " USD - AP "
107
+ break
108
+ }
109
+ }
102
110
}
103
111
104
112
guard let preTaxString = line [ safe: columnIndexAmountPreTax] ? . replacingOccurrences ( of: " , " , with: " " ) ,
@@ -190,6 +198,13 @@ public enum PlutusFinancialReportSlicer {
190
198
// remember currency of current line's country
191
199
currencies [ countryCode] = currency
192
200
201
+ if let start = formatDate ( startDate) , start >= Date . subsidiaryChange2024 {
202
+ // special case affecting countries Apple put in the "South Asia and Pacific" group: currency for those is listed as "USD"
203
+ // in the sales reports but the corresponding exchange rate is keyed "USD - AP"
204
+ if Subsidiary . pacificCountries. contains ( countryCode) && currency == " USD " {
205
+ currencies [ countryCode] = " USD - AP "
206
+ }
207
+ }
193
208
// special case affecting countries Apple put in the "Rest of World" group: currency for those is listed as "USD"
194
209
// in the sales reports but the corresponding exchange rate is keyed "USD - RoW"
195
210
if Subsidiary . restOfWorldCountries. contains ( countryCode) && currency == " USD " {
@@ -219,7 +234,11 @@ public enum PlutusFinancialReportSlicer {
219
234
let localCurrency : String = localCurrency ?? currencyData. map ( \. bankAccountCurrency) . reduce ( into: [ : ] , { $0 [ $1, default: 0 ] += 1 } ) . max ( by: { $0. value < $1. value } ) ? . key ?? " EUR "
220
235
var invoices : [ Invoice ] = [ ]
221
236
222
- let corporations : [ Subsidiary ? : [ SalesForCountry ] ] = Dictionary ( grouping: sales, by: { Subsidiary ( code: $0. countryCode) } )
237
+ guard dateRange. start >= Date . subsidiaryChange2024 || dateRange. end <= Date . subsidiaryChange2024 else {
238
+ throw ParsingError . DateRangeOverlappingBreakingChangeDate
239
+ }
240
+
241
+ let corporations : [ Subsidiary ? : [ SalesForCountry ] ] = Dictionary ( grouping: sales, by: { Subsidiary ( code: $0. countryCode, date: dateRange. start) } )
223
242
224
243
for (corporation, salesInCorp) in corporations {
225
244
guard let corporation else { continue }
0 commit comments