version 1.22, 2011/04/08 18:10:28 |
version 1.24, 2011/04/12 20:32:15 |
|
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# $AFresh1: rt_invoices.pl,v 1.21 2011/03/24 20:03:49 andrew Exp $ |
# $AFresh1: rt_invoices.pl,v 1.23 2011/04/08 18:00:16 andrew Exp $ |
######################################################################## |
######################################################################## |
# Copyright (c) 2011 Andrew Fresh <andrew@afresh1.com> |
# Copyright (c) 2011 Andrew Fresh <andrew@afresh1.com> |
# |
# |
|
|
default { die "Unknown per [$per]\n" } |
default { die "Unknown per [$per]\n" } |
} |
} |
|
|
my $billends = DateTime->now->set( hour => 0, minute => 0, second => 0 ); |
my $billends = DateTime->now |
|
->subtract( days => 1 ) |
|
->set( hour => 23, minute => 59, second => 59 ); |
|
|
# XXX This is helpful, but monthly and billday > 28 == !!! |
# XXX This is helpful, but monthly and billday > 28 == !!! |
$billends->subtract( days => 1 ) |
$billends->subtract( days => 1 ) |
while $day && $billends->$day_method != $day; |
while $day && $billends->$day_method != $day; |
|
|
my $date = $billends->clone->subtract( $per => $freq ); |
my $date = $billends->clone->subtract( $per => $freq ) |
|
->set( hour => 0, minute => 0, second => 0 ); |
|
|
my %invoice = ( end => $billends->clone->subtract( seconds => 1 ) ); |
my %invoice = ( end => $billends->clone->subtract( seconds => 1 ) ); |
|
|
|
|
if !$startdate || $startdate > $date; |
if !$startdate || $startdate > $date; |
} |
} |
|
|
return if $billends <= $date; |
# Is the start date more than $freq $per before the end date? |
|
my $diff = $billends - $date; |
|
return if $diff->in_units($per) < 1; |
|
|
if ( $cust->{base_rate} ) { |
if ( $cust->{base_rate} ) { |
my ( $project, $hours ) = make_base_project( |
my ( $project, $hours ) = make_base_project( |