Revision 693c0013
Von Jan Büren vor mehr als 3 Jahren hinzugefügt
SL/Helper/ShippedQty.pm | ||
---|---|---|
38 | 38 |
WHERE oi.trans_id IN (%s) |
39 | 39 |
ORDER BY oi.trans_id, oi.position |
40 | 40 |
|
41 |
my $stock_fill_up_doi_query = <<''; |
|
42 |
SELECT doi.id, doi.delivery_order_id, doi.position, doi.parts_id, doi.description, doi.reqdate, doi.serialnumber, |
|
43 |
(CASE WHEN doe.customer_id > 0 THEN -1 ELSE 1 END) * i.qty, p.unit |
|
44 |
FROM delivery_order_items doi |
|
45 |
INNER JOIN parts p ON p.id = doi.parts_id |
|
46 |
INNER JOIN delivery_order_items_stock dois ON dois.delivery_order_item_id = doi.id |
|
47 |
INNER JOIN delivery_orders doe ON doe.id = doi.delivery_order_id |
|
48 |
INNER JOIN inventory i ON dois.id = i.delivery_order_items_stock_id |
|
49 |
WHERE doi.delivery_order_id IN ( |
|
50 |
SELECT to_id |
|
51 |
FROM record_links |
|
52 |
WHERE from_id IN (%s) |
|
53 |
AND from_table = 'oe' |
|
54 |
AND to_table = 'delivery_orders' |
|
55 |
AND to_id = doi.delivery_order_id) |
|
56 |
AND NOT EXISTS ( |
|
57 |
SELECT NULL |
|
58 |
FROM record_links |
|
59 |
WHERE from_table = 'orderitems' |
|
60 |
AND to_table = 'delivery_order_items' |
|
61 |
AND to_id = doi.id) |
|
62 |
|
|
63 | 41 |
sub calculate { |
64 | 42 |
my ($self, $data) = @_; |
65 | 43 |
|
Auch abrufbar als: Unified diff
S/H/ShippedQty vergessener toter Code