Revision 461b6311
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
bin/mozilla/io.pl | ||
---|---|---|
438 | 438 |
sub select_item { |
439 | 439 |
$main::lxdebug->enter_sub(); |
440 | 440 |
|
441 |
my %params = @_; |
|
442 |
|
|
443 |
my $form = $main::form; |
|
444 |
my %myconfig = %main::myconfig; |
|
445 |
my $locale = $main::locale; |
|
446 |
my $cgi = $main::cgi; |
|
447 |
|
|
448 |
my $mode = $params{mode} || croak "Missing parameter 'mode'"; |
|
449 |
my $is_purchase = $mode eq 'IS'; |
|
441 |
my %params = @_; |
|
442 |
my $mode = $params{mode} || croak "Missing parameter 'mode'"; |
|
450 | 443 |
|
451 | 444 |
_check_io_auth(); |
452 | 445 |
|
453 |
my @column_index = qw(ndx partnumber description rop onhand unit sellprice); |
|
454 |
my %column_data; |
|
455 |
$column_data{ndx} = qq|<th> </th>|; |
|
456 |
$column_data{partnumber} = |
|
457 |
qq|<th class="listheading">| . $locale->text('Number') . qq|</th>|; |
|
458 |
$column_data{description} = |
|
459 |
qq|<th class="listheading">| . $locale->text('Part Description') . qq|</th>|; |
|
460 |
$column_data{sellprice} = |
|
461 |
qq|<th class="listheading">| . $locale->text('Price') . qq|</th>|; |
|
462 |
if ($is_purchase){ |
|
463 |
$column_data{rop} = |
|
464 |
qq|<th class="listheading">| . $locale->text('ROP') . qq|</th>|; |
|
465 |
}# ende if $is_purchase -> Überschrift Mindestlagerbestand - ähnliche Prüfung weiter unten |
|
466 |
$column_data{onhand} = |
|
467 |
qq|<th class="listheading">| . $locale->text('Qty') . qq|</th>|; |
|
468 |
$column_data{unit} = |
|
469 |
qq|<th class="listheading">| . $locale->text('Unit') . qq|</th>|; |
|
470 |
# list items with radio button on a form |
|
471 |
$form->header; |
|
472 |
|
|
473 |
my $title = $locale->text('Select from one of the items below'); |
|
474 |
my $colspan = $#column_index + 1; |
|
475 |
|
|
476 |
print qq| |
|
477 |
<body> |
|
478 |
|
|
479 |
<form method="post" action="$form->{script}"> |
|
480 |
|
|
481 |
<table width="100%"> |
|
482 |
<tr> |
|
483 |
<th class="listtop" colspan="$colspan">$title</th> |
|
484 |
</tr> |
|
485 |
<tr height="5"></tr> |
|
486 |
<tr class="listheading">|; |
|
487 |
|
|
488 |
map { print "\n$column_data{$_}" } @column_index; |
|
489 |
|
|
490 |
print qq|</tr>|; |
|
491 |
|
|
492 |
my $i = 0; |
|
493 |
my $j; |
|
494 |
foreach my $ref (@{ $form->{item_list} }) { |
|
495 |
my $checked = ($i++) ? "" : "checked"; |
|
496 |
|
|
497 |
if ($::lx_office_conf{features}->{lizenzen}) { |
|
498 |
if ($ref->{inventory_accno} > 0) { |
|
499 |
$ref->{"lizenzen"} = qq|<option></option>|; |
|
500 |
foreach my $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) { |
|
501 |
$ref->{"lizenzen"} .= |
|
502 |
qq|<option value=\"$item->{"id"}\">$item->{"licensenumber"}</option>|; |
|
503 |
} |
|
504 |
$ref->{"lizenzen"} .= qq|<option value="-1">Neue Lizenz</option>|; |
|
505 |
$ref->{"lizenzen"} =~ s/\"/"/g; |
|
506 |
} |
|
507 |
} |
|
508 |
|
|
509 |
my $display_sellprice = $ref->{sellprice} * (1 - $form->{tradediscount}); |
|
510 |
$display_sellprice /= $ref->{price_factor} if ($ref->{price_factor}); |
|
511 |
$display_sellprice = $form->format_amount(\%myconfig, $display_sellprice, 2); |
|
512 |
my $new_id = $ref->{id}; |
|
513 |
|
|
514 |
map { $ref->{$_} = H($ref->{$_}) } qw(id partnumber description unit); |
|
446 |
$::form->{title} = $::locale->text('Select from one of the items below'); |
|
447 |
$::form->header; |
|
515 | 448 |
|
516 |
$column_data{ndx} = qq|<td><input name="select_item_id" class="radio" type="radio" value="${new_id}" $checked></td>|; |
|
517 |
$column_data{partnumber} = qq|<td>$ref->{partnumber}</td>|; |
|
518 |
$column_data{description} = qq|<td>$ref->{description}</td>|; |
|
519 |
$column_data{sellprice} = qq|<td align="right">${display_sellprice}</td>|; |
|
520 |
$column_data{onhand} = qq|<td align="right">| . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ") . qq|</td>|; |
|
521 |
$column_data{unit} = qq|<td>$ref->{unit}</td>|; |
|
522 |
|
|
523 |
if ($is_purchase){ |
|
524 |
$column_data{rop} = qq|<td align="right">| . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . qq|</td>|; |
|
525 |
}# ende if $is_purchase -> Falls der Aufruf über eine Einkaufsmaske kam, handelt es sich um einen Lieferantenauftrag und uns interessiert auch die Mindestbestandsmenge |
|
526 |
|
|
527 |
$j++; |
|
528 |
$j %= 2; |
|
529 |
print qq| |
|
530 |
<tr class=listrow$j>|; |
|
531 |
|
|
532 |
map { print "\n$column_data{$_}" } @column_index; |
|
533 |
|
|
534 |
print("</tr>\n"); |
|
535 |
} |
|
536 |
|
|
537 |
print qq| |
|
538 |
<tr><td colspan="8"><hr size="3" noshade></td></tr> |
|
539 |
</table> |
|
540 |
|; |
|
449 |
my @item_list = map { |
|
450 |
$_->{display_sellprice} = $_->{sellprice} * (1 - $::form->{tradediscount}); |
|
451 |
$_->{display_sellprice} /= $_->{price_factor} if ($_->{price_factor}); |
|
452 |
$_; |
|
453 |
} @{ $::form->{item_list} }; |
|
541 | 454 |
|
542 | 455 |
# delete action variable |
543 |
map { delete $form->{$_} } qw(action item_list header); |
|
544 |
|
|
545 |
my $previous_form = $::auth->save_form_in_session(form => $form); |
|
456 |
delete @{$::form}{qw(action item_list header)}; |
|
546 | 457 |
|
547 |
print qq| |
|
548 |
<input name="select_item_mode" type="hidden" value="$mode"> |
|
549 |
<input name="select_item_previous_form" type="hidden" value="${previous_form}"> |
|
550 |
<input type="hidden" name="nextsub" value="item_selected"> |
|
551 |
|
|
552 |
<br> |
|
553 |
<input class="submit" type="submit" name="action" value="| |
|
554 |
. $locale->text('Continue') . qq|"> |
|
555 |
</form> |
|
556 |
|
|
557 |
</body> |
|
558 |
</html> |
|
559 |
|; |
|
458 |
print $::form->parse_html_template('io/select_item', { PREVIOUS_FORM => $::auth->save_form_in_session(form => $::form), |
|
459 |
MODE => $mode, |
|
460 |
ITEM_LIST => \@item_list, |
|
461 |
IS_PURCHASE => $mode eq 'IS' }); |
|
560 | 462 |
|
561 | 463 |
$main::lxdebug->leave_sub(); |
562 | 464 |
} |
Auch abrufbar als: Unified diff
select_item() in io.pl auf Template umgestellt