diff options
Diffstat (limited to 'mktreasurer')
-rwxr-xr-x | mktreasurer | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/mktreasurer b/mktreasurer index d12217a..9f89b6a 100755 --- a/mktreasurer +++ b/mktreasurer @@ -50,6 +50,7 @@ sub donations_list { nb => $don->{Nb}, amount => $don->{Am}, date => epoch_date($don->{Dt}), + pa => $don->{Pa}, who => party_name($r, $don->{Pa}), type => subcat_name($r, $don->{Sca}, $don_cat), $don->{No} ne '(null)' ? (notes => $don->{No}) : (), @@ -65,6 +66,7 @@ sub donations_infos { donations => donations_list($r), by_month => {}, by_year => {}, + by_pa => {}, total_30 => 0, ); foreach my $don (@{$res{donations}}) { @@ -76,11 +78,13 @@ sub donations_infos { $res{by_month}->{$month}->{month} = $dt->month; push @{$res{by_year}->{$year}->{donations}}, $don; push @{$res{by_year}->{$year}->{months}}, $month; + push @{$res{by_pa}->{$don->{pa}}->{donations}}, $don; if (time - $don->{date} < '2592000') { # last 30 days $res{total_30} += $don->{amount}; } } - foreach my $d ((values %{$res{by_month}}), (values %{$res{by_year}})) { + foreach my $d ((values %{$res{by_month}}), (values %{$res{by_year}}), + (values %{$res{by_pa}})) { foreach my $don (@{$d->{donations}}) { $d->{total} += $don->{amount}; $d->{type}->{$don->{type}} += $don->{amount}; @@ -98,7 +102,7 @@ sub process_template { } sub output_pages { - my ($donations) = @_; + my ($r, $donations) = @_; my $template = Template->new( INCLUDE_PATH => $config->{tmpl_dir}, OUTPUT_PATH => $config->{out_dir}, @@ -123,6 +127,16 @@ sub output_pages { process_template($template, 'donations_by_year', $vars, "donations_y_$year"); } + foreach my $pa (keys %{$donations->{by_pa}}) { + my $vars = { + config => $config, + pa => $pa, + who => party_name($r, $pa), + donations => $donations, + }; + process_template($template, 'donations_by_pa', $vars, "donations_p_$pa"); + } + my $vars = { config => $config, donations => $donations, @@ -135,5 +149,5 @@ sub output_pages { my $r = XMLin($config->{grisbi_file}); my $donations = donations_infos($r); -output_pages($donations); +output_pages($r, $donations); |