Skip to content

Commit 5316cbf

Browse files
committed
fix(excel): handle missing account balance
1 parent 26aeb23 commit 5316cbf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

excel/result.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,12 @@ func xlsxSumSumMonths(xlsx *excelize.File, sheet string, row int, starts, ends t
477477
for t = starts; !t.After(ends); t = t.AddDate(0, 1, 0) {
478478
capital := inCapital
479479
for _, acc := range currentCapitalAccounts {
480-
if month := accountBalances[acc].months[t.Format("2006-01")]; month != nil {
481-
for _, cv := range month {
482-
capital -= cv.amount
483-
}
480+
bal := accountBalances[acc]
481+
if bal == nil {
482+
continue
483+
}
484+
for _, cv := range bal.months[t.Format("2006-01")] {
485+
capital -= cv.amount
484486
}
485487
}
486488

0 commit comments

Comments
 (0)