8 use SL::DB::MetaSetup::Order;
9 use SL::DB::Manager::Order;
11 use SL::DB::Helper::LinkedRecords;
12 use SL::DB::Helper::PriceTaxCalculator;
13 use SL::DB::Helper::TransNumberGenerator;
15 __PACKAGE__->meta->add_relationship(
17 type => 'one to many',
18 class => 'SL::DB::OrderItem',
19 column_map => { id => 'trans_id' },
21 with_objects => [ 'part' ]
24 periodic_invoices_config => {
26 class => 'SL::DB::PeriodicInvoicesConfig',
27 column_map => { id => 'oe_id' },
29 periodic_invoices => {
30 type => 'one to many',
31 class => 'SL::DB::PeriodicInvoice',
32 column_map => { id => 'oe_id' },
36 class => 'SL::DB::PaymentTerm',
37 column_map => { payment_id => 'id' },
41 __PACKAGE__->meta->initialize;
45 sub items { goto &orderitems; }
50 return 'sales_order' if $self->customer_id && ! $self->quotation;
51 return 'purchase_order' if $self->vendor_id && ! $self->quotation;
52 return 'sales_quotation' if $self->customer_id && $self->quotation;
53 return 'request_quotation' if $self->vendor_id && $self->quotation;
59 return shift->type eq shift;
66 if ($self->quotation) {
69 return SL::DB::Manager::Invoice->get_all(
71 ordnumber => $self->ordnumber,
72 @{ $params{query} || [] },
78 sub abschlag_invoices {
79 return shift()->invoices(query => [ abschlag => 1 ]);
83 return shift()->invoices(query => [ abschlag => 0 ]);
92 SL::DB::Order - Order Datenbank Objekt.
98 Returns one of the following string types:
106 =item sales_quotation
108 =item request_quotation
114 Rreturns true if the order is of the given type.
122 Sven Schöling <s.schoeling@linet-services.de>