#!/usr/bin/perl use strict; use warnings; use 5.010; use YAML::XS qw/ LoadFile Dump /; my $state = LoadFile('rt_invoice.state'); foreach my $invoice (keys %{ $state->{invoice}->{$date} }) { my $i = $state->{invoice}->{$date}->{$invoice}; next unless $i->{custid}; next unless $i->{custid} eq 'WireFree'; #next unless $i->{custid} eq 'speakman'; #next unless $i->{custid} eq 'jscherz@itc-home.com'; next if $i->{void}; #print Dump $i; printf "Invoice %s for \$%0.2f on %s\n", $invoice, $i->{total}, $i->{invdate}; my $owes = $i->{total}; if ($i->{paid}) { $owes -= $i->{paid}; printf ' Paid: $%0.2f', $i->{paid}; print ' on ', $i->{pmt_date} if $i->{pmt_date}; print ' with check ', $i->{check} if $i->{check}; print "\n"; } printf " Owing \$%0.2f\n", $owes; }