1 package SL::DB::PurchaseInvoice;
7 use SL::DB::MetaSetup::PurchaseInvoice;
8 use SL::DB::Manager::PurchaseInvoice;
9 use SL::DB::Helper::AttrHTML;
10 use SL::DB::Helper::AttrSorted;
11 use SL::DB::Helper::LinkedRecords;
12 use SL::Locale::String qw(t8);
14 # The calculator hasn't been adjusted for purchase invoices yet.
15 # use SL::DB::Helper::PriceTaxCalculator;
17 __PACKAGE__->meta->add_relationship(
19 type => 'one to many',
20 class => 'SL::DB::InvoiceItem',
21 column_map => { id => 'trans_id' },
22 manager_args => { with_objects => [ 'part' ] }
24 sepa_export_items => {
25 type => 'one to many',
26 class => 'SL::DB::SepaExportItem',
27 column_map => { id => 'ap_id' },
28 manager_args => { with_objects => [ 'sepa_export' ] }
32 class => 'SL::DB::Shipto',
33 column_map => { id => 'trans_id' },
34 query_args => [ module => 'AP' ],
37 type => 'one to many',
38 class => 'SL::DB::AccTransaction',
39 column_map => { id => 'trans_id' },
40 manager_args => { with_objects => [ 'chart' ],
41 sort_by => 'acc_trans_id ASC' }
45 __PACKAGE__->meta->initialize;
47 __PACKAGE__->attr_html('notes');
48 __PACKAGE__->attr_sorted('items');
50 sub items { goto &invoiceitems; }
51 sub add_items { goto &add_invoiceitems; }
54 # For compatibility with Order, DeliveryOrder
55 croak 'not an accessor' if @_ > 1;
74 return t8('AP Transaction (abbreviation)') if !$self->invoice && !$self->storno;
75 return t8('AP Transaction (abbreviation)') . '(' . t8('Storno (one letter abbreviation)') . ')' if !$self->invoice && $self->storno;
76 return t8('Invoice (one letter abbreviation)'). '(' . t8('Storno (one letter abbreviation)') . ')' if $self->storno;
77 return t8('Invoice (one letter abbreviation)');