Revision 82498fb7
Von Moritz Bunkus vor fast 16 Jahren hinzugefügt
SL/WH.pm | ||
---|---|---|
433 | 433 |
"chargeid" => "c.id", |
434 | 434 |
"warehousedescription" => "w.description", |
435 | 435 |
"partunit" => "p.unit", |
436 |
"stock_value" => "p.lastcost / COALESCE(pfac.factor, 1)", |
|
436 | 437 |
); |
437 | 438 |
my $select_clause = join ', ', map { +/^l_/; "$select_tokens{$'} AS $'" } |
438 | 439 |
( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), |
... | ... | |
442 | 443 |
( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), |
443 | 444 |
qw(l_parts_id l_partunit) ); |
444 | 445 |
|
446 |
my %join_tokens = ( |
|
447 |
"stock_value" => "LEFT JOIN price_factors pfac ON (p.price_factor_id = pfac.id)", |
|
448 |
); |
|
449 |
|
|
450 |
my $joins = join ' ', grep { $_ } map { +/^l_/; $join_tokens{"$'"} } |
|
451 |
( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), |
|
452 |
qw(l_parts_id l_qty l_partunit) ); |
|
453 |
|
|
445 | 454 |
my $query = |
446 | 455 |
qq|SELECT $select_clause |
447 | 456 |
$columns |
... | ... | |
449 | 458 |
LEFT JOIN parts p ON i.parts_id = p.id |
450 | 459 |
LEFT JOIN bin b ON i.bin_id = b.id |
451 | 460 |
LEFT JOIN warehouse w ON i.warehouse_id = w.id |
461 |
$joins |
|
452 | 462 |
WHERE $where_clause |
453 | 463 |
GROUP BY $group_clause $group_by |
454 | 464 |
ORDER BY $form->{sort}|; |
... | ... | |
477 | 487 |
@all_fields = keys %{ $ref } unless (@all_fields); |
478 | 488 |
} |
479 | 489 |
|
490 |
$ref->{stock_value} *= $ref->{qty}; |
|
491 |
|
|
480 | 492 |
push @contents, $ref; |
481 | 493 |
} |
482 | 494 |
|
bin/mozilla/wh.pl | ||
---|---|---|
625 | 625 |
my $sort_col = $form->{sort}; |
626 | 626 |
|
627 | 627 |
my %filter; |
628 |
my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber qty); |
|
628 |
my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber qty stock_value);
|
|
629 | 629 |
|
630 | 630 |
# filter stuff |
631 | 631 |
map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber); |
... | ... | |
655 | 655 |
'partdescription' => { 'text' => $locale->text('Description'), }, |
656 | 656 |
'chargenumber' => { 'text' => $locale->text('Charge Number'), }, |
657 | 657 |
'qty' => { 'text' => $locale->text('Qty'), }, |
658 |
'stock_value' => { 'text' => $locale->text('Stock value'), }, |
|
658 | 659 |
); |
659 | 660 |
|
660 | 661 |
my $href = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables); |
661 | 662 |
map { $column_defs{$_}->{link} = $href . "&sort=${_}&order=" . Q($_ eq $sort_col ? 1 - $form->{order} : $form->{order}) } @columns; |
662 | 663 |
|
663 |
my %column_alignment = map { $_ => 'right' } qw(qty); |
|
664 |
my %column_alignment = map { $_ => 'right' } qw(qty stock_value);
|
|
664 | 665 |
|
665 | 666 |
map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns; |
666 | 667 |
|
... | ... | |
679 | 680 |
my $all_units = AM->retrieve_units(\%myconfig, $form); |
680 | 681 |
my @contents = WH->get_warehouse_report(%filter); |
681 | 682 |
|
682 |
my $subtotal = 0; |
|
683 | 683 |
my $idx = 0; |
684 | 684 |
|
685 |
my @subtotals_columns = qw(qty stock_value); |
|
686 |
my %subtotals = map { $_ => 0 } @subtotals_columns; |
|
687 |
|
|
688 |
my $total_stock_value = 0; |
|
689 |
|
|
685 | 690 |
foreach $entry (@contents) { |
686 |
$subtotal += $entry->{qty}; |
|
687 |
$entry->{qty} = $form->format_amount_units('amount' => $entry->{qty}, |
|
688 |
'part_unit' => $entry->{partunit}, |
|
689 |
'conv_units' => 'convertible'); |
|
691 |
map { $subtotals{$_} += $entry->{$_} } @subtotals_columns; |
|
692 |
$total_stock_value += $entry->{stock_value} * 1; |
|
693 |
|
|
694 |
$entry->{qty} = $form->format_amount_units('amount' => $entry->{qty}, |
|
695 |
'part_unit' => $entry->{partunit}, |
|
696 |
'conv_units' => 'convertible'); |
|
697 |
$entry->{stock_value} = $form->format_amount(\%myconfig, $entry->{stock_value} * 1, 2); |
|
690 | 698 |
|
691 | 699 |
$row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ]; |
692 | 700 |
|
... | ... | |
695 | 703 |
|| ($entry->{$sort_col} ne $contents[$idx + 1]->{$sort_col}))) { |
696 | 704 |
|
697 | 705 |
my $row = { map { $_ => { 'data' => '', 'class' => 'listsubtotal', 'align' => $column_alignment{$_}, } } @columns }; |
698 |
$row->{qty}->{data} = $form->format_amount_units('amount' => $subtotal, |
|
699 |
'part_unit' => $entry->{partunit}, |
|
700 |
'conv_units' => 'convertible'); |
|
701 |
$subtotal = 0; |
|
706 |
$row->{qty}->{data} = $form->format_amount_units('amount' => $subtotals{qty} * 1, |
|
707 |
'part_unit' => $entry->{partunit}, |
|
708 |
'conv_units' => 'convertible'); |
|
709 |
$row->{stock_value}->{data} = $form->format_amount(\%myconfig, $subtotals{stock_value} * 1, 2); |
|
710 |
|
|
711 |
%subtotals = map { $_ => 0 } @subtotals_columns; |
|
702 | 712 |
|
703 | 713 |
push @{ $row_set }, $row; |
704 | 714 |
} |
... | ... | |
708 | 718 |
$idx++; |
709 | 719 |
} |
710 | 720 |
|
721 |
if ($column_defs{stock_value}->{visible}) { |
|
722 |
$report->add_separator(); |
|
723 |
|
|
724 |
my $row = { map { $_ => { 'data' => '', 'class' => 'listsubtotal', } } @columns }; |
|
725 |
|
|
726 |
my $left_col = first { $column_defs{$_}->{visible} } @columns; |
|
727 |
|
|
728 |
$row->{$left_col}->{data} = $locale->text('Total stock value'); |
|
729 |
$row->{stock_value}->{data} = $form->format_amount(\%myconfig, $total_stock_value, 2); |
|
730 |
$row->{stock_value}->{align} = 'right'; |
|
731 |
|
|
732 |
$report->add_data($row); |
|
733 |
} |
|
734 |
|
|
711 | 735 |
$report->generate_with_headers(); |
712 | 736 |
|
713 | 737 |
$lxdebug->leave_sub(); |
locale/de/all | ||
---|---|---|
1299 | 1299 |
'Step 3 of 3: Default units' => 'Schritt 3 von 3: Standardeinheiten', |
1300 | 1300 |
'Steuersatz' => 'Steuersatz', |
1301 | 1301 |
'Stock' => 'Einlagern', |
1302 |
'Stock value' => 'Bestandswert', |
|
1302 | 1303 |
'Storno' => 'Storno', |
1303 | 1304 |
'Storno (one letter abbreviation)' => 'S', |
1304 | 1305 |
'Storno Invoice' => 'Stornorechnung', |
... | ... | |
1498 | 1499 |
'Top Level' => 'Hauptartikelbezeichnung', |
1499 | 1500 |
'Total' => 'Summe', |
1500 | 1501 |
'Total Fees' => 'Kumulierte Geb?hren', |
1502 |
'Total stock value' => 'Gesamter Bestandswert', |
|
1501 | 1503 |
'Trade Discount' => 'Rabatt', |
1502 | 1504 |
'Trans Id' => 'Trans-ID', |
1503 | 1505 |
'Trans Type' => 'Transfertyp', |
locale/de/wh | ||
---|---|---|
124 | 124 |
'Select a part' => 'Artikel auswählen', |
125 | 125 |
'Select a vendor' => 'Einen Lieferanten auswählen', |
126 | 126 |
'Stock' => 'Einlagern', |
127 |
'Stock value' => 'Bestandswert', |
|
127 | 128 |
'Storno Invoice' => 'Stornorechnung', |
128 | 129 |
'Storno Packing List' => 'Stornolieferschein', |
129 | 130 |
'Subject' => 'Betreff', |
... | ... | |
147 | 148 |
'The warehouse or the bin is missing.' => 'Das Lager oder der Lagerplatz fehlen.', |
148 | 149 |
'There is not enough left of \'#1\' in bin \'#2\' for the removal of #3.' => 'In Lagerplatz \'#2\' ist nicht genug von \'#1\' vorhanden, um #3 zu entnehmen.', |
149 | 150 |
'To (email)' => 'An', |
151 |
'Total stock value' => 'Gesamter Bestandswert', |
|
150 | 152 |
'Trans Id' => 'Trans-ID', |
151 | 153 |
'Trans Type' => 'Transfertyp', |
152 | 154 |
'Transactions, AR transactions, AP transactions' => 'Dialogbuchen, Debitorenrechnungen, Kreditorenrechnungen', |
templates/webpages/wh/report_filter_de.html | ||
---|---|---|
157 | 157 |
<td align="right"><input name="include_empty_bins" id="include_empty_bins" class="checkbox" type="checkbox" value="Y"></td> |
158 | 158 |
<td nowrap><label for="include_empty_bins">Leere Lagerplätze anzeigen</label></td> |
159 | 159 |
</tr> |
160 |
|
|
161 |
<tr> |
|
162 |
<td align="right"><input name="l_stock_value" id="l_stock_value" class="checkbox" type="checkbox" value="Y"></td> |
|
163 |
<td nowrap><label for="l_stock_value">Bestandswert</label></td> |
|
164 |
</tr> |
|
165 |
|
|
160 | 166 |
</table> |
161 | 167 |
</td> |
162 | 168 |
</tr> |
templates/webpages/wh/report_filter_master.html | ||
---|---|---|
157 | 157 |
<td align="right"><input name="include_empty_bins" id="include_empty_bins" class="checkbox" type="checkbox" value="Y"></td> |
158 | 158 |
<td nowrap><label for="include_empty_bins"><translate>Include empty bins</translate></label></td> |
159 | 159 |
</tr> |
160 |
|
|
161 |
<tr> |
|
162 |
<td align="right"><input name="l_stock_value" id="l_stock_value" class="checkbox" type="checkbox" value="Y"></td> |
|
163 |
<td nowrap><label for="l_stock_value"><translate>Stock value</translate></label></td> |
|
164 |
</tr> |
|
165 |
|
|
160 | 166 |
</table> |
161 | 167 |
</td> |
162 | 168 |
</tr> |
Auch abrufbar als: Unified diff
Lagerbestandswert zum Lagerbericht ergänzt.