version 1.5, 2012/08/15 01:52:28 |
version 1.8, 2012/11/28 02:25:13 |
|
|
$invoice->{$_} = ymd_to_DateTime( $invoice->{$_} ) |
$invoice->{$_} = ymd_to_DateTime( $invoice->{$_} ) |
for qw/ invdate start end /; |
for qw/ invdate start end /; |
} |
} |
|
foreach my $custid (keys %{ $self->{payment} || {} }) { |
|
foreach my $payment (@{ $self->{payment}->{$custid} || [] }) { |
|
$payment->{date} = ymd_to_DateTime( $payment->{date} ) |
|
if $payment->{date}; |
|
} |
|
} |
} |
} |
|
|
bless $self, $class; |
bless $self, $class; |
|
|
: $self->{_table}->{unpaid}; |
: $self->{_table}->{unpaid}; |
} |
} |
|
|
|
sub credits { |
|
my ( $self, $custid ) = @_; |
|
|
|
$self->_match_payments; |
|
return defined $custid |
|
? $self->{_table}->{credit}->{$custid} |
|
: $self->{_table}->{credit}; |
|
} |
|
|
sub save { |
sub save { |
my ($self) = @_; |
my ($self) = @_; |
|
|
|
|
} |
} |
} |
} |
} |
} |
|
foreach my $custid (keys %{ $self->{payment} || {} }) { |
|
foreach my $payment (@{ $self->{payment}->{$custid} || [] }) { |
|
$payment->{date} = $payment->{date}->ymd |
|
if ref $payment->{date} eq 'DateTime'; |
|
} |
|
} |
DumpFile( $file, {%$self} ) or die "Unable to save state: $!"; |
DumpFile( $file, {%$self} ) or die "Unable to save state: $!"; |
} |
} |
|
|
|
|
delete $credit{$custid} unless $credit{$custid}; |
delete $credit{$custid} unless $credit{$custid}; |
} |
} |
|
|
foreach my $id ( sort { $b <=> $a } keys %owes ) { |
foreach my $id ( sort { $a <=> $b } keys %owes ) { |
my $i = $invoices->{$id}; |
my $i = $invoices->{$id}; |
my $custid = $i->{custid} or next; |
my $custid = $i->{custid} or next; |
|
|