1 package SL::DB::Manager::Invoice;
5 use base qw(SL::DB::Helper::Manager);
7 sub object_class { 'SL::DB::Invoice' }
9 __PACKAGE__->make_manager_methods;
13 my $type = lc(shift || '');
15 return (or => [ invoice => 0, invoice => undef ]) if $type eq 'ar_transaction';
16 return (and => [ invoice => 1, amount => { ge => 0 }, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice';
17 return (and => [ invoice => 1, amount => { lt => 0 }, or => [ storno => 0, storno => undef ] ]) if $type eq 'credit_note';
18 return (and => [ invoice => 1, amount => { lt => 0 }, storno => 1 ]) if $type =~ m/(?:invoice_)?storno/;
19 return (and => [ invoice => 1, amount => { ge => 0 }, storno => 1 ]) if $type eq 'credit_note_storno';
21 die "Unknown type $type";