[BACK]Return to report_paid.pl CVS log [TXT][DIR] Up to [local] / RT / Invoicing

File: [local] / RT / Invoicing / report_paid.pl (download)

Revision 1.1, Thu Aug 20 02:11:55 2020 UTC (3 years, 8 months ago) by afresh1
Branch: MAIN
CVS Tags: HEAD

Add some helper tools

#!/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;
}