質問編集履歴
1
進んだとこまで更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,11 +20,11 @@
|
|
20
20
|
|
21
21
|
【結果】
|
22
22
|
|
23
|
-
![イメージ説明](
|
23
|
+
![イメージ説明](e29c3241d0d7bab38c18fbc4c5c03648.png)
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
-
202
|
27
|
+
2021年の合計が上手くいきません。
|
28
28
|
|
29
29
|
いかがすればよいかご教授頂けないでしょうか?
|
30
30
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
|
79
79
|
*/
|
80
80
|
|
81
|
-
protected $description = '05';
|
81
|
+
protected $description = '課題05';
|
82
82
|
|
83
83
|
|
84
84
|
|
@@ -190,111 +190,177 @@
|
|
190
190
|
|
191
191
|
|
192
192
|
|
193
|
-
$
|
193
|
+
$stock_nyukin[] = $work_field[1];
|
194
|
-
|
194
|
+
|
195
|
-
$
|
195
|
+
$total_nyukin = array_sum($stock_nyukin);
|
196
|
-
|
197
|
-
|
198
|
-
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
-
$c[] = $work_field[2];
|
199
|
+
$stock_syukin[] = $work_field[2];
|
200
|
-
|
200
|
+
|
201
|
-
$
|
201
|
+
$total_syukin = array_sum($stock_syukin);
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
207
|
-
if(($break_key_year != $work_date[0])){
|
211
|
+
if (($break_key_year != $work_date[0]) || ($break_key_month != $work_date[1])) {
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
208
220
|
|
209
221
|
if ($i != 1) {
|
210
222
|
|
223
|
+
|
224
|
+
|
225
|
+
echo $break_key_year.'年'.$break_key_month.'月'.'入金集計:'.$nyukin.'、出金合計:'.$syukin.PHP_EOL;
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
$stock_year_nyukin[] = $nyukin;
|
230
|
+
|
231
|
+
$year_nyukin = array_sum($stock_year_nyukin);
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
$stock_year_syukin[] = $syukin;
|
236
|
+
|
237
|
+
$year_syukin = array_sum($stock_year_syukin);
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
$nyukin = 0;
|
242
|
+
|
243
|
+
$syukin = 0;
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
if(($break_key_year != $work_date[0])){
|
250
|
+
|
251
|
+
|
252
|
+
|
211
|
-
echo '---------------------------------------------------'.PHP_EOL;
|
253
|
+
echo '---------------------------------------------------'.PHP_EOL;
|
212
|
-
|
254
|
+
|
213
|
-
echo $break_key_year.'年:'.'入金合計:'.$
|
255
|
+
echo $break_key_year.'年:'.'入金合計:'.$year_nyukin.'出金合計:'.$year_syukin.PHP_EOL;
|
214
|
-
|
256
|
+
|
215
|
-
echo PHP_EOL;
|
257
|
+
echo PHP_EOL;
|
258
|
+
|
216
|
-
|
259
|
+
}
|
217
|
-
|
218
|
-
|
260
|
+
|
261
|
+
|
262
|
+
|
219
|
-
$
|
263
|
+
// $year_nyukin =0;
|
220
|
-
|
264
|
+
|
221
|
-
$
|
265
|
+
// $year_syukin =0;
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
222
270
|
|
223
271
|
}
|
224
272
|
|
225
273
|
|
226
274
|
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
$break_key_year = $work_date[0];
|
280
|
+
|
281
|
+
$break_key_month = $work_date[1];
|
282
|
+
|
283
|
+
|
284
|
+
|
227
|
-
}
|
285
|
+
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
if (($break_key_year != $work_date[0]) || ($break_key_month != $work_date[1])) {
|
234
286
|
|
235
287
|
|
236
288
|
|
289
|
+
|
290
|
+
|
291
|
+
$w_nyukin = trim($work_field[1]);
|
292
|
+
|
293
|
+
$w_syukin = trim($work_field[2]);
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
if(empty($w_nyukin) && empty($w_syukin)){
|
298
|
+
|
299
|
+
echo $i.'行目のデータがありませんのでデータをスキップします。'.PHP_EOL;
|
300
|
+
|
301
|
+
continue;
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
//通常処理
|
308
|
+
|
237
|
-
|
309
|
+
if (empty($w_nyukin)) {
|
310
|
+
|
238
|
-
|
311
|
+
$syukin += $w_syukin;
|
312
|
+
|
239
|
-
|
313
|
+
} else {
|
314
|
+
|
240
|
-
|
315
|
+
$nyukin += $w_nyukin;
|
316
|
+
|
317
|
+
}
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
241
|
-
|
329
|
+
echo $break_key_year.'年'.$break_key_month.'月'.'入金集計:'.$nyukin.'、出金合計:'.$syukin.PHP_EOL;
|
330
|
+
|
242
|
-
|
331
|
+
echo '---------------------------------------------------'.PHP_EOL;
|
332
|
+
|
243
|
-
|
333
|
+
echo $break_key_year.'年:'.'入金合計:'.$year_nyukin.'出金合計:'.$year_syukin.PHP_EOL;
|
334
|
+
|
244
|
-
|
335
|
+
echo PHP_EOL;
|
336
|
+
|
337
|
+
echo '========================================='.PHP_EOL;
|
338
|
+
|
339
|
+
echo 'トータル:'.'入金合計:'.$total_nyukin.'、出金合計:'.$total_syukin.PHP_EOL;
|
340
|
+
|
341
|
+
fclose($fp);
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
245
|
-
|
347
|
+
if ($i == 0) {
|
246
|
-
|
348
|
+
|
247
|
-
|
349
|
+
echo "指定されたファイルは空ファイルでした。".PHP_EOL;
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
350
|
+
|
253
|
-
|
351
|
+
}
|
254
|
-
|
255
|
-
|
256
|
-
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
257
|
-
|
357
|
+
return 0;
|
258
|
-
|
358
|
+
|
259
|
-
|
359
|
+
}
|
260
360
|
|
261
361
|
|
262
362
|
|
263
|
-
|
264
|
-
|
265
|
-
|
363
|
+
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
$w_nyukin = trim($work_field[1]);
|
272
|
-
|
273
|
-
$w_syukin = trim($work_field[2]);
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
if(empty($w_nyukin) && empty($w_syukin)){
|
278
|
-
|
279
|
-
echo $i.'行目のデータがありませんのでデータをスキップします。'.PHP_EOL;
|
280
|
-
|
281
|
-
continue;
|
282
|
-
|
283
|
-
}
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
//通常処理
|
288
|
-
|
289
|
-
if (empty($w_nyukin)) {
|
290
|
-
|
291
|
-
$syukin += $w_syukin;
|
292
|
-
|
293
|
-
} else {
|
294
|
-
|
295
|
-
$nyukin += $w_nyukin;
|
296
|
-
|
297
|
-
}
|
298
364
|
|
299
365
|
|
300
366
|
|
@@ -302,46 +368,4 @@
|
|
302
368
|
|
303
369
|
|
304
370
|
|
305
|
-
|
306
|
-
|
307
|
-
echo $break_key_year.'年'.$break_key_month.'月'.'入金集計:'.$nyukin.'、出金合計:'.$syukin.PHP_EOL;
|
308
|
-
|
309
|
-
echo '---------------------------------------------------'.PHP_EOL;
|
310
|
-
|
311
|
-
echo $break_key_year.'年:'.'入金合計:'.$b.'出金合計:'.$d.PHP_EOL;
|
312
|
-
|
313
|
-
echo PHP_EOL;
|
314
|
-
|
315
|
-
echo '========================================='.PHP_EOL;
|
316
|
-
|
317
|
-
echo 'トータル:'.'入金合計:'.$b.'、出金合計:'.$d.PHP_EOL;
|
318
|
-
|
319
|
-
fclose($fp);
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
if ($i == 0) {
|
326
|
-
|
327
|
-
echo "指定されたファイルは空ファイルでした。".PHP_EOL;
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
return 0;
|
336
|
-
|
337
|
-
}
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
}
|
346
|
-
|
347
371
|
```
|