]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/Invoice.pm
Verknüpfungen zum Unit-Model
[mfinanz.git] / SL / DB / Invoice.pm
index cc488829f6b17b64387cbc4267da12757646de8d..c64cf9d1dcb38780042008732c60e52360198b9e 100644 (file)
@@ -9,10 +9,8 @@ use List::Util qw(first);
 
 use SL::DB::MetaSetup::Invoice;
 use SL::DB::Manager::Invoice;
-
-__PACKAGE__->attr_number($_, places => -2) for qw(amount netamount paid  marge_total marge_percent taxamount);
-__PACKAGE__->attr_date($_) for qw(transdate gldate datepaid duedate deliverydate orddate quodate);
-__PACKAGE__->attr_percent($_) for qw(abschlag_percentage);
+use SL::DB::Helper::LinkedRecords;
+use SL::DB::Helper::PriceTaxCalculator;
 
 __PACKAGE__->meta->add_relationship(
   invoiceitems => {
@@ -29,6 +27,8 @@ __PACKAGE__->meta->initialize;
 
 # methods
 
+sub items { goto &invoiceitems; }
+
 # it is assumed, that ordnumbers are unique here.
 sub first_order_by_ordnumber {
   my $self = shift;
@@ -59,4 +59,6 @@ sub taxamount {
   return $self->amount - $self->netamount;
 }
 
+__PACKAGE__->meta->make_attr_helpers(taxamount => 'numeric(15,5)');
+
 1;