From: Sven Schöling Date: Wed, 5 Aug 2015 15:35:17 +0000 (+0200) Subject: RecordItem: unit_muiltiplier Methode X-Git-Tag: release-3.3.0~33 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1904d8c63b2ab4172b36b117ec476c81c690ca86;p=kivitendo-erp.git RecordItem: unit_muiltiplier Methode --- diff --git a/SL/DB/DeliveryOrderItem.pm b/SL/DB/DeliveryOrderItem.pm index de7587cfd..ba2c2e099 100644 --- a/SL/DB/DeliveryOrderItem.pm +++ b/SL/DB/DeliveryOrderItem.pm @@ -5,6 +5,7 @@ use strict; use SL::DB::MetaSetup::DeliveryOrderItem; use SL::DB::Helper::ActsAsList; use SL::DB::Helper::LinkedRecords; +use SL::DB::Helper::RecordItem; use SL::DB::Helper::CustomVariables ( sub_module => 'delivery_order_items', cvars_alias => 1, diff --git a/SL/DB/Helper/RecordItem.pm b/SL/DB/Helper/RecordItem.pm new file mode 100644 index 000000000..020128db1 --- /dev/null +++ b/SL/DB/Helper/RecordItem.pm @@ -0,0 +1,17 @@ +package SL::DB::Helper::RecordItem; + +use strict; +use parent qw(Exporter); + +our @EXPORT = qw(base_sellprice unit_multiplier); + +sub base_sellprice { + $_[0]->sellprice / $_[0]->unit_multiplier; +} + +sub unit_multiplier { + $_[0]->unit_obj->convert_to(1, $_[0]->part->unit_obj) +} + + +1; diff --git a/SL/DB/InvoiceItem.pm b/SL/DB/InvoiceItem.pm index a20f56fc9..80c406b77 100644 --- a/SL/DB/InvoiceItem.pm +++ b/SL/DB/InvoiceItem.pm @@ -5,6 +5,7 @@ use strict; use SL::DB::MetaSetup::InvoiceItem; use SL::DB::Helper::ActsAsList; use SL::DB::Helper::LinkedRecords; +use SL::DB::Helper::RecordItem; use SL::DB::Helper::CustomVariables ( sub_module => 'invoice', cvars_alias => 1, diff --git a/SL/DB/OrderItem.pm b/SL/DB/OrderItem.pm index 6ab16ac2a..8ae5e0bdd 100644 --- a/SL/DB/OrderItem.pm +++ b/SL/DB/OrderItem.pm @@ -9,6 +9,7 @@ use SL::DB::Manager::OrderItem; use SL::DB::DeliveryOrderItemsStock; use SL::DB::Helper::ActsAsList; use SL::DB::Helper::LinkedRecords; +use SL::DB::Helper::RecordItem; use SL::DB::Helper::CustomVariables ( sub_module => 'orderitems', cvars_alias => 1,