1 package SL::DB::DeliveryOrderItem;
5 use SL::DB::MetaSetup::DeliveryOrderItem;
6 use SL::DB::Helper::ActsAsList;
7 use SL::DB::Helper::LinkedRecords;
8 use SL::DB::Helper::RecordItem;
9 use SL::DB::Helper::CustomVariables (
10 sub_module => 'delivery_order_items',
14 class => 'SL::DB::Part',
20 __PACKAGE__->meta->make_manager_class;
22 __PACKAGE__->meta->add_relationship(
23 delivery_order_stock_entries => {
24 type => 'one to many',
25 class => 'SL::DB::DeliveryOrderItemsStock',
26 column_map => { id => 'delivery_order_item_id' },
28 with_objects => [ 'inventory' ]
33 __PACKAGE__->meta->initialize;
35 __PACKAGE__->configure_acts_as_list(group_by => [qw(delivery_order_id)]);
39 sub record { goto &delivery_order }
41 sub displayable_delivery_order_info {
42 my ($self, $dec) = @_;
46 return SL::Presenter->get->sales_delivery_order($self->delivery_order, display => 'inline')
47 . " " . $::form->format_amount(\%::myconfig, $self->qty, $dec) . " " . $self->unit
48 . " (" . $self->delivery_order->transdate->to_kivitendo . ")";
59 SL::DB::DeliveryOrderItem Model for the 'delivery_order_items' table
63 This is a standard Rose::DB::Object based model and can be used as one.
69 =item C<displayable_delivery_order_info DEC>
71 Returns a string with information about the delivery order item in relation to
72 its delivery order, specifically
74 * the (HTML-linked) delivery order number
76 * the qty and unit of the part in the delivery order
78 * the date of the delivery order
80 Doesn't include any part information, it is assumed that is already shown elsewhere.
82 The method takes an optional argument "dec" which determines how many decimals to
83 round to, as used by format_amount.
85 SL::DB::Manager::DeliveryOrderItem->get_first->displayable_delivery_order_info(0);
86 # 201601234 5 Stck (12.12.2016)
92 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>