version 1.5, 2012/08/15 01:52:28 |
version 1.7, 2012/11/28 02:24:04 |
|
|
$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) = @_; |
|
|
|
|
else { |
else { |
delete $invoice->{$k}; |
delete $invoice->{$k}; |
} |
} |
|
} |
|
} |
|
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: $!"; |