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 #======================================================================
39 require "$form->{path}/io.pl";
46 $lxdebug->enter_sub();
48 $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
51 "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
52 unless $form->{callback};
55 ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea');
56 IC->get_pricegroups(\%myconfig, \%$form);
60 $lxdebug->leave_sub();
64 $lxdebug->enter_sub();
66 $form->{title} = (ucfirst $form->{searchitems}) . "s";
67 $form->{title} = $locale->text($form->{title});
69 # switch for backward sorting
72 # memory for which table was sort at last time
73 $form->{lastsort} = "";
75 # counter for added entries to top100
76 $form->{ndxs_counter} = 0;
78 # $locale->text('Parts')
79 # $locale->text('Services')
81 # use JavaScript Calendar or not
82 $form->{jsscript} = $jscalendar;
84 if ($form->{jsscript}) {
86 # with JavaScript Calendar
88 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
89 <td><input type=button name=transdatefrom id="trigger1" value=|
90 . $locale->text('button') . qq|></td>
93 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
94 <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
95 . $locale->text('button') . qq|></td>
100 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1",
101 "transdateto", "BL", "trigger2");
104 # without JavaScript Calendar
106 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
108 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
111 unless ($form->{searchitems} eq 'service') {
114 <input name=itemstatus class=radio type=radio value=onhand> |
115 . $locale->text('On Hand') . qq|
116 <input name=itemstatus class=radio type=radio value=short> |
117 . $locale->text('Short') . qq|
122 <th align=right nowrap>| . $locale->text('Make') . qq|</th>
123 <td><input name=make size=20></td>
124 <th align=right nowrap>| . $locale->text('Model') . qq|</th>
125 <td><input name=model size=20></td>
130 <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th>
131 <td><input name=serialnumber size=20></td>
134 $l_serialnumber = qq|
135 <td><input name=l_serialnumber class=checkbox type=checkbox value=Y> |
136 . $locale->text('Serial Number') . qq|</td>
141 if ($form->{searchitems} eq 'assembly') {
143 $form->{title} = $locale->text('Assemblies');
149 <input name=null class=radio type=radio value=1 checked> |
150 . $locale->text('Top Level') . qq|
151 <input name=bom class=checkbox type=checkbox value=1> |
152 . $locale->text('Individual Items') . qq|
166 <td><input name=sold class=checkbox type=checkbox value=1></td>
167 <td nowrap>| . $locale->text('Sold') . qq|</td>
170 <td colspan=2><hr size=1 noshade></td>
173 <td><input name=ordered class=checkbox type=checkbox value=1></td>
174 <td nowrap>| . $locale->text('Ordered') . qq|</td>
177 <td colspan=4><hr size=1 noshade></td>
180 <td><input name=quoted class=checkbox type=checkbox value=1></td>
181 <td nowrap>| . $locale->text('Quoted') . qq|</td>
185 <td width=5%> </td>
186 <th>| . $locale->text('From') . qq|</th>
188 <th>| . $locale->text('To') . qq|</th>
207 <td><input name=bought class=checkbox type=checkbox value=1></td>
208 <td nowrap>| . $locale->text('Bought') . qq|</td>
209 <td><input name=sold class=checkbox type=checkbox value=1></td>
210 <td nowrap>| . $locale->text('Sold') . qq|</td>
213 <td colspan=4><hr size=1 noshade></td>
216 <td><input name=onorder class=checkbox type=checkbox value=1></td>
217 <td nowrap>| . $locale->text('On Order') . qq|</td>
218 <td><input name=ordered class=checkbox type=checkbox value=1></td>
219 <td nowrap>| . $locale->text('Ordered') . qq|</td>
222 <td colspan=4><hr size=1 noshade></td>
225 <td><input name=rfq class=checkbox type=checkbox value=1></td>
226 <td nowrap>| . $locale->text('RFQ') . qq|</td>
227 <td><input name=quoted class=checkbox type=checkbox value=1></td>
228 <td nowrap>| . $locale->text('Quoted') . qq|</td>
232 <td width=5%> </td>
236 <th>| . $locale->text('From') . qq|</th>
238 <th>| . $locale->text('To') . qq|</th>
255 <form method=post action=$form->{script}>
257 <input type=hidden name=searchitems value=$form->{searchitems}>
258 <input type=hidden name=title value="$form->{title}">
260 <input type=hidden name=revers value="$form->{revers}">
261 <input type=hidden name=lastsort value="$form->{lastsort}">
264 <tr><th class=listtop>$form->{title}</th></tr>
270 <th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
271 <td><input name=partnumber size=20></td>
274 <th align=right nowrap>|
275 . $locale->text('Part Description') . qq|</th>
276 <td colspan=3><input name=description size=40></td>
279 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
280 <td><input name=partsgroup size=20></td>
285 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
286 <td><input name=drawing size=20></td>
287 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
288 <td><input name=microfiche size=20></td>
294 <input name=itemstatus class=radio type=radio value=active checked> |
295 . $locale->text('Active') . qq|
297 <input name=itemstatus class=radio type=radio value=obsolete> |
298 . $locale->text('Obsolete') . qq|
299 <input name=itemstatus class=radio type=radio value=orphaned> |
300 . $locale->text('Orphaned') . qq|
311 <th align=right nowrap>|
312 . $locale->text('Include in Report') . qq|</th>
316 <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked> |
317 . $locale->text('Part Number') . qq|</td>
318 <td><input name=l_description class=checkbox type=checkbox value=Y checked> |
319 . $locale->text('Part Description') . qq|</td>
321 <td><input name=l_unit class=checkbox type=checkbox value=Y checked> |
322 . $locale->text('Unit of measure') . qq|</td>
325 <td><input name=l_listprice class=checkbox type=checkbox value=Y> |
326 . $locale->text('List Price') . qq|</td>
327 <td><input name=l_sellprice class=checkbox type=checkbox value=Y checked> |
328 . $locale->text('Sell Price') . qq|</td>
329 <td><input name=l_lastcost class=checkbox type=checkbox value=Y> |
330 . $locale->text('Last Cost') . qq|</td>
331 <td><input name=l_linetotal class=checkbox type=checkbox value=Y checked> |
332 . $locale->text('Line Total') . qq|</td>
335 <td><input name=l_priceupdate class=checkbox type=checkbox value=Y> |
336 . $locale->text('Updated') . qq|</td>
337 <td><input name=l_bin class=checkbox type=checkbox value=Y> |
338 . $locale->text('Bin') . qq|</td>
339 <td><input name=l_rop class=checkbox type=checkbox value=Y> |
340 . $locale->text('ROP') . qq|</td>
341 <td><input name=l_weight class=checkbox type=checkbox value=Y> |
342 . $locale->text('Weight') . qq|</td>
345 <td><input name=l_image class=checkbox type=checkbox value=Y> |
346 . $locale->text('Image') . qq|</td>
347 <td><input name=l_drawing class=checkbox type=checkbox value=Y> |
348 . $locale->text('Drawing') . qq|</td>
349 <td><input name=l_microfiche class=checkbox type=checkbox value=Y> |
350 . $locale->text('Microfiche') . qq|</td>
351 <td><input name=l_partsgroup class=checkbox type=checkbox value=Y> |
352 . $locale->text('Group') . qq|</td>
355 <td><input name=l_subtotal class=checkbox type=checkbox value=Y> |
356 . $locale->text('Subtotal') . qq|</td>
357 <td><input name=l_soldtotal class=checkbox type=checkbox value=Y> |
358 . $locale->text('soldtotal') . qq|</td>
359 <td><input name=l_deliverydate class=checkbox type=checkbox value=Y> |
360 . $locale->text('deliverydate') . qq|</td>
368 <tr><td colspan=4><hr size=3 noshade></td></tr>
373 <input type=hidden name=nextsub value=generate_report>
375 <input type=hidden name=path value=$form->{path}>
376 <input type=hidden name=login value=$form->{login}>
377 <input type=hidden name=password value=$form->{password}>
379 <input type=hidden name=revers value="$form->{revers}">
380 <input type=hidden name=lastsort value="$form->{lastsort}">
382 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
385 <input class=submit type=submit name=action value="|
386 . $locale->text('Continue') . qq|">
387 <input class=submit type=submit name=action value="|
388 . $locale->text('TOP100') . qq|">
394 $lxdebug->leave_sub();
398 $lxdebug->enter_sub();
400 $form->{title} = $locale->text('Top 100 hinzufuegen');
407 <form method=post action=$form->{script}>
409 <input type=hidden name=searchitems value=$form->{searchitems}>
410 <input type=hidden name=title value="$form->{title}">
412 <input type=hidden name=revers value="$form->{revers}">
413 <input type=hidden name=lastsort value="$form->{lastsort}">|;
417 <tr class=listheading>
418 <th class=listheading nowrap>|
419 . $locale->text('Part Number') . qq|</th>
420 <th class=listheading nowrap>|
421 . $locale->text('Part Description') . qq|</th>
424 <td><input type=text name=partnumber size=20 value=></td>
425 <td><input type=text name=description size=30 value=></td>
432 <input type=hidden name=path value=$form->{path}>
433 <input type=hidden name=login value=$form->{login}>
434 <input type=hidden name=password value=$form->{password}>
436 <input type=hidden name=itemstatus value="$form->{itemstatus}">
437 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
438 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
439 <input type=hidden name=l_description value="$form->{l_description}">
440 <input type=hidden name=l_onhand value="$form->{l_onhand}">
441 <input type=hidden name=l_unit value="$form->{l_unit}">
442 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
443 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
444 <input type=hidden name=sort value="$form->{sort}">
445 <input type=hidden name=revers value="$form->{revers}">
446 <input type=hidden name=lastsort value="$form->{lastsort}">
448 <input type=hidden name=bom value="$form->{bom}">
449 <input type=hidden name=titel value="$form->{titel}">
450 <input type=hidden name=searchitems value="$form->{searchitems}">
452 <input type=hidden name=row value=$j>
454 <input type=hidden name=nextsub value=item_selected>
456 <input type=hidden name=test value=item_selected>
458 <input name=lastndx type=hidden value=$lastndx>
460 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>
462 <input name=extras type=hidden value=$form->{extras}>|;
466 for ($i = 0; $i < $form->{ndxs_counter}; $i++) {
469 $partnumber = $form->{"totop100_partnumber_$j"};
470 $description = $form->{"totop100_description_$j"};
471 $unit = $form->{"totop100_unit_$j"};
472 $sellprice = $form->{"totop100_sellprice_$j"};
473 $soldtotal = $form->{"totop100_soldtotal_$j"};
475 # insert data into top100
476 push @{ $form->{parts} },
478 partnumber => "$partnumber",
479 description => "$description",
481 sellprice => "$sellprice",
482 soldtotal => "$soldtotal" };
488 # set data for next page
489 if (($form->{ndxs_counter}) > 0) {
490 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
491 $partnumber = $form->{"totop100_partnumber_$i"};
492 $description = $form->{"totop100_description_$i"};
493 $unit = $form->{"totop100_unit_$i"};
494 $sellprice = $form->{"totop100_sellprice_$i"};
495 $soldtotal = $form->{"totop100_soldtotal_$i"};
498 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
499 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
500 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
501 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
502 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
510 <input class=submit type=submit name=action value="|
511 . $locale->text('list') . qq|">
516 $lxdebug->leave_sub();
520 $lxdebug->enter_sub();
523 if (($form->{partnumber} eq "") and ($form->{description} eq "")) {
524 IC->get_parts(\%myconfig, \%$form, "");
526 if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) {
527 IC->get_parts(\%myconfig, \%$form, "partnumber");
529 if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) {
530 IC->get_parts(\%myconfig, \%$form, "description");
532 IC->get_parts(\%myconfig, \%$form, "all");
537 $form->{title} = $locale->text('Top 100 hinzufuegen');
543 <form method=post action=ic.pl>
546 <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
549 <tr class=listheading>
551 <th class=listheading>| . $locale->text('Part Number') . qq|</th>
552 <th class=listheading>| . $locale->text('Part Description') . qq|</th>
553 <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
554 <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
555 <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
559 my $i = $form->{rows};
561 for ($j = 1; $j <= $i; $j++) {
564 <tr class=listrow1>|;
567 <td><input name=ndx class=radio type=radio value=$j checked></td>|;
570 <td><input name=ndx class=radio type=radio value=$j></td>|;
573 <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
574 <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
575 <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
576 <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
577 <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
580 <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
590 <input type=hidden name=path value=$form->{path}>
591 <input type=hidden name=login value=$form->{login}>
592 <input type=hidden name=password value=$form->{password}>
594 <input type=hidden name=itemstatus value="$form->{itemstatus}">
595 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
596 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
597 <input type=hidden name=l_description value="$form->{l_description}">
598 <input type=hidden name=l_onhand value="$form->{l_onhand}">
599 <input type=hidden name=l_unit value="$form->{l_unit}">
600 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
601 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
602 <input type=hidden name=sort value="$form->{sort}">
603 <input type=hidden name=revers value="$form->{revers}">
604 <input type=hidden name=lastsort value="$form->{lastsort}">
606 <input type=hidden name=bom value="$form->{bom}">
607 <input type=hidden name=titel value="$form->{titel}">
608 <input type=hidden name=searchitems value="$form->{searchitems}">
610 <input type=hidden name=row value=$j>
612 <input type=hidden name=nextsub value=item_selected>
614 <input name=lastndx type=hidden value=$lastndx>
616 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
620 if (($form->{ndxs_counter}) > 0) {
621 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
622 $j1 = $form->{"totop100_partnumber_$i"};
623 $j2 = $form->{"totop100_description_$i"};
624 $j3 = $form->{"totop100_unit_$i"};
625 $j4 = $form->{"totop100_sellprice_$i"};
626 $j5 = $form->{"totop100_soldtotal_$i"};
635 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
636 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
637 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
638 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
639 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
647 <input class=submit type=submit name=action value="|
648 . $locale->text('TOP100') . qq|">
654 $lxdebug->leave_sub();
658 $lxdebug->enter_sub();
661 $form->{ndxs_counter}++;
663 if ($form->{ndxs_counter} > 0) {
665 $index = $form->{ndx};
667 $j1 = $form->{"new_partnumber_$index"};
668 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $j1;
669 $j2 = $form->{"new_description_$index"};
670 $form->{"totop100_description_$form->{ndxs_counter}"} = $j2;
671 $j3 = $form->{"new_unit_$index"};
672 $form->{"totop100_unit_$form->{ndxs_counter}"} = $j3;
673 $j4 = $form->{"new_sellprice_$index"};
674 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $j4;
675 $j5 = $form->{"new_soldtotal_$index"};
676 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $j5;
680 $lxdebug->leave_sub();
684 $lxdebug->enter_sub();
686 $form->{top100} = "top100";
687 $form->{l_soldtotal} = "Y";
688 $form->{soldtotal} = "soldtotal";
689 $form->{sort} = "soldtotal";
690 $form->{l_qty} = "N";
691 $callback .= "&form->{top100}=$form->{top100}";
692 $form->{l_linetotal} = "";
694 $form->{number} = "position";
695 $form->{l_number} = "Y";
699 $form->{title} = $locale->text('Top 100');
701 $revers = $form->{revers};
702 $lastsort = $form->{lastsort};
704 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
706 $form->{lastsort} = "partnumber";
707 $form->{sort} = "partnumber";
711 "$form->{script}?action=top100&path=$form->{path}&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
712 . $form->escape($form->{title}, 1);
714 # if we have a serialnumber limit search
715 if ($form->{serialnumber} || $form->{l_serialnumber}) {
716 $form->{l_serialnumber} = "Y";
717 unless ( $form->{bought}
720 || $form->{quoted}) {
721 $form->{bought} = $form->{sold} = 1;
724 IC->all_parts(\%myconfig, \%$form);
726 if ($form->{itemstatus} eq 'active') {
727 $option .= $locale->text('Active') . " : ";
729 if ($form->{itemstatus} eq 'obsolete') {
730 $option .= $locale->text('Obsolete') . " : ";
732 if ($form->{itemstatus} eq 'orphaned') {
733 $option .= $locale->text('Orphaned') . " : ";
735 if ($form->{itemstatus} eq 'onhand') {
736 $option .= $locale->text('On Hand') . " : ";
737 $form->{l_onhand} = "Y";
739 if ($form->{itemstatus} eq 'short') {
740 $option .= $locale->text('Short') . " : ";
741 $form->{l_onhand} = "Y";
743 if ($form->{onorder}) {
744 $form->{l_ordnumber} = "Y";
745 $callback .= "&onorder=$form->{onorder}";
746 $option .= $locale->text('On Order') . " : ";
748 if ($form->{ordered}) {
749 $form->{l_ordnumber} = "Y";
750 $callback .= "&ordered=$form->{ordered}";
751 $option .= $locale->text('Ordered') . " : ";
754 $form->{l_quonumber} = "Y";
755 $callback .= "&rfq=$form->{rfq}";
756 $option .= $locale->text('RFQ') . " : ";
758 if ($form->{quoted}) {
759 $form->{l_quonumber} = "Y";
760 $callback .= ""ed=$form->{quoted}";
761 $option .= $locale->text('Quoted') . " : ";
763 if ($form->{bought}) {
764 $form->{l_invnumber} = "Y";
765 $callback .= "&bought=$form->{bought}";
766 $option .= $locale->text('Bought') . " : ";
769 $form->{l_invnumber} = "Y";
770 $callback .= "&sold=$form->{sold}";
771 $option .= $locale->text('Sold') . " : ";
778 || $form->{quoted}) {
780 $form->{l_lastcost} = "";
781 $form->{l_name} = "Y";
782 if ($form->{transdatefrom}) {
783 $callback .= "&transdatefrom=$form->{transdatefrom}";
785 . $locale->text('From')
787 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
789 if ($form->{transdateto}) {
790 $callback .= "&transdateto=$form->{transdateto}";
792 . $locale->text('To')
794 . $locale->date(\%myconfig, $form->{transdateto}, 1);
800 if ($form->{partnumber}) {
801 $callback .= "&partnumber=$form->{partnumber}";
802 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
804 if ($form->{partsgroup}) {
805 $callback .= "&partsgroup=$form->{partsgroup}";
806 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
808 if ($form->{serialnumber}) {
809 $callback .= "&serialnumber=$form->{serialnumber}";
811 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
813 if ($form->{description}) {
814 $callback .= "&description=$form->{description}";
815 $description = $form->{description};
819 $locale->text('Part Description') . qq| : $form->{description}<br>|;
822 $callback .= "&make=$form->{make}";
823 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
825 if ($form->{model}) {
826 $callback .= "&model=$form->{model}";
827 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
829 if ($form->{drawing}) {
830 $callback .= "&drawing=$form->{drawing}";
831 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
833 if ($form->{microfiche}) {
834 $callback .= "µfiche=$form->{microfiche}";
835 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
837 if ($form->{l_soldtotal}) {
838 $callback .= "&soldtotal=$form->{soldtotal}";
839 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
842 @columns = $form->sort_columns(
843 qw(number partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
846 if ($form->{l_linetotal}) {
847 $form->{l_onhand} = "Y";
848 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
849 if ($form->{l_lastcost}) {
850 $form->{l_linetotallastcost} = "Y";
851 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
852 $form->{l_linetotallastcost} = "";
855 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
858 if ($form->{searchitems} eq 'service') {
860 # remove bin, weight and rop from list
861 map { $form->{"l_$_"} = "" } qw(bin weight rop);
863 $form->{l_onhand} = "";
865 # qty is irrelevant unless bought or sold
871 || $form->{quoted}) {
872 $form->{l_onhand} = "Y";
874 $form->{l_linetotalsellprice} = "";
875 $form->{l_linetotallastcost} = "";
879 $form->{l_lastcost} = ""
880 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
882 foreach $item (@columns) {
883 if ($form->{"l_$item"} eq "Y") {
884 push @column_index, $item;
886 # add column to callback
887 $callback .= "&l_$item=Y";
891 if ($form->{l_subtotal} eq 'Y') {
892 $callback .= "&l_subtotal=Y";
895 $column_header{number} =
896 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
897 $column_header{partnumber} =
898 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
899 . $locale->text('Part Number')
901 $column_header{description} =
902 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
903 . $locale->text('Part Description')
905 $column_header{partsgroup} =
906 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
907 . $locale->text('Group')
909 $column_header{bin} =
910 qq|<th><a class=listheading href=$callback&sort=bin>|
911 . $locale->text('Bin')
913 $column_header{priceupdate} =
914 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
915 . $locale->text('Updated')
917 $column_header{onhand} =
918 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
919 . $locale->text('Qty')
921 $column_header{unit} =
922 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
923 $column_header{listprice} =
924 qq|<th class=listheading nowrap>|
925 . $locale->text('List Price')
927 $column_header{lastcost} =
928 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
929 $column_header{rop} =
930 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
931 $column_header{weight} =
932 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
934 $column_header{invnumber} =
935 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
936 . $locale->text('Invoice Number')
938 $column_header{ordnumber} =
939 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
940 . $locale->text('Order Number')
942 $column_header{quonumber} =
943 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
944 . $locale->text('Quotation')
947 $column_header{name} =
948 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
949 . $locale->text('Name')
952 $column_header{sellprice} =
953 qq|<th class=listheading nowrap>|
954 . $locale->text('Sell Price')
956 $column_header{linetotalsellprice} =
957 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
958 $column_header{linetotallastcost} =
959 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
960 $column_header{linetotallistprice} =
961 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
963 $column_header{image} =
964 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
965 $column_header{drawing} =
966 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
967 . $locale->text('Drawing')
969 $column_header{microfiche} =
970 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
971 . $locale->text('Microfiche')
974 $column_header{serialnumber} =
975 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
976 . $locale->text('Serial Number')
978 $column_header{soldtotal} =
979 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
980 . $locale->text('soldtotal')
984 $colspan = $#column_index + 1;
991 <th class=listtop colspan=$colspan>$form->{title}</th>
995 <tr><td colspan=$colspan>$option</td></tr>
997 <tr class=listheading>
1000 map { print "\n$column_header{$_}" } @column_index;
1006 # add order to callback
1007 $form->{callback} = $callback .= "&sort=$form->{sort}";
1009 # escape callback for href
1010 $callback = $form->escape($callback);
1012 if (@{ $form->{parts} }) {
1013 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1016 # insert numbers for top100
1018 foreach $ref (@{ $form->{parts} }) {
1020 $ref->{number} = $j;
1023 # if avaible -> insert choice here
1024 if (($form->{ndxs_counter}) > 0) {
1025 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
1026 $partnumber = $form->{"totop100_partnumber_$i"};
1027 $description = $form->{"totop100_description_$i"};
1028 $unit = $form->{"totop100_unit_$i"};
1029 $sellprice = $form->{"totop100_sellprice_$i"};
1030 $soldtotal = $form->{"totop100_soldtotal_$i"};
1033 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
1034 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
1035 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
1036 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
1037 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
1041 push @{ $form->{parts} },
1043 partnumber => "$partnumber",
1044 description => "$description",
1046 sellprice => "$sellprice",
1047 soldtotal => "$soldtotal" };
1050 # build data for columns
1051 foreach $ref (@{ $form->{parts} }) {
1053 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1054 if ($sameitem ne $ref->{ $form->{sort} }) {
1056 $sameitem = $ref->{ $form->{sort} };
1060 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1061 $ref->{sellprice} *= $ref->{exchangerate};
1062 $ref->{listprice} *= $ref->{exchangerate};
1063 $ref->{lastcost} *= $ref->{exchangerate};
1065 # use this for assemblies
1066 $onhand = $ref->{onhand};
1069 if ($ref->{assemblyitem}) {
1071 $onhand = 0 if ($form->{sold});
1074 $ref->{description} =~ s/
1077 $column_data{number} =
1079 . $form->format_amount(\%myconfig, $ref->{number}, '', " ")
1081 $column_data{partnumber} =
1082 "<td align=$align>$ref->{partnumber} </a></td>";
1083 $column_data{description} = "<td>$ref->{description} </td>";
1084 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1086 $column_data{onhand} =
1088 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1090 $column_data{sellprice} =
1092 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1094 $column_data{listprice} =
1096 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1098 $column_data{lastcost} =
1100 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1103 $column_data{linetotalsellprice} = "<td align=right>"
1104 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1107 $column_data{linetotallastcost} = "<td align=right>"
1108 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1111 $column_data{linetotallistprice} = "<td align=right>"
1112 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1116 if (!$ref->{assemblyitem}) {
1117 $totalsellprice += $onhand * $ref->{sellprice};
1118 $totallastcost += $onhand * $ref->{lastcost};
1119 $totallistprice += $onhand * $ref->{listprice};
1121 $subtotalonhand += $onhand;
1122 $subtotalsellprice += $onhand * $ref->{sellprice};
1123 $subtotallastcost += $onhand * $ref->{lastcost};
1124 $subtotallistprice += $onhand * $ref->{listprice};
1129 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1130 $column_data{weight} =
1132 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1134 $column_data{unit} = "<td>$ref->{unit} </td>";
1135 $column_data{bin} = "<td>$ref->{bin} </td>";
1136 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1138 $column_data{invnumber} =
1139 ($ref->{module} ne 'oe')
1140 ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>"
1141 : "<td>$ref->{invnumber}</td>";
1142 $column_data{ordnumber} =
1143 ($ref->{module} eq 'oe')
1144 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}</a></td>"
1145 : "<td>$ref->{ordnumber}</td>";
1146 $column_data{quonumber} =
1147 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1148 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
1149 : "<td>$ref->{quonumber}</td>";
1151 $column_data{name} = "<td>$ref->{name}</td>";
1153 $column_data{image} =
1155 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1156 : "<td> </td>";
1157 $column_data{drawing} =
1159 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1160 : "<td> </td>";
1161 $column_data{microfiche} =
1162 ($ref->{microfiche})
1163 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1164 : "<td> </td>";
1166 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1168 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
1172 print "<tr class=listrow$i>";
1174 map { print "\n$column_data{$_}" } @column_index;
1181 if ($form->{l_subtotal} eq 'Y') {
1185 if ($form->{"l_linetotal"}) {
1186 map { $column_data{$_} = "<td> </td>" } @column_index;
1187 $column_data{linetotalsellprice} =
1188 "<th class=listtotal align=right>"
1189 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1191 $column_data{linetotallastcost} =
1192 "<th class=listtotal align=right>"
1193 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1195 $column_data{linetotallistprice} =
1196 "<th class=listtotal align=right>"
1197 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1200 print "<tr class=listtotal>";
1202 map { print "\n$column_data{$_}" } @column_index;
1209 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1218 <form method=post action=$form->{script}>
1220 <input type=hidden name=path value=$form->{path}>
1221 <input type=hidden name=login value=$form->{login}>
1222 <input type=hidden name=password value=$form->{password}>
1224 <input type=hidden name=itemstatus value="$form->{itemstatus}">
1225 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
1226 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
1227 <input type=hidden name=l_description value="$form->{l_description}">
1228 <input type=hidden name=l_onhand value="$form->{l_onhand}">
1229 <input type=hidden name=l_unit value="$form->{l_unit}">
1230 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
1231 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
1232 <input type=hidden name=sort value="$form->{sort}">
1233 <input type=hidden name=revers value="$form->{revers}">
1234 <input type=hidden name=lastsort value="$form->{lastsort}">
1235 <input type=hidden name=parts value="$form->{parts}">
1237 <input type=hidden name=bom value="$form->{bom}">
1238 <input type=hidden name=titel value="$form->{titel}">
1239 <input type=hidden name=searchitems value="$form->{searchitems}">|;
1244 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
1246 <input class=submit type=submit name=action value="|
1247 . $locale->text('choice') . qq|">|;
1249 if ($form->{menubar}) {
1250 require "$form->{path}/menu.pl";
1261 $lxdebug->leave_sub();
1264 sub generate_report {
1265 $lxdebug->enter_sub();
1267 $revers = $form->{revers};
1268 $lastsort = $form->{lastsort};
1270 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1271 $form->{revers} = 0;
1272 $form->{lastsort} = "partnumber";
1273 $form->{sort} = "partnumber";
1276 # switch between backward sorting of tables
1277 if ($form->{lastsort} eq $form->{sort}) {
1278 if ($form->{revers} == 0) {
1279 $form->{revers} = 1;
1281 $form->{revers} = 0;
1284 $form->{revers} == 0;
1285 $form->{lastsort} = $form->{sort};
1290 "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
1291 . $form->escape($form->{title}, 1);
1293 # if we have a serialnumber limit search
1294 if ($form->{serialnumber} || $form->{l_serialnumber}) {
1295 $form->{l_serialnumber} = "Y";
1296 unless ( $form->{bought}
1299 || $form->{quoted}) {
1300 $form->{bought} = $form->{sold} = 1;
1304 IC->all_parts(\%myconfig, \%$form);
1306 if ($form->{itemstatus} eq 'active') {
1307 $option .= $locale->text('Active') . " : ";
1309 if ($form->{itemstatus} eq 'obsolete') {
1310 $option .= $locale->text('Obsolete') . " : ";
1312 if ($form->{itemstatus} eq 'orphaned') {
1313 $option .= $locale->text('Orphaned') . " : ";
1315 if ($form->{itemstatus} eq 'onhand') {
1316 $option .= $locale->text('On Hand') . " : ";
1317 $form->{l_onhand} = "Y";
1319 if ($form->{itemstatus} eq 'short') {
1320 $option .= $locale->text('Short') . " : ";
1321 $form->{l_onhand} = "Y";
1323 if ($form->{onorder}) {
1324 $form->{l_ordnumber} = "Y";
1325 $callback .= "&onorder=$form->{onorder}";
1326 $option .= $locale->text('On Order') . " : ";
1328 if ($form->{ordered}) {
1329 $form->{l_ordnumber} = "Y";
1330 $callback .= "&ordered=$form->{ordered}";
1331 $option .= $locale->text('Ordered') . " : ";
1334 $form->{l_quonumber} = "Y";
1335 $callback .= "&rfq=$form->{rfq}";
1336 $option .= $locale->text('RFQ') . " : ";
1338 if ($form->{quoted}) {
1339 $form->{l_quonumber} = "Y";
1340 $callback .= ""ed=$form->{quoted}";
1341 $option .= $locale->text('Quoted') . " : ";
1343 if ($form->{bought}) {
1344 $form->{l_invnumber} = "Y";
1345 $callback .= "&bought=$form->{bought}";
1346 $option .= $locale->text('Bought') . " : ";
1348 if ($form->{sold}) {
1349 $form->{l_invnumber} = "Y";
1350 $callback .= "&sold=$form->{sold}";
1351 $option .= $locale->text('Sold') . " : ";
1353 if ( $form->{bought}
1358 || $form->{quoted}) {
1360 $form->{l_lastcost} = "";
1361 $form->{l_name} = "Y";
1362 if ($form->{transdatefrom}) {
1363 $callback .= "&transdatefrom=$form->{transdatefrom}";
1365 . $locale->text('From')
1367 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1369 if ($form->{transdateto}) {
1370 $callback .= "&transdateto=$form->{transdateto}";
1372 . $locale->text('To')
1374 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1380 if ($form->{partnumber}) {
1381 $callback .= "&partnumber=$form->{partnumber}";
1382 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
1384 if ($form->{partsgroup}) {
1385 $callback .= "&partsgroup=$form->{partsgroup}";
1386 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
1388 if ($form->{serialnumber}) {
1389 $callback .= "&serialnumber=$form->{serialnumber}";
1391 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
1393 if ($form->{description}) {
1394 $callback .= "&description=$form->{description}";
1395 $description = $form->{description};
1399 $locale->text('Part Description') . qq| : $form->{description}<br>|;
1401 if ($form->{make}) {
1402 $callback .= "&make=$form->{make}";
1403 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
1405 if ($form->{model}) {
1406 $callback .= "&model=$form->{model}";
1407 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
1409 if ($form->{drawing}) {
1410 $callback .= "&drawing=$form->{drawing}";
1411 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
1413 if ($form->{microfiche}) {
1414 $callback .= "µfiche=$form->{microfiche}";
1415 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
1418 # table soldtotal aktive
1419 if ($form->{l_soldtotal}) {
1420 $callback .= "&soldtotal=$form->{soldtotal}";
1421 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1424 if ($form->{l_deliverydate}) {
1425 $callback .= "&deliverydate=$form->{deliverydate}";
1428 @columns = $form->sort_columns(
1429 qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate)
1432 if ($form->{l_linetotal}) {
1433 $form->{l_onhand} = "Y";
1434 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1435 if ($form->{l_lastcost}) {
1436 $form->{l_linetotallastcost} = "Y";
1437 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1438 $form->{l_linetotallastcost} = "";
1441 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1444 if ($form->{searchitems} eq 'service') {
1446 # remove bin, weight and rop from list
1447 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1449 $form->{l_onhand} = "";
1451 # qty is irrelevant unless bought or sold
1452 if ( $form->{bought}
1457 || $form->{quoted}) {
1458 $form->{l_onhand} = "Y";
1460 $form->{l_linetotalsellprice} = "";
1461 $form->{l_linetotallastcost} = "";
1465 $form->{l_lastcost} = ""
1466 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1468 foreach $item (@columns) {
1469 if ($form->{"l_$item"} eq "Y") {
1470 push @column_index, $item;
1472 # add column to callback
1473 $callback .= "&l_$item=Y";
1477 if ($form->{l_subtotal} eq 'Y') {
1478 $callback .= "&l_subtotal=Y";
1480 $column_header{partnumber} =
1481 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1482 . $locale->text('Part Number')
1484 $column_header{description} =
1485 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1486 . $locale->text('Part Description')
1488 $column_header{partsgroup} =
1489 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
1490 . $locale->text('Group')
1492 $column_header{bin} =
1493 qq|<th><a class=listheading href=$callback&sort=bin>|
1494 . $locale->text('Bin')
1496 $column_header{priceupdate} =
1497 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
1498 . $locale->text('Updated')
1500 $column_header{onhand} =
1501 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1502 . $locale->text('Qty')
1504 $column_header{unit} =
1505 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
1506 $column_header{listprice} =
1507 qq|<th class=listheading nowrap>|
1508 . $locale->text('List Price')
1510 $column_header{lastcost} =
1511 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
1512 $column_header{rop} =
1513 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
1514 $column_header{weight} =
1515 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
1517 $column_header{invnumber} =
1518 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
1519 . $locale->text('Invoice Number')
1521 $column_header{ordnumber} =
1522 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
1523 . $locale->text('Order Number')
1525 $column_header{quonumber} =
1526 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
1527 . $locale->text('Quotation')
1530 $column_header{name} =
1531 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
1532 . $locale->text('Name')
1535 $column_header{sellprice} =
1536 qq|<th class=listheading nowrap>|
1537 . $locale->text('Sell Price')
1539 $column_header{linetotalsellprice} =
1540 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1541 $column_header{linetotallastcost} =
1542 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1543 $column_header{linetotallistprice} =
1544 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1546 $column_header{image} =
1547 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
1548 $column_header{drawing} =
1549 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
1550 . $locale->text('Drawing')
1552 $column_header{microfiche} =
1553 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
1554 . $locale->text('Microfiche')
1557 $column_header{serialnumber} =
1558 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
1559 . $locale->text('Serial Number')
1561 $column_header{soldtotal} =
1562 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1563 . $locale->text('soldtotal')
1566 $column_header{deliverydate} =
1567 qq|<th nowrap><a class=listheading href=$callback&sort=deliverydate&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1568 . $locale->text('deliverydate')
1572 $colspan = $#column_index + 1;
1579 <th class=listtop colspan=$colspan>$form->{title}</th>
1581 <tr height="5"></tr>
1583 <tr><td colspan=$colspan>$option</td></tr>
1585 <tr class=listheading>
1588 map { print "\n$column_header{$_}" } @column_index;
1594 # add order to callback
1595 $form->{callback} = $callback .= "&sort=$form->{sort}";
1597 # escape callback for href
1598 $callback = $form->escape($callback);
1600 if (@{ $form->{parts} }) {
1601 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1604 foreach $ref (@{ $form->{parts} }) {
1606 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1607 if ($sameitem ne $ref->{ $form->{sort} }) {
1609 $sameitem = $ref->{ $form->{sort} };
1613 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1614 $ref->{sellprice} *= $ref->{exchangerate};
1615 $ref->{listprice} *= $ref->{exchangerate};
1616 $ref->{lastcost} *= $ref->{exchangerate};
1618 # use this for assemblies
1619 $onhand = $ref->{onhand};
1622 if ($ref->{assemblyitem}) {
1624 $onhand = 0 if ($form->{sold});
1627 $ref->{description} =~ s/
1630 $column_data{partnumber} =
1631 "<td align=$align><a href=$form->{script}?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{partnumber} </a></td>";
1632 $column_data{description} = "<td>$ref->{description} </td>";
1633 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1635 $column_data{onhand} =
1637 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1639 $column_data{sellprice} =
1641 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1643 $column_data{listprice} =
1645 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1647 $column_data{lastcost} =
1649 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1652 $column_data{linetotalsellprice} = "<td align=right>"
1653 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1656 $column_data{linetotallastcost} = "<td align=right>"
1657 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1660 $column_data{linetotallistprice} = "<td align=right>"
1661 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1665 if (!$ref->{assemblyitem}) {
1666 $totalsellprice += $onhand * $ref->{sellprice};
1667 $totallastcost += $onhand * $ref->{lastcost};
1668 $totallistprice += $onhand * $ref->{listprice};
1670 $subtotalonhand += $onhand;
1671 $subtotalsellprice += $onhand * $ref->{sellprice};
1672 $subtotallastcost += $onhand * $ref->{lastcost};
1673 $subtotallistprice += $onhand * $ref->{listprice};
1678 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1679 $column_data{weight} =
1681 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1683 $column_data{unit} = "<td>$ref->{unit} </td>";
1684 $column_data{bin} = "<td>$ref->{bin} </td>";
1685 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1687 $column_data{invnumber} =
1688 ($ref->{module} ne 'oe')
1689 ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>"
1690 : "<td>$ref->{invnumber}</td>";
1691 $column_data{ordnumber} =
1692 ($ref->{module} eq 'oe')
1693 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}</a></td>"
1694 : "<td>$ref->{ordnumber}</td>";
1695 $column_data{quonumber} =
1696 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1697 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
1698 : "<td>$ref->{quonumber}</td>";
1700 $column_data{name} = "<td>$ref->{name}</td>";
1702 $column_data{image} =
1704 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1705 : "<td> </td>";
1706 $column_data{drawing} =
1708 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1709 : "<td> </td>";
1710 $column_data{microfiche} =
1711 ($ref->{microfiche})
1712 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1713 : "<td> </td>";
1715 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1717 $column_data{soldtotal} =
1719 . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ")
1722 $column_data{deliverydate} = "<td>$ref->{deliverydate}</td>";
1726 print "<tr class=listrow$i>";
1728 map { print "\n$column_data{$_}" } @column_index;
1736 if ($form->{l_subtotal} eq 'Y') {
1740 if ($form->{"l_linetotal"}) {
1741 map { $column_data{$_} = "<td> </td>" } @column_index;
1742 $column_data{linetotalsellprice} =
1743 "<th class=listtotal align=right>"
1744 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1746 $column_data{linetotallastcost} =
1747 "<th class=listtotal align=right>"
1748 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1750 $column_data{linetotallistprice} =
1751 "<th class=listtotal align=right>"
1752 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1755 print "<tr class=listtotal>";
1757 map { print "\n$column_data{$_}" } @column_index;
1764 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1773 <form method=post action=$form->{script}>
1775 <input name=callback type=hidden value="$form->{callback}">
1777 <input type=hidden name=item value=$form->{searchitems}>
1779 <input type=hidden name=path value=$form->{path}>
1780 <input type=hidden name=login value=$form->{login}>
1781 <input type=hidden name=password value=$form->{password}>|;
1784 <input class=submit type=submit name=action value="|
1785 . $locale->text('Add') . qq|">|;
1787 if ($form->{menubar}) {
1788 require "$form->{path}/menu.pl";
1799 $lxdebug->leave_sub();
1800 } #end generate_report
1802 sub parts_subtotal {
1803 $lxdebug->enter_sub();
1805 map { $column_data{$_} = "<td> </td>" } @column_index;
1806 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1808 $column_data{onhand} =
1809 "<th class=listsubtotal align=right>"
1810 . $form->format_amount(\%myconfig, $subtotalonhand, '', " ")
1813 $column_data{linetotalsellprice} =
1814 "<th class=listsubtotal align=right>"
1815 . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ")
1817 $column_data{linetotallistprice} =
1818 "<th class=listsubtotal align=right>"
1819 . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ")
1821 $column_data{linetotallastcost} =
1822 "<th class=listsubtotal align=right>"
1823 . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ")
1826 $subtotalonhand = 0;
1827 $subtotalsellprice = 0;
1828 $subtotallistprice = 0;
1829 $subtotallastcost = 0;
1831 print "<tr class=listsubtotal>";
1833 map { print "\n$column_data{$_}" } @column_index;
1839 $lxdebug->leave_sub();
1843 $lxdebug->enter_sub();
1845 IC->get_part(\%myconfig, \%$form);
1847 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1852 $lxdebug->leave_sub();
1856 $lxdebug->enter_sub();
1858 IC->create_links("IC", \%myconfig, \%$form);
1861 map { $form->{selectcurrency} .= "<option>$_\n" } split /:/,
1862 $form->{currencies};
1864 # parts and assemblies have the same links
1865 $item = $form->{item};
1866 if ($form->{item} eq 'assembly') {
1870 # build the popup menus
1871 $form->{taxaccounts} = "";
1872 foreach $key (keys %{ $form->{IC_links} }) {
1873 foreach $ref (@{ $form->{IC_links}{$key} }) {
1875 # if this is a tax field
1876 if ($key =~ /IC_tax/) {
1877 if ($key =~ /$item/) {
1878 $form->{taxaccounts} .= "$ref->{accno} ";
1879 $form->{"IC_tax_$ref->{accno}_description"} =
1880 "$ref->{accno}--$ref->{description}";
1883 if ($form->{amount}{ $ref->{accno} }) {
1884 $form->{"IC_tax_$ref->{accno}"} = "checked";
1887 $form->{"IC_tax_$ref->{accno}"} = "checked";
1892 $form->{"select$key"} .=
1893 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1894 if ($form->{amount}{$key} eq $ref->{accno}) {
1895 $form->{$key} = "$ref->{accno}--$ref->{description}";
1901 chop $form->{taxaccounts};
1903 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1904 $form->{selectIC_income} = $form->{selectIC_sale};
1905 $form->{selectIC_expense} = $form->{selectIC_cogs};
1906 $form->{IC_income} = $form->{IC_sale};
1907 $form->{IC_expense} = $form->{IC_cogs};
1910 delete $form->{IC_links};
1911 delete $form->{amount};
1913 $form->get_partsgroup(\%myconfig, { all => 1 });
1915 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1917 if (@{ $form->{all_partsgroup} }) {
1918 $form->{selectpartsgroup} = qq|<option>\n|;
1920 $form->{selectpartsgroup} .=
1921 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1922 } @{ $form->{all_partsgroup} };
1925 if ($form->{item} eq 'assembly') {
1927 foreach $i (1 .. $form->{assembly_rows}) {
1928 if ($form->{"partsgroup_id_$i"}) {
1929 $form->{"partsgroup_$i"} =
1930 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1933 $form->get_partsgroup(\%myconfig);
1935 if (@{ $form->{all_partsgroup} }) {
1936 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1939 $form->{selectassemblypartsgroup} .=
1940 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1941 } @{ $form->{all_partsgroup} };
1944 $lxdebug->leave_sub();
1948 $lxdebug->enter_sub();
1952 #decimalplaces for listprice
1953 ($dec) = ($form->{listprice} =~ /\.(\d+)/);
1955 my $decimalplaces = ($dec > 2) ? $dec : 2;
1956 $form->{listprice} =
1957 $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces);
1959 #decimalplaces for sellprice and gv
1960 ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
1962 my $decimalplaces = ($dec > 2) ? $dec : 2;
1966 $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
1969 ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
1971 my $decimalplaces = ($dec > 2) ? $dec : 2;
1974 $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
1976 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
1977 qw(weight rop stock);
1979 foreach $item (qw(partnumber description unit notes)) {
1980 $form->{$item} =~ s/\"/"/g;
1983 if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
1988 qq|<textarea name=notes rows=$rows cols=40 wrap=soft>$form->{notes}</textarea>|;
1989 if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
1991 qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
1994 qq|<input name=description size=40 value="$form->{description}">|;
1997 foreach $item (split / /, $form->{taxaccounts}) {
1998 $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
2002 foreach $item (qw(IC IC_income IC_expense)) {
2003 if ($form->{$item}) {
2004 if ($form->{id} && $form->{orphaned}) {
2005 $form->{"select$item"} =~ s/ selected//;
2006 $form->{"select$item"} =~
2007 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2009 $form->{"select$item"} = qq|<option selected>$form->{$item}|;
2014 if ($form->{selectpartsgroup}) {
2015 $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2017 qq|<input type=hidden name=selectpartsgroup value="|
2018 . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
2019 $form->{selectpartsgroup} =~
2020 s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
2023 qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
2024 $group = $locale->text('Group');
2028 foreach $item (split / /, $form->{taxaccounts}) {
2030 <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
2031 <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
2035 $form->{obsolete} = "checked" if $form->{obsolete};
2039 <th align="right" nowrap="true">|
2040 . $locale->text('Last Cost') . qq|</th>
2041 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2047 <th align=right>| . $locale->text('Inventory') . qq|</th>
2048 <td><select name=IC>$form->{selectIC}</select></td>
2049 <input name=selectIC type=hidden value="$form->{selectIC}">
2053 if ($form->{item} eq "part") {
2055 $linkaccounts .= qq|
2057 <th align=right>| . $locale->text('Revenue') . qq|</th>
2058 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2059 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2062 <th align=right>| . $locale->text('Expense') . qq|</th>
2063 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2064 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2070 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2075 <input name=weight size=10 value=$form->{weight}>
2080 <input type=hidden name=weightunit value=$form->{weightunit}>
2090 if ($form->{item} eq "assembly") {
2096 <th align=right>| . $locale->text('Revenue') . qq|</th>
2097 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2098 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2104 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2109 $form->{weight}
2110 <input type=hidden name=weight value=$form->{weight}>
2115 <input type=hidden name=weightunit value=$form->{weightunit}>
2125 if ($form->{item} eq "service") {
2129 <th align=right>| . $locale->text('Revenue') . qq|</th>
2130 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2131 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2134 <th align=right>| . $locale->text('Expense') . qq|</th>
2135 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2136 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2142 if ($form->{item} ne 'service') {
2143 $n = ($form->{onhand} > 0) ? "1" : "0";
2146 <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2147 <th align=left nowrap class="plus$n"> |
2148 . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
2152 if ($form->{item} eq 'assembly') {
2155 <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
2156 <td><input name=stock size=10 value=$form->{stock}></td>
2163 <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
2164 <td><input name=rop size=10 value=$form->{rop}></td>
2170 <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
2171 <td><input name=bin size=10 value=$form->{bin}></td>
2176 <th align="right" nowrap="true">|
2177 . $locale->text('Verrechnungseinheit') . qq|</th>
2178 <td><input name=ve size=10 value=$form->{ve}></td>
2181 <th align="right" nowrap="true">|
2182 . $locale->text('Geschäftsvolumen') . qq|</th>
2183 <td><input name=gv size=10 value=$form->{gv}></td>
2191 <th align=right nowrap>| . $locale->text('Image') . qq|</th>
2192 <td><input name=image size=40 value="$form->{image}"></td>
2193 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
2194 <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
2197 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
2198 <td><input name=drawing size=40 value="$form->{drawing}"></td>
2210 <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
2211 <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
2215 $shopok = $form->{shop} == 1 ? "checked" : "";
2218 <th align=right nowrap>|
2219 . $locale->text('Shopartikel') . qq|</th>
2220 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2224 # type=submit $locale->text('Add Part')
2225 # type=submit $locale->text('Add Service')
2226 # type=submit $locale->text('Add Assembly')
2228 # type=submit $locale->text('Edit Part')
2229 # type=submit $locale->text('Edit Service')
2230 # type=submit $locale->text('Edit Assembly')
2231 # use JavaScript Calendar or not
2232 $form->{jsscript} = $jscalendar;
2234 if ($form->{jsscript}) {
2236 # with JavaScript Calendar
2238 <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2239 <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2240 . $locale->text('button') . qq|></td>
2245 Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1");
2248 # without JavaScript Calendar
2250 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
2253 $form->{fokus} = "ic.partnumber";
2257 <body onLoad="fokus()">
2260 <form method=post name="ic" action=$form->{script}>
2262 <input name=id type=hidden value=$form->{id}>
2263 <input name=item type=hidden value=$form->{item}>
2264 <input name=title type=hidden value="$form->{title}">
2265 <input name=makemodel type=hidden value="$form->{makemodel}">
2266 <input name=alternate type=hidden value="$form->{alternate}">
2267 <input name=onhand type=hidden value=$form->{onhand}>
2268 <input name=orphaned type=hidden value=$form->{orphaned}>
2269 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2270 <input name=rowcount type=hidden value=$form->{rowcount}>
2271 <input name=eur type=hidden value=$eur>
2273 <table width="100%">
2275 <th class=listtop>$form->{title}</th>
2277 <tr height="5"></tr>
2280 <table width="100%">
2282 <th align=left>| . $locale->text('Part Number') . qq|</th>
2283 <th align=left>| . $locale->text('Part Description') . qq|</th>
2284 <th align=left>$group</th>
2287 <td><input name=partnumber value="$form->{partnumber}" size=20></td>
2288 <td>$description</td>
2289 <td>$partsgroup</td>
2290 <input type=hidden name=oldpartsgroup value="$form->{oldpartsgroup}">
2297 <table width="100%" height="100%">
2300 <table width="100%" height="100%">
2301 <tr class="listheading">
2302 <th class="listheading" align="center" colspan=2>|
2303 . $locale->text('Link Accounts') . qq|</th>
2307 <th align="left">| . $locale->text('Notes') . qq|</th>
2317 <table width="100%">
2319 <th align="right" nowrap="true">|
2320 . $locale->text('Updated') . qq|</th>
2324 <th align="right" nowrap="true">| . $locale->text('List Price') . qq|</th>
2325 <td><input name=listprice size=11 value=$form->{listprice}></td>
2328 <th align="right" nowrap="true">| . $locale->text('Sell Price') . qq|</th>
2329 <td><input name=sellprice size=11 value=$form->{sellprice}></td>
2333 <th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
2334 <td><input name=unit size=5 maxlength="10" value="$form->{unit}"></td>
2351 $lxdebug->leave_sub();
2355 $lxdebug->enter_sub();
2357 if ($form->{item} eq "assembly") {
2362 <table width="100%">
2364 <th colspan=2 align=right>|
2365 . $locale->text('Total') . qq| </th>
2367 . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
2372 <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
2377 <input type=hidden name=path value=$form->{path}>
2378 <input type=hidden name=login value=$form->{login}>
2379 <input type=hidden name=password value=$form->{password}>
2380 <input type=hidden name=callback value="$form->{callback}">
2381 <input type=hidden name=previousform value="$form->{previousform}">
2382 <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
2383 <input type=hidden name=vc value=$form->{vc}>
2385 <td><hr size=3 noshade></td>
2390 <input class=submit type=submit name=action value="|
2391 . $locale->text('Update') . qq|">
2394 unless ($form->{item} eq "service") {
2396 <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
2401 <input type=hidden name=price_rows value=$form->{price_rows}>|;
2404 <input class=submit type=submit name=action value="|
2405 . $locale->text('Save') . qq|">|;
2409 if (!$form->{previousform}) {
2411 <input class=submit type=submit name=action value="|
2412 . $locale->text('Save as new') . qq|">|;
2415 if ($form->{orphaned}) {
2416 if (!$form->{previousform}) {
2417 if ($form->{item} eq 'assembly') {
2418 if (!$form->{onhand}) {
2420 <input class=submit type=submit name=action value="|
2421 . $locale->text('Delete') . qq|">|;
2425 <input class=submit type=submit name=action value="|
2426 . $locale->text('Delete') . qq|">|;
2432 if (!$form->{previousform}) {
2433 if ($form->{menubar}) {
2434 require "$form->{path}/menu.pl";
2447 $lxdebug->leave_sub();
2451 $lxdebug->enter_sub();
2454 $form->{"make_$i"} =~ s/\"/"/g;
2455 $form->{"model_$i"} =~ s/\"/"/g;
2462 <th class="listheading">| . $locale->text('Make') . qq|</th>
2463 <th class="listheading">| . $locale->text('Model') . qq|</th>
2467 for $i (1 .. $numrows) {
2470 <td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
2471 <td width=50%><input name="model_$i" size=30 value="$form->{"model_$i"}"></td>
2482 $lxdebug->leave_sub();
2486 $lxdebug->enter_sub();
2490 qw(runningnumber qty unit bom partnumber description partsgroup total);
2492 if ($form->{previousform}) {
2494 @column_index = qw(qty unit bom partnumber description partsgroup total);
2498 $form->{old_callback} = $form->{callback};
2499 $callback = $form->{callback};
2500 $form->{callback} = "$form->{script}?action=display_form";
2503 map { delete $form->{$_} } qw(action header);
2507 # save form variables in a previousform variable
2508 foreach $key (sort keys %$form) {
2511 $form->{$key} =~ s/&/%26/g;
2512 $previousform .= qq|$key=$form->{$key}&|;
2515 $previousform = $form->escape($form->escape($previousform, 1));
2516 $form->{callback} = $callback;
2518 $form->{assemblytotal} = 0;
2519 $form->{weight} = 0;
2522 $column_header{runningnumber} =
2523 qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
2524 $column_header{qty} =
2525 qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
2526 $column_header{unit} =
2527 qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
2528 $column_header{partnumber} =
2529 qq|<th align=left nowrap width=20%>|
2530 . $locale->text('Part Number')
2532 $column_header{description} =
2533 qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
2534 $column_header{total} =
2535 qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
2536 $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
2537 $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
2540 <tr class=listheading>
2541 <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
2549 map { print "\n$column_header{$_}" } @column_index;
2555 for $i (1 .. $numrows) {
2556 $form->{"partnumber_$i"} =~ s/\"/"/g;
2559 $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
2560 $form->{assemblytotal} += $linetotal;
2562 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
2564 $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
2566 if (($i >= 1) && ($i == $numrows)) {
2569 map { $column_data{$_} = qq|<td></td>| }
2570 qw(qty unit partnumber description bom partsgroup);
2573 map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
2576 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2577 $column_data{partnumber} =
2578 qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
2579 $column_data{description} =
2580 qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
2581 $column_data{partsgroup} =
2582 qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
2588 if ($form->{previousform}) {
2589 $column_data{partnumber} =
2590 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
2592 qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
2595 qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
2596 $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
2597 $column_data{bom} .= qq|</td>|;
2599 $column_data{partsgroup} =
2600 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2604 qq|$form->{script}?action=edit&id=$form->{"id_$i"}&path=$form->{path}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
2605 $column_data{partnumber} =
2606 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
2607 $column_data{runningnumber} =
2608 qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
2610 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2612 $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
2614 qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
2616 $column_data{partsgroup} =
2617 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2620 $column_data{unit} =
2621 qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
2622 $column_data{description} =
2623 qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
2626 $column_data{total} = qq|<td align=right>$linetotal</td>|;
2628 $column_data{deliverydate} = qq|<td align=right>$deliverydate</td>|;
2633 map { print "\n$column_data{$_}" } @column_index;
2637 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2638 <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
2639 <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
2649 $lxdebug->leave_sub();
2653 $lxdebug->enter_sub();
2655 if ($form->{item} eq "assembly") {
2656 $i = $form->{assembly_rows};
2658 # if last row is empty check the form otherwise retrieve item
2659 if ( ($form->{"partnumber_$i"} eq "")
2660 && ($form->{"description_$i"} eq "")
2661 && ($form->{"partsgroup_$i"} eq "")) {
2667 IC->assembly_item(\%myconfig, \%$form);
2669 $rows = scalar @{ $form->{item_list} };
2672 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2675 $form->{makemodel_rows}--;
2679 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
2680 qw(partnumber description unit partsgroup);
2681 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
2682 keys %{ $form->{item_list}[0] };
2683 $form->{"runningnumber_$i"} = $form->{assembly_rows};
2684 $form->{assembly_rows}++;
2692 $form->{rowcount} = $i;
2693 $form->{assembly_rows}++;
2701 if ($form->{item} eq "part") {
2705 if ($form->{item} eq 'service') {
2706 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2707 qw(sellprice listprice);
2712 $lxdebug->leave_sub();
2716 $lxdebug->enter_sub();
2718 # check if there is a part number - commented out, cause there is an automatic allocation of numbers
2719 # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
2721 # check if there is a description
2722 $form->isblank("description", $locale->text("Part Description missing!"));
2724 if ($form->{obsolete}) {
2727 "Inventory quantity must be zero before you can set this $form->{item} obsolete!"
2729 if ($form->{onhand});
2732 # expand dynamic strings
2733 # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
2734 # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
2735 # $locale->text('Part Number missing!')
2736 # $locale->text('Service Number missing!')
2737 # $locale->text('Assembly Number missing!')
2740 $lxdebug->message(LXDebug::DEBUG1,
2741 "ic.pl: sellprice in save = $form->{sellprice}\n");
2742 $rc = IC->save(\%myconfig, \%$form);
2744 $form->error($locale->text('Partnumber not unique!'));
2746 $parts_id = $form->{id};
2748 # load previous variables
2749 if ($form->{previousform}) {
2751 # save the new form variables before splitting previousform
2752 map { $newform{$_} = $form->{$_} } keys %$form;
2754 $previousform = $form->unescape($form->{previousform});
2756 # don't trample on previous variables
2757 map { delete $form->{$_} } keys %newform;
2759 # now take it apart and restore original values
2760 foreach $item (split /&/, $previousform) {
2761 ($key, $value) = split /=/, $item, 2;
2762 $value =~ s/%26/&/g;
2763 $form->{$key} = $value;
2765 $form->{taxaccounts} = $newform{taxaccount2};
2767 if ($form->{item} eq 'assembly') {
2769 # undo number formatting
2770 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2771 qw(weight listprice sellprice rop);
2773 $form->{assembly_rows}--;
2774 $i = $newform{rowcount};
2775 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2777 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
2778 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
2780 # change/add values for assembly item
2781 map { $form->{"${_}_$i"} = $newform{$_} }
2782 qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno);
2784 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
2785 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
2789 # set values for last invoice/order item
2790 $i = $form->{rowcount};
2791 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2793 map { $form->{"${_}_$i"} = $newform{$_} }
2794 qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice);
2795 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
2796 if ($form->{exchangerate} != 0) {
2797 $form->{"sellprice_$i"} /= $form->{exchangerate};
2799 $lxdebug->message(LXDebug::DEBUG1,
2800 qq|sellprice_$i in previousform 2 = |
2801 . $form->{"sellprice_$i"} . qq|\n|);
2802 map { $form->{"taxaccounts_$i"} .= "$_ " } split / /,
2803 $newform{taxaccount};
2804 chop $form->{"taxaccounts_$i"};
2805 foreach $item (qw(description rate taxnumber)) {
2806 $index = $form->{"taxaccounts_$i"} . "_$item";
2807 $form->{$index} = $newform{$index};
2810 # credit remaining calculation
2812 $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
2814 map { $form->{"${_}_base"} += $amount }
2815 (split / /, $form->{"taxaccounts_$i"});
2816 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
2817 split / /, $form->{"taxaccounts_$i"}
2818 if !$form->{taxincluded};
2820 $form->{creditremaining} -= $amount;
2822 # redo number formatting, because invoice parse them!
2823 $i = $form->{rowcount};
2825 $form->{"${_}_$i"} =
2826 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
2827 } qw(weight listprice sellprice rop);
2830 $form->{"id_$i"} = $parts_id;
2831 delete $form->{action};
2833 # restore original callback
2834 $callback = $form->unescape($form->{callback});
2835 $form->{callback} = $form->unescape($form->{old_callback});
2836 delete $form->{old_callback};
2838 $form->{makemodel_rows}--;
2840 # put callback together
2841 foreach $key (keys %$form) {
2843 # do single escape for Apache 2.0
2844 $value = $form->escape($form->{$key}, 1);
2845 $callback .= qq|&$key=$value|;
2847 $form->{callback} = $callback;
2849 $lxdebug->message(LXDebug::DEBUG1,
2850 qq|ic.pl: sellprice_$i nach sub save = |
2851 . $form->{"sellprice_$i"} . qq|\n|);
2856 $lxdebug->leave_sub();
2860 $lxdebug->enter_sub();
2865 $lxdebug->leave_sub();
2869 $lxdebug->enter_sub();
2871 $rc = IC->delete(\%myconfig, \%$form);
2874 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
2875 $form->error($locale->text('Cannot delete item!'));
2877 $lxdebug->leave_sub();
2880 sub stock_assembly {
2881 $lxdebug->enter_sub();
2883 $form->{title} = $locale->text('Stock Assembly');
2890 <form method=post action=$form->{script}>
2892 <table width="100%">
2894 <th class=listtop>$form->{title}</th>
2896 <tr height="5"></tr>
2901 <th align="right" nowrap="true">|
2902 . $locale->text('Part Number') . qq|</th>
2903 <td><input name=partnumber size=20></td>
2907 <th align="right" nowrap="true">|
2908 . $locale->text('Part Description') . qq|</th>
2909 <td><input name=description size=40></td>
2914 <tr><td><hr size=3 noshade></td></tr>
2917 <input type=hidden name=path value=$form->{path}>
2918 <input type=hidden name=login value=$form->{login}>
2919 <input type=hidden name=password value=$form->{password}>
2921 <input type=hidden name=nextsub value=list_assemblies>
2924 <input class=submit type=submit name=action value="|
2925 . $locale->text('Continue') . qq|">
2932 $lxdebug->leave_sub();
2935 sub list_assemblies {
2936 $lxdebug->enter_sub();
2938 IC->retrieve_assemblies(\%myconfig, \%$form);
2940 $column_header{partnumber} =
2941 qq|<th class=listheading>| . $locale->text('Part Number') . qq|</th>|;
2942 $column_header{description} =
2943 qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
2944 $column_header{bin} =
2945 qq|<th class=listheading>| . $locale->text('Bin') . qq|</th>|;
2946 $column_header{onhand} =
2947 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
2948 $column_header{rop} =
2949 qq|<th class=listheading>| . $locale->text('ROP') . qq|</th>|;
2950 $column_header{stock} =
2951 qq|<th class=listheading>| . $locale->text('Add') . qq|</th>|;
2953 @column_index = (qw(partnumber description bin onhand rop stock));
2955 $form->{title} = $locale->text('Stock Assembly');
2958 "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2962 $colspan = $#column_index + 1;
2967 <form method=post action=$form->{script}>
2971 <th class=listtop colspan=$colspan>$form->{title}</th>
2974 <tr class=listheading>|;
2976 map { print "\n$column_header{$_}" } @column_index;
2983 foreach $ref (@{ $form->{assembly_items} }) {
2985 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description);
2987 $column_data{partnumber} = qq|<td width=20%>$ref->{partnumber}</td>|;
2988 $column_data{description} =
2989 qq|<td width=50%>$ref->{description} </td>|;
2990 $column_data{bin} = qq|<td>$ref->{bin} </td>|;
2991 $column_data{onhand} =
2992 qq|<td align=right>|
2993 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
2996 qq|<td align=right>|
2997 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ")
2999 $column_data{stock} = qq|<td width=10%><input name="qty_$i" size=10></td>|;
3004 qq|<tr class=listrow$j><input name="id_$i" type=hidden value=$ref->{id}>\n|;
3006 map { print "\n$column_data{$_}" } @column_index;
3019 <td colspan=6><hr size=3 noshade>
3022 <input name=rowcount type=hidden value="$i">
3024 <input type=hidden name=path value=$form->{path}>
3025 <input type=hidden name=login value=$form->{login}>
3026 <input type=hidden name=password value=$form->{password}>
3028 <input name=callback type=hidden value="$form->{callback}">
3030 <input type=hidden name=nextsub value=restock_assemblies>
3033 <input class=submit type=submit name=action value="|
3034 . $locale->text('Continue') . qq|">
3042 $lxdebug->leave_sub();
3045 sub restock_assemblies {
3046 $lxdebug->enter_sub();
3048 $form->redirect($locale->text('Assemblies restocked!'))
3049 if (IC->restock_assemblies(\%myconfig, \%$form));
3050 $form->error($locale->text('Cannot stock assemblies!'));
3052 $lxdebug->leave_sub();
3056 $lxdebug->enter_sub();
3065 <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
3066 <th class="listheading">| . $locale->text('Preis') . qq|</th>
3069 for $i (1 .. $numrows) {
3072 <td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
3073 <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
3074 <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
3085 $lxdebug->leave_sub();
3088 sub continue { &{ $form->{nextsub} } }