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>
366 <tr><td colspan=4><hr size=3 noshade></td></tr>
371 <input type=hidden name=nextsub value=generate_report>
373 <input type=hidden name=path value=$form->{path}>
374 <input type=hidden name=login value=$form->{login}>
375 <input type=hidden name=password value=$form->{password}>
377 <input type=hidden name=revers value="$form->{revers}">
378 <input type=hidden name=lastsort value="$form->{lastsort}">
380 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
383 <input class=submit type=submit name=action value="|
384 . $locale->text('Continue') . qq|">
385 <input class=submit type=submit name=action value="|
386 . $locale->text('TOP100') . qq|">
392 $lxdebug->leave_sub();
396 $lxdebug->enter_sub();
398 $form->{title} = $locale->text('Top 100 hinzufuegen');
405 <form method=post action=$form->{script}>
407 <input type=hidden name=searchitems value=$form->{searchitems}>
408 <input type=hidden name=title value="$form->{title}">
410 <input type=hidden name=revers value="$form->{revers}">
411 <input type=hidden name=lastsort value="$form->{lastsort}">|;
415 <tr class=listheading>
416 <th class=listheading nowrap>|
417 . $locale->text('Part Number') . qq|</th>
418 <th class=listheading nowrap>|
419 . $locale->text('Part Description') . qq|</th>
422 <td><input type=text name=partnumber size=20 value=></td>
423 <td><input type=text name=description size=30 value=></td>
430 <input type=hidden name=path value=$form->{path}>
431 <input type=hidden name=login value=$form->{login}>
432 <input type=hidden name=password value=$form->{password}>
434 <input type=hidden name=itemstatus value="$form->{itemstatus}">
435 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
436 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
437 <input type=hidden name=l_description value="$form->{l_description}">
438 <input type=hidden name=l_onhand value="$form->{l_onhand}">
439 <input type=hidden name=l_unit value="$form->{l_unit}">
440 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
441 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
442 <input type=hidden name=sort value="$form->{sort}">
443 <input type=hidden name=revers value="$form->{revers}">
444 <input type=hidden name=lastsort value="$form->{lastsort}">
446 <input type=hidden name=bom value="$form->{bom}">
447 <input type=hidden name=titel value="$form->{titel}">
448 <input type=hidden name=searchitems value="$form->{searchitems}">
450 <input type=hidden name=row value=$j>
452 <input type=hidden name=nextsub value=item_selected>
454 <input type=hidden name=test value=item_selected>
456 <input name=lastndx type=hidden value=$lastndx>
458 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>
460 <input name=extras type=hidden value=$form->{extras}>|;
464 for ($i = 0; $i < $form->{ndxs_counter}; $i++) {
467 $partnumber = $form->{"totop100_partnumber_$j"};
468 $description = $form->{"totop100_description_$j"};
469 $unit = $form->{"totop100_unit_$j"};
470 $sellprice = $form->{"totop100_sellprice_$j"};
471 $soldtotal = $form->{"totop100_soldtotal_$j"};
473 # insert data into top100
474 push @{ $form->{parts} },
476 partnumber => "$partnumber",
477 description => "$description",
479 sellprice => "$sellprice",
480 soldtotal => "$soldtotal" };
486 # set data for next page
487 if (($form->{ndxs_counter}) > 0) {
488 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
489 $partnumber = $form->{"totop100_partnumber_$i"};
490 $description = $form->{"totop100_description_$i"};
491 $unit = $form->{"totop100_unit_$i"};
492 $sellprice = $form->{"totop100_sellprice_$i"};
493 $soldtotal = $form->{"totop100_soldtotal_$i"};
496 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
497 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
498 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
499 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
500 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
508 <input class=submit type=submit name=action value="|
509 . $locale->text('list') . qq|">
514 $lxdebug->leave_sub();
518 $lxdebug->enter_sub();
521 if (($form->{partnumber} eq "") and ($form->{description} eq "")) {
522 IC->get_parts(\%myconfig, \%$form, "");
524 if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) {
525 IC->get_parts(\%myconfig, \%$form, "partnumber");
527 if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) {
528 IC->get_parts(\%myconfig, \%$form, "description");
530 IC->get_parts(\%myconfig, \%$form, "all");
535 $form->{title} = $locale->text('Top 100 hinzufuegen');
541 <form method=post action=ic.pl>
544 <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
547 <tr class=listheading>
549 <th class=listheading>| . $locale->text('Part Number') . qq|</th>
550 <th class=listheading>| . $locale->text('Part Description') . qq|</th>
551 <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
552 <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
553 <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
557 my $i = $form->{rows};
559 for ($j = 1; $j <= $i; $j++) {
562 <tr class=listrow1>|;
565 <td><input name=ndx class=radio type=radio value=$j checked></td>|;
568 <td><input name=ndx class=radio type=radio value=$j></td>|;
571 <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
572 <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
573 <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
574 <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
575 <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
578 <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
588 <input type=hidden name=path value=$form->{path}>
589 <input type=hidden name=login value=$form->{login}>
590 <input type=hidden name=password value=$form->{password}>
592 <input type=hidden name=itemstatus value="$form->{itemstatus}">
593 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
594 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
595 <input type=hidden name=l_description value="$form->{l_description}">
596 <input type=hidden name=l_onhand value="$form->{l_onhand}">
597 <input type=hidden name=l_unit value="$form->{l_unit}">
598 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
599 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
600 <input type=hidden name=sort value="$form->{sort}">
601 <input type=hidden name=revers value="$form->{revers}">
602 <input type=hidden name=lastsort value="$form->{lastsort}">
604 <input type=hidden name=bom value="$form->{bom}">
605 <input type=hidden name=titel value="$form->{titel}">
606 <input type=hidden name=searchitems value="$form->{searchitems}">
608 <input type=hidden name=row value=$j>
610 <input type=hidden name=nextsub value=item_selected>
612 <input name=lastndx type=hidden value=$lastndx>
614 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
618 if (($form->{ndxs_counter}) > 0) {
619 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
620 $j1 = $form->{"totop100_partnumber_$i"};
621 $j2 = $form->{"totop100_description_$i"};
622 $j3 = $form->{"totop100_unit_$i"};
623 $j4 = $form->{"totop100_sellprice_$i"};
624 $j5 = $form->{"totop100_soldtotal_$i"};
633 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
634 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
635 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
636 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
637 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
645 <input class=submit type=submit name=action value="|
646 . $locale->text('TOP100') . qq|">
652 $lxdebug->leave_sub();
656 $lxdebug->enter_sub();
659 $form->{ndxs_counter}++;
661 if ($form->{ndxs_counter} > 0) {
663 $index = $form->{ndx};
665 $j1 = $form->{"new_partnumber_$index"};
666 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $j1;
667 $j2 = $form->{"new_description_$index"};
668 $form->{"totop100_description_$form->{ndxs_counter}"} = $j2;
669 $j3 = $form->{"new_unit_$index"};
670 $form->{"totop100_unit_$form->{ndxs_counter}"} = $j3;
671 $j4 = $form->{"new_sellprice_$index"};
672 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $j4;
673 $j5 = $form->{"new_soldtotal_$index"};
674 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $j5;
678 $lxdebug->leave_sub();
682 $lxdebug->enter_sub();
684 $form->{top100} = "top100";
685 $form->{l_soldtotal} = "Y";
686 $form->{soldtotal} = "soldtotal";
687 $form->{sort} = "soldtotal";
688 $form->{l_qty} = "N";
689 $callback .= "&form->{top100}=$form->{top100}";
690 $form->{l_linetotal} = "";
692 $form->{number} = "position";
693 $form->{l_number} = "Y";
697 $form->{title} = $locale->text('Top 100');
699 $revers = $form->{revers};
700 $lastsort = $form->{lastsort};
702 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
704 $form->{lastsort} = "partnumber";
705 $form->{sort} = "partnumber";
709 "$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="
710 . $form->escape($form->{title}, 1);
712 # if we have a serialnumber limit search
713 if ($form->{serialnumber} || $form->{l_serialnumber}) {
714 $form->{l_serialnumber} = "Y";
715 unless ( $form->{bought}
718 || $form->{quoted}) {
719 $form->{bought} = $form->{sold} = 1;
722 IC->all_parts(\%myconfig, \%$form);
724 if ($form->{itemstatus} eq 'active') {
725 $option .= $locale->text('Active') . " : ";
727 if ($form->{itemstatus} eq 'obsolete') {
728 $option .= $locale->text('Obsolete') . " : ";
730 if ($form->{itemstatus} eq 'orphaned') {
731 $option .= $locale->text('Orphaned') . " : ";
733 if ($form->{itemstatus} eq 'onhand') {
734 $option .= $locale->text('On Hand') . " : ";
735 $form->{l_onhand} = "Y";
737 if ($form->{itemstatus} eq 'short') {
738 $option .= $locale->text('Short') . " : ";
739 $form->{l_onhand} = "Y";
741 if ($form->{onorder}) {
742 $form->{l_ordnumber} = "Y";
743 $callback .= "&onorder=$form->{onorder}";
744 $option .= $locale->text('On Order') . " : ";
746 if ($form->{ordered}) {
747 $form->{l_ordnumber} = "Y";
748 $callback .= "&ordered=$form->{ordered}";
749 $option .= $locale->text('Ordered') . " : ";
752 $form->{l_quonumber} = "Y";
753 $callback .= "&rfq=$form->{rfq}";
754 $option .= $locale->text('RFQ') . " : ";
756 if ($form->{quoted}) {
757 $form->{l_quonumber} = "Y";
758 $callback .= ""ed=$form->{quoted}";
759 $option .= $locale->text('Quoted') . " : ";
761 if ($form->{bought}) {
762 $form->{l_invnumber} = "Y";
763 $callback .= "&bought=$form->{bought}";
764 $option .= $locale->text('Bought') . " : ";
767 $form->{l_invnumber} = "Y";
768 $callback .= "&sold=$form->{sold}";
769 $option .= $locale->text('Sold') . " : ";
776 || $form->{quoted}) {
778 $form->{l_lastcost} = "";
779 $form->{l_name} = "Y";
780 if ($form->{transdatefrom}) {
781 $callback .= "&transdatefrom=$form->{transdatefrom}";
783 . $locale->text('From')
785 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
787 if ($form->{transdateto}) {
788 $callback .= "&transdateto=$form->{transdateto}";
790 . $locale->text('To')
792 . $locale->date(\%myconfig, $form->{transdateto}, 1);
798 if ($form->{partnumber}) {
799 $callback .= "&partnumber=$form->{partnumber}";
800 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
802 if ($form->{partsgroup}) {
803 $callback .= "&partsgroup=$form->{partsgroup}";
804 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
806 if ($form->{serialnumber}) {
807 $callback .= "&serialnumber=$form->{serialnumber}";
809 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
811 if ($form->{description}) {
812 $callback .= "&description=$form->{description}";
813 $description = $form->{description};
817 $locale->text('Part Description') . qq| : $form->{description}<br>|;
820 $callback .= "&make=$form->{make}";
821 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
823 if ($form->{model}) {
824 $callback .= "&model=$form->{model}";
825 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
827 if ($form->{drawing}) {
828 $callback .= "&drawing=$form->{drawing}";
829 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
831 if ($form->{microfiche}) {
832 $callback .= "µfiche=$form->{microfiche}";
833 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
835 if ($form->{l_soldtotal}) {
836 $callback .= "&soldtotal=$form->{soldtotal}";
837 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
840 @columns = $form->sort_columns(
841 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)
844 if ($form->{l_linetotal}) {
845 $form->{l_onhand} = "Y";
846 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
847 if ($form->{l_lastcost}) {
848 $form->{l_linetotallastcost} = "Y";
849 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
850 $form->{l_linetotallastcost} = "";
853 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
856 if ($form->{searchitems} eq 'service') {
858 # remove bin, weight and rop from list
859 map { $form->{"l_$_"} = "" } qw(bin weight rop);
861 $form->{l_onhand} = "";
863 # qty is irrelevant unless bought or sold
869 || $form->{quoted}) {
870 $form->{l_onhand} = "Y";
872 $form->{l_linetotalsellprice} = "";
873 $form->{l_linetotallastcost} = "";
877 $form->{l_lastcost} = ""
878 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
880 foreach $item (@columns) {
881 if ($form->{"l_$item"} eq "Y") {
882 push @column_index, $item;
884 # add column to callback
885 $callback .= "&l_$item=Y";
889 if ($form->{l_subtotal} eq 'Y') {
890 $callback .= "&l_subtotal=Y";
893 $column_header{number} =
894 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
895 $column_header{partnumber} =
896 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
897 . $locale->text('Part Number')
899 $column_header{description} =
900 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
901 . $locale->text('Part Description')
903 $column_header{partsgroup} =
904 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
905 . $locale->text('Group')
907 $column_header{bin} =
908 qq|<th><a class=listheading href=$callback&sort=bin>|
909 . $locale->text('Bin')
911 $column_header{priceupdate} =
912 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
913 . $locale->text('Updated')
915 $column_header{onhand} =
916 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
917 . $locale->text('Qty')
919 $column_header{unit} =
920 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
921 $column_header{listprice} =
922 qq|<th class=listheading nowrap>|
923 . $locale->text('List Price')
925 $column_header{lastcost} =
926 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
927 $column_header{rop} =
928 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
929 $column_header{weight} =
930 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
932 $column_header{invnumber} =
933 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
934 . $locale->text('Invoice Number')
936 $column_header{ordnumber} =
937 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
938 . $locale->text('Order Number')
940 $column_header{quonumber} =
941 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
942 . $locale->text('Quotation')
945 $column_header{name} =
946 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
947 . $locale->text('Name')
950 $column_header{sellprice} =
951 qq|<th class=listheading nowrap>|
952 . $locale->text('Sell Price')
954 $column_header{linetotalsellprice} =
955 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
956 $column_header{linetotallastcost} =
957 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
958 $column_header{linetotallistprice} =
959 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
961 $column_header{image} =
962 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
963 $column_header{drawing} =
964 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
965 . $locale->text('Drawing')
967 $column_header{microfiche} =
968 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
969 . $locale->text('Microfiche')
972 $column_header{serialnumber} =
973 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
974 . $locale->text('Serial Number')
976 $column_header{soldtotal} =
977 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
978 . $locale->text('soldtotal')
982 $colspan = $#column_index + 1;
989 <th class=listtop colspan=$colspan>$form->{title}</th>
993 <tr><td colspan=$colspan>$option</td></tr>
995 <tr class=listheading>
998 map { print "\n$column_header{$_}" } @column_index;
1004 # add order to callback
1005 $form->{callback} = $callback .= "&sort=$form->{sort}";
1007 # escape callback for href
1008 $callback = $form->escape($callback);
1010 if (@{ $form->{parts} }) {
1011 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1014 # insert numbers for top100
1016 foreach $ref (@{ $form->{parts} }) {
1018 $ref->{number} = $j;
1021 # if avaible -> insert choice here
1022 if (($form->{ndxs_counter}) > 0) {
1023 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
1024 $partnumber = $form->{"totop100_partnumber_$i"};
1025 $description = $form->{"totop100_description_$i"};
1026 $unit = $form->{"totop100_unit_$i"};
1027 $sellprice = $form->{"totop100_sellprice_$i"};
1028 $soldtotal = $form->{"totop100_soldtotal_$i"};
1031 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
1032 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
1033 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
1034 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
1035 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
1039 push @{ $form->{parts} },
1041 partnumber => "$partnumber",
1042 description => "$description",
1044 sellprice => "$sellprice",
1045 soldtotal => "$soldtotal" };
1048 # build data for columns
1049 foreach $ref (@{ $form->{parts} }) {
1051 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1052 if ($sameitem ne $ref->{ $form->{sort} }) {
1054 $sameitem = $ref->{ $form->{sort} };
1058 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1059 $ref->{sellprice} *= $ref->{exchangerate};
1060 $ref->{listprice} *= $ref->{exchangerate};
1061 $ref->{lastcost} *= $ref->{exchangerate};
1063 # use this for assemblies
1064 $onhand = $ref->{onhand};
1067 if ($ref->{assemblyitem}) {
1069 $onhand = 0 if ($form->{sold});
1072 $ref->{description} =~ s/
1075 $column_data{number} =
1077 . $form->format_amount(\%myconfig, $ref->{number}, '', " ")
1079 $column_data{partnumber} =
1080 "<td align=$align>$ref->{partnumber} </a></td>";
1081 $column_data{description} = "<td>$ref->{description} </td>";
1082 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1084 $column_data{onhand} =
1086 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1088 $column_data{sellprice} =
1090 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1092 $column_data{listprice} =
1094 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1096 $column_data{lastcost} =
1098 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1101 $column_data{linetotalsellprice} = "<td align=right>"
1102 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1105 $column_data{linetotallastcost} = "<td align=right>"
1106 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1109 $column_data{linetotallistprice} = "<td align=right>"
1110 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1114 if (!$ref->{assemblyitem}) {
1115 $totalsellprice += $onhand * $ref->{sellprice};
1116 $totallastcost += $onhand * $ref->{lastcost};
1117 $totallistprice += $onhand * $ref->{listprice};
1119 $subtotalonhand += $onhand;
1120 $subtotalsellprice += $onhand * $ref->{sellprice};
1121 $subtotallastcost += $onhand * $ref->{lastcost};
1122 $subtotallistprice += $onhand * $ref->{listprice};
1127 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1128 $column_data{weight} =
1130 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1132 $column_data{unit} = "<td>$ref->{unit} </td>";
1133 $column_data{bin} = "<td>$ref->{bin} </td>";
1134 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1136 $column_data{invnumber} =
1137 ($ref->{module} ne 'oe')
1138 ? "<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>"
1139 : "<td>$ref->{invnumber}</td>";
1140 $column_data{ordnumber} =
1141 ($ref->{module} eq 'oe')
1142 ? "<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>"
1143 : "<td>$ref->{ordnumber}</td>";
1144 $column_data{quonumber} =
1145 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1146 ? "<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>"
1147 : "<td>$ref->{quonumber}</td>";
1149 $column_data{name} = "<td>$ref->{name}</td>";
1151 $column_data{image} =
1153 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1154 : "<td> </td>";
1155 $column_data{drawing} =
1157 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1158 : "<td> </td>";
1159 $column_data{microfiche} =
1160 ($ref->{microfiche})
1161 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1162 : "<td> </td>";
1164 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1166 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
1170 print "<tr class=listrow$i>";
1172 map { print "\n$column_data{$_}" } @column_index;
1179 if ($form->{l_subtotal} eq 'Y') {
1183 if ($form->{"l_linetotal"}) {
1184 map { $column_data{$_} = "<td> </td>" } @column_index;
1185 $column_data{linetotalsellprice} =
1186 "<th class=listtotal align=right>"
1187 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1189 $column_data{linetotallastcost} =
1190 "<th class=listtotal align=right>"
1191 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1193 $column_data{linetotallistprice} =
1194 "<th class=listtotal align=right>"
1195 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1198 print "<tr class=listtotal>";
1200 map { print "\n$column_data{$_}" } @column_index;
1207 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1216 <form method=post action=$form->{script}>
1218 <input type=hidden name=path value=$form->{path}>
1219 <input type=hidden name=login value=$form->{login}>
1220 <input type=hidden name=password value=$form->{password}>
1222 <input type=hidden name=itemstatus value="$form->{itemstatus}">
1223 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
1224 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
1225 <input type=hidden name=l_description value="$form->{l_description}">
1226 <input type=hidden name=l_onhand value="$form->{l_onhand}">
1227 <input type=hidden name=l_unit value="$form->{l_unit}">
1228 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
1229 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
1230 <input type=hidden name=sort value="$form->{sort}">
1231 <input type=hidden name=revers value="$form->{revers}">
1232 <input type=hidden name=lastsort value="$form->{lastsort}">
1233 <input type=hidden name=parts value="$form->{parts}">
1235 <input type=hidden name=bom value="$form->{bom}">
1236 <input type=hidden name=titel value="$form->{titel}">
1237 <input type=hidden name=searchitems value="$form->{searchitems}">|;
1242 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
1244 <input class=submit type=submit name=action value="|
1245 . $locale->text('choice') . qq|">|;
1247 if ($form->{menubar}) {
1248 require "$form->{path}/menu.pl";
1259 $lxdebug->leave_sub();
1262 sub generate_report {
1263 $lxdebug->enter_sub();
1265 $revers = $form->{revers};
1266 $lastsort = $form->{lastsort};
1268 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1269 $form->{revers} = 0;
1270 $form->{lastsort} = "partnumber";
1271 $form->{sort} = "partnumber";
1274 # switch between backward sorting of tables
1275 if ($form->{lastsort} eq $form->{sort}) {
1276 if ($form->{revers} == 0) {
1277 $form->{revers} = 1;
1279 $form->{revers} = 0;
1282 $form->{revers} == 0;
1283 $form->{lastsort} = $form->{sort};
1288 "$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="
1289 . $form->escape($form->{title}, 1);
1291 # if we have a serialnumber limit search
1292 if ($form->{serialnumber} || $form->{l_serialnumber}) {
1293 $form->{l_serialnumber} = "Y";
1294 unless ( $form->{bought}
1297 || $form->{quoted}) {
1298 $form->{bought} = $form->{sold} = 1;
1302 IC->all_parts(\%myconfig, \%$form);
1304 if ($form->{itemstatus} eq 'active') {
1305 $option .= $locale->text('Active') . " : ";
1307 if ($form->{itemstatus} eq 'obsolete') {
1308 $option .= $locale->text('Obsolete') . " : ";
1310 if ($form->{itemstatus} eq 'orphaned') {
1311 $option .= $locale->text('Orphaned') . " : ";
1313 if ($form->{itemstatus} eq 'onhand') {
1314 $option .= $locale->text('On Hand') . " : ";
1315 $form->{l_onhand} = "Y";
1317 if ($form->{itemstatus} eq 'short') {
1318 $option .= $locale->text('Short') . " : ";
1319 $form->{l_onhand} = "Y";
1321 if ($form->{onorder}) {
1322 $form->{l_ordnumber} = "Y";
1323 $callback .= "&onorder=$form->{onorder}";
1324 $option .= $locale->text('On Order') . " : ";
1326 if ($form->{ordered}) {
1327 $form->{l_ordnumber} = "Y";
1328 $callback .= "&ordered=$form->{ordered}";
1329 $option .= $locale->text('Ordered') . " : ";
1332 $form->{l_quonumber} = "Y";
1333 $callback .= "&rfq=$form->{rfq}";
1334 $option .= $locale->text('RFQ') . " : ";
1336 if ($form->{quoted}) {
1337 $form->{l_quonumber} = "Y";
1338 $callback .= ""ed=$form->{quoted}";
1339 $option .= $locale->text('Quoted') . " : ";
1341 if ($form->{bought}) {
1342 $form->{l_invnumber} = "Y";
1343 $callback .= "&bought=$form->{bought}";
1344 $option .= $locale->text('Bought') . " : ";
1346 if ($form->{sold}) {
1347 $form->{l_invnumber} = "Y";
1348 $callback .= "&sold=$form->{sold}";
1349 $option .= $locale->text('Sold') . " : ";
1351 if ( $form->{bought}
1356 || $form->{quoted}) {
1358 $form->{l_lastcost} = "";
1359 $form->{l_name} = "Y";
1360 if ($form->{transdatefrom}) {
1361 $callback .= "&transdatefrom=$form->{transdatefrom}";
1363 . $locale->text('From')
1365 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1367 if ($form->{transdateto}) {
1368 $callback .= "&transdateto=$form->{transdateto}";
1370 . $locale->text('To')
1372 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1378 if ($form->{partnumber}) {
1379 $callback .= "&partnumber=$form->{partnumber}";
1380 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
1382 if ($form->{partsgroup}) {
1383 $callback .= "&partsgroup=$form->{partsgroup}";
1384 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
1386 if ($form->{serialnumber}) {
1387 $callback .= "&serialnumber=$form->{serialnumber}";
1389 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
1391 if ($form->{description}) {
1392 $callback .= "&description=$form->{description}";
1393 $description = $form->{description};
1397 $locale->text('Part Description') . qq| : $form->{description}<br>|;
1399 if ($form->{make}) {
1400 $callback .= "&make=$form->{make}";
1401 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
1403 if ($form->{model}) {
1404 $callback .= "&model=$form->{model}";
1405 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
1407 if ($form->{drawing}) {
1408 $callback .= "&drawing=$form->{drawing}";
1409 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
1411 if ($form->{microfiche}) {
1412 $callback .= "µfiche=$form->{microfiche}";
1413 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
1416 # table soldtotal aktive
1417 if ($form->{l_soldtotal}) {
1418 $callback .= "&soldtotal=$form->{soldtotal}";
1419 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1422 @columns = $form->sort_columns(
1423 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)
1426 if ($form->{l_linetotal}) {
1427 $form->{l_onhand} = "Y";
1428 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1429 if ($form->{l_lastcost}) {
1430 $form->{l_linetotallastcost} = "Y";
1431 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1432 $form->{l_linetotallastcost} = "";
1435 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1438 if ($form->{searchitems} eq 'service') {
1440 # remove bin, weight and rop from list
1441 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1443 $form->{l_onhand} = "";
1445 # qty is irrelevant unless bought or sold
1446 if ( $form->{bought}
1451 || $form->{quoted}) {
1452 $form->{l_onhand} = "Y";
1454 $form->{l_linetotalsellprice} = "";
1455 $form->{l_linetotallastcost} = "";
1459 $form->{l_lastcost} = ""
1460 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1462 foreach $item (@columns) {
1463 if ($form->{"l_$item"} eq "Y") {
1464 push @column_index, $item;
1466 # add column to callback
1467 $callback .= "&l_$item=Y";
1471 if ($form->{l_subtotal} eq 'Y') {
1472 $callback .= "&l_subtotal=Y";
1474 $column_header{partnumber} =
1475 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1476 . $locale->text('Part Number')
1478 $column_header{description} =
1479 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1480 . $locale->text('Part Description')
1482 $column_header{partsgroup} =
1483 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
1484 . $locale->text('Group')
1486 $column_header{bin} =
1487 qq|<th><a class=listheading href=$callback&sort=bin>|
1488 . $locale->text('Bin')
1490 $column_header{priceupdate} =
1491 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
1492 . $locale->text('Updated')
1494 $column_header{onhand} =
1495 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1496 . $locale->text('Qty')
1498 $column_header{unit} =
1499 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
1500 $column_header{listprice} =
1501 qq|<th class=listheading nowrap>|
1502 . $locale->text('List Price')
1504 $column_header{lastcost} =
1505 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
1506 $column_header{rop} =
1507 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
1508 $column_header{weight} =
1509 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
1511 $column_header{invnumber} =
1512 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
1513 . $locale->text('Invoice Number')
1515 $column_header{ordnumber} =
1516 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
1517 . $locale->text('Order Number')
1519 $column_header{quonumber} =
1520 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
1521 . $locale->text('Quotation')
1524 $column_header{name} =
1525 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
1526 . $locale->text('Name')
1529 $column_header{sellprice} =
1530 qq|<th class=listheading nowrap>|
1531 . $locale->text('Sell Price')
1533 $column_header{linetotalsellprice} =
1534 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1535 $column_header{linetotallastcost} =
1536 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1537 $column_header{linetotallistprice} =
1538 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1540 $column_header{image} =
1541 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
1542 $column_header{drawing} =
1543 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
1544 . $locale->text('Drawing')
1546 $column_header{microfiche} =
1547 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
1548 . $locale->text('Microfiche')
1551 $column_header{serialnumber} =
1552 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
1553 . $locale->text('Serial Number')
1555 $column_header{soldtotal} =
1556 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1557 . $locale->text('soldtotal')
1561 $colspan = $#column_index + 1;
1568 <th class=listtop colspan=$colspan>$form->{title}</th>
1570 <tr height="5"></tr>
1572 <tr><td colspan=$colspan>$option</td></tr>
1574 <tr class=listheading>
1577 map { print "\n$column_header{$_}" } @column_index;
1583 # add order to callback
1584 $form->{callback} = $callback .= "&sort=$form->{sort}";
1586 # escape callback for href
1587 $callback = $form->escape($callback);
1589 if (@{ $form->{parts} }) {
1590 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1593 foreach $ref (@{ $form->{parts} }) {
1595 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1596 if ($sameitem ne $ref->{ $form->{sort} }) {
1598 $sameitem = $ref->{ $form->{sort} };
1602 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1603 $ref->{sellprice} *= $ref->{exchangerate};
1604 $ref->{listprice} *= $ref->{exchangerate};
1605 $ref->{lastcost} *= $ref->{exchangerate};
1607 # use this for assemblies
1608 $onhand = $ref->{onhand};
1611 if ($ref->{assemblyitem}) {
1613 $onhand = 0 if ($form->{sold});
1616 $ref->{description} =~ s/
1619 $column_data{partnumber} =
1620 "<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>";
1621 $column_data{description} = "<td>$ref->{description} </td>";
1622 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1624 $column_data{onhand} =
1626 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1628 $column_data{sellprice} =
1630 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1632 $column_data{listprice} =
1634 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1636 $column_data{lastcost} =
1638 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1641 $column_data{linetotalsellprice} = "<td align=right>"
1642 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1645 $column_data{linetotallastcost} = "<td align=right>"
1646 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1649 $column_data{linetotallistprice} = "<td align=right>"
1650 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1654 if (!$ref->{assemblyitem}) {
1655 $totalsellprice += $onhand * $ref->{sellprice};
1656 $totallastcost += $onhand * $ref->{lastcost};
1657 $totallistprice += $onhand * $ref->{listprice};
1659 $subtotalonhand += $onhand;
1660 $subtotalsellprice += $onhand * $ref->{sellprice};
1661 $subtotallastcost += $onhand * $ref->{lastcost};
1662 $subtotallistprice += $onhand * $ref->{listprice};
1667 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1668 $column_data{weight} =
1670 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1672 $column_data{unit} = "<td>$ref->{unit} </td>";
1673 $column_data{bin} = "<td>$ref->{bin} </td>";
1674 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1676 $column_data{invnumber} =
1677 ($ref->{module} ne 'oe')
1678 ? "<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>"
1679 : "<td>$ref->{invnumber}</td>";
1680 $column_data{ordnumber} =
1681 ($ref->{module} eq 'oe')
1682 ? "<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>"
1683 : "<td>$ref->{ordnumber}</td>";
1684 $column_data{quonumber} =
1685 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1686 ? "<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>"
1687 : "<td>$ref->{quonumber}</td>";
1689 $column_data{name} = "<td>$ref->{name}</td>";
1691 $column_data{image} =
1693 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1694 : "<td> </td>";
1695 $column_data{drawing} =
1697 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1698 : "<td> </td>";
1699 $column_data{microfiche} =
1700 ($ref->{microfiche})
1701 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1702 : "<td> </td>";
1704 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1706 $column_data{soldtotal} =
1708 . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ")
1713 print "<tr class=listrow$i>";
1715 map { print "\n$column_data{$_}" } @column_index;
1723 if ($form->{l_subtotal} eq 'Y') {
1727 if ($form->{"l_linetotal"}) {
1728 map { $column_data{$_} = "<td> </td>" } @column_index;
1729 $column_data{linetotalsellprice} =
1730 "<th class=listtotal align=right>"
1731 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1733 $column_data{linetotallastcost} =
1734 "<th class=listtotal align=right>"
1735 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1737 $column_data{linetotallistprice} =
1738 "<th class=listtotal align=right>"
1739 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1742 print "<tr class=listtotal>";
1744 map { print "\n$column_data{$_}" } @column_index;
1751 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1760 <form method=post action=$form->{script}>
1762 <input name=callback type=hidden value="$form->{callback}">
1764 <input type=hidden name=item value=$form->{searchitems}>
1766 <input type=hidden name=path value=$form->{path}>
1767 <input type=hidden name=login value=$form->{login}>
1768 <input type=hidden name=password value=$form->{password}>|;
1771 <input class=submit type=submit name=action value="|
1772 . $locale->text('Add') . qq|">|;
1774 if ($form->{menubar}) {
1775 require "$form->{path}/menu.pl";
1786 $lxdebug->leave_sub();
1787 } #end generate_report
1789 sub parts_subtotal {
1790 $lxdebug->enter_sub();
1792 map { $column_data{$_} = "<td> </td>" } @column_index;
1793 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1795 $column_data{onhand} =
1796 "<th class=listsubtotal align=right>"
1797 . $form->format_amount(\%myconfig, $subtotalonhand, '', " ")
1800 $column_data{linetotalsellprice} =
1801 "<th class=listsubtotal align=right>"
1802 . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ")
1804 $column_data{linetotallistprice} =
1805 "<th class=listsubtotal align=right>"
1806 . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ")
1808 $column_data{linetotallastcost} =
1809 "<th class=listsubtotal align=right>"
1810 . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ")
1813 $subtotalonhand = 0;
1814 $subtotalsellprice = 0;
1815 $subtotallistprice = 0;
1816 $subtotallastcost = 0;
1818 print "<tr class=listsubtotal>";
1820 map { print "\n$column_data{$_}" } @column_index;
1826 $lxdebug->leave_sub();
1830 $lxdebug->enter_sub();
1832 IC->get_part(\%myconfig, \%$form);
1834 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1839 $lxdebug->leave_sub();
1843 $lxdebug->enter_sub();
1845 IC->create_links("IC", \%myconfig, \%$form);
1848 map { $form->{selectcurrency} .= "<option>$_\n" } split /:/,
1849 $form->{currencies};
1851 # parts and assemblies have the same links
1852 $item = $form->{item};
1853 if ($form->{item} eq 'assembly') {
1857 # build the popup menus
1858 $form->{taxaccounts} = "";
1859 foreach $key (keys %{ $form->{IC_links} }) {
1860 foreach $ref (@{ $form->{IC_links}{$key} }) {
1862 # if this is a tax field
1863 if ($key =~ /IC_tax/) {
1864 if ($key =~ /$item/) {
1865 $form->{taxaccounts} .= "$ref->{accno} ";
1866 $form->{"IC_tax_$ref->{accno}_description"} =
1867 "$ref->{accno}--$ref->{description}";
1870 if ($form->{amount}{ $ref->{accno} }) {
1871 $form->{"IC_tax_$ref->{accno}"} = "checked";
1874 $form->{"IC_tax_$ref->{accno}"} = "checked";
1879 $form->{"select$key"} .=
1880 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1881 if ($form->{amount}{$key} eq $ref->{accno}) {
1882 $form->{$key} = "$ref->{accno}--$ref->{description}";
1888 chop $form->{taxaccounts};
1890 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1891 $form->{selectIC_income} = $form->{selectIC_sale};
1892 $form->{selectIC_expense} = $form->{selectIC_cogs};
1893 $form->{IC_income} = $form->{IC_sale};
1894 $form->{IC_expense} = $form->{IC_cogs};
1897 delete $form->{IC_links};
1898 delete $form->{amount};
1900 $form->get_partsgroup(\%myconfig, { all => 1 });
1902 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1904 if (@{ $form->{all_partsgroup} }) {
1905 $form->{selectpartsgroup} = qq|<option>\n|;
1907 $form->{selectpartsgroup} .=
1908 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1909 } @{ $form->{all_partsgroup} };
1912 if ($form->{item} eq 'assembly') {
1914 foreach $i (1 .. $form->{assembly_rows}) {
1915 if ($form->{"partsgroup_id_$i"}) {
1916 $form->{"partsgroup_$i"} =
1917 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1920 $form->get_partsgroup(\%myconfig);
1922 if (@{ $form->{all_partsgroup} }) {
1923 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1926 $form->{selectassemblypartsgroup} .=
1927 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1928 } @{ $form->{all_partsgroup} };
1931 $lxdebug->leave_sub();
1935 $lxdebug->enter_sub();
1939 #decimalplaces for listprice
1940 ($dec) = ($form->{listprice} =~ /\.(\d+)/);
1942 my $decimalplaces = ($dec > 2) ? $dec : 2;
1943 $form->{listprice} =
1944 $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces);
1946 #decimalplaces for sellprice and gv
1947 ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
1949 my $decimalplaces = ($dec > 2) ? $dec : 2;
1953 $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
1956 ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
1958 my $decimalplaces = ($dec > 2) ? $dec : 2;
1961 $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
1963 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
1964 qw(weight rop stock);
1966 foreach $item (qw(partnumber description unit notes)) {
1967 $form->{$item} =~ s/\"/"/g;
1970 if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
1975 qq|<textarea name=notes rows=$rows cols=40 wrap=soft>$form->{notes}</textarea>|;
1976 if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
1978 qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
1981 qq|<input name=description size=40 value="$form->{description}">|;
1984 foreach $item (split / /, $form->{taxaccounts}) {
1985 $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
1989 foreach $item (qw(IC IC_income IC_expense)) {
1990 if ($form->{$item}) {
1991 if ($form->{id} && $form->{orphaned}) {
1992 $form->{"select$item"} =~ s/ selected//;
1993 $form->{"select$item"} =~
1994 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
1996 $form->{"select$item"} = qq|<option selected>$form->{$item}|;
2001 if ($form->{selectpartsgroup}) {
2002 $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2004 qq|<input type=hidden name=selectpartsgroup value="|
2005 . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
2006 $form->{selectpartsgroup} =~
2007 s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
2010 qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
2011 $group = $locale->text('Group');
2015 foreach $item (split / /, $form->{taxaccounts}) {
2017 <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
2018 <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
2022 $form->{obsolete} = "checked" if $form->{obsolete};
2026 <th align="right" nowrap="true">|
2027 . $locale->text('Last Cost') . qq|</th>
2028 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2034 <th align=right>| . $locale->text('Inventory') . qq|</th>
2035 <td><select name=IC>$form->{selectIC}</select></td>
2036 <input name=selectIC type=hidden value="$form->{selectIC}">
2040 if ($form->{item} eq "part") {
2042 $linkaccounts .= qq|
2044 <th align=right>| . $locale->text('Revenue') . qq|</th>
2045 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2046 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2049 <th align=right>| . $locale->text('Expense') . qq|</th>
2050 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2051 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2057 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2062 <input name=weight size=10 value=$form->{weight}>
2067 <input type=hidden name=weightunit value=$form->{weightunit}>
2077 if ($form->{item} eq "assembly") {
2083 <th align=right>| . $locale->text('Revenue') . qq|</th>
2084 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2085 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2091 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2096 $form->{weight}
2097 <input type=hidden name=weight value=$form->{weight}>
2102 <input type=hidden name=weightunit value=$form->{weightunit}>
2112 if ($form->{item} eq "service") {
2116 <th align=right>| . $locale->text('Revenue') . qq|</th>
2117 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2118 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2121 <th align=right>| . $locale->text('Expense') . qq|</th>
2122 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2123 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2129 if ($form->{item} ne 'service') {
2130 $n = ($form->{onhand} > 0) ? "1" : "0";
2133 <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2134 <th align=left nowrap class="plus$n"> |
2135 . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
2139 if ($form->{item} eq 'assembly') {
2142 <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
2143 <td><input name=stock size=10 value=$form->{stock}></td>
2150 <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
2151 <td><input name=rop size=10 value=$form->{rop}></td>
2157 <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
2158 <td><input name=bin size=10 value=$form->{bin}></td>
2163 <th align="right" nowrap="true">|
2164 . $locale->text('Verrechnungseinheit') . qq|</th>
2165 <td><input name=ve size=10 value=$form->{ve}></td>
2168 <th align="right" nowrap="true">|
2169 . $locale->text('Geschäftsvolumen') . qq|</th>
2170 <td><input name=gv size=10 value=$form->{gv}></td>
2178 <th align=right nowrap>| . $locale->text('Image') . qq|</th>
2179 <td><input name=image size=40 value="$form->{image}"></td>
2180 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
2181 <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
2184 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
2185 <td><input name=drawing size=40 value="$form->{drawing}"></td>
2197 <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
2198 <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
2202 $shopok = $form->{shop} == 1 ? "checked" : "";
2205 <th align=right nowrap>|
2206 . $locale->text('Shopartikel') . qq|</th>
2207 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2211 # type=submit $locale->text('Add Part')
2212 # type=submit $locale->text('Add Service')
2213 # type=submit $locale->text('Add Assembly')
2215 # type=submit $locale->text('Edit Part')
2216 # type=submit $locale->text('Edit Service')
2217 # type=submit $locale->text('Edit Assembly')
2218 # use JavaScript Calendar or not
2219 $form->{jsscript} = $jscalendar;
2221 if ($form->{jsscript}) {
2223 # with JavaScript Calendar
2225 <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2226 <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2227 . $locale->text('button') . qq|></td>
2232 Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1");
2235 # without JavaScript Calendar
2237 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
2240 $form->{fokus} = "ic.partnumber";
2244 <body onLoad="fokus()">
2247 <form method=post name="ic" action=$form->{script}>
2249 <input name=id type=hidden value=$form->{id}>
2250 <input name=item type=hidden value=$form->{item}>
2251 <input name=title type=hidden value="$form->{title}">
2252 <input name=makemodel type=hidden value="$form->{makemodel}">
2253 <input name=alternate type=hidden value="$form->{alternate}">
2254 <input name=onhand type=hidden value=$form->{onhand}>
2255 <input name=orphaned type=hidden value=$form->{orphaned}>
2256 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2257 <input name=rowcount type=hidden value=$form->{rowcount}>
2258 <input name=eur type=hidden value=$eur>
2260 <table width="100%">
2262 <th class=listtop>$form->{title}</th>
2264 <tr height="5"></tr>
2267 <table width="100%">
2269 <th align=left>| . $locale->text('Part Number') . qq|</th>
2270 <th align=left>| . $locale->text('Part Description') . qq|</th>
2271 <th align=left>$group</th>
2274 <td><input name=partnumber value="$form->{partnumber}" size=20></td>
2275 <td>$description</td>
2276 <td>$partsgroup</td>
2277 <input type=hidden name=oldpartsgroup value="$form->{oldpartsgroup}">
2284 <table width="100%" height="100%">
2287 <table width="100%" height="100%">
2288 <tr class="listheading">
2289 <th class="listheading" align="center" colspan=2>|
2290 . $locale->text('Link Accounts') . qq|</th>
2294 <th align="left">| . $locale->text('Notes') . qq|</th>
2304 <table width="100%">
2306 <th align="right" nowrap="true">|
2307 . $locale->text('Updated') . qq|</th>
2311 <th align="right" nowrap="true">| . $locale->text('List Price') . qq|</th>
2312 <td><input name=listprice size=11 value=$form->{listprice}></td>
2315 <th align="right" nowrap="true">| . $locale->text('Sell Price') . qq|</th>
2316 <td><input name=sellprice size=11 value=$form->{sellprice}></td>
2320 <th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
2321 <td><input name=unit size=5 maxlength="10" value="$form->{unit}"></td>
2338 $lxdebug->leave_sub();
2342 $lxdebug->enter_sub();
2344 if ($form->{item} eq "assembly") {
2349 <table width="100%">
2351 <th colspan=2 align=right>|
2352 . $locale->text('Total') . qq| </th>
2354 . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
2359 <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
2364 <input type=hidden name=path value=$form->{path}>
2365 <input type=hidden name=login value=$form->{login}>
2366 <input type=hidden name=password value=$form->{password}>
2367 <input type=hidden name=callback value="$form->{callback}">
2368 <input type=hidden name=previousform value="$form->{previousform}">
2369 <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
2370 <input type=hidden name=vc value=$form->{vc}>
2372 <td><hr size=3 noshade></td>
2377 <input class=submit type=submit name=action value="|
2378 . $locale->text('Update') . qq|">
2381 unless ($form->{item} eq "service") {
2383 <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
2388 <input type=hidden name=price_rows value=$form->{price_rows}>|;
2391 <input class=submit type=submit name=action value="|
2392 . $locale->text('Save') . qq|">|;
2396 if (!$form->{previousform}) {
2398 <input class=submit type=submit name=action value="|
2399 . $locale->text('Save as new') . qq|">|;
2402 if ($form->{orphaned}) {
2403 if (!$form->{previousform}) {
2404 if ($form->{item} eq 'assembly') {
2405 if (!$form->{onhand}) {
2407 <input class=submit type=submit name=action value="|
2408 . $locale->text('Delete') . qq|">|;
2412 <input class=submit type=submit name=action value="|
2413 . $locale->text('Delete') . qq|">|;
2419 if (!$form->{previousform}) {
2420 if ($form->{menubar}) {
2421 require "$form->{path}/menu.pl";
2434 $lxdebug->leave_sub();
2438 $lxdebug->enter_sub();
2441 $form->{"make_$i"} =~ s/\"/"/g;
2442 $form->{"model_$i"} =~ s/\"/"/g;
2449 <th class="listheading">| . $locale->text('Make') . qq|</th>
2450 <th class="listheading">| . $locale->text('Model') . qq|</th>
2454 for $i (1 .. $numrows) {
2457 <td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
2458 <td width=50%><input name="model_$i" size=30 value="$form->{"model_$i"}"></td>
2469 $lxdebug->leave_sub();
2473 $lxdebug->enter_sub();
2477 qw(runningnumber qty unit bom partnumber description partsgroup total);
2479 if ($form->{previousform}) {
2481 @column_index = qw(qty unit bom partnumber description partsgroup total);
2485 $form->{old_callback} = $form->{callback};
2486 $callback = $form->{callback};
2487 $form->{callback} = "$form->{script}?action=display_form";
2490 map { delete $form->{$_} } qw(action header);
2494 # save form variables in a previousform variable
2495 foreach $key (sort keys %$form) {
2498 $form->{$key} =~ s/&/%26/g;
2499 $previousform .= qq|$key=$form->{$key}&|;
2502 $previousform = $form->escape($form->escape($previousform, 1));
2503 $form->{callback} = $callback;
2505 $form->{assemblytotal} = 0;
2506 $form->{weight} = 0;
2509 $column_header{runningnumber} =
2510 qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
2511 $column_header{qty} =
2512 qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
2513 $column_header{unit} =
2514 qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
2515 $column_header{partnumber} =
2516 qq|<th align=left nowrap width=20%>|
2517 . $locale->text('Part Number')
2519 $column_header{description} =
2520 qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
2521 $column_header{total} =
2522 qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
2523 $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
2524 $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
2527 <tr class=listheading>
2528 <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
2536 map { print "\n$column_header{$_}" } @column_index;
2542 for $i (1 .. $numrows) {
2543 $form->{"partnumber_$i"} =~ s/\"/"/g;
2546 $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
2547 $form->{assemblytotal} += $linetotal;
2549 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
2551 $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
2553 if (($i >= 1) && ($i == $numrows)) {
2556 map { $column_data{$_} = qq|<td></td>| }
2557 qw(qty unit partnumber description bom partsgroup);
2560 map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
2563 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2564 $column_data{partnumber} =
2565 qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
2566 $column_data{description} =
2567 qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
2568 $column_data{partsgroup} =
2569 qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
2575 if ($form->{previousform}) {
2576 $column_data{partnumber} =
2577 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
2579 qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
2582 qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
2583 $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
2584 $column_data{bom} .= qq|</td>|;
2586 $column_data{partsgroup} =
2587 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2591 qq|$form->{script}?action=edit&id=$form->{"id_$i"}&path=$form->{path}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
2592 $column_data{partnumber} =
2593 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
2594 $column_data{runningnumber} =
2595 qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
2597 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2599 $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
2601 qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
2603 $column_data{partsgroup} =
2604 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2607 $column_data{unit} =
2608 qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
2609 $column_data{description} =
2610 qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
2613 $column_data{total} = qq|<td align=right>$linetotal</td>|;
2618 map { print "\n$column_data{$_}" } @column_index;
2622 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2623 <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
2624 <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
2634 $lxdebug->leave_sub();
2638 $lxdebug->enter_sub();
2640 if ($form->{item} eq "assembly") {
2641 $i = $form->{assembly_rows};
2643 # if last row is empty check the form otherwise retrieve item
2644 if ( ($form->{"partnumber_$i"} eq "")
2645 && ($form->{"description_$i"} eq "")
2646 && ($form->{"partsgroup_$i"} eq "")) {
2652 IC->assembly_item(\%myconfig, \%$form);
2654 $rows = scalar @{ $form->{item_list} };
2657 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2660 $form->{makemodel_rows}--;
2664 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
2665 qw(partnumber description unit partsgroup);
2666 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
2667 keys %{ $form->{item_list}[0] };
2668 $form->{"runningnumber_$i"} = $form->{assembly_rows};
2669 $form->{assembly_rows}++;
2677 $form->{rowcount} = $i;
2678 $form->{assembly_rows}++;
2686 if ($form->{item} eq "part") {
2690 if ($form->{item} eq 'service') {
2691 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2692 qw(sellprice listprice);
2697 $lxdebug->leave_sub();
2701 $lxdebug->enter_sub();
2703 # check if there is a part number
2704 # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
2706 if ($form->{obsolete}) {
2709 "Inventory quantity must be zero before you can set this $form->{item} obsolete!"
2711 if ($form->{onhand});
2714 # expand dynamic strings
2715 # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
2716 # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
2717 # $locale->text('Part Number missing!')
2718 # $locale->text('Service Number missing!')
2719 # $locale->text('Assembly Number missing!')
2722 $lxdebug->message(LXDebug::DEBUG1,
2723 "ic.pl: sellprice in save = $form->{sellprice}\n");
2724 $rc = IC->save(\%myconfig, \%$form);
2726 $form->error($locale->text('Partnumber not unique!'));
2728 $parts_id = $form->{id};
2730 # load previous variables
2731 if ($form->{previousform}) {
2733 # save the new form variables before splitting previousform
2734 map { $newform{$_} = $form->{$_} } keys %$form;
2736 $previousform = $form->unescape($form->{previousform});
2738 # don't trample on previous variables
2739 map { delete $form->{$_} } keys %newform;
2741 # now take it apart and restore original values
2742 foreach $item (split /&/, $previousform) {
2743 ($key, $value) = split /=/, $item, 2;
2744 $value =~ s/%26/&/g;
2745 $form->{$key} = $value;
2747 $form->{taxaccounts} = $newform{taxaccount2};
2749 if ($form->{item} eq 'assembly') {
2751 # undo number formatting
2752 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2753 qw(weight listprice sellprice rop);
2755 $form->{assembly_rows}--;
2756 $i = $newform{rowcount};
2757 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2759 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
2760 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
2762 # change/add values for assembly item
2763 map { $form->{"${_}_$i"} = $newform{$_} }
2764 qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno);
2766 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
2767 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
2771 # set values for last invoice/order item
2772 $i = $form->{rowcount};
2773 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2775 map { $form->{"${_}_$i"} = $newform{$_} }
2776 qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice);
2777 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
2778 if ($form->{exchangerate} != 0) {
2779 $form->{"sellprice_$i"} /= $form->{exchangerate};
2781 $lxdebug->message(LXDebug::DEBUG1,
2782 qq|sellprice_$i in previousform 2 = |
2783 . $form->{"sellprice_$i"} . qq|\n|);
2784 map { $form->{"taxaccounts_$i"} .= "$_ " } split / /,
2785 $newform{taxaccount};
2786 chop $form->{"taxaccounts_$i"};
2787 foreach $item (qw(description rate taxnumber)) {
2788 $index = $form->{"taxaccounts_$i"} . "_$item";
2789 $form->{$index} = $newform{$index};
2792 # credit remaining calculation
2794 $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
2796 map { $form->{"${_}_base"} += $amount }
2797 (split / /, $form->{"taxaccounts_$i"});
2798 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
2799 split / /, $form->{"taxaccounts_$i"}
2800 if !$form->{taxincluded};
2802 $form->{creditremaining} -= $amount;
2804 # redo number formatting, because invoice parse them!
2805 $i = $form->{rowcount};
2807 $form->{"${_}_$i"} =
2808 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
2809 } qw(weight listprice sellprice rop);
2812 $form->{"id_$i"} = $parts_id;
2813 delete $form->{action};
2815 # restore original callback
2816 $callback = $form->unescape($form->{callback});
2817 $form->{callback} = $form->unescape($form->{old_callback});
2818 delete $form->{old_callback};
2820 $form->{makemodel_rows}--;
2822 # put callback together
2823 foreach $key (keys %$form) {
2825 # do single escape for Apache 2.0
2826 $value = $form->escape($form->{$key}, 1);
2827 $callback .= qq|&$key=$value|;
2829 $form->{callback} = $callback;
2831 $lxdebug->message(LXDebug::DEBUG1,
2832 qq|ic.pl: sellprice_$i nach sub save = |
2833 . $form->{"sellprice_$i"} . qq|\n|);
2838 $lxdebug->leave_sub();
2842 $lxdebug->enter_sub();
2847 $lxdebug->leave_sub();
2851 $lxdebug->enter_sub();
2853 $rc = IC->delete(\%myconfig, \%$form);
2856 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
2857 $form->error($locale->text('Cannot delete item!'));
2859 $lxdebug->leave_sub();
2862 sub stock_assembly {
2863 $lxdebug->enter_sub();
2865 $form->{title} = $locale->text('Stock Assembly');
2872 <form method=post action=$form->{script}>
2874 <table width="100%">
2876 <th class=listtop>$form->{title}</th>
2878 <tr height="5"></tr>
2883 <th align="right" nowrap="true">|
2884 . $locale->text('Part Number') . qq|</th>
2885 <td><input name=partnumber size=20></td>
2889 <th align="right" nowrap="true">|
2890 . $locale->text('Part Description') . qq|</th>
2891 <td><input name=description size=40></td>
2896 <tr><td><hr size=3 noshade></td></tr>
2899 <input type=hidden name=path value=$form->{path}>
2900 <input type=hidden name=login value=$form->{login}>
2901 <input type=hidden name=password value=$form->{password}>
2903 <input type=hidden name=nextsub value=list_assemblies>
2906 <input class=submit type=submit name=action value="|
2907 . $locale->text('Continue') . qq|">
2914 $lxdebug->leave_sub();
2917 sub list_assemblies {
2918 $lxdebug->enter_sub();
2920 IC->retrieve_assemblies(\%myconfig, \%$form);
2922 $column_header{partnumber} =
2923 qq|<th class=listheading>| . $locale->text('Part Number') . qq|</th>|;
2924 $column_header{description} =
2925 qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
2926 $column_header{bin} =
2927 qq|<th class=listheading>| . $locale->text('Bin') . qq|</th>|;
2928 $column_header{onhand} =
2929 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
2930 $column_header{rop} =
2931 qq|<th class=listheading>| . $locale->text('ROP') . qq|</th>|;
2932 $column_header{stock} =
2933 qq|<th class=listheading>| . $locale->text('Add') . qq|</th>|;
2935 @column_index = (qw(partnumber description bin onhand rop stock));
2937 $form->{title} = $locale->text('Stock Assembly');
2940 "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2944 $colspan = $#column_index + 1;
2949 <form method=post action=$form->{script}>
2953 <th class=listtop colspan=$colspan>$form->{title}</th>
2956 <tr class=listheading>|;
2958 map { print "\n$column_header{$_}" } @column_index;
2965 foreach $ref (@{ $form->{assembly_items} }) {
2967 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description);
2969 $column_data{partnumber} = qq|<td width=20%>$ref->{partnumber}</td>|;
2970 $column_data{description} =
2971 qq|<td width=50%>$ref->{description} </td>|;
2972 $column_data{bin} = qq|<td>$ref->{bin} </td>|;
2973 $column_data{onhand} =
2974 qq|<td align=right>|
2975 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
2978 qq|<td align=right>|
2979 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ")
2981 $column_data{stock} = qq|<td width=10%><input name="qty_$i" size=10></td>|;
2986 qq|<tr class=listrow$j><input name="id_$i" type=hidden value=$ref->{id}>\n|;
2988 map { print "\n$column_data{$_}" } @column_index;
3001 <td colspan=6><hr size=3 noshade>
3004 <input name=rowcount type=hidden value="$i">
3006 <input type=hidden name=path value=$form->{path}>
3007 <input type=hidden name=login value=$form->{login}>
3008 <input type=hidden name=password value=$form->{password}>
3010 <input name=callback type=hidden value="$form->{callback}">
3012 <input type=hidden name=nextsub value=restock_assemblies>
3015 <input class=submit type=submit name=action value="|
3016 . $locale->text('Continue') . qq|">
3024 $lxdebug->leave_sub();
3027 sub restock_assemblies {
3028 $lxdebug->enter_sub();
3030 $form->redirect($locale->text('Assemblies restocked!'))
3031 if (IC->restock_assemblies(\%myconfig, \%$form));
3032 $form->error($locale->text('Cannot stock assemblies!'));
3034 $lxdebug->leave_sub();
3038 $lxdebug->enter_sub();
3047 <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
3048 <th class="listheading">| . $locale->text('Preis') . qq|</th>
3051 for $i (1 .. $numrows) {
3054 <td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
3055 <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
3056 <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
3067 $lxdebug->leave_sub();
3070 sub continue { &{ $form->{nextsub} } }