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 #======================================================================
35 use POSIX qw(strftime);
38 use SL::ReportGenerator;
46 our ($form, $locale, %myconfig, $lxdebug);
48 require "bin/mozilla/io.pl";
49 require "bin/mozilla/invoice_io.pl";
50 require "bin/mozilla/common.pl";
51 require "bin/mozilla/reportgenerator.pl";
58 $lxdebug->enter_sub();
60 $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
63 "$form->{script}?action=add&item=$form->{item}&login=$form->{login}&password=$form->{password}"
64 unless $form->{callback};
66 $form->{"unit_changeable"} = 1;
68 IC->get_pricegroups(\%myconfig, \%$form);
72 $lxdebug->leave_sub();
76 $lxdebug->enter_sub();
78 my ($button1, $button2, $onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought);
80 $form->{title} = (ucfirst $form->{searchitems}) . "s";
81 $form->{title} = $locale->text($form->{title});
83 # switch for backward sorting
86 # memory for which table was sort at last time
87 $form->{lastsort} = "";
89 # counter for added entries to top100
90 $form->{ndxs_counter} = 0;
92 # $locale->text('Parts')
93 # $locale->text('Services')
95 # use JavaScript Calendar or not
96 $form->{jsscript} = 1;
98 if ($form->{jsscript}) {
100 # with JavaScript Calendar
102 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
103 <td><input type=button name=transdatefrom id="trigger1" value=|
104 . $locale->text('button') . qq|></td>
107 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
108 <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
109 . $locale->text('button') . qq|></td>
113 $jsscript = Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", "transdateto", "BL", "trigger2");
116 # without JavaScript Calendar
117 $button1 = qq| <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
118 $button2 = qq| <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
121 unless ($form->{searchitems} eq 'service') {
123 $onhand = qq| <input name=itemstatus class=radio type=radio value=onhand> | . $locale->text('On Hand') . qq|
124 <input name=itemstatus class=radio type=radio value=short> | . $locale->text('Short') . qq|
129 <th align=right nowrap>| . $locale->text('Make') . qq|</th> <td><input name=make size=20></td>
130 <th align=right nowrap>| . $locale->text('Model') . qq|</th> <td><input name=model size=20></td>
135 <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th> <td><input name=serialnumber size=20></td>
138 $l_serialnumber = qq|
139 <td><input name=l_serialnumber class=checkbox type=checkbox value=Y> | . $locale->text('Serial Number') . qq|</td>
144 if ($form->{searchitems} eq 'assembly') {
146 $form->{title} = $locale->text('Assemblies');
152 <input name=null class=radio type=radio value=1 checked> |
153 . $locale->text('Top Level') . qq|
154 <input name=bom class=checkbox type=checkbox value=1> |
155 . $locale->text('Individual Items') . qq|
169 <td><input name=sold class=checkbox type=checkbox value=1></td>
170 <td nowrap>| . $locale->text('Sold') . qq|</td>
173 <td colspan=2><hr size=1 noshade></td>
176 <td><input name=ordered class=checkbox type=checkbox value=1></td>
177 <td nowrap>| . $locale->text('Ordered') . qq|</td>
180 <td colspan=4><hr size=1 noshade></td>
183 <td><input name=quoted class=checkbox type=checkbox value=1></td>
184 <td nowrap>| . $locale->text('Quoted') . qq|</td>
188 <td width=5%> </td>
189 <th>| . $locale->text('From') . qq|</th>
191 <th>| . $locale->text('To (time)') . qq|</th>
210 <td><input name=bought class=checkbox type=checkbox value=1></td>
211 <td nowrap>| . $locale->text('Bought') . qq|</td>
212 <td><input name=sold class=checkbox type=checkbox value=1></td>
213 <td nowrap>| . $locale->text('Sold') . qq|</td>
216 <td colspan=4><hr size=1 noshade></td>
219 <td><input name=onorder class=checkbox type=checkbox value=1></td>
220 <td nowrap>| . $locale->text('On Order') . qq|</td>
221 <td><input name=ordered class=checkbox type=checkbox value=1></td>
222 <td nowrap>| . $locale->text('Ordered') . qq|</td>
225 <td colspan=4><hr size=1 noshade></td>
228 <td><input name=rfq class=checkbox type=checkbox value=1></td>
229 <td nowrap>| . $locale->text('RFQ') . qq|</td>
230 <td><input name=quoted class=checkbox type=checkbox value=1></td>
231 <td nowrap>| . $locale->text('Quoted') . qq|</td>
235 <td width=5%> </td>
239 <th>| . $locale->text('From') . qq|</th>
241 <th>| . $locale->text('To (time)') . qq|</th>
258 <form method=post action=$form->{script}>
260 <input type=hidden name=searchitems value=$form->{searchitems}>
261 <input type=hidden name=title value="$form->{title}">
263 <input type=hidden name=revers value="$form->{revers}">
264 <input type=hidden name=lastsort value="$form->{lastsort}">
267 <tr><th class=listtop>$form->{title}</th></tr>
273 <th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
274 <td><input name=partnumber size=20></td>
275 <th align=right nowrap>| . $locale->text('EAN') . qq|</th>
276 <td><input name=ean size=20></td>
279 <th align=right nowrap>|
280 . $locale->text('Part Description') . qq|</th>
281 <td colspan=3><input name=description size=40></td>
284 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
285 <td><input name=partsgroup size=20></td>
290 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
291 <td><input name=drawing size=20></td>
292 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
293 <td><input name=microfiche size=20></td>
299 <input name=itemstatus class=radio type=radio value=active checked> |
300 . $locale->text('Active') . qq|
302 <input name=itemstatus class=radio type=radio value=obsolete> |
303 . $locale->text('Obsolete') . qq|
304 <input name=itemstatus class=radio type=radio value=orphaned> |
305 . $locale->text('Orphaned') . qq|
316 <th align=right nowrap>|
317 . $locale->text('Include in Report') . qq|</th>
321 <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked> |
322 . $locale->text('Part Number') . qq|</td>
323 <td><input name=l_description class=checkbox type=checkbox value=Y checked> |
324 . $locale->text('Part Description') . qq|</td>
326 <td><input name=l_unit class=checkbox type=checkbox value=Y checked> |
327 . $locale->text('Unit of measure') . qq|</td>
330 <td><input name=l_listprice class=checkbox type=checkbox value=Y> |
331 . $locale->text('List Price') . qq|</td>
332 <td><input name=l_sellprice class=checkbox type=checkbox value=Y checked> |
333 . $locale->text('Sell Price') . qq|</td>
334 <td><input name=l_lastcost class=checkbox type=checkbox value=Y checked> |
335 . $locale->text('Last Cost') . qq|</td>
336 <td><input name=l_linetotal class=checkbox type=checkbox value=Y checked> |
337 . $locale->text('Line Total') . qq|</td>
340 <td><input name=l_priceupdate class=checkbox type=checkbox value=Y> |
341 . $locale->text('Updated') . qq|</td>
342 <td><input name=l_bin class=checkbox type=checkbox value=Y> |
343 . $locale->text('Bin') . qq|</td>
344 <td><input name=l_rop class=checkbox type=checkbox value=Y> |
345 . $locale->text('ROP') . qq|</td>
346 <td><input name=l_weight class=checkbox type=checkbox value=Y> |
347 . $locale->text('Weight') . qq|</td>
350 <td><input name=l_image class=checkbox type=checkbox value=Y> |
351 . $locale->text('Image') . qq|</td>
352 <td><input name=l_drawing class=checkbox type=checkbox value=Y> |
353 . $locale->text('Drawing') . qq|</td>
354 <td><input name=l_microfiche class=checkbox type=checkbox value=Y> |
355 . $locale->text('Microfiche') . qq|</td>
356 <td><input name=l_partsgroup class=checkbox type=checkbox value=Y> |
357 . $locale->text('Group') . qq|</td>
360 <td><input name=l_subtotal class=checkbox type=checkbox value=Y> |
361 . $locale->text('Subtotal') . qq|</td>
362 <td><input name=l_soldtotal class=checkbox type=checkbox value=Y> |
363 . $locale->text('soldtotal') . qq|</td>
364 <td><input name=l_deliverydate class=checkbox type=checkbox value=Y> |
365 . $locale->text('deliverydate') . qq|</td>
373 <tr><td colspan=4><hr size=3 noshade></td></tr>
378 <input type=hidden name=nextsub value=generate_report>
380 <input type=hidden name=login value=$form->{login}>
381 <input type=hidden name=password value=$form->{password}>
383 <input type=hidden name=revers value="$form->{revers}">
384 <input type=hidden name=lastsort value="$form->{lastsort}">
385 <input type=hidden name=sort value="description">
387 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
390 <input class=submit type=submit name=action value="|
391 . $locale->text('Continue') . qq|">
392 <input class=submit type=submit name=action value="|
393 . $locale->text('TOP100') . qq|">
399 $lxdebug->leave_sub();
402 sub search_update_prices {
403 $lxdebug->enter_sub();
405 my ($onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought);
407 $form->{title} = $locale->text('Update prices');
408 IC->get_pricegroups(\%myconfig, \%$form);
410 # use JavaScript Calendar or not
411 # $form->{jsscript} = 1;
413 # if ($form->{jsscript}) {
415 # # with JavaScript Calendar
417 # <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
418 # <td><input type=button name=transdatefrom id="trigger1" value=|
419 # . $locale->text('button') . qq|></td>
422 # <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
423 # <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
424 # . $locale->text('button') . qq|></td>
429 # Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1",
430 # "transdateto", "BL", "trigger2");
433 # # without JavaScript Calendar
435 # <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
437 # <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
441 <input name=itemstatus class=radio type=radio value=onhand> |
442 . $locale->text('On Hand') . qq|
443 <input name=itemstatus class=radio type=radio value=short> |
444 . $locale->text('Short') . qq|
449 <th align=right nowrap>| . $locale->text('Make') . qq|</th>
450 <td><input name=make size=20></td>
451 <th align=right nowrap>| . $locale->text('Model') . qq|</th>
452 <td><input name=model size=20></td>
457 <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th>
458 <td><input name=serialnumber size=20></td>
461 $l_serialnumber = qq|
462 <td><input name=l_serialnumber class=checkbox type=checkbox value=Y> |
463 . $locale->text('Serial Number') . qq|</td>
473 <form method=post action=$form->{script}>
475 <input type=hidden name=title value="$form->{title}">
478 <tr><th class=listtop>$form->{title}</th></tr>
484 <th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
485 <td><input name=partnumber size=20></td>
488 <th align=right nowrap>|
489 . $locale->text('Part Description') . qq|</th>
490 <td colspan=3><input name=description size=40></td>
493 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
494 <td><input name=partsgroup size=20></td>
499 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
500 <td><input name=drawing size=20></td>
501 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
502 <td><input name=microfiche size=20></td>
508 <input name=itemstatus class=radio type=radio value=active checked> |
509 . $locale->text('Active') . qq|
511 <input name=itemstatus class=radio type=radio value=obsolete> |
512 . $locale->text('Obsolete') . qq|
513 <input name=itemstatus class=radio type=radio value=orphaned> |
514 . $locale->text('Orphaned') . qq|
529 <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
530 <th class="listheading">| . $locale->text('Preis') . qq|</th>
531 <th class="listheading">| . $locale->text('Prozentual/Absolut') . qq|</th>
534 <td>| . $locale->text('Sell Price') . qq|</td>
535 <td><input name="sellprice" size=11 value="$form->{"sellprice"}"></td>
536 <td><input name="sellprice_type" class=radio type=radio value=percent checked>/<input name="sellprice_type" class=radio type=radio value=absolut></td>
539 <td>| . $locale->text('List Price') . qq|</td>
540 <td><input name="listprice" size=11 value="$form->{"listprice"}"></td>
541 <td><input name="listprice_type" class=radio type=radio value=percent checked>/<input name="listprice_type" class=radio type=radio value=absolut></td>
544 for my $i (1 .. $form->{price_rows}) {
547 <td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
548 <td width=50%><input name="price_$i" size=11></td>
549 <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
550 <td><input name="pricegroup_type_$i" class=radio type=radio value=percent checked>/<input name="pricegroup_type_$i" class=radio type=radio value=absolut></td>
560 <tr><td colspan=4><hr size=3 noshade></td></tr>
562 <input type=hidden name=nextsub value=confirm_price_update>
563 <input type=hidden name=price_rows value=$form->{price_rows}>
565 <input type=hidden name=login value=$form->{login}>
566 <input type=hidden name=password value=$form->{password}>
569 <input class=submit type=submit name=action value="|
570 . $locale->text('Continue') . qq|">
576 $lxdebug->leave_sub();
579 sub confirm_price_update {
580 $lxdebug->enter_sub();
583 $form->{nextsub} = "update_prices";
589 <form method=post action=$form->{script}>
592 # delete action variable
593 map { delete $form->{$_} } qw(action header);
595 foreach my $key (keys %$form) {
596 $form->{$key} =~ s/\"/"/g;
597 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
601 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
604 . $locale->text('Are you sure you want to update the prices')
608 <input name=action class=submit type=submit value="|
609 . $locale->text('Continue') . qq|">
613 $lxdebug->leave_sub();
617 $lxdebug->enter_sub();
619 if (IC->update_prices(\%myconfig, \%$form)) {
620 $form->redirect($form->{update_count} . $locale->text('prices updated!'));
622 $form->error($locale->text('Could not update prices!'));
625 $lxdebug->leave_sub();
629 $lxdebug->enter_sub();
634 $form->{title} = $locale->text('Top 100 hinzufuegen');
641 <form method=post action=$form->{script}>
643 <input type=hidden name=searchitems value=$form->{searchitems}>
644 <input type=hidden name=title value="$form->{title}">
646 <input type=hidden name=revers value="$form->{revers}">
647 <input type=hidden name=lastsort value="$form->{lastsort}">|;
651 <tr class=listheading>
652 <th class=listheading nowrap>| . $locale->text('Part Number') . qq|</th>
653 <th class=listheading nowrap>| . $locale->text('Part Description') . qq|</th>
656 <td><input type=text name=partnumber size=20 value=></td>
657 <td><input type=text name=description size=30 value=></td>
664 <input type=hidden name=login value=$form->{login}>
665 <input type=hidden name=password value=$form->{password}>
667 <input type=hidden name=itemstatus value="$form->{itemstatus}">
668 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
669 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
670 <input type=hidden name=l_description value="$form->{l_description}">
671 <input type=hidden name=l_onhand value="$form->{l_onhand}">
672 <input type=hidden name=l_unit value="$form->{l_unit}">
673 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
674 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
675 <input type=hidden name=sort value="$form->{sort}">
676 <input type=hidden name=revers value="$form->{revers}">
677 <input type=hidden name=lastsort value="$form->{lastsort}">
679 <input type=hidden name=bom value="$form->{bom}">
680 <input type=hidden name=titel value="$form->{titel}">
681 <input type=hidden name=searchitems value="$form->{searchitems}">
683 <input type=hidden name=row value=$j>
685 <input type=hidden name=nextsub value=item_selected>
687 <input type=hidden name=test value=item_selected>
689 <input name=lastndx type=hidden value=$lastndx>
691 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>
693 <input name=extras type=hidden value=$form->{extras}>|;
695 my ($partnumber, $description, $unit, $sellprice, $soldtotal);
698 for (my $i = 0; $i < $form->{ndxs_counter}; $i++) {
701 $partnumber = $form->{"totop100_partnumber_$j"};
702 $description = $form->{"totop100_description_$j"};
703 $unit = $form->{"totop100_unit_$j"};
704 $sellprice = $form->{"totop100_sellprice_$j"};
705 $soldtotal = $form->{"totop100_soldtotal_$j"};
707 # insert data into top100
708 push @{ $form->{parts} },
710 partnumber => "$partnumber",
711 description => "$description",
713 sellprice => "$sellprice",
714 soldtotal => "$soldtotal" };
720 # set data for next page
721 if (($form->{ndxs_counter}) > 0) {
722 for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
723 $partnumber = $form->{"totop100_partnumber_$i"};
724 $description = $form->{"totop100_description_$i"};
725 $unit = $form->{"totop100_unit_$i"};
726 $sellprice = $form->{"totop100_sellprice_$i"};
727 $soldtotal = $form->{"totop100_soldtotal_$i"};
730 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
731 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
732 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
733 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
734 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
742 <input class=submit type=submit name=action value="|
743 . $locale->text('list') . qq|">
748 $lxdebug->leave_sub();
752 $lxdebug->enter_sub();
755 our ($partnumber, $description, $unit, $sellprice, $soldtotal);
757 my @sortorders = ("", "partnumber", "description", "all");
758 my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)];
759 IC->get_parts(\%myconfig, \%$form, $sortorder);
761 $form->{title} = $locale->text('Top 100 hinzufuegen');
767 <form method=post action=ic.pl>
770 <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
773 <tr class=listheading>
775 <th class=listheading>| . $locale->text('Part Number') . qq|</th>
776 <th class=listheading>| . $locale->text('Part Description') . qq|</th>
777 <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
778 <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
779 <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
783 my $i = $form->{rows};
785 for ($j = 1; $j <= $i; $j++) {
788 <tr class=listrow1>|;
791 <td><input name=ndx class=radio type=radio value=$j checked></td>|;
794 <td><input name=ndx class=radio type=radio value=$j></td>|;
797 <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
798 <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
799 <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
800 <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
801 <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
804 <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
814 <input type=hidden name=login value=$form->{login}>
815 <input type=hidden name=password value=$form->{password}>
817 <input type=hidden name=itemstatus value="$form->{itemstatus}">
818 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
819 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
820 <input type=hidden name=l_description value="$form->{l_description}">
821 <input type=hidden name=l_onhand value="$form->{l_onhand}">
822 <input type=hidden name=l_unit value="$form->{l_unit}">
823 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
824 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
825 <input type=hidden name=sort value="$form->{sort}">
826 <input type=hidden name=revers value="$form->{revers}">
827 <input type=hidden name=lastsort value="$form->{lastsort}">
829 <input type=hidden name=bom value="$form->{bom}">
830 <input type=hidden name=titel value="$form->{titel}">
831 <input type=hidden name=searchitems value="$form->{searchitems}">
833 <input type=hidden name=row value=$j>
835 <input type=hidden name=nextsub value=item_selected>
837 <input name=lastndx type=hidden value=$lastndx>
839 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
843 if (($form->{ndxs_counter}) > 0) {
844 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
846 $partnumber = $form->{"totop100_partnumber_$i"};
847 $description = $form->{"totop100_description_$i"};
848 $unit = $form->{"totop100_unit_$i"};
849 $sellprice = $form->{"totop100_sellprice_$i"};
850 $soldtotal = $form->{"totop100_soldtotal_$i"};
853 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
854 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
855 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
856 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
857 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
865 <input class=submit type=submit name=action value="|
866 . $locale->text('TOP100') . qq|">
872 $lxdebug->leave_sub();
876 $lxdebug->enter_sub();
879 $form->{ndxs_counter}++;
881 if ($form->{ndxs_counter} > 0) {
883 my $index = $form->{ndx};
885 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $form->{"new_partnumber_$index"};
886 $form->{"totop100_description_$form->{ndxs_counter}"} = $form->{"new_description_$index"};
887 $form->{"totop100_unit_$form->{ndxs_counter}"} = $form->{"new_unit_$index"};
888 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $form->{"new_sellprice_$index"};
889 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $form->{"new_soldtotal_$index"};
893 $lxdebug->leave_sub();
897 $lxdebug->enter_sub();
899 my ($revers, $lastsort, $callback, $option, $description, $sameitem,
900 $partnumber, $unit, $sellprice, $soldtotal, $totop100, $onhand, $align);
901 my (@column_index, %column_header, %column_data);
902 my ($totalsellprice, $totallastcost, $totallistprice, $subtotalonhand, $subtotalsellprice, $subtotallastcost, $subtotallistprice);
904 $form->{top100} = "top100";
905 $form->{l_soldtotal} = "Y";
906 $form->{soldtotal} = "soldtotal";
907 $form->{sort} = "soldtotal";
908 $form->{l_qty} = "N";
909 $form->{l_linetotal} = "";
911 $form->{number} = "position";
912 $form->{l_number} = "Y";
916 $form->{title} = $locale->text('Top 100');
918 $revers = $form->{revers};
919 $lastsort = $form->{lastsort};
921 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
923 $form->{lastsort} = "partnumber";
924 $form->{sort} = "partnumber";
928 "$form->{script}?action=top100&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
929 . $form->escape($form->{title}, 1);
931 # if we have a serialnumber limit search
932 if ($form->{serialnumber} || $form->{l_serialnumber}) {
933 $form->{l_serialnumber} = "Y";
934 unless ( $form->{bought}
937 || $form->{quoted}) {
938 $form->{bought} = $form->{sold} = 1;
941 IC->all_parts(\%myconfig, \%$form);
943 if ($form->{itemstatus} eq 'active') {
944 $option .= $locale->text('Active') . " : ";
946 if ($form->{itemstatus} eq 'obsolete') {
947 $option .= $locale->text('Obsolete') . " : ";
949 if ($form->{itemstatus} eq 'orphaned') {
950 $option .= $locale->text('Orphaned') . " : ";
952 if ($form->{itemstatus} eq 'onhand') {
953 $option .= $locale->text('On Hand') . " : ";
954 $form->{l_onhand} = "Y";
956 if ($form->{itemstatus} eq 'short') {
957 $option .= $locale->text('Short') . " : ";
958 $form->{l_onhand} = "Y";
960 if ($form->{onorder}) {
961 $form->{l_ordnumber} = "Y";
962 $callback .= "&onorder=$form->{onorder}";
963 $option .= $locale->text('On Order') . " : ";
965 if ($form->{ordered}) {
966 $form->{l_ordnumber} = "Y";
967 $callback .= "&ordered=$form->{ordered}";
968 $option .= $locale->text('Ordered') . " : ";
971 $form->{l_quonumber} = "Y";
972 $callback .= "&rfq=$form->{rfq}";
973 $option .= $locale->text('RFQ') . " : ";
975 if ($form->{quoted}) {
976 $form->{l_quonumber} = "Y";
977 $callback .= ""ed=$form->{quoted}";
978 $option .= $locale->text('Quoted') . " : ";
980 if ($form->{bought}) {
981 $form->{l_invnumber} = "Y";
982 $callback .= "&bought=$form->{bought}";
983 $option .= $locale->text('Bought') . " : ";
986 $form->{l_invnumber} = "Y";
987 $callback .= "&sold=$form->{sold}";
988 $option .= $locale->text('Sold') . " : ";
995 || $form->{quoted}) {
997 $form->{l_lastcost} = "";
998 $form->{l_name} = "Y";
999 if ($form->{transdatefrom}) {
1000 $callback .= "&transdatefrom=$form->{transdatefrom}";
1002 . $locale->text('From')
1004 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1006 if ($form->{transdateto}) {
1007 $callback .= "&transdateto=$form->{transdateto}";
1009 . $locale->text('To')
1011 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1017 if ($form->{partnumber}) {
1018 $callback .= "&partnumber=$form->{partnumber}";
1019 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
1022 $callback .= "&partnumber=$form->{ean}";
1023 $option .= $locale->text('EAN') . qq| : $form->{ean}<br>|;
1025 if ($form->{partsgroup}) {
1026 $callback .= "&partsgroup=$form->{partsgroup}";
1027 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
1029 if ($form->{serialnumber}) {
1030 $callback .= "&serialnumber=$form->{serialnumber}";
1032 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
1034 if ($form->{description}) {
1035 $callback .= "&description=$form->{description}";
1036 $description = $form->{description};
1040 $locale->text('Part Description') . qq| : $form->{description}<br>|;
1042 if ($form->{make}) {
1043 $callback .= "&make=$form->{make}";
1044 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
1046 if ($form->{model}) {
1047 $callback .= "&model=$form->{model}";
1048 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
1050 if ($form->{drawing}) {
1051 $callback .= "&drawing=$form->{drawing}";
1052 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
1054 if ($form->{microfiche}) {
1055 $callback .= "µfiche=$form->{microfiche}";
1056 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
1058 if ($form->{l_soldtotal}) {
1059 $callback .= "&soldtotal=$form->{soldtotal}";
1060 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1063 my @columns = $form->sort_columns(
1064 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)
1067 if ($form->{l_linetotal}) {
1068 $form->{l_onhand} = "Y";
1069 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1070 if ($form->{l_lastcost}) {
1071 $form->{l_linetotallastcost} = "Y";
1072 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1073 $form->{l_linetotallastcost} = "";
1076 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1079 if ($form->{searchitems} eq 'service') {
1081 # remove bin, weight and rop from list
1082 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1084 $form->{l_onhand} = "";
1086 # qty is irrelevant unless bought or sold
1087 if ( $form->{bought}
1092 || $form->{quoted}) {
1093 $form->{l_onhand} = "Y";
1095 $form->{l_linetotalsellprice} = "";
1096 $form->{l_linetotallastcost} = "";
1100 $form->{l_lastcost} = ""
1101 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1103 foreach my $item (@columns) {
1104 if ($form->{"l_$item"} eq "Y") {
1105 push @column_index, $item;
1107 # add column to callback
1108 $callback .= "&l_$item=Y";
1112 if ($form->{l_subtotal} eq 'Y') {
1113 $callback .= "&l_subtotal=Y";
1116 $column_header{number} =
1117 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
1118 $column_header{partnumber} =
1119 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1120 . $locale->text('Part Number')
1122 $column_header{description} =
1123 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1124 . $locale->text('Part Description')
1126 $column_header{partsgroup} =
1127 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
1128 . $locale->text('Group')
1130 $column_header{bin} =
1131 qq|<th><a class=listheading href=$callback&sort=bin>|
1132 . $locale->text('Bin')
1134 $column_header{priceupdate} =
1135 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
1136 . $locale->text('Updated')
1138 $column_header{onhand} =
1139 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1140 . $locale->text('Qty')
1142 $column_header{unit} =
1143 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
1144 $column_header{listprice} =
1145 qq|<th class=listheading nowrap>|
1146 . $locale->text('List Price')
1148 $column_header{lastcost} =
1149 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
1150 $column_header{rop} =
1151 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
1152 $column_header{weight} =
1153 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
1155 $column_header{invnumber} =
1156 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
1157 . $locale->text('Invoice Number')
1159 $column_header{ordnumber} =
1160 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
1161 . $locale->text('Order Number')
1163 $column_header{quonumber} =
1164 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
1165 . $locale->text('Quotation')
1168 $column_header{name} =
1169 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
1170 . $locale->text('Name')
1173 $column_header{sellprice} =
1174 qq|<th class=listheading nowrap>|
1175 . $locale->text('Sell Price')
1177 $column_header{linetotalsellprice} =
1178 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1179 $column_header{linetotallastcost} =
1180 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1181 $column_header{linetotallistprice} =
1182 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1184 $column_header{image} =
1185 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
1186 $column_header{drawing} =
1187 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
1188 . $locale->text('Drawing')
1190 $column_header{microfiche} =
1191 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
1192 . $locale->text('Microfiche')
1195 $column_header{serialnumber} =
1196 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
1197 . $locale->text('Serial Number')
1199 $column_header{soldtotal} =
1200 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1201 . $locale->text('soldtotal')
1205 my $colspan = $#column_index + 1;
1212 <th class=listtop colspan=$colspan>$form->{title}</th>
1214 <tr height="5"></tr>
1216 <tr><td colspan=$colspan>$option</td></tr>
1218 <tr class=listheading>
1221 map { print "\n$column_header{$_}" } @column_index;
1227 # add order to callback
1228 $form->{callback} = $callback .= "&sort=$form->{sort}";
1230 # escape callback for href
1231 $callback = $form->escape($callback);
1233 if (@{ $form->{parts} }) {
1234 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1237 # insert numbers for top100
1239 foreach my $ref (@{ $form->{parts} }) {
1241 $ref->{number} = $j;
1244 # if avaible -> insert choice here
1245 if (($form->{ndxs_counter}) > 0) {
1246 for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
1247 $partnumber = $form->{"totop100_partnumber_$i"};
1248 $description = $form->{"totop100_description_$i"};
1249 $unit = $form->{"totop100_unit_$i"};
1250 $sellprice = $form->{"totop100_sellprice_$i"};
1251 $soldtotal = $form->{"totop100_soldtotal_$i"};
1254 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
1255 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
1256 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
1257 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
1258 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
1262 push @{ $form->{parts} },
1264 partnumber => "$partnumber",
1265 description => "$description",
1267 sellprice => "$sellprice",
1268 soldtotal => "$soldtotal" };
1271 # build data for columns
1272 foreach my $ref (@{ $form->{parts} }) {
1275 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1276 if ($sameitem ne $ref->{ $form->{sort} }) {
1278 $sameitem = $ref->{ $form->{sort} };
1282 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1283 $ref->{sellprice} *= $ref->{exchangerate};
1284 $ref->{listprice} *= $ref->{exchangerate};
1285 $ref->{lastcost} *= $ref->{exchangerate};
1287 # use this for assemblies
1288 $onhand = $ref->{onhand};
1291 if ($ref->{assemblyitem}) {
1293 $onhand = 0 if ($form->{sold});
1296 $ref->{description} =~ s/
1299 $column_data{number} =
1301 . $form->format_amount(\%myconfig, $ref->{number})
1303 $column_data{partnumber} =
1304 "<td align=$align>$ref->{partnumber} </a></td>";
1305 $column_data{description} = "<td>$ref->{description} </td>";
1306 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1308 $column_data{onhand} =
1310 . $form->format_amount(\%myconfig, $ref->{onhand})
1312 $column_data{sellprice} =
1314 . $form->format_amount(\%myconfig, $ref->{sellprice})
1316 $column_data{listprice} =
1318 . $form->format_amount(\%myconfig, $ref->{listprice})
1320 $column_data{lastcost} =
1322 . $form->format_amount(\%myconfig, $ref->{lastcost})
1325 $column_data{linetotalsellprice} = "<td align=right>"
1326 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2)
1328 $column_data{linetotallastcost} = "<td align=right>"
1329 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2)
1331 $column_data{linetotallistprice} = "<td align=right>"
1332 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2)
1335 if (!$ref->{assemblyitem}) {
1336 $totalsellprice += $onhand * $ref->{sellprice};
1337 $totallastcost += $onhand * $ref->{lastcost};
1338 $totallistprice += $onhand * $ref->{listprice};
1340 $subtotalonhand += $onhand;
1341 $subtotalsellprice += $onhand * $ref->{sellprice};
1342 $subtotallastcost += $onhand * $ref->{lastcost};
1343 $subtotallistprice += $onhand * $ref->{listprice};
1348 . $form->format_amount(\%myconfig, $ref->{rop}) . "</td>";
1349 $column_data{weight} =
1351 . $form->format_amount(\%myconfig, $ref->{weight})
1353 $column_data{unit} = "<td>$ref->{unit} </td>";
1354 $column_data{bin} = "<td>$ref->{bin} </td>";
1355 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1357 $column_data{invnumber} =
1358 ($ref->{module} ne 'oe')
1359 ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>"
1360 : "<td>$ref->{invnumber}</td>";
1361 $column_data{ordnumber} =
1362 ($ref->{module} eq 'oe')
1363 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}</a></td>"
1364 : "<td>$ref->{ordnumber}</td>";
1365 $column_data{quonumber} =
1366 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1367 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
1368 : "<td>$ref->{quonumber}</td>";
1370 $column_data{name} = "<td>$ref->{name}</td>";
1372 $column_data{image} =
1374 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1375 : "<td> </td>";
1376 $column_data{drawing} =
1378 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1379 : "<td> </td>";
1380 $column_data{microfiche} =
1381 ($ref->{microfiche})
1382 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1383 : "<td> </td>";
1385 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1387 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
1391 print "<tr class=listrow$i>";
1393 map { print "\n$column_data{$_}" } @column_index;
1400 if ($form->{l_subtotal} eq 'Y') {
1404 if ($form->{"l_linetotal"}) {
1405 map { $column_data{$_} = "<td> </td>" } @column_index;
1406 $column_data{linetotalsellprice} =
1407 "<th class=listtotal align=right>"
1408 . $form->format_amount(\%myconfig, $totalsellprice, 2)
1410 $column_data{linetotallastcost} =
1411 "<th class=listtotal align=right>"
1412 . $form->format_amount(\%myconfig, $totallastcost, 2)
1414 $column_data{linetotallistprice} =
1415 "<th class=listtotal align=right>"
1416 . $form->format_amount(\%myconfig, $totallistprice, 2)
1419 print "<tr class=listtotal>";
1421 map { print "\n$column_data{$_}" } @column_index;
1428 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1437 <form method=post action=$form->{script}>
1439 <input type=hidden name=login value=$form->{login}>
1440 <input type=hidden name=password value=$form->{password}>
1442 <input type=hidden name=itemstatus value="$form->{itemstatus}">
1443 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
1444 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
1445 <input type=hidden name=l_description value="$form->{l_description}">
1446 <input type=hidden name=l_onhand value="$form->{l_onhand}">
1447 <input type=hidden name=l_unit value="$form->{l_unit}">
1448 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
1449 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
1450 <input type=hidden name=sort value="$form->{sort}">
1451 <input type=hidden name=revers value="$form->{revers}">
1452 <input type=hidden name=lastsort value="$form->{lastsort}">
1453 <input type=hidden name=parts value="$form->{parts}">
1455 <input type=hidden name=bom value="$form->{bom}">
1456 <input type=hidden name=titel value="$form->{titel}">
1457 <input type=hidden name=searchitems value="$form->{searchitems}">|;
1462 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
1464 <input class=submit type=submit name=action value="|
1465 . $locale->text('choice') . qq|">
1473 $lxdebug->leave_sub();
1478 # Warning, deep magic ahead.
1479 # This function parses the requested details, sanity checks them, and converts them into a format thats usable for IC->all_parts
1481 # flags coming from the form:
1483 # searchitems=part revers=0 lastsort=''
1486 # partnumber ean description partsgroup serialnumber make model drawing microfiche
1487 # transdatefrom transdateto
1490 # itemstatus = active | onhand | short | obsolete | orphaned
1491 # action = continue | top100
1494 # bought sold onorder ordered rfq quoted
1495 # l_partnumber l_description l_serialnumber l_unit l_listprice l_sellprice l_lastcost
1496 # l_linetotal l_priceupdate l_bin l_rop l_weight l_image l_drawing l_microfiche
1497 # l_partsgroup l_subtotal l_soldtotal l_deliverydate
1500 # nextsub login password revers lastsort sort ndxs_counter
1502 sub generate_report {
1503 $lxdebug->enter_sub();
1505 my ($revers, $lastsort, $description);
1507 $form->{title} = (ucfirst $form->{searchitems}) . "s";
1508 $form->{title} = $locale->text($form->{title});
1510 my $revers = $form->{revers};
1511 my $lastsort = $form->{lastsort};
1513 # sorting and direction of sorting
1514 # ToDO: change this to the simpler field+direction method
1515 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1516 $form->{revers} = 0;
1517 $form->{lastsort} = "partnumber";
1518 $form->{sort} = "partnumber";
1520 if ($form->{lastsort} eq $form->{sort}) {
1521 $form->{revers} = 1 - $form->{revers};
1523 $form->{revers} = 0;
1524 $form->{lastsort} = $form->{sort};
1528 # special case if we have a serialnumber limit search
1529 # serialnumbers are only given in invoices and orders,
1530 # so they can only pop up in bought, sold, rfq, and quoted stuff
1531 $form->{no_sn_joins} = 'Y' if ( !$form->{bought} && !$form->{sold}
1532 && !$form->{rfq} && !$form->{quoted}
1533 && ($form->{l_serialnumber} || $form->{serialnumber}));
1535 # special case for any checkbox of bought | sold | onorder | ordered | rfq | quoted.
1536 # if any of these are ticked the behavior changes slightly for lastcost
1537 # since all those are aggregation checks for the legder tables this is an internal switch
1538 # refered to as ledgerchecks
1539 $form->{ledgerchecks} = 'Y' if ( $form->{bought} || $form->{sold} || $form->{onorder}
1540 || $form->{ordered} || $form->{rfq} || $form->{quoted});
1542 # if something should be activated if something else is active, enter it here
1543 my %dependencies = (
1544 onhand => [ qw(l_onhand) ],
1545 short => [ qw(l_onhand) ],
1546 onorder => [ qw(l_ordnumber) ],
1547 ordered => [ qw(l_ordnumber) ],
1548 rfq => [ qw(l_quonumber) ],
1549 quoted => [ qw(l_quonumber) ],
1550 bought => [ qw(l_invnumber) ],
1551 sold => [ qw(l_invnumber) ],
1552 ledgerchecks => [ qw(l_name) ],
1553 serialnumber => [ qw(l_serialnumber) ],
1554 no_sn_joins => [ qw(bought sold) ],
1557 # these strings get displayed at the top of the results to indicate the user which switches were used
1559 active => $locale->text('Active'),
1560 obsolete => $locale->text('Obsolete'),
1561 orphaned => $locale->text('Orphaned'),
1562 onhand => $locale->text('On Hand'),
1563 short => $locale->text('Short'),
1564 onorder => $locale->text('On Order'),
1565 ordered => $locale->text('Ordered'),
1566 rfq => $locale->text('RFQ'),
1567 quoted => $locale->text('Quoted'),
1568 bought => $locale->text('Bought'),
1569 sold => $locale->text('Sold'),
1570 transdatefrom => $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1),
1571 transdateto => $locale->text('To (time)') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1),
1572 partnumber => $locale->text('Part Number') . ": '$form->{partnumber}'",
1573 partsgroup => $locale->text('Group') . ": '$form->{partsgroup}'",
1574 serialnumber => $locale->text('Serial Number') . ": '$form->{serialnumber}'",
1575 description => $locale->text('Part Description') . ": '$form->{description}'",
1576 make => $locale->text('Make') . ": '$form->{make}'",
1577 model => $locale->text('Model') . ": '$form->{model}'",
1578 drawing => $locale->text('Drawing') . ": '$form->{drawing}'",
1579 microfiche => $locale->text('Microfiche') . ": '$form->{microfiche}'",
1580 l_soldtotal => $locale->text('soldtotal'),
1583 my @itemstatus_keys = qw(active obsolete orphaned onhand short);
1584 my @callback_keys = qw(onorder ordered rfq quoted bought sold partnumber partsgroup serialnumber description make model
1585 drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean);
1587 # calculate dependencies
1588 for (@itemstatus_keys, @callback_keys) {
1589 next if ($form->{itemstatus} ne $_ && !$form->{$_});
1590 map { $form->{$_} = 'Y' } @{ $dependencies{$_} } if $dependencies{$_};
1593 # generate callback and optionstrings
1595 for my $key (@itemstatus_keys, @callback_keys) {
1596 next if ($form->{itemstatus} ne $key && !$form->{$key});
1597 push @options, $optiontexts{$key};
1600 IC->all_parts(\%myconfig, \%$form);
1602 # special case for lastcost
1603 $form->{l_lastcost} = "" if $form->{ledgerchecks};
1605 if ($form->{description}) {
1606 $description = $form->{description};
1607 $description =~ s/\n/<br>/g;
1610 if ($form->{l_linetotal}) {
1611 $form->{l_onhand} = "Y";
1612 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1613 if ($form->{l_lastcost}) {
1614 $form->{l_linetotallastcost} = "Y";
1615 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1616 $form->{l_linetotallastcost} = "";
1619 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1622 if ($form->{searchitems} eq 'service') {
1624 # remove bin, weight and rop from list
1625 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1627 $form->{l_onhand} = "";
1629 # qty is irrelevant unless bought or sold
1630 if ( $form->{bought}
1635 || $form->{quoted}) {
1636 $form->{l_onhand} = "Y";
1638 $form->{l_linetotalsellprice} = "";
1639 $form->{l_linetotallastcost} = "";
1643 $form->{l_lastcost} = "" if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1646 qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost
1647 priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate);
1650 'bin' => { 'text' => $locale->text('Bin'), },
1651 'deliverydate' => { 'text' => $locale->text('deliverydate'), },
1652 'description' => { 'text' => $locale->text('Part Description'), },
1653 'drawing' => { 'text' => $locale->text('Drawing'), },
1654 'image' => { 'text' => $locale->text('Image'), },
1655 'invnumber' => { 'text' => $locale->text('Invoice Number'), },
1656 'lastcost' => { 'text' => $locale->text('Last Cost'), },
1657 'linetotallastcost' => { 'text' => $locale->text('Extended'), },
1658 'linetotallistprice' => { 'text' => $locale->text('Extended'), },
1659 'linetotalsellprice' => { 'text' => $locale->text('Extended'), },
1660 'listprice' => { 'text' => $locale->text('List Price'), },
1661 'microfiche' => { 'text' => $locale->text('Microfiche'), },
1662 'name' => { 'text' => $locale->text('Name'), },
1663 'onhand' => { 'text' => $locale->text('Qty'), },
1664 'ordnumber' => { 'text' => $locale->text('Order Number'), },
1665 'partnumber' => { 'text' => $locale->text('Part Number'), },
1666 'partsgroup' => { 'text' => $locale->text('Group'), },
1667 'priceupdate' => { 'text' => $locale->text('Updated'), },
1668 'quonumber' => { 'text' => $locale->text('Quotation'), },
1669 'rop' => { 'text' => $locale->text('ROP'), },
1670 'sellprice' => { 'text' => $locale->text('Sell Price'), },
1671 'serialnumber' => { 'text' => $locale->text('Serial Number'), },
1672 'soldtotal' => { 'text' => $locale->text('soldtotal'), },
1673 'unit' => { 'text' => $locale->text('Unit'), },
1674 'weight' => { 'text' => $locale->text('Weight'), },
1677 map { $column_defs{$_}->{visible} = $form->{"l_$_"} ? 1 : 0 } @columns;
1678 map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal);
1680 my @hidden_variables = (qw(l_subtotal l_linetotal searchitems itemstatus bom), @itemstatus_keys, @callback_keys, map { "l_$_" } @columns);
1681 my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
1683 my @sort_full = qw(partnumber description onhand soldtotal deliverydate);
1684 my @sort_no_revers = qw(partsgroup bin priceupdate invnumber ordnumber quonumber name image drawing serialnumber);
1686 foreach my $col (@sort_full) {
1687 $column_defs{$col}->{link} = join '&', $callback, "sort=$col", map { "$_=" . E($form->{$_}) } qw(revers lastsort);
1689 map { $column_defs{$_}->{link} = "${callback}&sort=$_" } @sort_no_revers;
1691 # add order to callback
1692 $form->{callback} = join '&', ($callback, map { "${_}=" . E($form->{$_}) } qw(sort revers));
1694 my $report = SL::ReportGenerator->new(\%myconfig, $form);
1696 my %attachment_basenames = (
1697 'part' => $locale->text('part_list'),
1698 'service' => $locale->text('service_list'),
1699 'assembly' => $locale->text('assembly_list'),
1702 $report->set_options('top_info_text' => $locale->text('Options') . ': ' . join(', ', grep $_, @options),
1703 'raw_bottom_info_text' => $form->parse_html_template2('ic/generate_report_bottom'),
1704 'output_format' => 'HTML',
1705 'title' => $form->{title},
1706 'attachment_basename' => $attachment_basenames{$form->{searchitems}} . strftime('_%Y%m%d', localtime time),
1708 $report->set_options_from_form();
1710 $report->set_columns(%column_defs);
1711 $report->set_column_order(@columns);
1713 $report->set_export_options('generate_report', @hidden_variables, qw(sort revers));
1715 $report->set_sort_indicator($form->{sort}, $form->{revers} ? 0 : 1);
1717 my @subtotal_columns = qw(sellprice listprice lastcost);
1718 my %subtotals = map { $_ => 0 } ('onhand', @subtotal_columns);
1719 my %totals = map { $_ => 0 } @subtotal_columns;
1721 my $same_item = $form->{parts}[0]{ $form->{sort} } if (scalar @{ $form->{parts} });
1724 foreach my $ref (@{ $form->{parts} }) {
1726 # fresh row, for inserting later
1727 my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns };
1729 $ref->{exchangerate} ||= 1;
1730 $ref->{price_factor} ||= 1;
1731 $ref->{sellprice} *= $ref->{exchangerate} / $ref->{price_factor};
1732 $ref->{listprice} *= $ref->{exchangerate} / $ref->{price_factor};
1733 $ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor};
1735 # use this for assemblies
1736 my $onhand = $ref->{onhand};
1738 if ($ref->{assemblyitem}) {
1739 $row->{partnumber}{align} = 'right';
1740 $row->{onhand}{data} = 0;
1741 $onhand = 0 if ($form->{sold});
1744 my $edit_link = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback');
1745 $row->{partnumber}->{link} = $edit_link;
1746 $row->{description}->{link} = $edit_link;
1748 foreach (qw(sellprice listprice lastcost)) {
1749 $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}, -2);
1750 $row->{"linetotal$_"}{data} = $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{$_}, 2);
1753 map { $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}); } qw(onhand rop weight soldtotal);
1755 if (!$ref->{assemblyitem}) {
1756 foreach my $col (@subtotal_columns) {
1757 $totals{$col} += $onhand * $ref->{$col};
1758 $subtotals{$col} += $onhand * $ref->{$col};
1761 $subtotals{onhand} += $onhand;
1765 if ($ref->{module} eq 'oe') {
1766 my $edit_oe_link = build_std_url("script=oe.pl", 'action=edit', 'type=' . E($ref->{type}), 'id=' . E($ref->{trans_id}), 'callback');
1767 $row->{ordnumber}{link} = $edit_oe_link;
1768 $row->{quonumber}{link} = $edit_oe_link if (!$ref->{ordnumber});
1771 $row->{invnumber}{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'type=invoice', 'id=' . E($ref->{trans_id}), 'callback');
1774 # set properties of images
1775 if ($ref->{image} && (lc $report->{options}->{output_format} eq 'html')) {
1776 $row->{image}{data} = '';
1777 $row->{image}{raw_data} = '<a href="' . H($ref->{image}) . '"><img src="' . H($ref->{image}) . '" height="32" border="0"></a>';
1779 map { $row->{$_}{link} = $ref->{$_} } qw(drawing microfiche);
1781 $report->add_data($row);
1783 my $next_ref = $form->{parts}[$idx + 1];
1785 # insert subtotal rows
1786 if (($form->{l_subtotal} eq 'Y') &&
1788 (!$next_ref->{assemblyitem} && ($same_item ne $next_ref->{ $form->{sort} })))) {
1789 my $row = { map { $_ => { 'class' => 'listsubtotal', } } @columns };
1791 if (($form->{searchitems} ne 'assembly') || !$form->{bom}) {
1792 $row->{onhand}->{data} = $form->format_amount(\%myconfig, $subtotals{onhand});
1795 map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $subtotals{$_}, 2) } @subtotal_columns;
1796 map { $subtotals{$_} = 0 } ('onhand', @subtotal_columns);
1798 $report->add_data($row);
1800 $same_item = $next_ref->{ $form->{sort} };
1806 if ($form->{"l_linetotal"}) {
1807 my $row = { map { $_ => { 'class' => 'listtotal', } } @columns };
1809 map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $totals{$_}, 2) } @subtotal_columns;
1811 $report->add_separator();
1812 $report->add_data($row);
1815 $report->generate_with_headers();
1817 $lxdebug->leave_sub();
1818 } #end generate_report
1820 sub parts_subtotal {
1821 $lxdebug->enter_sub();
1824 our (%column_data, @column_index);
1825 our ($subtotalonhand, $totalsellprice, $totallastcost, $totallistprice, $subtotalsellprice, $subtotallastcost, $subtotallistprice);
1827 map { $column_data{$_} = "<td> </td>" } @column_index;
1828 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1830 $column_data{onhand} =
1831 "<th class=listsubtotal align=right>"
1832 . $form->format_amount(\%myconfig, $subtotalonhand)
1835 $column_data{linetotalsellprice} =
1836 "<th class=listsubtotal align=right>"
1837 . $form->format_amount(\%myconfig, $subtotalsellprice, 2)
1839 $column_data{linetotallistprice} =
1840 "<th class=listsubtotal align=right>"
1841 . $form->format_amount(\%myconfig, $subtotallistprice, 2)
1843 $column_data{linetotallastcost} =
1844 "<th class=listsubtotal align=right>"
1845 . $form->format_amount(\%myconfig, $subtotallastcost, 2)
1848 $subtotalonhand = 0;
1849 $subtotalsellprice = 0;
1850 $subtotallistprice = 0;
1851 $subtotallastcost = 0;
1853 print "<tr class=listsubtotal>";
1855 map { print "\n$column_data{$_}" } @column_index;
1861 $lxdebug->leave_sub();
1865 $lxdebug->enter_sub();
1866 # show history button
1867 $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
1868 #/show hhistory button
1869 IC->get_part(\%myconfig, \%$form);
1871 $form->{"original_partnumber"} = $form->{"partnumber"};
1873 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1878 $lxdebug->leave_sub();
1882 $lxdebug->enter_sub();
1884 IC->create_links("IC", \%myconfig, \%$form);
1887 map({ $form->{selectcurrency} .= "<option>$_\n" }
1888 split(/:/, $form->{currencies}));
1890 # parts and assemblies have the same links
1891 my $item = $form->{item};
1892 if ($form->{item} eq 'assembly') {
1896 # build the popup menus
1897 $form->{taxaccounts} = "";
1898 foreach my $key (keys %{ $form->{IC_links} }) {
1899 foreach my $ref (@{ $form->{IC_links}{$key} }) {
1901 # if this is a tax field
1902 if ($key =~ /IC_tax/) {
1903 if ($key =~ /\Q$item\E/) {
1904 $form->{taxaccounts} .= "$ref->{accno} ";
1905 $form->{"IC_tax_$ref->{accno}_description"} =
1906 "$ref->{accno}--$ref->{description}";
1909 if ($form->{amount}{ $ref->{accno} }) {
1910 $form->{"IC_tax_$ref->{accno}"} = "checked";
1913 $form->{"IC_tax_$ref->{accno}"} = "checked";
1918 $form->{"select$key"} .=
1919 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1920 if ($form->{amount}{$key} eq $ref->{accno}) {
1921 $form->{$key} = "$ref->{accno}--$ref->{description}";
1927 chop $form->{taxaccounts};
1929 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1930 $form->{selectIC_income} = $form->{selectIC_sale};
1931 $form->{selectIC_expense} = $form->{selectIC_cogs};
1932 $form->{IC_income} = $form->{IC_sale};
1933 $form->{IC_expense} = $form->{IC_cogs};
1936 delete $form->{IC_links};
1937 delete $form->{amount};
1939 $form->get_partsgroup(\%myconfig, { all => 1 });
1941 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1943 if (@{ $form->{all_partsgroup} }) {
1944 $form->{selectpartsgroup} = qq|<option>\n|;
1946 $form->{selectpartsgroup} .=
1947 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1948 } @{ $form->{all_partsgroup} };
1951 if ($form->{item} eq 'assembly') {
1953 foreach my $i (1 .. $form->{assembly_rows}) {
1954 if ($form->{"partsgroup_id_$i"}) {
1955 $form->{"partsgroup_$i"} =
1956 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1959 $form->get_partsgroup(\%myconfig);
1961 if (@{ $form->{all_partsgroup} }) {
1962 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1965 $form->{selectassemblypartsgroup} .=
1966 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1967 } @{ $form->{all_partsgroup} };
1970 $lxdebug->leave_sub();
1974 $lxdebug->enter_sub();
1976 my ($payment, $rows, $notes, $description, $ean, $buchungsgruppe, $partsgroup, $group, $tax, $lastcost, $eur, $linkaccounts, $weight, $n, $rop, $bin, $vegv);
1977 my ($notdiscountableok, $notdiscountable);
1978 my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop);
1980 $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
1982 map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) }
1983 qw(sellprice listprice lastcost gv));
1985 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
1986 qw(weight rop stock);
1988 foreach my $item (qw(partnumber description unit notes)) {
1989 $form->{$item} =~ s/\"/"/g;
1992 $payment = qq|<option value=""></option>|;
1993 foreach my $item (@{ $form->{payment_terms} }) {
1994 if ($form->{payment_id} eq $item->{id}) {
1995 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
1997 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
2002 if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
2007 qq|<textarea name=notes rows=$rows cols=45 wrap=soft>$form->{notes}</textarea>|;
2008 if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
2010 qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
2013 qq|<input name=description size=40 value="$form->{description}">|;
2016 $ean = qq|<input name=ean size=40 value="$form->{ean}">|;
2018 foreach my $item (split / /, $form->{taxaccounts}) {
2019 $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
2022 IC->retrieve_buchungsgruppen(\%myconfig, $form);
2023 if (@{ $form->{BUCHUNGSGRUPPEN} }) {
2024 foreach my $item (@{ $form->{BUCHUNGSGRUPPEN} }) {
2025 if ($item->{id} == $form->{buchungsgruppen_id}) {
2026 $form->{selectbuchungsgruppe} .=
2027 "<option value=$item->{id} selected>$item->{description}\n";
2028 } elsif (($form->{id} && $form->{orphaned}) || (!$form->{id})) {
2029 $form->{selectbuchungsgruppe} .=
2030 "<option value=$item->{id}>$item->{description}\n";
2036 $buchungsgruppe = qq|
2038 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2039 <td><select name=buchungsgruppen_id>$form->{selectbuchungsgruppe}</select></td>
2044 foreach my $item (qw(IC IC_income IC_expense)) {
2045 if ($form->{$item}) {
2046 if ($form->{id} && $form->{orphaned}) {
2047 $form->{"select$item"} =~ s/ selected//;
2048 $form->{"select$item"} =~
2049 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2051 $form->{"select$item"} = qq|<option selected>$form->{$item}|;
2056 if ($form->{selectpartsgroup}) {
2057 $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2059 qq|<input type=hidden name=selectpartsgroup value="|
2060 . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
2061 $form->{selectpartsgroup} =~
2062 s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
2065 qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
2066 $group = $locale->text('Group');
2070 foreach my $item (split / /, $form->{taxaccounts}) {
2072 <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
2073 <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
2077 $form->{obsolete} = "checked" if $form->{obsolete};
2081 <th align="right" nowrap="true">|
2082 . $locale->text('Last Cost') . qq|</th>
2083 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2089 <th align=right>| . $locale->text('Inventory') . qq|</th>
2090 <td><select name=IC>$form->{selectIC}</select></td>
2091 <input name=selectIC type=hidden value="$form->{selectIC}">
2095 if ($form->{item} eq "part") {
2097 $linkaccounts .= qq|
2099 <th align=right>| . $locale->text('Revenue') . qq|</th>
2100 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2101 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2104 <th align=right>| . $locale->text('Expense') . qq|</th>
2105 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2106 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2112 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2117 <input name=weight size=10 value=$form->{weight}>
2127 if ($form->{item} eq "assembly") {
2133 <th align=right>| . $locale->text('Revenue') . qq|</th>
2134 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2135 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2141 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2146 $form->{weight}
2147 <input type=hidden name=weight value=$form->{weight}>
2157 if ($form->{item} eq "service") {
2161 <th align=right>| . $locale->text('Revenue') . qq|</th>
2162 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2163 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2166 <th align=right>| . $locale->text('Expense') . qq|</th>
2167 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2168 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2173 $linkaccounts = qq|<input type=hidden name=IC_income value="$form->{IC_income_default}">|;
2175 if ($form->{IC_cogs_default}) {
2176 $form->{IC_expense_default} = $form->{IC_cogs_default};
2179 if (($form->{item} eq "service") || ($form->{item} eq "part")) {
2180 $linkaccounts .= qq|<input type=hidden name=IC_expense value="$form->{IC_expense_default}">|;
2182 if ($form->{item} eq "part") {
2183 $linkaccounts .= qq|<input type=hidden name=IC value="$form->{IC_default}">|;
2186 if ($form->{item} ne 'service') {
2187 $n = ($form->{onhand} > 0) ? "1" : "0";
2190 <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2191 <th align=left nowrap class="plus$n"> |
2192 . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
2196 if ($form->{item} eq 'assembly') {
2199 <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
2200 <td><input name=stock size=10 value=$form->{stock}></td>
2207 <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
2208 <td><input name=rop size=10 value=$form->{rop}></td>
2214 <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
2215 <td><input name=bin size=10 value=$form->{bin}></td>
2220 <th align="right" nowrap="true">|
2221 . $locale->text('Verrechnungseinheit') . qq|</th>
2222 <td><input name=ve size=10 value=$form->{ve}></td>
2225 <th align="right" nowrap="true">|
2226 . $locale->text('Business Volume') . qq|</th>
2227 <td><input name=gv size=10 value=$form->{gv}></td>
2230 $notdiscountableok = ($form->{not_discountable}) == 1 ? "checked" : "";
2231 $notdiscountable .= qq|
2233 <th align=right nowrap>|
2234 . $locale->text('Not Discountable') . qq|</th>
2235 <td><input class=checkbox type=checkbox name=not_discountable value=1 $notdiscountableok></td>
2240 qq|<ilayer><layer onmouseover="this.T_STICKY=true;this.T_STATIC=true;return escape('| . $locale->text('The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>') . qq|')"><textarea name=formel rows=4 cols=30 wrap=soft>$form->{formel}</textarea></layer><ilayer>|;
2242 $formula_label = $locale->text('Formula');
2249 <th align=right nowrap>| . $locale->text('Image') . qq|</th>
2250 <td><input name=image size=40 value="$form->{image}"></td>
2251 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
2252 <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
2255 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
2256 <td><input name=drawing size=40 value="$form->{drawing}"></td>
2268 <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
2269 <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
2273 $shopok = $form->{shop} == 1 ? "checked" : "";
2276 <th align=right nowrap>|
2277 . $locale->text('Shopartikel') . qq|</th>
2278 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2283 # type=submit $locale->text('Add Part')
2284 # type=submit $locale->text('Add Service')
2285 # type=submit $locale->text('Add Assembly')
2287 # type=submit $locale->text('Edit Part')
2288 # type=submit $locale->text('Edit Service')
2289 # type=submit $locale->text('Edit Assembly')
2290 # use JavaScript Calendar or not
2291 my ($jsscript, $button1);
2292 $form->{jsscript} = 1;
2294 if ($form->{jsscript}) {
2296 # with JavaScript Calendar
2298 <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2299 <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2300 . $locale->text('button') . qq|></td>
2305 Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1");
2308 # without JavaScript Calendar
2310 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
2313 my $unit_select = '<input type="hidden" name="unit_changeable" value="' . $form->{"unit_changeable"} . '">';
2314 if (!$form->{"unit_changeable"}) {
2315 $unit_select .= '<input type="hidden" name="unit" value="' . $form->{"unit"} . '">' . $form->{"unit"};
2317 my $units = AM->retrieve_units(\%myconfig, $form, $form->{"item"} eq "service" ? "service" : "dimension");
2318 $unit_select .= AM->unit_select_html($units, "unit", $form->{"unit"});
2322 if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) {
2323 my @values = ('', map { $_->{id} } @{ $form->{ALL_PRICE_FACTORS} });
2324 my %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} };
2327 qq|<tr><th align="right">|
2328 . $locale->text('Price Factor')
2330 . NTI($cgi->popup_menu('-name' => 'price_factor_id',
2331 '-default' => $form->{price_factor_id},
2332 '-values' => \@values,
2333 '-labels' => \%labels))
2337 $form->{fokus} = "ic.partnumber";
2341 <body onLoad="fokus()">
2342 <script type="text/javascript" src="js/common.js"></script>
2343 <script type="text/javascript" src="js/parts_language_selection.js"></script>
2345 <form method=post name="ic" action=$form->{script}>
2347 <input name=id type=hidden value=$form->{id}>
2348 <input name=item type=hidden value=$form->{item}>
2349 <input name=title type=hidden value="$form->{title}">
2350 <input name=makemodel type=hidden value="$form->{makemodel}">
2351 <input name=alternate type=hidden value="$form->{alternate}">
2352 <input name=onhand type=hidden value=$form->{onhand}>
2353 <input name=orphaned type=hidden value=$form->{orphaned}>
2354 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2355 <input name=rowcount type=hidden value=$form->{rowcount}>
2356 <input name=eur type=hidden value=$eur>
2357 <input name=language_values type=hidden value="$form->{language_values}">
2358 <input name="original_partnumber" type="hidden" value="| . $form->quote($form->{"original_partnumber"}) . qq|">
2360 <table width="100%">
2362 <th class=listtop>$form->{title}</th>
2364 <tr height="5"></tr>
2367 <table width="100%">
2369 <th align=left>| . $locale->text('Part Number') . qq|</th>
2370 <th align=left>| . $locale->text('Part Description') . qq|</th>
2371 <th align=left>$group</th>
2374 <td><input name=partnumber value="$form->{partnumber}" size=20></td>
2375 <td>$description</td>
2376 <td>$partsgroup</td>
2377 <input type=hidden name=oldpartsgroup value="$form->{oldpartsgroup}">
2384 <table width="100%" height="100%">
2387 <table width="100%" height="100%">
2397 <th align="left">| . $locale->text('Notes') . qq|</th>
2398 <th align="left">$formula_label</th>
2409 <th align="left"></th>
2410 <th align="left">| . $locale->text('EAN-Code') . qq|</th>
2414 <button type="button" onclick="parts_language_selection_window('language_values')">| . $locale->text('Set Language Values') . qq|</button>
2424 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
2425 <td><select name=payment_id>$payment</select></td>
2433 <table width="100%">
2435 <th align="right" nowrap="true">|
2436 . $locale->text('Updated') . qq|</th>
2440 <th align="right" nowrap="true">| . $locale->text('List Price') . qq|</th>
2441 <td><input name=listprice size=11 value=$form->{listprice}></td>
2444 <th align="right" nowrap="true">| . $locale->text('Sell Price') . qq|</th>
2445 <td><input name=sellprice size=11 value=$form->{sellprice}></td>
2450 <th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
2451 <td>$unit_select</td>
2470 $lxdebug->leave_sub();
2474 $lxdebug->enter_sub();
2476 if ($form->{item} eq "assembly") {
2481 <table width="100%">
2483 <th colspan=2 align=right>|
2484 . $locale->text('Total') . qq| </th>
2486 . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
2491 <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
2496 <input type=hidden name=login value=$form->{login}>
2497 <input type=hidden name=password value=$form->{password}>
2498 <input type=hidden name=callback value="$form->{callback}">
2499 <input type=hidden name=previousform value="$form->{previousform}">
2500 <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
2501 <input type=hidden name=vc value=$form->{vc}>
2503 <td><hr size=3 noshade></td>
2508 <input class=submit type=submit name=action value="|
2509 . $locale->text('Update') . qq|">
2512 unless ($form->{item} eq "service") {
2514 <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
2519 <input type=hidden name=price_rows value=$form->{price_rows}>|;
2522 <input class=submit type=submit name=action value="|
2523 . $locale->text('Save') . qq|">|;
2527 if (!$form->{previousform}) {
2529 <input class=submit type=submit name=action value="|
2530 . $locale->text('Save as new') . qq|">|;
2533 if ($form->{orphaned}) {
2534 if (!$form->{previousform}) {
2535 if ($form->{item} eq 'assembly') {
2536 if (!$form->{onhand}) {
2538 <input class=submit type=submit name=action value="|
2539 . $locale->text('Delete') . qq|">|;
2543 <input class=submit type=submit name=action value="|
2544 . $locale->text('Delete') . qq|">|;
2550 if (!$form->{previousform}) {
2551 if ($form->{menubar}) {
2552 require "bin/mozilla/menu.pl";
2556 # button for saving history
2557 if($form->{id} ne "") {
2559 <input type=button class=submit onclick=set_history_window(|
2561 . qq|); name=history id=history value=|
2562 . $locale->text('history')
2565 # /button for saving history
2570 <script type="text/javascript" src="js/wz_tooltip.js"></script>
2576 $lxdebug->leave_sub();
2580 $lxdebug->enter_sub();
2588 <th class="listheading">| . $locale->text('Make') . qq|</th>
2589 <th class="listheading">| . $locale->text('Model') . qq|</th>
2593 for my $i (1 .. $numrows) {
2594 $form->{"make_$i"} =~ s/\"/"/g;
2595 $form->{"model_$i"} =~ s/\"/"/g;
2598 <td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
2599 <td width=50%><input name="model_$i" size=30 value="$form->{"model_$i"}"></td>
2610 $lxdebug->leave_sub();
2614 $lxdebug->enter_sub();
2616 my (@column_index, %column_data, %column_header);
2617 my ($nochange, $callback, $previousform, $linetotal, $href);
2619 our ($deliverydate); # ToDO: cjeck if this indeed comes from global context
2622 qw(runningnumber qty unit bom partnumber description partsgroup total);
2624 if ($form->{previousform}) {
2626 @column_index = qw(qty unit bom partnumber description partsgroup total);
2630 $form->{old_callback} = $form->{callback};
2631 $callback = $form->{callback};
2632 $form->{callback} = "$form->{script}?action=display_form";
2635 map { delete $form->{$_} } qw(action header);
2639 # save form variables in a previousform variable
2640 foreach my $key (sort keys %$form) {
2643 $form->{$key} =~ s/&/%26/g;
2644 $previousform .= qq|$key=$form->{$key}&|;
2647 $previousform = $form->escape($form->escape($previousform, 1));
2648 $form->{callback} = $callback;
2650 $form->{assemblytotal} = 0;
2651 $form->{weight} = 0;
2654 $column_header{runningnumber} =
2655 qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
2656 $column_header{qty} =
2657 qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
2658 $column_header{unit} =
2659 qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
2660 $column_header{partnumber} =
2661 qq|<th align=left nowrap width=20%>|
2662 . $locale->text('Part Number')
2664 $column_header{description} =
2665 qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
2666 $column_header{total} =
2667 qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
2668 $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
2669 $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
2672 <tr class=listheading>
2673 <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
2681 map { print "\n$column_header{$_}" } @column_index;
2687 for my $i (1 .. $numrows) {
2688 $form->{"partnumber_$i"} =~ s/\"/"/g;
2691 $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
2692 $form->{assemblytotal} += $linetotal;
2694 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
2696 $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
2698 if (($i >= 1) && ($i == $numrows)) {
2701 map { $column_data{$_} = qq|<td></td>| }
2702 qw(qty unit partnumber description bom partsgroup);
2705 map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
2708 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2709 $column_data{partnumber} =
2710 qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
2711 $column_data{description} =
2712 qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
2713 $column_data{partsgroup} =
2714 qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
2720 if ($form->{previousform}) {
2721 $column_data{partnumber} =
2722 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
2724 qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
2727 qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
2728 $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
2729 $column_data{bom} .= qq|</td>|;
2731 $column_data{partsgroup} =
2732 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2736 qq|$form->{script}?action=edit&id=$form->{"id_$i"}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
2737 $column_data{partnumber} =
2738 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
2739 $column_data{runningnumber} =
2740 qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
2742 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2744 $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
2746 qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
2748 $column_data{partsgroup} =
2749 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2752 $column_data{unit} =
2753 qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
2754 $column_data{description} =
2755 qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
2758 $column_data{total} = qq|<td align=right>$linetotal</td>|;
2760 $column_data{deliverydate} = qq|<td align=right>$deliverydate</td>|;
2765 map { print "\n$column_data{$_}" } @column_index;
2769 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2770 <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
2771 <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
2781 $lxdebug->leave_sub();
2785 $lxdebug->enter_sub();
2787 if ($form->{item} eq "assembly") {
2788 my $i = $form->{assembly_rows};
2790 # if last row is empty check the form otherwise retrieve item
2791 if ( ($form->{"partnumber_$i"} eq "")
2792 && ($form->{"description_$i"} eq "")
2793 && ($form->{"partsgroup_$i"} eq "")) {
2799 IC->assembly_item(\%myconfig, \%$form);
2801 my $rows = scalar @{ $form->{item_list} };
2804 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2807 $form->{makemodel_rows}--;
2811 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
2812 qw(partnumber description unit partsgroup);
2813 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
2814 keys %{ $form->{item_list}[0] };
2815 $form->{"runningnumber_$i"} = $form->{assembly_rows};
2816 $form->{assembly_rows}++;
2824 $form->{rowcount} = $i;
2825 $form->{assembly_rows}++;
2832 } elsif (($form->{item} eq 'part') || ($form->{item} eq 'service')) {
2836 $lxdebug->leave_sub();
2840 $lxdebug->enter_sub();
2842 my ($parts_id, %newform, $previousform, $amount, $callback);
2844 # check if there is a part number - commented out, cause there is an automatic allocation of numbers
2845 # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
2847 # check if there is a description
2848 $form->isblank("description", $locale->text("Part Description missing!"));
2850 if ($form->{obsolete}) {
2853 "Inventory quantity must be zero before you can set this $form->{item} obsolete!"
2855 if ($form->{onhand} * 1);
2858 if (!$form->{buchungsgruppen_id}) {
2859 $form->error($locale->text("Parts must have an entry type.") . " " .
2860 $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.")
2864 $form->error($locale->text('Description must not be empty!')) unless $form->{description};
2865 $form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber};
2867 # expand dynamic strings
2868 # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
2869 # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
2870 # $locale->text('Part Number missing!')
2871 # $locale->text('Service Number missing!')
2872 # $locale->text('Assembly Number missing!')
2875 $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n");
2876 if (IC->save(\%myconfig, \%$form) == 3) {
2877 $form->error($locale->text('Partnumber not unique!'));
2879 # saving the history
2880 if(!exists $form->{addition}) {
2881 $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
2882 $form->{addition} = "SAVED";
2883 $form->save_history($form->dbconnect(\%myconfig));
2885 # /saving the history
2886 $parts_id = $form->{id};
2889 # load previous variables
2890 if ($form->{previousform}) {
2892 # save the new form variables before splitting previousform
2893 map { $newform{$_} = $form->{$_} } keys %$form;
2895 $previousform = $form->unescape($form->{previousform});
2897 # don't trample on previous variables
2898 map { delete $form->{$_} } keys %newform;
2900 # now take it apart and restore original values
2901 foreach my $item (split /&/, $previousform) {
2902 my ($key, $value) = split m/=/, $item, 2;
2903 $value =~ s/%26/&/g;
2904 $form->{$key} = $value;
2906 $form->{taxaccounts} = $newform{taxaccount2};
2908 if ($form->{item} eq 'assembly') {
2910 # undo number formatting
2911 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2912 qw(weight listprice sellprice rop);
2914 $form->{assembly_rows}--;
2915 $i = $newform{rowcount};
2916 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2918 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
2919 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
2921 # change/add values for assembly item
2922 map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id);
2924 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
2925 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
2929 # set values for last invoice/order item
2930 $i = $form->{rowcount};
2931 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2933 map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id);
2935 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
2937 if ($form->{exchangerate} != 0) {
2938 $form->{"sellprice_$i"} /= $form->{exchangerate};
2941 $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|);
2943 map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount};
2944 chop $form->{"taxaccounts_$i"};
2945 foreach my $item (qw(description rate taxnumber)) {
2946 my $index = $form->{"taxaccounts_$i"} . "_$item";
2947 $form->{$index} = $newform{$index};
2950 # credit remaining calculation
2951 $amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
2953 map { $form->{"${_}_base"} += $amount } (split / /, $form->{"taxaccounts_$i"});
2954 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded};
2956 $form->{creditremaining} -= $amount;
2958 # redo number formatting, because invoice parse them!
2959 map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } qw(weight listprice sellprice rop);
2962 $form->{"id_$i"} = $parts_id;
2964 # Get the actual price factor (not just the ID) for the marge calculation.
2965 $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
2966 foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) {
2967 next if ($pfac->{id} != $newform{price_factor_id});
2968 $form->{"marge_price_factor_$i"} = $pfac->{factor};
2971 delete $form->{ALL_PRICE_FACTORS};
2973 delete $form->{action};
2975 # restore original callback
2976 $callback = $form->unescape($form->{callback});
2977 $form->{callback} = $form->unescape($form->{old_callback});
2978 delete $form->{old_callback};
2980 $form->{makemodel_rows}--;
2982 # put callback together
2983 foreach my $key (keys %$form) {
2985 # do single escape for Apache 2.0
2986 my $value = $form->escape($form->{$key}, 1);
2987 $callback .= qq|&$key=$value|;
2989 $form->{callback} = $callback;
2991 $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|);
2996 $lxdebug->leave_sub();
3000 $lxdebug->enter_sub();
3002 # saving the history
3003 if(!exists $form->{addition}) {
3004 $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
3005 $form->{addition} = "SAVED AS NEW";
3006 $form->save_history($form->dbconnect(\%myconfig));
3008 # /saving the history
3010 if ($form->{"original_partnumber"} &&
3011 ($form->{"partnumber"} eq $form->{"original_partnumber"})) {
3012 $form->{partnumber} = "";
3015 $lxdebug->leave_sub();
3019 $lxdebug->enter_sub();
3020 # saving the history
3021 if(!exists $form->{addition}) {
3022 $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
3023 $form->{addition} = "DELETED";
3024 $form->save_history($form->dbconnect(\%myconfig));
3026 # /saving the history
3027 my $rc = IC->delete(\%myconfig, \%$form);
3030 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
3031 $form->error($locale->text('Cannot delete item!'));
3033 $lxdebug->leave_sub();
3037 $lxdebug->enter_sub();
3046 <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
3047 <th class="listheading">| . $locale->text('Preis') . qq|</th>
3050 for my $i (1 .. $numrows) {
3053 <td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
3054 <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
3055 <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
3066 $lxdebug->leave_sub();
3069 sub parts_language_selection {
3070 $lxdebug->enter_sub();
3074 my $languages = IC->retrieve_languages(\%myconfig, $form);
3076 if ($form->{language_values} ne "") {
3077 foreach $item (split(/---\+\+\+---/, $form->{language_values})) {
3078 my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
3080 foreach my $language (@{ $languages }) {
3081 next unless ($language->{id} == $language_id);
3083 $language->{translation} = $translation;
3084 $language->{longdescription} = $longdescription;
3090 my @header_sort = qw(name longdescription);
3091 my %header_title = ( "name" => $locale->text("Name"),
3092 "longdescription" => $locale->text("Long Description"),
3096 map(+{ "column_title" => $header_title{$_},
3098 "callback" => $callback,
3102 $form->{"title"} = $locale->text("Language Values");
3104 print $form->parse_html_template2("ic/parts_language_selection", { "HEADER" => \@header,
3105 "LANGUAGES" => $languages,
3106 "onload" => $onload });
3108 $lxdebug->leave_sub();
3111 sub continue { call_sub($form->{"nextsub"}); }