cumulative bal in reg includes bpis
cicd / ci (push) Successful in 59s Details

main
Bel LaPointe 2025-04-03 12:25:39 -06:00
parent 757afa603e
commit 768ce8e92e
2 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ func Main() {
transactions := deltas.Transactions()
for i, transaction := range transactions {
balances := ledger.Deltas(transaction).Like(q).Group(group).Balances().WithBPIs(bpis).Nonzero()
balances := ledger.Deltas(transaction).Like(q).Group(group).Balances().WithBPIsAt(bpis, transaction[0].Date).Nonzero()
shouldPrint := false
shouldPrint = shouldPrint || len(balances) > 2
if config.Query.NoExchanging {
@ -110,7 +110,7 @@ func Main() {
}
if shouldPrint {
fmt.Printf("%s\t%s\n", transaction[0].Date, transaction[0].Description)
FPrintBalances(os.Stdout, "\t\t", balances, transactions[:i+1].Deltas().Like(q).Group(group).Balances())
FPrintBalances(os.Stdout, "\t\t", balances, transactions[:i+1].Deltas().Like(q).Group(group).Balances().WithBPIsAt(bpis, transaction[0].Date).Nonzero())
}
}
default:

View File

@ -157,7 +157,7 @@ func (balances Balances) WithBPIsAt(bpis BPIs, date string) Balances {
if k2 == USD {
result[k][USD] = result[k][USD] + v2
} else if scalar := bpis[k2].Lookup(date); scalar != nil {
result[k][USD] = result[k][USD] + *scalar*v2
result[k][USD] = result[k][USD] + v2*(*scalar)
} else {
result[k][k2] = result[k][k2] + v2
}