@@ -122,8 +122,14 @@ private static Sales ParseSalesLineItem(IXLRow row, int i)
122
122
var eomStr = row . Cell ( "A" ) . Value . ToString ( ) ;
123
123
if ( string . IsNullOrEmpty ( eomStr ) ) throw new ArgumentException ( $ "MONTH_END field is required in SALES sheet cell A{ i } ") ;
124
124
var eomParsed = DateTime . TryParse ( eomStr , out var eom ) ;
125
+
125
126
if ( ! eomParsed ) throw new ArgumentException ( $ "Invalid [MONTH_END] value in SALES sheet cell A{ i } ") ;
126
127
128
+ var monthEnd = eom . Day ;
129
+ var expectedMonthEnd = DateTime . DaysInMonth ( eom . Year , eom . Month ) ;
130
+ if ( monthEnd != expectedMonthEnd )
131
+ throw new ArgumentException ( $ "Invalid [MONTH_END] value in SALES sheet cell A{ i } ") ;
132
+
127
133
var tin = row . Cell ( "B" ) . Value . ToString ( ) ?? string . Empty ;
128
134
if ( ! string . IsNullOrEmpty ( tin ) && ! tin . IsValidTin ( ) )
129
135
throw new ArgumentException ( $ "Invalid [TIN] value in SALES sheet cell B{ i } ") ;
@@ -179,7 +185,7 @@ private static List<Purchases> GetPurchaseData(IXLWorkbook workbook, Info info)
179
185
{
180
186
var row = purchaseSheet . Row ( i ) ;
181
187
var purchase = ParsePurchasesLineItem ( row , i ) ;
182
-
188
+
183
189
if ( purchase . Tin . Strip ( ) == info . Tin )
184
190
throw new ArgumentException ( $ "TIN in PURCHASES sheet cell B{ i } cannot be the same as the TIN of the taxpayer") ;
185
191
@@ -197,8 +203,14 @@ private static Purchases ParsePurchasesLineItem(IXLRow row, int i)
197
203
var eomStr = row . Cell ( "A" ) . Value . ToString ( ) ;
198
204
if ( string . IsNullOrEmpty ( eomStr ) ) throw new ArgumentException ( $ "MONTH_END field is required in PURCHASES sheet cell A{ i } ") ;
199
205
var eomParsed = DateTime . TryParse ( eomStr , out var eom ) ;
206
+
200
207
if ( ! eomParsed ) throw new ArgumentException ( $ "Invalid [MONTH_END] value in PURCHASES sheet cell A{ i } ") ;
201
208
209
+ var monthEnd = eom . Day ;
210
+ var expectedMonthEnd = DateTime . DaysInMonth ( eom . Year , eom . Month ) ;
211
+ if ( monthEnd != expectedMonthEnd )
212
+ throw new ArgumentException ( $ "Invalid [MONTH_END] value in PURCHASES sheet cell A{ i } ") ;
213
+
202
214
var tin = row . Cell ( "B" ) . Value . ToString ( ) ?? string . Empty ;
203
215
if ( ! tin . IsValidTin ( ) ) throw new ArgumentException ( $ "Invalid [TIN] value in PURCHASES sheet cell B{ i } ") ;
204
216
0 commit comments