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 class => 'SL::DB::PaymentTerm',
36 column_map => { payment_id => 'id' },
40 __PACKAGE__->meta->initialize;
44 sub items { goto &orderitems; }
49 return 'sales_order' if $self->customer_id && ! $self->quotation;
50 return 'purchase_order' if $self->vendor_id && ! $self->quotation;
51 return 'sales_quotation' if $self->customer_id && $self->quotation;
52 return 'request_quotation' if $self->vendor_id && $self->quotation;
58 return shift->type eq shift;
65 if ($self->quotation) {
68 return SL::DB::Manager::Invoice->get_all(
70 ordnumber => $self->ordnumber,
71 @{ $params{query} || [] },
77 sub abschlag_invoices {
78 return shift()->invoices(query => [ abschlag => 1 ]);
82 return shift()->invoices(query => [ abschlag => 0 ]);
91 SL::DB::Order - Order Datenbank Objekt.
97 Returns one of the following string types:
105 =item sales_quotation
107 =item request_quotation
113 Rreturns true if the order is of the given type.
121 Sven Schöling <s.schoeling@linet-services.de>