Revision 667cfdce
Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
91 | 91 |
$main::lxdebug->leave_sub(); |
92 | 92 |
} |
93 | 93 |
|
94 |
sub retrieve_assemblies { |
|
95 |
$main::lxdebug->enter_sub(); |
|
96 |
|
|
97 |
my ($self, $myconfig, $form) = @_; |
|
98 |
|
|
99 |
# connect to database |
|
100 |
my $dbh = $form->get_standard_dbh; |
|
101 |
|
|
102 |
my $where = qq|NOT p.obsolete|; |
|
103 |
my @values; |
|
104 |
|
|
105 |
if ($form->{partnumber}) { |
|
106 |
$where .= qq| AND (p.partnumber ILIKE ?)|; |
|
107 |
push(@values, like($form->{partnumber})); |
|
108 |
} |
|
109 |
|
|
110 |
if ($form->{description}) { |
|
111 |
$where .= qq| AND (p.description ILIKE ?)|; |
|
112 |
push(@values, like($form->{description})); |
|
113 |
} |
|
114 |
|
|
115 |
# retrieve assembly items |
|
116 |
my $query = |
|
117 |
qq|SELECT p.id, p.partnumber, p.description, |
|
118 |
p.onhand, p.rop, |
|
119 |
(SELECT sum(p2.inventory_accno_id) |
|
120 |
FROM parts p2, assembly a |
|
121 |
WHERE (p2.id = a.parts_id) AND (a.id = p.id)) AS inventory |
|
122 |
FROM parts p |
|
123 |
WHERE NOT p.obsolete AND p.part_type = 'assembly' $where|; |
|
124 |
|
|
125 |
$form->{assembly_items} = selectall_hashref_query($form, $dbh, $query, @values); |
|
126 |
|
|
127 |
$main::lxdebug->leave_sub(); |
|
128 |
} |
|
129 |
|
|
130 | 94 |
sub assembly_item { |
131 | 95 |
$main::lxdebug->enter_sub(); |
132 | 96 |
|
Auch abrufbar als: Unified diff
Ungenutzte Funktion retrieve_assemblies in IC.pm entfernt