version 1.6, 2020/11/10 19:08:06 |
version 1.7, 2020/11/18 12:55:44 |
|
|
use strict; |
use strict; |
|
|
use Getopt::Std qw(getopts); |
use Getopt::Std qw(getopts); |
|
use Time::Local qw(timegm); |
|
|
our ($opt_a, $opt_b, $opt_c, $opt_L, $opt_n, $opt_p, $opt_s); |
our ($opt_a, $opt_b, $opt_c, $opt_L, $opt_n, $opt_p, $opt_s); |
|
|
|
|
month => $month, |
month => $month, |
day => $day, |
day => $day, |
date => "$year-$month-$day", |
date => "$year-$month-$day", |
days => ($month - 1) * 30 + ($day - 1), |
days => (timegm 0,0,0, $day, $month-1, $year) / 86400, |
price => $newpc * $amount, |
price => $newpc * $amount, |
}; |
}; |
$prices{$cc} = $new unless $prices{$cc} && $oldpc == $newpc; |
$prices{$cc} = $new unless $prices{$cc} && $oldpc == $newpc; |
|
|
if ($old) { |
if ($old) { |
# Record a gain or loss in this period. |
# Record a gain or loss in this period. |
$newprofit->{olddate} = $old->{date}; |
$newprofit->{olddate} = $old->{date}; |
$newprofit->{days} = $new->{days} - $old->{days} + |
$newprofit->{days} = $new->{days} - $old->{days}; |
($new->{year} - $old->{year}) * 360; |
|
$newprofit->{text} .= sprintf " %s %s (%dd)", |
$newprofit->{text} .= sprintf " %s %s (%dd)", |
(translate 'since'), $old->{date}, |
(translate 'since'), $old->{date}, |
$newprofit->{days}; |
$newprofit->{days}; |
Line 524 for my $cc (sort keys %cclist) { |
|
Line 524 for my $cc (sort keys %cclist) { |
|
100.0 * $entry->{rel}, $entry->{old}; |
100.0 * $entry->{rel}, $entry->{old}; |
if ($entry->{days}) { |
if ($entry->{days}) { |
printf "%5.1f%% p.a.", |
printf "%5.1f%% p.a.", |
36000.0 * $entry->{rel} / $entry->{days}; |
36524.5 * $entry->{rel} / $entry->{days}; |
} else { |
} else { |
printf "%11s", ''; |
printf "%11s", ''; |
} |
} |