1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger, Accounting
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
30 # Inventory Control module
32 #======================================================================
34 use POSIX qw(strftime);
35 use List::Util qw(max);
39 use SL::ReportGenerator;
47 our ($form, $locale, %myconfig, $lxdebug);
49 require "bin/mozilla/io.pl";
50 require "bin/mozilla/invoice_io.pl";
51 require "bin/mozilla/common.pl";
52 require "bin/mozilla/reportgenerator.pl";
57 # type=submit $locale->text('Add Part')
58 # type=submit $locale->text('Add Service')
59 # type=submit $locale->text('Add Assembly')
60 # type=submit $locale->text('Edit Part')
61 # type=submit $locale->text('Edit Service')
62 # type=submit $locale->text('Edit Assembly')
63 # $locale->text('Parts')
64 # $locale->text('Services')
65 # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
66 # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
67 # $locale->text('Part Number missing!')
68 # $locale->text('Service Number missing!')
69 # $locale->text('Assembly Number missing!')
70 # $locale->text('ea');
75 $lxdebug->enter_sub();
77 $auth->assert('part_service_assembly_edit');
79 $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
80 $form->{callback} = "$form->{script}?action=add&item=$form->{item}" unless $form->{callback};
81 $form->{unit_changeable} = 1;
83 IC->get_pricegroups(\%myconfig, \%$form);
87 $lxdebug->leave_sub();
91 $lxdebug->enter_sub();
93 $auth->assert('part_service_assembly_edit');
95 $form->{revers} = 0; # switch for backward sorting
96 $form->{lastsort} = ""; # memory for which table was sort at last time
97 $form->{ndxs_counter} = 0; # counter for added entries to top100
99 my %is_xyz = map { +"is_$_" => ($form->{searchitems} eq $_) } qw(part service assembly);
101 $form->{title} = (ucfirst $form->{searchitems}) . "s";
102 $form->{title} = $locale->text($form->{title});
103 $form->{title} = $locale->text('Assemblies') if ($is_xyz{is_assembly});
105 $form->{jsscript} = 1;
109 print $form->parse_html_template('ic/search', { %is_xyz,
110 dateformat => $myconfig{dateformat}, });
112 $lxdebug->leave_sub();
115 sub search_update_prices {
116 $lxdebug->enter_sub();
118 $auth->assert('part_service_assembly_edit');
120 my $pricegroups = IC->get_pricegroups(\%myconfig, \%$form);
124 print $form->parse_html_template('ic/search_update_prices', { PRICE_ROWS => $pricegroups });
126 $lxdebug->leave_sub();
129 sub confirm_price_update {
130 $lxdebug->enter_sub();
132 $auth->assert('part_service_assembly_edit');
135 my $value_found = false;
137 foreach my $idx (qw(sellprice listprice), (1..$form->{price_rows})) {
138 my $name = $idx =~ m/\d/ ? $form->{"pricegroup_${idx}"} : $idx eq 'sellprice' ? $locale->text('Sell Price') : $locale->text('List Price');
139 my $type = $idx =~ m/\d/ ? $form->{"pricegroup_type_${idx}"} : $form->{"${idx}_type"};
140 my $value_idx = $idx =~ m/\d/ ? "price_${idx}" : $idx;
141 my $value = $form->parse_amount(\%myconfig, $form->{$value_idx});
143 if ((0 > $value) && ($type eq 'percent')) {
144 push @errors, $locale->text('You cannot adjust the price for pricegroup "#1" by a negative percentage.', $name);
146 } elsif (!$value && ($form->{$value_idx} ne '')) {
147 push @errors, $locale->text('No valid number entered for pricegroup "#1".', $name);
149 } elsif (0 < $value) {
154 push @errors, $locale->text('No prices will be updated because no prices have been entered.') if (!$value_found);
156 my $num_matches = IC->get_num_matches_for_priceupdate();
161 $form->show_generic_error(join('<br>', @errors), 'back_button' => 1);
164 $form->{nextsub} = "update_prices";
166 map { delete $form->{$_} } qw(action header);
168 print $form->parse_html_template('ic/confirm_price_update', { HIDDENS => [ map { name => $_, value => $form->{$_} }, keys %$form ],
169 num_matches => $num_matches });
171 $lxdebug->leave_sub();
175 $lxdebug->enter_sub();
177 $auth->assert('part_service_assembly_edit');
179 my $num_updated = IC->update_prices(\%myconfig, \%$form);
181 if (-1 != $num_updated) {
182 $form->redirect($locale->text('#1 prices were updated.', $num_updated));
184 $form->error($locale->text('Could not update prices!'));
187 $lxdebug->leave_sub();
191 # $lxdebug->enter_sub();
193 # $auth->assert('part_service_assembly_edit');
195 # our ($j, $lastndx);
198 # $form->{title} = $locale->text('Top 100 hinzufuegen');
202 # push @custom_hiddens, qw(searchitems title bom titel revers lastsort sort ndxs_counter extras);
203 # push @custom_hiddens, qw(itemstatus l_linetotal l_partnumber l_description l_onhand l_unit l_sellprice l_linetotalsellprice);
205 # +{ name => 'row', value => $j },
206 # +{ name => 'nextsub', value => 'item_selected' },
207 # +{ name => 'test', value => 'item_selected' },
208 # +{ name => 'lastndx', value => $lastndx },
209 # map(+{ name => $_, value => $form->{$_} }, @custom_hiddens),
212 # my ($partnumber, $description, $unit, $sellprice, $soldtotal);
213 # # if choice set data
214 ## if ($form->{ndx}) {
215 ## for my $i (0 .. $form->{ndxs_counter}) {
217 ## # insert data into top100
218 ## push @{ $form->{parts} },
220 ## partnumber => $form->{"totop100_partnumber_$j"},
221 ## description => $form->{"totop100_description_$j"},
222 ## unit => $form->{"totop100_unit_$j"},
223 ## sellprice => $form->{"totop100_sellprice_$j"},
224 ## soldtotal => $form->{"totop100_soldtotal_$j"},
231 # # set data for next page
232 # for my $i (1 .. $form->{ndxs_counter}) {
233 # $partnumber = $form->{"totop100_partnumber_$i"};
234 # $description = $form->{"totop100_description_$i"};
235 # $unit = $form->{"totop100_unit_$i"};
236 # $sellprice = $form->{"totop100_sellprice_$i"};
237 # $soldtotal = $form->{"totop100_soldtotal_$i"};
240 # totop100_partnumber => $form->{"totop100_partnumber_$i"},
241 # totop100_description => $form->{"totop100_description_$i"},
242 # totop100_unit => $form->{"totop100_unit_$i"},
243 # totop100_sellprice => $form->{"totop100_sellprice_$i"},
244 # totop100_soldtotal => $form->{"totop100_soldtotal_$i"},
248 ##<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
249 ##<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
250 ##<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
251 ##<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
252 ##<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
256 # print $form->parse_html_template('ic/choice', +{ HIDDENS => \@HIDDENS, PARTS => \@PARTS });
258 # $lxdebug->leave_sub();
262 # $lxdebug->enter_sub();
264 # $auth->assert('part_service_assembly_edit');
267 # our ($partnumber, $description, $unit, $sellprice, $soldtotal);
269 # my @sortorders = ("", "partnumber", "description", "all");
270 # my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)];
271 # IC->get_parts(\%myconfig, \%$form, $sortorder);
273 # $form->{title} = $locale->text('Top 100 hinzufuegen');
279 # <form method=post action=ic.pl>
282 # <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
284 # <tr height="5"></tr>
285 # <tr class=listheading>
287 # <th class=listheading>| . $locale->text('Part Number') . qq|</th>
288 # <th class=listheading>| . $locale->text('Part Description') . qq|</th>
289 # <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
290 # <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
291 # <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
295 # my $i = $form->{rows};
297 # for ($j = 1; $j <= $i; $j++) {
300 # <tr class=listrow| . ($j % 2) . qq|>|;
303 # <td><input name=ndx class=radio type=radio value=$j checked></td>|;
306 # <td><input name=ndx class=radio type=radio value=$j></td>|;
309 # <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
310 # <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
311 # <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
312 # <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
313 # <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
316 # <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
326 #<input type=hidden name=itemstatus value="$form->{itemstatus}">
327 #<input type=hidden name=l_linetotal value="$form->{l_linetotal}">
328 #<input type=hidden name=l_partnumber value="$form->{l_partnumber}">
329 #<input type=hidden name=l_description value="$form->{l_description}">
330 #<input type=hidden name=l_onhand value="$form->{l_onhand}">
331 #<input type=hidden name=l_unit value="$form->{l_unit}">
332 #<input type=hidden name=l_sellprice value="$form->{l_sellprice}">
333 #<input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
334 #<input type=hidden name=sort value="$form->{sort}">
335 #<input type=hidden name=revers value="$form->{revers}">
336 #<input type=hidden name=lastsort value="$form->{lastsort}">
338 #<input type=hidden name=bom value="$form->{bom}">
339 #<input type=hidden name=titel value="$form->{titel}">
340 #<input type=hidden name=searchitems value="$form->{searchitems}">
342 #<input type=hidden name=row value=$j>
344 #<input type=hidden name=nextsub value=item_selected>
346 #<input name=lastndx type=hidden value=$lastndx>
348 #<input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
352 # if (($form->{ndxs_counter}) > 0) {
353 # for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
355 # $partnumber = $form->{"totop100_partnumber_$i"};
356 # $description = $form->{"totop100_description_$i"};
357 # $unit = $form->{"totop100_unit_$i"};
358 # $sellprice = $form->{"totop100_sellprice_$i"};
359 # $soldtotal = $form->{"totop100_soldtotal_$i"};
362 #<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
363 #<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
364 #<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
365 #<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
366 #<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
374 #<input class=submit type=submit name=action value="|
375 # . $locale->text('TOP100') . qq|">
381 # $lxdebug->leave_sub();
385 $lxdebug->enter_sub();
387 $auth->assert('part_service_assembly_edit');
390 $form->{ndxs_counter}++;
392 if ($form->{ndxs_counter} > 0) {
394 my $index = $form->{ndx};
396 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $form->{"new_partnumber_$index"};
397 $form->{"totop100_description_$form->{ndxs_counter}"} = $form->{"new_description_$index"};
398 $form->{"totop100_unit_$form->{ndxs_counter}"} = $form->{"new_unit_$index"};
399 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $form->{"new_sellprice_$index"};
400 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $form->{"new_soldtotal_$index"};
404 $lxdebug->leave_sub();
408 $lxdebug->enter_sub();
410 $auth->assert('part_service_assembly_edit');
412 my ($revers, $lastsort, $callback, $option, $description, $sameitem,
413 $partnumber, $unit, $sellprice, $soldtotal, $totop100, $onhand, $align);
414 my (@column_index, %column_header, %column_data);
415 my ($totalsellprice, $totallastcost, $totallistprice, $subtotalonhand, $subtotalsellprice, $subtotallastcost, $subtotallistprice);
417 $form->{top100} = "top100";
418 $form->{l_soldtotal} = "Y";
419 $form->{soldtotal} = "soldtotal";
420 $form->{sort} = "soldtotal";
421 $form->{l_qty} = "N";
422 $form->{l_linetotal} = "";
424 $form->{number} = "position";
425 $form->{l_number} = "Y";
429 $form->{title} = $locale->text('Top 100');
431 $revers = $form->{revers};
432 $lastsort = $form->{lastsort};
434 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
436 $form->{lastsort} = "partnumber";
437 $form->{sort} = "partnumber";
441 "$form->{script}?action=top100&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
442 . $form->escape($form->{title}, 1);
444 # if we have a serialnumber limit search
445 if ($form->{serialnumber} || $form->{l_serialnumber}) {
446 $form->{l_serialnumber} = "Y";
447 unless ( $form->{bought}
450 || $form->{quoted}) {
451 $form->{bought} = $form->{sold} = 1;
454 IC->all_parts(\%myconfig, \%$form);
456 if ($form->{itemstatus} eq 'active') {
457 $option .= $locale->text('Active') . " : ";
459 if ($form->{itemstatus} eq 'obsolete') {
460 $option .= $locale->text('Obsolete') . " : ";
462 if ($form->{itemstatus} eq 'orphaned') {
463 $option .= $locale->text('Orphaned') . " : ";
465 if ($form->{itemstatus} eq 'onhand') {
466 $option .= $locale->text('On Hand') . " : ";
467 $form->{l_onhand} = "Y";
469 if ($form->{itemstatus} eq 'short') {
470 $option .= $locale->text('Short') . " : ";
471 $form->{l_onhand} = "Y";
473 if ($form->{onorder}) {
474 $form->{l_ordnumber} = "Y";
475 $callback .= "&onorder=$form->{onorder}";
476 $option .= $locale->text('On Order') . " : ";
478 if ($form->{ordered}) {
479 $form->{l_ordnumber} = "Y";
480 $callback .= "&ordered=$form->{ordered}";
481 $option .= $locale->text('Ordered') . " : ";
484 $form->{l_quonumber} = "Y";
485 $callback .= "&rfq=$form->{rfq}";
486 $option .= $locale->text('RFQ') . " : ";
488 if ($form->{quoted}) {
489 $form->{l_quonumber} = "Y";
490 $callback .= ""ed=$form->{quoted}";
491 $option .= $locale->text('Quoted') . " : ";
493 if ($form->{bought}) {
494 $form->{l_invnumber} = "Y";
495 $callback .= "&bought=$form->{bought}";
496 $option .= $locale->text('Bought') . " : ";
499 $form->{l_invnumber} = "Y";
500 $callback .= "&sold=$form->{sold}";
501 $option .= $locale->text('Sold') . " : ";
508 || $form->{quoted}) {
510 $form->{l_lastcost} = "";
511 $form->{l_name} = "Y";
512 if ($form->{transdatefrom}) {
513 $callback .= "&transdatefrom=$form->{transdatefrom}";
515 . $locale->text('From')
517 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
519 if ($form->{transdateto}) {
520 $callback .= "&transdateto=$form->{transdateto}";
522 . $locale->text('To')
524 . $locale->date(\%myconfig, $form->{transdateto}, 1);
530 if ($form->{partnumber}) {
531 $callback .= "&partnumber=$form->{partnumber}";
532 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
535 $callback .= "&partnumber=$form->{ean}";
536 $option .= $locale->text('EAN') . qq| : $form->{ean}<br>|;
538 if ($form->{partsgroup}) {
539 $callback .= "&partsgroup=$form->{partsgroup}";
540 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
542 if ($form->{serialnumber}) {
543 $callback .= "&serialnumber=$form->{serialnumber}";
544 $option .= $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
546 if ($form->{description}) {
547 $callback .= "&description=$form->{description}";
548 $description = $form->{description};
549 $description =~ s/\n/<br>/g;
550 $option .= $locale->text('Part Description') . qq| : $form->{description}<br>|;
553 $callback .= "&make=$form->{make}";
554 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
556 if ($form->{model}) {
557 $callback .= "&model=$form->{model}";
558 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
560 if ($form->{drawing}) {
561 $callback .= "&drawing=$form->{drawing}";
562 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
564 if ($form->{microfiche}) {
565 $callback .= "µfiche=$form->{microfiche}";
566 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
568 if ($form->{l_soldtotal}) {
569 $callback .= "&soldtotal=$form->{soldtotal}";
570 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
573 my @columns = $form->sort_columns(
574 qw(number partnumber ean description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
577 if ($form->{l_linetotal}) {
578 $form->{l_onhand} = "Y";
579 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
580 if ($form->{l_lastcost}) {
581 $form->{l_linetotallastcost} = "Y";
582 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
583 $form->{l_linetotallastcost} = "";
586 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
589 if ($form->{searchitems} eq 'service') {
591 # remove bin, weight and rop from list
592 map { $form->{"l_$_"} = "" } qw(bin weight rop);
594 $form->{l_onhand} = "";
596 # qty is irrelevant unless bought or sold
602 || $form->{quoted}) {
603 $form->{l_onhand} = "Y";
605 $form->{l_linetotalsellprice} = "";
606 $form->{l_linetotallastcost} = "";
610 foreach my $item (@columns) {
611 if ($form->{"l_$item"} eq "Y") {
612 push @column_index, $item;
614 # add column to callback
615 $callback .= "&l_$item=Y";
619 if ($form->{l_subtotal} eq 'Y') {
620 $callback .= "&l_subtotal=Y";
623 $column_header{number} =
624 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
625 $column_header{partnumber} =
626 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
627 . $locale->text('Part Number')
629 $column_header{description} =
630 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
631 . $locale->text('Part Description')
633 $column_header{partsgroup} =
634 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
635 . $locale->text('Group')
637 $column_header{bin} =
638 qq|<th><a class=listheading href=$callback&sort=bin>|
639 . $locale->text('Bin')
641 $column_header{priceupdate} =
642 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
643 . $locale->text('Updated')
645 $column_header{onhand} =
646 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
647 . $locale->text('Qty')
649 $column_header{unit} =
650 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
651 $column_header{listprice} =
652 qq|<th class=listheading nowrap>|
653 . $locale->text('List Price')
655 $column_header{lastcost} =
656 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
657 $column_header{rop} =
658 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
659 $column_header{weight} =
660 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
662 $column_header{invnumber} =
663 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
664 . $locale->text('Invoice Number')
666 $column_header{ordnumber} =
667 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
668 . $locale->text('Order Number')
670 $column_header{quonumber} =
671 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
672 . $locale->text('Quotation')
675 $column_header{name} =
676 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
677 . $locale->text('Name')
680 $column_header{sellprice} =
681 qq|<th class=listheading nowrap>|
682 . $locale->text('Sell Price')
684 $column_header{linetotalsellprice} =
685 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
686 $column_header{linetotallastcost} =
687 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
688 $column_header{linetotallistprice} =
689 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
691 $column_header{image} =
692 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
693 $column_header{drawing} =
694 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
695 . $locale->text('Drawing')
697 $column_header{microfiche} =
698 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
699 . $locale->text('Microfiche')
702 $column_header{serialnumber} =
703 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
704 . $locale->text('Serial Number')
706 $column_header{soldtotal} =
707 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
708 . $locale->text('soldtotal')
712 my $colspan = $#column_index + 1;
719 <th class=listtop colspan=$colspan>$form->{title}</th>
723 <tr><td colspan=$colspan>$option</td></tr>
725 <tr class=listheading>
728 map { print "\n$column_header{$_}" } @column_index;
734 # add order to callback
735 $form->{callback} = $callback .= "&sort=$form->{sort}";
737 # escape callback for href
738 $callback = $form->escape($callback);
740 if (@{ $form->{parts} }) {
741 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
744 # insert numbers for top100
746 foreach my $ref (@{ $form->{parts} }) {
751 # if avaible -> insert choice here
752 if (($form->{ndxs_counter}) > 0) {
753 for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
754 $partnumber = $form->{"totop100_partnumber_$i"};
755 $description = $form->{"totop100_description_$i"};
756 $unit = $form->{"totop100_unit_$i"};
757 $sellprice = $form->{"totop100_sellprice_$i"};
758 $soldtotal = $form->{"totop100_soldtotal_$i"};
761 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
762 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
763 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
764 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
765 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
769 push @{ $form->{parts} },
771 partnumber => "$partnumber",
772 description => "$description",
774 sellprice => "$sellprice",
775 soldtotal => "$soldtotal" };
778 # build data for columns
780 foreach my $ref (@{ $form->{parts} }) {
782 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
783 if ($sameitem ne $ref->{ $form->{sort} }) {
785 $sameitem = $ref->{ $form->{sort} };
789 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
790 $ref->{sellprice} *= $ref->{exchangerate};
791 $ref->{listprice} *= $ref->{exchangerate};
792 $ref->{lastcost} *= $ref->{exchangerate};
794 # use this for assemblies
795 $onhand = $ref->{onhand};
798 if ($ref->{assemblyitem}) {
800 $onhand = 0 if ($form->{sold});
803 $ref->{description} =~ s/\n/<br>/g;
805 $column_data{number} =
807 . $form->format_amount(\%myconfig, $ref->{number})
809 $column_data{partnumber} =
810 "<td align=$align>$ref->{partnumber} </a></td>";
811 $column_data{description} = "<td>$ref->{description} </td>";
812 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
814 $column_data{onhand} =
816 . $form->format_amount(\%myconfig, $ref->{onhand})
818 $column_data{sellprice} =
820 . $form->format_amount(\%myconfig, $ref->{sellprice})
822 $column_data{listprice} =
824 . $form->format_amount(\%myconfig, $ref->{listprice})
826 $column_data{lastcost} =
828 . $form->format_amount(\%myconfig, $ref->{lastcost})
831 $column_data{linetotalsellprice} = "<td align=right>"
832 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2)
834 $column_data{linetotallastcost} = "<td align=right>"
835 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2)
837 $column_data{linetotallistprice} = "<td align=right>"
838 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2)
841 if (!$ref->{assemblyitem}) {
842 $totalsellprice += $onhand * $ref->{sellprice};
843 $totallastcost += $onhand * $ref->{lastcost};
844 $totallistprice += $onhand * $ref->{listprice};
846 $subtotalonhand += $onhand;
847 $subtotalsellprice += $onhand * $ref->{sellprice};
848 $subtotallastcost += $onhand * $ref->{lastcost};
849 $subtotallistprice += $onhand * $ref->{listprice};
854 . $form->format_amount(\%myconfig, $ref->{rop}) . "</td>";
855 $column_data{weight} =
857 . $form->format_amount(\%myconfig, $ref->{weight})
859 $column_data{unit} = "<td>$ref->{unit} </td>";
860 $column_data{bin} = "<td>$ref->{bin} </td>";
861 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
863 $column_data{invnumber} =
864 ($ref->{module} ne 'oe')
865 ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&callback=$callback>$ref->{invnumber}</a></td>"
866 : "<td>$ref->{invnumber}</td>";
867 $column_data{ordnumber} =
868 ($ref->{module} eq 'oe')
869 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&callback=$callback>$ref->{ordnumber}</a></td>"
870 : "<td>$ref->{ordnumber}</td>";
871 $column_data{quonumber} =
872 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
873 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&callback=$callback>$ref->{quonumber}</a></td>"
874 : "<td>$ref->{quonumber}</td>";
876 $column_data{name} = "<td>$ref->{name}</td>";
878 $column_data{image} =
880 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
882 $column_data{drawing} =
884 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
886 $column_data{microfiche} =
888 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
891 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
893 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
897 print "<tr class=listrow$i>";
899 map { print "\n$column_data{$_}" } @column_index;
906 if ($form->{l_subtotal} eq 'Y') {
910 if ($form->{"l_linetotal"}) {
911 map { $column_data{$_} = "<td> </td>" } @column_index;
912 $column_data{linetotalsellprice} =
913 "<th class=listtotal align=right>"
914 . $form->format_amount(\%myconfig, $totalsellprice, 2)
916 $column_data{linetotallastcost} =
917 "<th class=listtotal align=right>"
918 . $form->format_amount(\%myconfig, $totallastcost, 2)
920 $column_data{linetotallistprice} =
921 "<th class=listtotal align=right>"
922 . $form->format_amount(\%myconfig, $totallistprice, 2)
925 print "<tr class=listtotal>";
927 map { print "\n$column_data{$_}" } @column_index;
934 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
943 <form method=post action=$form->{script}>
945 <input type=hidden name=itemstatus value="$form->{itemstatus}">
946 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
947 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
948 <input type=hidden name=l_description value="$form->{l_description}">
949 <input type=hidden name=l_onhand value="$form->{l_onhand}">
950 <input type=hidden name=l_unit value="$form->{l_unit}">
951 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
952 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
953 <input type=hidden name=sort value="$form->{sort}">
954 <input type=hidden name=revers value="$form->{revers}">
955 <input type=hidden name=lastsort value="$form->{lastsort}">
956 <input type=hidden name=parts value="$form->{parts}">
958 <input type=hidden name=bom value="$form->{bom}">
959 <input type=hidden name=titel value="$form->{titel}">
960 <input type=hidden name=searchitems value="$form->{searchitems}">|;
965 <!-- <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">-->
967 <input class=submit type=submit name=action value="|
968 . $locale->text('choice') . qq|">
976 $lxdebug->leave_sub();
981 # Warning, deep magic ahead.
982 # This function parses the requested details, sanity checks them, and converts them into a format thats usable for IC->all_parts
984 # flags coming from the form:
986 # searchitems=part revers=0 lastsort=''
989 # partnumber ean description partsgroup serialnumber make model drawing microfiche
990 # transdatefrom transdateto
993 # itemstatus = active | onhand | short | obsolete | orphaned
994 # action = continue | top100
997 # bought sold onorder ordered rfq quoted
998 # l_partnumber l_description l_serialnumber l_unit l_listprice l_sellprice l_lastcost
999 # l_linetotal l_priceupdate l_bin l_rop l_weight l_image l_drawing l_microfiche
1000 # l_partsgroup l_subtotal l_soldtotal l_deliverydate
1003 # nextsub revers lastsort sort ndxs_counter
1005 sub generate_report {
1006 $lxdebug->enter_sub();
1008 $auth->assert('part_service_assembly_edit');
1010 my ($revers, $lastsort, $description);
1012 $form->{title} = (ucfirst $form->{searchitems}) . "s";
1013 $form->{title} =~ s/ys$/ies/;
1014 $form->{title} = $locale->text($form->{title});
1016 my $revers = $form->{revers};
1017 my $lastsort = $form->{lastsort};
1019 # sorting and direction of sorting
1020 # ToDO: change this to the simpler field+direction method
1021 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1022 $form->{revers} = 0;
1023 $form->{lastsort} = "partnumber";
1024 $form->{sort} = "partnumber";
1026 if ($form->{lastsort} eq $form->{sort}) {
1027 $form->{revers} = 1 - $form->{revers};
1029 $form->{revers} = 0;
1030 $form->{lastsort} = $form->{sort};
1034 # special case if we have a serialnumber limit search
1035 # serialnumbers are only given in invoices and orders,
1036 # so they can only pop up in bought, sold, rfq, and quoted stuff
1037 $form->{no_sn_joins} = 'Y' if ( !$form->{bought} && !$form->{sold}
1038 && !$form->{rfq} && !$form->{quoted}
1039 && ($form->{l_serialnumber} || $form->{serialnumber}));
1041 # special case for any checkbox of bought | sold | onorder | ordered | rfq | quoted.
1042 # if any of these are ticked the behavior changes slightly for lastcost
1043 # since all those are aggregation checks for the legder tables this is an internal switch
1044 # refered to as ledgerchecks
1045 $form->{ledgerchecks} = 'Y' if ( $form->{bought} || $form->{sold} || $form->{onorder}
1046 || $form->{ordered} || $form->{rfq} || $form->{quoted});
1048 # if something should be activated if something else is active, enter it here
1049 my %dependencies = (
1050 onhand => [ qw(l_onhand) ],
1051 short => [ qw(l_onhand) ],
1052 onorder => [ qw(l_ordnumber) ],
1053 ordered => [ qw(l_ordnumber) ],
1054 rfq => [ qw(l_quonumber) ],
1055 quoted => [ qw(l_quonumber) ],
1056 bought => [ qw(l_invnumber) ],
1057 sold => [ qw(l_invnumber) ],
1058 ledgerchecks => [ qw(l_name) ],
1059 serialnumber => [ qw(l_serialnumber) ],
1060 no_sn_joins => [ qw(bought sold) ],
1063 # these strings get displayed at the top of the results to indicate the user which switches were used
1065 active => $locale->text('Active'),
1066 obsolete => $locale->text('Obsolete'),
1067 orphaned => $locale->text('Orphaned'),
1068 onhand => $locale->text('On Hand'),
1069 short => $locale->text('Short'),
1070 onorder => $locale->text('On Order'),
1071 ordered => $locale->text('Ordered'),
1072 rfq => $locale->text('RFQ'),
1073 quoted => $locale->text('Quoted'),
1074 bought => $locale->text('Bought'),
1075 sold => $locale->text('Sold'),
1076 transdatefrom => $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1),
1077 transdateto => $locale->text('To (time)') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1),
1078 partnumber => $locale->text('Part Number') . ": '$form->{partnumber}'",
1079 partsgroup => $locale->text('Group') . ": '$form->{partsgroup}'",
1080 serialnumber => $locale->text('Serial Number') . ": '$form->{serialnumber}'",
1081 description => $locale->text('Part Description') . ": '$form->{description}'",
1082 make => $locale->text('Make') . ": '$form->{make}'",
1083 model => $locale->text('Model') . ": '$form->{model}'",
1084 drawing => $locale->text('Drawing') . ": '$form->{drawing}'",
1085 microfiche => $locale->text('Microfiche') . ": '$form->{microfiche}'",
1086 l_soldtotal => $locale->text('soldtotal'),
1089 my @itemstatus_keys = qw(active obsolete orphaned onhand short);
1090 my @callback_keys = qw(onorder ordered rfq quoted bought sold partnumber partsgroup serialnumber description make model
1091 drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean);
1093 # calculate dependencies
1094 for (@itemstatus_keys, @callback_keys) {
1095 next if ($form->{itemstatus} ne $_ && !$form->{$_});
1096 map { $form->{$_} = 'Y' } @{ $dependencies{$_} } if $dependencies{$_};
1099 # generate callback and optionstrings
1101 for my $key (@itemstatus_keys, @callback_keys) {
1102 next if ($form->{itemstatus} ne $key && !$form->{$key});
1103 push @options, $optiontexts{$key};
1106 # special case for lastcost
1107 $form->{l_lastcost} = "" if $form->{ledgerchecks};
1109 if ($form->{description}) {
1110 $description = $form->{description};
1111 $description =~ s/\n/<br>/g;
1114 if ($form->{l_linetotal}) {
1115 $form->{l_onhand} = "Y";
1116 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1117 if ($form->{l_lastcost}) {
1118 $form->{l_linetotallastcost} = "Y";
1119 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1120 $form->{l_linetotallastcost} = "";
1123 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1126 if ($form->{searchitems} eq 'service') {
1128 # remove bin, weight and rop from list
1129 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1131 $form->{l_onhand} = "";
1133 # qty is irrelevant unless bought or sold
1134 if ( $form->{bought}
1139 || $form->{quoted}) {
1140 $form->{l_onhand} = "Y";
1142 $form->{l_linetotalsellprice} = "";
1143 $form->{l_linetotallastcost} = "";
1147 IC->all_parts(\%myconfig, \%$form);
1150 qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost
1151 priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate);
1154 'bin' => { 'text' => $locale->text('Bin'), },
1155 'deliverydate' => { 'text' => $locale->text('deliverydate'), },
1156 'description' => { 'text' => $locale->text('Part Description'), },
1157 'drawing' => { 'text' => $locale->text('Drawing'), },
1158 'image' => { 'text' => $locale->text('Image'), },
1159 'invnumber' => { 'text' => $locale->text('Invoice Number'), },
1160 'lastcost' => { 'text' => $locale->text('Last Cost'), },
1161 'linetotallastcost' => { 'text' => $locale->text('Extended'), },
1162 'linetotallistprice' => { 'text' => $locale->text('Extended'), },
1163 'linetotalsellprice' => { 'text' => $locale->text('Extended'), },
1164 'listprice' => { 'text' => $locale->text('List Price'), },
1165 'microfiche' => { 'text' => $locale->text('Microfiche'), },
1166 'name' => { 'text' => $locale->text('Name'), },
1167 'onhand' => { 'text' => $locale->text('Qty'), },
1168 'ordnumber' => { 'text' => $locale->text('Order Number'), },
1169 'partnumber' => { 'text' => $locale->text('Part Number'), },
1170 'partsgroup' => { 'text' => $locale->text('Group'), },
1171 'priceupdate' => { 'text' => $locale->text('Updated'), },
1172 'quonumber' => { 'text' => $locale->text('Quotation'), },
1173 'rop' => { 'text' => $locale->text('ROP'), },
1174 'sellprice' => { 'text' => $locale->text('Sell Price'), },
1175 'serialnumber' => { 'text' => $locale->text('Serial Number'), },
1176 'soldtotal' => { 'text' => $locale->text('soldtotal'), },
1177 'unit' => { 'text' => $locale->text('Unit'), },
1178 'weight' => { 'text' => $locale->text('Weight'), },
1181 map { $column_defs{$_}->{visible} = $form->{"l_$_"} ? 1 : 0 } @columns;
1182 map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal);
1184 my @hidden_variables = (qw(l_subtotal l_linetotal searchitems itemstatus bom), @itemstatus_keys, @callback_keys, map { "l_$_" } @columns);
1185 my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
1187 my @sort_full = qw(partnumber description onhand soldtotal deliverydate);
1188 my @sort_no_revers = qw(partsgroup bin priceupdate invnumber ordnumber quonumber name image drawing serialnumber);
1190 foreach my $col (@sort_full) {
1191 $column_defs{$col}->{link} = join '&', $callback, "sort=$col", map { "$_=" . E($form->{$_}) } qw(revers lastsort);
1193 map { $column_defs{$_}->{link} = "${callback}&sort=$_" } @sort_no_revers;
1195 # add order to callback
1196 $form->{callback} = join '&', ($callback, map { "${_}=" . E($form->{$_}) } qw(sort revers));
1198 my $report = SL::ReportGenerator->new(\%myconfig, $form);
1200 my %attachment_basenames = (
1201 'part' => $locale->text('part_list'),
1202 'service' => $locale->text('service_list'),
1203 'assembly' => $locale->text('assembly_list'),
1206 $report->set_options('top_info_text' => $locale->text('Options') . ': ' . join(', ', grep $_, @options),
1207 'raw_bottom_info_text' => $form->parse_html_template('ic/generate_report_bottom'),
1208 'output_format' => 'HTML',
1209 'title' => $form->{title},
1210 'attachment_basename' => $attachment_basenames{$form->{searchitems}} . strftime('_%Y%m%d', localtime time),
1212 $report->set_options_from_form();
1214 $report->set_columns(%column_defs);
1215 $report->set_column_order(@columns);
1217 $report->set_export_options('generate_report', @hidden_variables, qw(sort revers));
1219 $report->set_sort_indicator($form->{sort}, $form->{revers} ? 0 : 1);
1221 my @subtotal_columns = qw(sellprice listprice lastcost);
1222 my %subtotals = map { $_ => 0 } ('onhand', @subtotal_columns);
1223 my %totals = map { $_ => 0 } @subtotal_columns;
1225 my $same_item = $form->{parts}[0]{ $form->{sort} } if (scalar @{ $form->{parts} });
1227 my $defaults = AM->get_defaults();
1230 foreach my $ref (@{ $form->{parts} }) {
1232 # fresh row, for inserting later
1233 my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns };
1235 $ref->{exchangerate} ||= 1;
1236 $ref->{price_factor} ||= 1;
1237 $ref->{sellprice} *= $ref->{exchangerate} / $ref->{price_factor};
1238 $ref->{listprice} *= $ref->{exchangerate} / $ref->{price_factor};
1239 $ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor};
1241 # use this for assemblies
1242 my $onhand = $ref->{onhand};
1244 if ($ref->{assemblyitem}) {
1245 $row->{partnumber}{align} = 'right';
1246 $row->{onhand}{data} = 0;
1247 $onhand = 0 if ($form->{sold});
1250 my $edit_link = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback');
1251 $row->{partnumber}->{link} = $edit_link;
1252 $row->{description}->{link} = $edit_link;
1254 foreach (qw(sellprice listprice lastcost)) {
1255 $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}, -2);
1256 $row->{"linetotal$_"}{data} = $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{$_}, 2);
1259 map { $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}); } qw(onhand rop weight soldtotal);
1261 $row->{weight}->{data} .= ' ' . $defaults->{weightunit};
1263 if (!$ref->{assemblyitem}) {
1264 foreach my $col (@subtotal_columns) {
1265 $totals{$col} += $onhand * $ref->{$col};
1266 $subtotals{$col} += $onhand * $ref->{$col};
1269 $subtotals{onhand} += $onhand;
1273 if ($ref->{module} eq 'oe') {
1274 my $edit_oe_link = build_std_url("script=oe.pl", 'action=edit', 'type=' . E($ref->{customer_id} ne '' ? 'sales_order' : 'purchase_order'), 'id=' . E($ref->{trans_id}), 'callback');
1275 $row->{ordnumber}{link} = $edit_oe_link;
1276 $row->{quonumber}{link} = $edit_oe_link if (!$ref->{ordnumber});
1279 $row->{invnumber}{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'type=invoice', 'id=' . E($ref->{trans_id}), 'callback');
1282 # set properties of images
1283 if ($ref->{image} && (lc $report->{options}->{output_format} eq 'html')) {
1284 $row->{image}{data} = '';
1285 $row->{image}{raw_data} = '<a href="' . H($ref->{image}) . '"><img src="' . H($ref->{image}) . '" height="32" border="0"></a>';
1287 map { $row->{$_}{link} = $ref->{$_} } qw(drawing microfiche);
1289 $report->add_data($row);
1291 my $next_ref = $form->{parts}[$idx + 1];
1293 # insert subtotal rows
1294 if (($form->{l_subtotal} eq 'Y') &&
1296 (!$next_ref->{assemblyitem} && ($same_item ne $next_ref->{ $form->{sort} })))) {
1297 my $row = { map { $_ => { 'class' => 'listsubtotal', } } @columns };
1299 if (($form->{searchitems} ne 'assembly') || !$form->{bom}) {
1300 $row->{onhand}->{data} = $form->format_amount(\%myconfig, $subtotals{onhand});
1303 map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $subtotals{$_}, 2) } @subtotal_columns;
1304 map { $subtotals{$_} = 0 } ('onhand', @subtotal_columns);
1306 $report->add_data($row);
1308 $same_item = $next_ref->{ $form->{sort} };
1314 if ($form->{"l_linetotal"}) {
1315 my $row = { map { $_ => { 'class' => 'listtotal', } } @columns };
1317 map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $totals{$_}, 2) } @subtotal_columns;
1319 $report->add_separator();
1320 $report->add_data($row);
1323 $report->generate_with_headers();
1325 $lxdebug->leave_sub();
1326 } #end generate_report
1328 sub parts_subtotal {
1329 $lxdebug->enter_sub();
1331 $auth->assert('part_service_assembly_edit');
1334 our (%column_data, @column_index);
1335 our ($subtotalonhand, $totalsellprice, $totallastcost, $totallistprice, $subtotalsellprice, $subtotallastcost, $subtotallistprice);
1337 map { $column_data{$_} = "<td> </td>" } @column_index;
1338 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1340 $column_data{onhand} =
1341 "<th class=listsubtotal align=right>"
1342 . $form->format_amount(\%myconfig, $subtotalonhand)
1345 $column_data{linetotalsellprice} =
1346 "<th class=listsubtotal align=right>"
1347 . $form->format_amount(\%myconfig, $subtotalsellprice, 2)
1349 $column_data{linetotallistprice} =
1350 "<th class=listsubtotal align=right>"
1351 . $form->format_amount(\%myconfig, $subtotallistprice, 2)
1353 $column_data{linetotallastcost} =
1354 "<th class=listsubtotal align=right>"
1355 . $form->format_amount(\%myconfig, $subtotallastcost, 2)
1358 $subtotalonhand = 0;
1359 $subtotalsellprice = 0;
1360 $subtotallistprice = 0;
1361 $subtotallastcost = 0;
1363 print "<tr class=listsubtotal>";
1365 map { print "\n$column_data{$_}" } @column_index;
1371 $lxdebug->leave_sub();
1375 $lxdebug->enter_sub();
1377 $auth->assert('part_service_assembly_edit');
1379 # show history button
1380 $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
1381 #/show hhistory button
1382 IC->get_part(\%myconfig, \%$form);
1384 $form->{"original_partnumber"} = $form->{"partnumber"};
1386 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1391 $lxdebug->leave_sub();
1395 $lxdebug->enter_sub();
1397 $auth->assert('part_service_assembly_edit');
1399 IC->create_links("IC", \%myconfig, \%$form);
1402 map({ $form->{selectcurrency} .= "<option>$_\n" }
1403 split(/:/, $form->{currencies}));
1405 # parts and assemblies have the same links
1406 my $item = $form->{item};
1407 if ($form->{item} eq 'assembly') {
1411 # build the popup menus
1412 $form->{taxaccounts} = "";
1413 foreach my $key (keys %{ $form->{IC_links} }) {
1414 foreach my $ref (@{ $form->{IC_links}{$key} }) {
1416 # if this is a tax field
1417 if ($key =~ /IC_tax/) {
1418 if ($key =~ /\Q$item\E/) {
1419 $form->{taxaccounts} .= "$ref->{accno} ";
1420 $form->{"IC_tax_$ref->{accno}_description"} =
1421 "$ref->{accno}--$ref->{description}";
1424 if ($form->{amount}{ $ref->{accno} }) {
1425 $form->{"IC_tax_$ref->{accno}"} = "checked";
1428 $form->{"IC_tax_$ref->{accno}"} = "checked";
1433 $form->{"select$key"} .=
1434 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1435 if ($form->{amount}{$key} eq $ref->{accno}) {
1436 $form->{$key} = "$ref->{accno}--$ref->{description}";
1442 chop $form->{taxaccounts};
1444 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1445 $form->{selectIC_income} = $form->{selectIC_sale};
1446 $form->{selectIC_expense} = $form->{selectIC_cogs};
1447 $form->{IC_income} = $form->{IC_sale};
1448 $form->{IC_expense} = $form->{IC_cogs};
1451 delete $form->{IC_links};
1452 delete $form->{amount};
1454 $form->get_partsgroup(\%myconfig, { all => 1 });
1456 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1458 if (@{ $form->{all_partsgroup} }) {
1459 $form->{selectpartsgroup} = qq|<option>\n|;
1460 map { $form->{selectpartsgroup} .= qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n| } @{ $form->{all_partsgroup} };
1463 if ($form->{item} eq 'assembly') {
1465 foreach my $i (1 .. $form->{assembly_rows}) {
1466 if ($form->{"partsgroup_id_$i"}) {
1467 $form->{"partsgroup_$i"} =
1468 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1471 $form->get_partsgroup(\%myconfig);
1473 if (@{ $form->{all_partsgroup} }) {
1474 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1477 $form->{selectassemblypartsgroup} .=
1478 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1479 } @{ $form->{all_partsgroup} };
1482 $lxdebug->leave_sub();
1486 $lxdebug->enter_sub();
1488 $auth->assert('part_service_assembly_edit');
1490 $form->{eur} = $eur; # config dumps into namespace - yuck
1491 $form->{pg_keys} = sub { "$_[0]->{partsgroup}--$_[0]->{id}" };
1492 $form->{description_area} = ($form->{rows} = $form->numtextrows($form->{description}, 40)) > 1;
1493 $form->{notes_rows} = max 4, $form->numtextrows($form->{notes}, 40), $form->numtextrows($form->{formel}, 40);
1495 map { $form->{"is_$_"} = ($form->{item} eq $_) } qw(part service assembly);
1496 map { $form->{$_} =~ s/"/"/g; } qw(unit);
1498 $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS',
1499 'partsgroup' => 'all_partsgroup',
1500 'vendors' => 'ALL_VENDORS',);
1503 IC->retrieve_buchungsgruppen(\%myconfig, $form);
1504 @{ $form->{BUCHUNGSGRUPPEN} } = grep { $_->{id} eq $form->{buchungsgruppen_id} || ($form->{id} && $form->{orphaned}) || !$form->{id} } @{ $form->{BUCHUNGSGRUPPEN} };
1506 # use JavaScript Calendar or not (yes!)
1507 $form->{jsscript} = 1;
1509 $units = AM->retrieve_units(\%myconfig, $form);
1510 $form->{ALL_UNITS} = [ map +{ name => $_ }, sort { $units->{$a}{sortkey} <=> $units->{$b}{sortkey} } keys %$units ];
1512 $form->{defaults} = AM->get_defaults();
1514 $form->{fokus} = "ic.partnumber";
1517 #print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
1518 # ALL_UNITS => $form->{ALL_UNITS},
1519 # BUCHUNGSGRUPPEN => $form->{BUCHUNGSGRUPPEN},
1520 # payment_terms => $form->{payment_terms},
1521 # all_partsgroup => $form->{all_partsgroup}});
1522 print $form->parse_html_template('ic/form_header');
1523 $lxdebug->leave_sub();
1527 $lxdebug->enter_sub();
1529 $auth->assert('part_service_assembly_edit');
1531 print $form->parse_html_template('ic/form_footer');
1533 $lxdebug->leave_sub();
1537 $lxdebug->enter_sub();
1540 my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows;
1541 delete @{$form}{grep { m/^make_\d+/ || m/^model_\d+/ } keys %{ $form }};
1542 print $form->parse_html_template('ic/makemodel', { MM_DATA => [ @mm_data, {} ], mm_rows => scalar @mm_data + 1 });
1544 $lxdebug->leave_sub();
1548 $lxdebug->enter_sub();
1550 my (@column_index, %column_data, %column_header);
1551 my ($nochange, $callback, $previousform, $linetotal, $href);
1553 our ($deliverydate); # ToDO: cjeck if this indeed comes from global context
1556 qw(runningnumber qty unit bom partnumber description partsgroup lastcost total);
1558 if ($form->{previousform}) {
1560 @column_index = qw(qty unit bom partnumber description partsgroup total);
1564 $form->{old_callback} = $form->{callback};
1565 $callback = $form->{callback};
1566 $form->{callback} = "$form->{script}?action=display_form";
1569 map { delete $form->{$_} } qw(action header);
1573 # save form variables in a previousform variable
1574 foreach my $key (sort keys %$form) {
1575 next unless ref $form->{$key} eq '' && $form->{$key};
1576 next if $key =~ /^select/; # get rid of these stupid select things
1579 $form->{$key} =~ s/&/%26/g;
1580 $previousform .= qq|$key=$form->{$key}&|;
1583 $previousform = $form->escape($form->escape($previousform, 1));
1584 $form->{callback} = $callback;
1586 $form->{assemblytotal} = 0;
1587 $form->{assembly_purchase_price_total} = 0;
1588 $form->{weight} = 0;
1591 $column_header{runningnumber} =
1592 qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
1593 $column_header{qty} =
1594 qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
1595 $column_header{unit} =
1596 qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
1597 $column_header{partnumber} =
1598 qq|<th align=left nowrap width=20%>|
1599 . $locale->text('Part Number')
1601 $column_header{description} =
1602 qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
1603 $column_header{lastcost} =
1604 qq|<th nowrap width=50%>| . $locale->text('Purchase Price') . qq|</th>|;
1605 $column_header{total} =
1606 qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
1607 $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
1608 $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
1611 <tr class=listheading>
1612 <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
1620 map { print "\n$column_header{$_}" } @column_index;
1626 for my $i (1 .. $numrows) {
1627 $form->{"partnumber_$i"} =~ s/\"/"/g;
1630 $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / ($form->{"price_factor_$i"} || 1), 2);
1631 $line_purchase_price =
1632 $form->round_amount($form->{"lastcost_$i"} * $form->{"qty_$i"} / ($form->{"price_factor_$i"} || 1), 2); #lastcost == purchase_price | ungenaue datenbankfeld-übersetzung
1633 $form->{assemblytotal} += $linetotal;
1634 $form->{assembly_purchase_price_total} += $line_purchase_price;
1636 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
1638 $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
1639 $line_purchase_price = $form->format_amount(\%myconfig, $line_purchase_price, 2);
1641 if (($i >= 1) && ($i == $numrows)) {
1644 map { $column_data{$_} = qq|<td></td>| }
1645 qw(qty unit partnumber description bom partsgroup);
1648 map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
1651 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
1652 $column_data{partnumber} =
1653 qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
1654 $column_data{description} =
1655 qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
1656 $column_data{partsgroup} =
1657 qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
1663 if ($form->{previousform}) {
1664 $column_data{partnumber} =
1665 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
1667 qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
1670 qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
1671 $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
1672 $column_data{bom} .= qq|</td>|;
1674 $column_data{partsgroup} =
1675 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
1679 qq|$form->{script}?action=edit&id=$form->{"id_$i"}&rowcount=$i&previousform=$previousform|;
1680 $column_data{partnumber} =
1681 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
1682 $column_data{runningnumber} =
1683 qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
1685 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
1687 $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
1689 qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
1691 $column_data{partsgroup} =
1692 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
1695 $column_data{unit} =
1696 qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
1697 $column_data{description} =
1698 qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
1701 $column_data{lastcost} = qq|<td align=right>$line_purchase_price</td>|;
1702 $column_data{total} = qq|<td align=right>$linetotal</td>|;
1704 $column_data{deliverydate} = qq|<td align=right>$deliverydate</td>|;
1709 map { print "\n$column_data{$_}" } @column_index;
1713 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
1714 <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
1715 <input type=hidden name="lastcost_$i" value=$form->{"lastcost_$i"}>
1716 <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
1717 <input type=hidden name="price_factor_id_$i" value=$form->{"price_factor_id_$i"}>
1718 <input type=hidden name="price_factor_$i" value=$form->{"price_factor_$i"}>
1728 $lxdebug->leave_sub();
1732 $lxdebug->enter_sub();
1734 # parse pricegroups. and no, don't rely on check_form for this...
1735 map { $form->{"price_$_"} = $form->parse_amount(\%myconfig, $form->{"price_$_"}) } 1 .. $form->{price_rows};
1737 if ($form->{item} eq "assembly") {
1738 my $i = $form->{assembly_rows};
1740 # if last row is empty check the form otherwise retrieve item
1741 if ( ($form->{"partnumber_$i"} eq "")
1742 && ($form->{"description_$i"} eq "")
1743 && ($form->{"partsgroup_$i"} eq "")) {
1749 IC->assembly_item(\%myconfig, \%$form);
1751 my $rows = scalar @{ $form->{item_list} };
1754 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1757 $form->{makemodel_rows}--;
1761 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
1762 qw(partnumber description unit partsgroup);
1763 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
1764 keys %{ $form->{item_list}[0] };
1765 $form->{"runningnumber_$i"} = $form->{assembly_rows};
1766 $form->{assembly_rows}++;
1774 $form->{rowcount} = $i;
1775 $form->{assembly_rows}++;
1782 } elsif (($form->{item} eq 'part') || ($form->{item} eq 'service')) {
1786 $lxdebug->leave_sub();
1790 $lxdebug->enter_sub();
1792 $auth->assert('part_service_assembly_edit');
1794 my ($parts_id, %newform, $previousform, $amount, $callback);
1796 # check if there is a part number - commented out, cause there is an automatic allocation of numbers
1797 # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
1799 # check if there is a description
1800 $form->isblank("description", $locale->text("Part Description missing!"));
1802 if ($form->{obsolete}) {
1805 "Inventory quantity must be zero before you can set this $form->{item} obsolete!"
1807 if ($form->{onhand} * 1);
1810 if (!$form->{buchungsgruppen_id}) {
1811 $form->error($locale->text("Parts must have an entry type.") . " " .
1812 $locale->text("If you see this message, you most likely just setup your LX-Office and haven't added any entry types. If this is the case, the option is accessible for administrators in the System menu.")
1816 $form->error($locale->text('Description must not be empty!')) unless $form->{description};
1817 $form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber};
1820 $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n");
1821 if (IC->save(\%myconfig, \%$form) == 3) {
1822 $form->error($locale->text('Partnumber not unique!'));
1824 # saving the history
1825 if(!exists $form->{addition}) {
1826 $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
1827 $form->{addition} = "SAVED";
1828 $form->save_history($form->dbconnect(\%myconfig));
1830 # /saving the history
1831 $parts_id = $form->{id};
1834 # load previous variables
1835 if ($form->{previousform}) {
1837 # save the new form variables before splitting previousform
1838 map { $newform{$_} = $form->{$_} } keys %$form;
1840 $previousform = $form->unescape($form->{previousform});
1842 # don't trample on previous variables
1843 map { delete $form->{$_} } keys %newform;
1845 # now take it apart and restore original values
1846 foreach my $item (split /&/, $previousform) {
1847 my ($key, $value) = split m/=/, $item, 2;
1848 $value =~ s/%26/&/g;
1849 $form->{$key} = $value;
1851 $form->{taxaccounts} = $newform{taxaccount2};
1853 if ($form->{item} eq 'assembly') {
1855 # undo number formatting
1856 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1857 qw(weight listprice sellprice rop);
1859 $form->{assembly_rows}--;
1860 $i = $newform{rowcount};
1861 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1863 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
1864 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
1866 # change/add values for assembly item
1867 map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id);
1869 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
1870 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
1874 # set values for last invoice/order item
1875 $i = $form->{rowcount};
1876 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1878 map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id);
1880 $form->{"longdescription_$i"} = $newform{notes};
1882 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
1884 if ($form->{exchangerate} != 0) {
1885 $form->{"sellprice_$i"} /= $form->{exchangerate};
1888 $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|);
1890 map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount};
1891 chop $form->{"taxaccounts_$i"};
1892 foreach my $item (qw(description rate taxnumber)) {
1893 my $index = $form->{"taxaccounts_$i"} . "_$item";
1894 $form->{$index} = $newform{$index};
1897 # credit remaining calculation
1898 $amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
1900 map { $form->{"${_}_base"} += $amount } (split / /, $form->{"taxaccounts_$i"});
1901 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded};
1903 $form->{creditremaining} -= $amount;
1905 # redo number formatting, because invoice parse them!
1906 map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } qw(weight listprice sellprice rop);
1909 $form->{"id_$i"} = $parts_id;
1911 # Get the actual price factor (not just the ID) for the marge calculation.
1912 $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
1913 foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) {
1914 next if ($pfac->{id} != $newform{price_factor_id});
1915 $form->{"marge_price_factor_$i"} = $pfac->{factor};
1918 delete $form->{ALL_PRICE_FACTORS};
1920 delete $form->{action};
1922 # restore original callback
1923 $callback = $form->unescape($form->{callback});
1924 $form->{callback} = $form->unescape($form->{old_callback});
1925 delete $form->{old_callback};
1927 $form->{makemodel_rows}--;
1929 # put callback together
1930 foreach my $key (keys %$form) {
1932 # do single escape for Apache 2.0
1933 my $value = $form->escape($form->{$key}, 1);
1934 $callback .= qq|&$key=$value|;
1936 $form->{callback} = $callback;
1938 $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|);
1943 $lxdebug->leave_sub();
1947 $lxdebug->enter_sub();
1949 $auth->assert('part_service_assembly_edit');
1951 # saving the history
1952 if(!exists $form->{addition}) {
1953 $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
1954 $form->{addition} = "SAVED AS NEW";
1955 $form->save_history($form->dbconnect(\%myconfig));
1957 # /saving the history
1959 if ($form->{"original_partnumber"} &&
1960 ($form->{"partnumber"} eq $form->{"original_partnumber"})) {
1961 $form->{partnumber} = "";
1964 $lxdebug->leave_sub();
1968 $lxdebug->enter_sub();
1970 $auth->assert('part_service_assembly_edit');
1972 # saving the history
1973 if(!exists $form->{addition}) {
1974 $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
1975 $form->{addition} = "DELETED";
1976 $form->save_history($form->dbconnect(\%myconfig));
1978 # /saving the history
1979 my $rc = IC->delete(\%myconfig, \%$form);
1982 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
1983 $form->error($locale->text('Cannot delete item!'));
1985 $lxdebug->leave_sub();
1989 $lxdebug->enter_sub();
1991 $auth->assert('part_service_assembly_edit');
1996 pricegroup => $form->{"pricegroup_$_"},
1997 pricegroup_id => $form->{"pricegroup_id_$_"},
1998 price => $form->{"price_$_"},
2001 print $form->parse_html_template('ic/price_row', { PRICES => \@PRICES });
2003 $lxdebug->leave_sub();
2006 sub parts_language_selection {
2007 $lxdebug->enter_sub();
2009 $auth->assert('part_service_assembly_edit');
2013 my $languages = IC->retrieve_languages(\%myconfig, $form);
2015 if ($form->{language_values} ne "") {
2016 foreach $item (split(/---\+\+\+---/, $form->{language_values})) {
2017 my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
2019 foreach my $language (@{ $languages }) {
2020 next unless ($language->{id} == $language_id);
2022 $language->{translation} = $translation;
2023 $language->{longdescription} = $longdescription;
2029 my @header_sort = qw(name longdescription);
2030 my %header_title = ( "name" => $locale->text("Name"),
2031 "longdescription" => $locale->text("Long Description"),
2035 map(+{ "column_title" => $header_title{$_},
2037 "callback" => $callback,
2041 $form->{"title"} = $locale->text("Language Values");
2043 print $form->parse_html_template("ic/parts_language_selection", { "HEADER" => \@header,
2044 "LANGUAGES" => $languages,
2045 "onload" => $onload });
2047 $lxdebug->leave_sub();
2050 sub continue { call_sub($form->{"nextsub"}); }