8 use SL::DB::MetaSetup::Order;
9 use SL::DB::Manager::Order;
11 use SL::DB::Helper::LinkedRecords;
12 use SL::DB::Helper::PriceTaxCalculator;
14 __PACKAGE__->meta->add_relationship(
16 type => 'one to many',
17 class => 'SL::DB::OrderItem',
18 column_map => { id => 'trans_id' },
20 with_objects => [ 'part' ]
23 periodic_invoices_config => {
25 class => 'SL::DB::PeriodicInvoicesConfig',
26 column_map => { id => 'oe_id' },
28 periodic_invoices => {
29 type => 'one to many',
30 class => 'SL::DB::PeriodicInvoice',
31 column_map => { id => 'oe_id' },
35 __PACKAGE__->meta->initialize;
39 sub items { goto &orderitems; }
44 return 'sales_order' if $self->customer_id && ! $self->quotation;
45 return 'purchase_order' if $self->vendor_id && ! $self->quotation;
46 return 'sales_quotation' if $self->customer_id && $self->quotation;
47 return 'request_quotation' if $self->vendor_id && $self->quotation;
53 return shift->type eq shift;
60 if ($self->quotation) {
63 return SL::DB::Manager::Invoice->get_all(
65 ordnumber => $self->ordnumber,
66 @{ $params{query} || [] },
72 sub abschlag_invoices {
73 return shift()->invoices(query => [ abschlag => 1 ]);
77 return shift()->invoices(query => [ abschlag => 0 ]);
86 SL::DB::Order - Order Datenbank Objekt.
92 Returns one of the following string types:
100 =item sales_quotation
102 =item request_quotation
108 Rreturns true if the order is of the given type.
116 Sven Schöling <s.schoeling@linet-services.de>