projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
13fb6d8
)
Assembly - linetotal Helperfunktionen
author
G. Richardson
<information@kivitendo-premium.de>
Sun, 7 Aug 2016 20:37:22 +0000
(22:37 +0200)
committer
G. Richardson
<information@kivitendo-premium.de>
Tue, 22 Nov 2016 13:42:49 +0000
(14:42 +0100)
SL/DB/Assembly.pm
patch
|
blob
|
history
diff --git
a/SL/DB/Assembly.pm
b/SL/DB/Assembly.pm
index
767ba41
..
a77e34b
100644
(file)
--- a/
SL/DB/Assembly.pm
+++ b/
SL/DB/Assembly.pm
@@
-12,4
+12,18
@@
__PACKAGE__->meta->make_manager_class;
__PACKAGE__->meta->initialize;
__PACKAGE__->meta->initialize;
+sub linetotal {
+ my ($self) = @_;
+
+ return 0 unless $self->qty > 0 and $self->part->sellprice > 0;
+ return $self->qty * $self->part->sellprice / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 );
+}
+
+sub linetotal_lastcost {
+ my ($self) = @_;
+
+ return 0 unless $self->qty > 0 and $self->part->lastcost > 0;
+ return $self->qty * $self->part->lastcost / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 );
+}
+
1;
1;