Revision 17409513
Von Moritz Bunkus vor etwa 15 Jahren hinzugefügt
SL/WH.pm | ||
---|---|---|
158 | 158 |
|
159 | 159 |
# Hier wird das prepared Statement für die Schleife über alle Lagerplätze vorbereitet |
160 | 160 |
my $transferPartSQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, comment, employee_id, qty, trans_id, trans_type_id) |
161 |
VALUES (?, ?, ?, ?, ?,(SELECT id FROM employee WHERE login = ?), ?, nextval('id'),
|
|
161 |
VALUES (?, ?, ?, ?, ?,(SELECT id FROM employee WHERE login = ?), ?, nextval('id'), |
|
162 | 162 |
(SELECT id FROM transfer_type WHERE direction = 'out' AND description = 'used'))|; |
163 | 163 |
my $sthTransferPartSQL = prepare_query($form, $dbh, $transferPartSQL); |
164 | 164 |
|
165 | 165 |
my $kannNichtFertigen =""; # der return-string für die fehlermeldung inkl. welche waren zum fertigen noch fehlen |
166 | 166 |
|
167 |
while (my $hash_ref = $sth_part_qty_assembly->fetchrow_hashref()) { # Schleife für $query=select parts_id,qty from assembly
|
|
167 |
while (my $hash_ref = $sth_part_qty_assembly->fetchrow_hashref()) { # Schleife für $query=select parts_id,qty from assembly |
|
168 | 168 |
|
169 | 169 |
my $partsQTY = $hash_ref->{qty} * $params{qty}; # benötigte teile * anzahl erzeugnisse |
170 | 170 |
my $currentPart_ID = $hash_ref->{parts_id}; |
... | ... | |
215 | 215 |
return $kannNichtFertigen; |
216 | 216 |
} |
217 | 217 |
|
218 |
# soweit alles gut. Jetzt noch die wirkliche Lagerbewegung für das Erzeugnis ausführen ...
|
|
218 |
# soweit alles gut. Jetzt noch die wirkliche Lagerbewegung für das Erzeugnis ausführen ... |
|
219 | 219 |
my $transferAssemblySQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, comment, employee_id, qty, trans_id, trans_type_id) |
220 |
VALUES (?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, nextval('id'),
|
|
220 |
VALUES (?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, nextval('id'), |
|
221 | 221 |
(SELECT id FROM transfer_type WHERE direction = 'in' AND description = 'stock'))|; |
222 | 222 |
my $sthTransferAssemblySQL = prepare_query($form, $dbh, $transferAssemblySQL); |
223 | 223 |
do_statement($form, $sthTransferAssemblySQL, $transferAssemblySQL, $params{assembly_id}, $params{dst_warehouse_id}, $params{dst_bin_id}, $params{chargenumber}, $params{comment}, $params{login}, $params{qty}); |
... | ... | |
328 | 328 |
"comment" => "i1.comment", |
329 | 329 |
"trans_type" => "tt.description", |
330 | 330 |
"trans_id" => "i1.trans_id", |
331 |
"oe_id" => "COALESCE(i1.oe_id, i2.oe_id)", |
|
331 | 332 |
"date" => "i1.itime::DATE", |
332 | 333 |
"itime" => "i1.itime", |
333 | 334 |
"employee" => "e.name", |
... | ... | |
407 | 408 |
|
408 | 409 |
my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars, @filter_vars, @filter_vars); |
409 | 410 |
|
411 |
my ($h_oe_id, $q_oe_id); |
|
412 |
if ($form->{l_oe_id}) { |
|
413 |
$q_oe_id = <<SQL; |
|
414 |
SELECT oe.id AS id, |
|
415 |
CASE WHEN oe.quotation THEN oe.quonumber ELSE oe.ordnumber END AS number, |
|
416 |
CASE |
|
417 |
WHEN oe.customer_id IS NOT NULL AND COALESCE(oe.quotation, FALSE) THEN 'sales_quotation' |
|
418 |
WHEN oe.customer_id IS NOT NULL AND NOT COALESCE(oe.quotation, FALSE) THEN 'sales_order' |
|
419 |
WHEN oe.customer_id IS NULL AND COALESCE(oe.quotation, FALSE) THEN 'request_quotation' |
|
420 |
ELSE 'purchase_order' |
|
421 |
END AS type |
|
422 |
FROM oe |
|
423 |
WHERE oe.id = ? |
|
424 |
|
|
425 |
UNION |
|
426 |
|
|
427 |
SELECT dord.id AS id, dord.donumber AS number, |
|
428 |
CASE |
|
429 |
WHEN dord.customer_id IS NULL THEN 'purchase_delivery_order' |
|
430 |
ELSE 'sales_delivery_order' |
|
431 |
END AS type |
|
432 |
FROM delivery_orders dord |
|
433 |
WHERE dord.id = ? |
|
434 |
|
|
435 |
UNION |
|
436 |
|
|
437 |
SELECT ar.id AS id, ar.invnumber AS number, 'sales_invoice' AS type |
|
438 |
FROM ar |
|
439 |
WHERE ar.id = ? |
|
440 |
|
|
441 |
UNION |
|
442 |
|
|
443 |
SELECT ap.id AS id, ap.invnumber AS number, 'purchase_invoice' AS type |
|
444 |
FROM ap |
|
445 |
WHERE ap.id = ? |
|
446 |
SQL |
|
447 |
$h_oe_id = prepare_query($form, $dbh, $q_oe_id); |
|
448 |
} |
|
449 |
|
|
410 | 450 |
my @contents = (); |
411 | 451 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
412 | 452 |
map { /^r_/; $ref->{"$'"} = $ref->{$_} } keys %$ref; |
... | ... | |
423 | 463 |
next if (('<=' eq $f_qty_op) && ($qty > $f_qty)); |
424 | 464 |
} |
425 | 465 |
|
466 |
if ($h_oe_id && $ref->{oe_id}) { |
|
467 |
do_statement($form, $h_oe_id, $q_oe_id, ($ref->{oe_id}) x 4); |
|
468 |
$ref->{oe_id_info} = $h_oe_id->fetchrow_hashref() || {}; |
|
469 |
} |
|
470 |
|
|
426 | 471 |
push @contents, $ref; |
427 | 472 |
} |
428 | 473 |
|
429 | 474 |
$sth->finish(); |
475 |
$h_oe_id->finish() if $h_oe_id; |
|
430 | 476 |
|
431 | 477 |
$main::lxdebug->leave_sub(); |
432 | 478 |
|
... | ... | |
732 | 778 |
my $self = shift; |
733 | 779 |
my %params = @_; |
734 | 780 |
|
735 |
Common::check_params(\%params, qw(parts_id warehouse_id)); #die brauchen wir
|
|
781 |
Common::check_params(\%params, qw(parts_id warehouse_id)); #die brauchen wir |
|
736 | 782 |
|
737 | 783 |
my $myconfig = \%main::myconfig; |
738 | 784 |
my $form = $main::form; |
... | ... | |
742 | 788 |
my $query = qq| SELECT SUM(qty), bin_id, chargenumber FROM inventory where parts_id = ? AND warehouse_id = ? GROUP BY bin_id, chargenumber|; |
743 | 789 |
|
744 | 790 |
my $sth_QTY = prepare_execute_query($form, $dbh, $query, ,$params{parts_id}, $params{warehouse_id}); #info: aufruf an DBUtils.pm |
745 |
|
|
791 |
|
|
746 | 792 |
my $max_qty_parts = 0; #Initialisierung mit 0 |
747 | 793 |
while (my $ref = $sth_QTY->fetchrow_hashref()) { # wir laufen über alle chargen und Lagerorte (s.a. SQL-Query oben) |
748 |
$max_qty_parts += $ref->{sum};
|
|
794 |
$max_qty_parts += $ref->{sum}; |
|
749 | 795 |
} |
750 | 796 |
|
751 | 797 |
$main::lxdebug->leave_sub(); |
... | ... | |
763 | 809 |
my $self = shift; |
764 | 810 |
my %params = @_; |
765 | 811 |
|
766 |
Common::check_params(\%params, qw(parts_id )); #die brauchen wir
|
|
812 |
Common::check_params(\%params, qw(parts_id )); #die brauchen wir |
|
767 | 813 |
|
768 | 814 |
my $myconfig = \%main::myconfig; |
769 | 815 |
my $form = $main::form; |
... | ... | |
773 | 819 |
my $query = qq| SELECT partnumber, description FROM parts where id = ? |; |
774 | 820 |
|
775 | 821 |
my $sth = prepare_execute_query($form, $dbh, $query, ,$params{parts_id}); #info: aufruf zu DBUtils.pm |
776 |
|
|
777 |
my $ref = $sth->fetchrow_hashref();
|
|
778 |
my $part_description = $ref->{partnumber} . " " . $ref->{description};
|
|
822 |
|
|
823 |
my $ref = $sth->fetchrow_hashref(); |
|
824 |
my $part_description = $ref->{partnumber} . " " . $ref->{description}; |
|
779 | 825 |
|
780 | 826 |
$main::lxdebug->leave_sub(); |
781 | 827 |
|
bin/mozilla/wh.pl | ||
---|---|---|
600 | 600 |
$form->{sort} ||= 'date'; |
601 | 601 |
|
602 | 602 |
my %filter; |
603 |
my @columns = qw(trans_id date warehouse_from bin_from warehouse_to bin_to partnumber partdescription chargenumber trans_type comment qty employee projectnumber); |
|
603 |
my @columns = qw(trans_id date warehouse_from bin_from warehouse_to bin_to partnumber partdescription chargenumber trans_type comment qty employee oe_id projectnumber);
|
|
604 | 604 |
|
605 | 605 |
# filter stuff |
606 | 606 |
map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber); |
... | ... | |
635 | 635 |
'qty' => { 'text' => $locale->text('Qty'), }, |
636 | 636 |
'employee' => { 'text' => $locale->text('Employee'), }, |
637 | 637 |
'projectnumber' => { 'text' => $locale->text('Project Number'), }, |
638 |
'oe_id' => { 'text' => $locale->text('Document'), }, |
|
638 | 639 |
); |
639 | 640 |
|
640 | 641 |
my $href = build_std_url('action=generate_journal', grep { $form->{$_} } @hidden_variables); |
... | ... | |
659 | 660 |
my $all_units = AM->retrieve_units(\%myconfig, $form); |
660 | 661 |
my @contents = WH->get_warehouse_journal(%filter); |
661 | 662 |
|
663 |
my %doc_types = ( 'sales_quotation' => { script => 'oe', title => $locale->text('Sales quotation') }, |
|
664 |
'sales_order' => { script => 'oe', title => $locale->text('Sales Order') }, |
|
665 |
'request_quotation' => { script => 'oe', title => $locale->text('Request quotation') }, |
|
666 |
'purchase_order' => { script => 'oe', title => $locale->text('Purchase Order') }, |
|
667 |
'sales_delivery_order' => { script => 'do', title => $locale->text('Sales delivery order') }, |
|
668 |
'purchase_delivery_order' => { script => 'do', title => $locale->text('Purchase delivery order') }, |
|
669 |
'sales_invoice' => { script => 'is', title => $locale->text('Sales Invoice') }, |
|
670 |
'purchase_invoice' => { script => 'ir', title => $locale->text('Purchase Invoice') }, |
|
671 |
); |
|
672 |
|
|
662 | 673 |
foreach $entry (@contents) { |
663 | 674 |
$entry->{qty} = $form->format_amount_units('amount' => $entry->{qty}, |
664 | 675 |
'part_unit' => $entry->{partunit}, |
... | ... | |
681 | 692 |
'align' => $column_alignment{trans_type}, |
682 | 693 |
}; |
683 | 694 |
|
695 |
if ($form->{l_oe_id}) { |
|
696 |
$row->{oe_id}->{data} = ''; |
|
697 |
my $info = $entry->{oe_id_info}; |
|
698 |
|
|
699 |
if ($info && $info->{id} && $info->{type} && $doc_types{$info->{type}}) { |
|
700 |
$row->{oe_id} = { data => $doc_types{ $info->{type} }->{title} . ' ' . $info->{number}, |
|
701 |
link => build_std_url('script=' . $doc_types{ $info->{type} }->{script} . '.pl', 'action=edit', 'id=' . $info->{id}, 'type=' . $info->{type}) }; |
|
702 |
} |
|
703 |
} |
|
704 |
|
|
684 | 705 |
$report->add_data($row); |
685 | 706 |
} |
686 | 707 |
|
locale/de/all | ||
---|---|---|
536 | 536 |
'Do you want to <b>limit</b> your search?' => 'Wollen Sie Ihre Suche <b>spezialisieren</b>?', |
537 | 537 |
'Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?' => 'Wollen Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?', |
538 | 538 |
'Do you want to store the existing onhand values into a new warehouse?' => 'Möchten Sie die vorhandenen Mengendaten in ein Lager übertragen?', |
539 |
'Document' => 'Dokument', |
|
539 | 540 |
'Documents in the WebDAV repository' => 'Dokumente im WebDAV-Repository', |
540 | 541 |
'Done' => 'Fertig', |
541 | 542 |
'Download the backup' => 'Die Sicherungsdatei herunterladen', |
... | ... | |
1206 | 1207 |
'Projects' => 'Projekte', |
1207 | 1208 |
'Projecttransactions' => 'Projektbuchungen', |
1208 | 1209 |
'Prozentual/Absolut' => 'Prozentual/Absolut', |
1210 |
'Purchase Invoice' => 'Einkaufsrechnung', |
|
1209 | 1211 |
'Purchase Order' => 'Lieferantenauftrag', |
1210 | 1212 |
'Purchase Orders' => 'Lieferantenauftr?ge', |
1211 | 1213 |
'Purchase Price' => 'Einkaufspreis', |
1212 | 1214 |
'Purchase Prices' => 'Einkaufspreise', |
1215 |
'Purchase delivery order' => 'Lieferschein (Einkauf)', |
|
1213 | 1216 |
'Purchase invoices' => 'Einkaufsrechnungen', |
1214 | 1217 |
'Qty' => 'Menge', |
1215 | 1218 |
'Qty according to delivery order' => 'Menge laut Lieferschein', |
... | ... | |
1291 | 1294 |
'Sales Order' => 'Kundenauftrag', |
1292 | 1295 |
'Sales Orders' => 'Auftr?ge', |
1293 | 1296 |
'Sales and purchase invoices with inventory transactions with taxkeys' => 'Einkaufs- und Verkaufsrechnungen mit Warenbestandsbuchungen mit Steuerschl?sseln', |
1297 |
'Sales delivery order' => 'Lieferschein (Verkauf)', |
|
1294 | 1298 |
'Sales invoice number' => 'Ausgangsrechnungsnummer', |
1295 | 1299 |
'Sales invoices' => 'Verkaufsrechnungen', |
1296 | 1300 |
'Sales quotation' => 'Angebot', |
locale/de/wh | ||
---|---|---|
68 | 68 |
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:', |
69 | 69 |
'Description' => 'Beschreibung', |
70 | 70 |
'Directory' => 'Verzeichnis', |
71 |
'Document' => 'Dokument', |
|
71 | 72 |
'Dunning' => 'Mahnung', |
72 | 73 |
'ELSE' => 'Zusatz', |
73 | 74 |
'Employee' => 'Bearbeiter', |
... | ... | |
120 | 121 |
'Produce Assembly' => 'Erzeugnis fertigen', |
121 | 122 |
'Proforma Invoice' => 'Proformarechnung', |
122 | 123 |
'Project Number' => 'Projektnummer', |
124 |
'Purchase Invoice' => 'Einkaufsrechnung', |
|
123 | 125 |
'Purchase Order' => 'Lieferantenauftrag', |
126 |
'Purchase delivery order' => 'Lieferschein (Einkauf)', |
|
124 | 127 |
'Qty' => 'Menge', |
125 | 128 |
'Quantity missing.' => 'Die Mengenangabe fehlt.', |
126 | 129 |
'Quotation' => 'Angebot', |
... | ... | |
136 | 139 |
'SCREENED' => 'Angezeigt', |
137 | 140 |
'Sales Invoice' => 'Rechnung', |
138 | 141 |
'Sales Order' => 'Kundenauftrag', |
142 |
'Sales delivery order' => 'Lieferschein (Verkauf)', |
|
139 | 143 |
'Sales quotation' => 'Angebot', |
140 | 144 |
'Select a Customer' => 'Endkunde ausw?hlen', |
141 | 145 |
'Select a customer' => 'Einen Kunden auswählen', |
templates/webpages/wh/journal_filter_de.html | ||
---|---|---|
181 | 181 |
<tr> |
182 | 182 |
<td align="right"><input name="l_employee" id="l_employee" class="checkbox" type="checkbox" value="Y"></td> |
183 | 183 |
<td nowrap><label for="l_employee">Bearbeiter</label></td> |
184 |
<td align="right"><input name="l_oe_id" id="l_oe_id" class="checkbox" type="checkbox" value="Y"></td> |
|
185 |
<td nowrap><label for="l_oe_id">Dokument</label></td> |
|
184 | 186 |
<td align="right"><input name="l_projectnumber" id="l_projectnumber" class="checkbox" type="checkbox" value="Y" checked></td> |
185 | 187 |
<td nowrap><label for="l_projectnumber">Projektnummer</label></td> |
186 | 188 |
</tr> |
templates/webpages/wh/journal_filter_master.html | ||
---|---|---|
181 | 181 |
<tr> |
182 | 182 |
<td align="right"><input name="l_employee" id="l_employee" class="checkbox" type="checkbox" value="Y"></td> |
183 | 183 |
<td nowrap><label for="l_employee"><translate>Employee</translate></label></td> |
184 |
<td align="right"><input name="l_oe_id" id="l_oe_id" class="checkbox" type="checkbox" value="Y"></td> |
|
185 |
<td nowrap><label for="l_oe_id"><translate>Document</translate></label></td> |
|
184 | 186 |
<td align="right"><input name="l_projectnumber" id="l_projectnumber" class="checkbox" type="checkbox" value="Y" checked></td> |
185 | 187 |
<td nowrap><label for="l_projectnumber"><translate>Project Number</translate></label></td> |
186 | 188 |
</tr> |
Auch abrufbar als: Unified diff
Anzeige einer Spalte "Dokument" im Lagerbewegungsbericht mit Verlinkung auf den Beleg, von dem aus Waren ein-/ausgelagert wurden.
Ist nur mit Lieferscheinen getestet, weil bisher nur von
Lieferscheinen aus direkt ein-/ausgelagert werden kann, aber der
Mechanismus ist bereits für alle Verkaufs- und Einkaufsbelege
implementiert.
Fix für Bug 1058.