Revision 6d808fff
Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt
SL/WH.pm | ||
---|---|---|
410 | 410 |
"trans_type" => "tt.description", |
411 | 411 |
"trans_id" => "i1.trans_id", |
412 | 412 |
"oe_id" => "COALESCE(i1.oe_id, i2.oe_id)", |
413 |
"invoice_id" => "COALESCE(i1.invoice_id, i2.invoice_id)", |
|
413 | 414 |
"date" => "i1.itime::DATE", |
414 | 415 |
"itime" => "i1.itime", |
415 | 416 |
"employee" => "e.name", |
... | ... | |
426 | 427 |
"warehouse_from" => "'$filter{na}'", |
427 | 428 |
}; |
428 | 429 |
|
430 |
$form->{l_invoice_id} = $form->{l_oe_id} if $form->{l_oe_id}; |
|
431 |
|
|
429 | 432 |
# build the select clauses. |
430 | 433 |
# take all the requested ones from the first hash and overwrite them from the out/in hashes if present. |
431 | 434 |
for my $i ('trans', 'out', 'in') { |
... | ... | |
525 | 528 |
SELECT ap.id AS id, ap.invnumber AS number, 'purchase_invoice' AS type |
526 | 529 |
FROM ap |
527 | 530 |
WHERE ap.id = ? |
531 |
|
|
532 |
UNION |
|
533 |
|
|
534 |
SELECT ar.id AS id, ar.invnumber AS number, 'sales_invoice' AS type |
|
535 |
FROM ar |
|
536 |
WHERE ar.id = (SELECT trans_id FROM invoice WHERE id = ?) |
|
537 |
|
|
538 |
UNION |
|
539 |
|
|
540 |
SELECT ap.id AS id, ap.invnumber AS number, 'purchase_invoice' AS type |
|
541 |
FROM ap |
|
542 |
WHERE ap.id = (SELECT trans_id FROM invoice WHERE id = ?) |
|
528 | 543 |
SQL |
529 | 544 |
$h_oe_id = prepare_query($form, $dbh, $q_oe_id); |
530 | 545 |
} |
... | ... | |
545 | 560 |
next if (('<=' eq $f_qty_op) && ($qty > $f_qty)); |
546 | 561 |
} |
547 | 562 |
|
548 |
if ($h_oe_id && $ref->{oe_id}) { |
|
549 |
do_statement($form, $h_oe_id, $q_oe_id, ($ref->{oe_id}) x 4); |
|
563 |
if ($h_oe_id && ($ref->{oe_id} || $ref->{invoice_id})) { |
|
564 |
my $id = $ref->{oe_id} ? $ref->{oe_id} : $ref->{invoice_id}; |
|
565 |
do_statement($form, $h_oe_id, $q_oe_id, ($id) x 6); |
|
550 | 566 |
$ref->{oe_id_info} = $h_oe_id->fetchrow_hashref() || {}; |
551 | 567 |
} |
552 | 568 |
|
Auch abrufbar als: Unified diff
Auslagern in VK-Rechnung: Anzeige der Rechnungsnummer/Dokument im Lager-Journal