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 #======================================================================
38 require "$form->{path}/io.pl";
45 $lxdebug->enter_sub();
47 $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
50 "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
51 unless $form->{callback};
54 ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea');
55 IC->get_pricegroups(\%myconfig, \%$form);
59 $lxdebug->leave_sub();
63 $lxdebug->enter_sub();
65 $form->{title} = (ucfirst $form->{searchitems}) . "s";
66 $form->{title} = $locale->text($form->{title});
68 # switch for backward sorting
71 # memory for which table was sort at last time
72 $form->{lastsort} = "";
74 # counter for added entries to top100
75 $form->{ndxs_counter} = 0;
77 # $locale->text('Parts')
78 # $locale->text('Services')
80 # use JavaScript Calendar or not
81 $form->{jsscript} = $jscalendar;
83 if ($form->{jsscript}) {
85 # with JavaScript Calendar
87 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
88 <td><input type=button name=transdatefrom id="trigger1" value=|
89 . $locale->text('button') . qq|></td>
92 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
93 <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
94 . $locale->text('button') . qq|></td>
99 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1",
100 "transdateto", "BL", "trigger2");
103 # without JavaScript Calendar
105 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
107 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
110 unless ($form->{searchitems} eq 'service') {
113 <input name=itemstatus class=radio type=radio value=onhand> |
114 . $locale->text('On Hand') . qq|
115 <input name=itemstatus class=radio type=radio value=short> |
116 . $locale->text('Short') . qq|
121 <th align=right nowrap>| . $locale->text('Make') . qq|</th>
122 <td><input name=make size=20></td>
123 <th align=right nowrap>| . $locale->text('Model') . qq|</th>
124 <td><input name=model size=20></td>
129 <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th>
130 <td><input name=serialnumber size=20></td>
133 $l_serialnumber = qq|
134 <td><input name=l_serialnumber class=checkbox type=checkbox value=Y> |
135 . $locale->text('Serial Number') . qq|</td>
140 if ($form->{searchitems} eq 'assembly') {
142 $form->{title} = $locale->text('Assemblies');
148 <input name=null class=radio type=radio value=1 checked> |
149 . $locale->text('Top Level') . qq|
150 <input name=bom class=checkbox type=checkbox value=1> |
151 . $locale->text('Individual Items') . qq|
165 <td><input name=sold class=checkbox type=checkbox value=1></td>
166 <td nowrap>| . $locale->text('Sold') . qq|</td>
169 <td colspan=2><hr size=1 noshade></td>
172 <td><input name=ordered class=checkbox type=checkbox value=1></td>
173 <td nowrap>| . $locale->text('Ordered') . qq|</td>
176 <td colspan=4><hr size=1 noshade></td>
179 <td><input name=quoted class=checkbox type=checkbox value=1></td>
180 <td nowrap>| . $locale->text('Quoted') . qq|</td>
184 <td width=5%> </td>
185 <th>| . $locale->text('From') . qq|</th>
187 <th>| . $locale->text('To') . qq|</th>
206 <td><input name=bought class=checkbox type=checkbox value=1></td>
207 <td nowrap>| . $locale->text('Bought') . qq|</td>
208 <td><input name=sold class=checkbox type=checkbox value=1></td>
209 <td nowrap>| . $locale->text('Sold') . qq|</td>
212 <td colspan=4><hr size=1 noshade></td>
215 <td><input name=onorder class=checkbox type=checkbox value=1></td>
216 <td nowrap>| . $locale->text('On Order') . qq|</td>
217 <td><input name=ordered class=checkbox type=checkbox value=1></td>
218 <td nowrap>| . $locale->text('Ordered') . qq|</td>
221 <td colspan=4><hr size=1 noshade></td>
224 <td><input name=rfq class=checkbox type=checkbox value=1></td>
225 <td nowrap>| . $locale->text('RFQ') . qq|</td>
226 <td><input name=quoted class=checkbox type=checkbox value=1></td>
227 <td nowrap>| . $locale->text('Quoted') . qq|</td>
231 <td width=5%> </td>
235 <th>| . $locale->text('From') . qq|</th>
237 <th>| . $locale->text('To') . qq|</th>
254 <form method=post action=$form->{script}>
256 <input type=hidden name=searchitems value=$form->{searchitems}>
257 <input type=hidden name=title value="$form->{title}">
259 <input type=hidden name=revers value="$form->{revers}">
260 <input type=hidden name=lastsort value="$form->{lastsort}">
263 <tr><th class=listtop>$form->{title}</th></tr>
269 <th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
270 <td><input name=partnumber size=20></td>
273 <th align=right nowrap>|
274 . $locale->text('Part Description') . qq|</th>
275 <td colspan=3><input name=description size=40></td>
278 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
279 <td><input name=partsgroup size=20></td>
284 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
285 <td><input name=drawing size=20></td>
286 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
287 <td><input name=microfiche size=20></td>
293 <input name=itemstatus class=radio type=radio value=active checked> |
294 . $locale->text('Active') . qq|
296 <input name=itemstatus class=radio type=radio value=obsolete> |
297 . $locale->text('Obsolete') . qq|
298 <input name=itemstatus class=radio type=radio value=orphaned> |
299 . $locale->text('Orphaned') . qq|
310 <th align=right nowrap>|
311 . $locale->text('Include in Report') . qq|</th>
315 <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked> |
316 . $locale->text('Part Number') . qq|</td>
317 <td><input name=l_description class=checkbox type=checkbox value=Y checked> |
318 . $locale->text('Part Description') . qq|</td>
320 <td><input name=l_unit class=checkbox type=checkbox value=Y checked> |
321 . $locale->text('Unit of measure') . qq|</td>
324 <td><input name=l_listprice class=checkbox type=checkbox value=Y> |
325 . $locale->text('List Price') . qq|</td>
326 <td><input name=l_sellprice class=checkbox type=checkbox value=Y checked> |
327 . $locale->text('Sell Price') . qq|</td>
328 <td><input name=l_lastcost class=checkbox type=checkbox value=Y> |
329 . $locale->text('Last Cost') . qq|</td>
330 <td><input name=l_linetotal class=checkbox type=checkbox value=Y checked> |
331 . $locale->text('Line Total') . qq|</td>
334 <td><input name=l_priceupdate class=checkbox type=checkbox value=Y> |
335 . $locale->text('Updated') . qq|</td>
336 <td><input name=l_bin class=checkbox type=checkbox value=Y> |
337 . $locale->text('Bin') . qq|</td>
338 <td><input name=l_rop class=checkbox type=checkbox value=Y> |
339 . $locale->text('ROP') . qq|</td>
340 <td><input name=l_weight class=checkbox type=checkbox value=Y> |
341 . $locale->text('Weight') . qq|</td>
344 <td><input name=l_image class=checkbox type=checkbox value=Y> |
345 . $locale->text('Image') . qq|</td>
346 <td><input name=l_drawing class=checkbox type=checkbox value=Y> |
347 . $locale->text('Drawing') . qq|</td>
348 <td><input name=l_microfiche class=checkbox type=checkbox value=Y> |
349 . $locale->text('Microfiche') . qq|</td>
350 <td><input name=l_partsgroup class=checkbox type=checkbox value=Y> |
351 . $locale->text('Group') . qq|</td>
354 <td><input name=l_subtotal class=checkbox type=checkbox value=Y> |
355 . $locale->text('Subtotal') . qq|</td>
356 <td><input name=l_soldtotal class=checkbox type=checkbox value=Y> |
357 . $locale->text('soldtotal') . qq|</td>
365 <tr><td colspan=4><hr size=3 noshade></td></tr>
370 <input type=hidden name=nextsub value=generate_report>
372 <input type=hidden name=path value=$form->{path}>
373 <input type=hidden name=login value=$form->{login}>
374 <input type=hidden name=password value=$form->{password}>
376 <input type=hidden name=revers value="$form->{revers}">
377 <input type=hidden name=lastsort value="$form->{lastsort}">
379 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
382 <input class=submit type=submit name=action value="|
383 . $locale->text('Continue') . qq|">
384 <input class=submit type=submit name=action value="|
385 . $locale->text('TOP100') . qq|">
391 $lxdebug->leave_sub();
395 $lxdebug->enter_sub();
397 $form->{title} = $locale->text('Top 100 hinzufuegen');
404 <form method=post action=$form->{script}>
406 <input type=hidden name=searchitems value=$form->{searchitems}>
407 <input type=hidden name=title value="$form->{title}">
409 <input type=hidden name=revers value="$form->{revers}">
410 <input type=hidden name=lastsort value="$form->{lastsort}">|;
414 <tr class=listheading>
415 <th class=listheading nowrap>|
416 . $locale->text('Part Number') . qq|</th>
417 <th class=listheading nowrap>|
418 . $locale->text('Part Description') . qq|</th>
421 <td><input type=text name=partnumber size=20 value=></td>
422 <td><input type=text name=description size=30 value=></td>
429 <input type=hidden name=path value=$form->{path}>
430 <input type=hidden name=login value=$form->{login}>
431 <input type=hidden name=password value=$form->{password}>
433 <input type=hidden name=itemstatus value="$form->{itemstatus}">
434 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
435 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
436 <input type=hidden name=l_description value="$form->{l_description}">
437 <input type=hidden name=l_onhand value="$form->{l_onhand}">
438 <input type=hidden name=l_unit value="$form->{l_unit}">
439 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
440 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
441 <input type=hidden name=sort value="$form->{sort}">
442 <input type=hidden name=revers value="$form->{revers}">
443 <input type=hidden name=lastsort value="$form->{lastsort}">
445 <input type=hidden name=bom value="$form->{bom}">
446 <input type=hidden name=titel value="$form->{titel}">
447 <input type=hidden name=searchitems value="$form->{searchitems}">
449 <input type=hidden name=row value=$j>
451 <input type=hidden name=nextsub value=item_selected>
453 <input type=hidden name=test value=item_selected>
455 <input name=lastndx type=hidden value=$lastndx>
457 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>
459 <input name=extras type=hidden value=$form->{extras}>|;
463 for ($i = 0; $i < $form->{ndxs_counter}; $i++) {
466 $partnumber = $form->{"totop100_partnumber_$j"};
467 $description = $form->{"totop100_description_$j"};
468 $unit = $form->{"totop100_unit_$j"};
469 $sellprice = $form->{"totop100_sellprice_$j"};
470 $soldtotal = $form->{"totop100_soldtotal_$j"};
472 # insert data into top100
473 push @{ $form->{parts} },
475 partnumber => "$partnumber",
476 description => "$description",
478 sellprice => "$sellprice",
479 soldtotal => "$soldtotal" };
485 # set data for next page
486 if (($form->{ndxs_counter}) > 0) {
487 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
488 $partnumber = $form->{"totop100_partnumber_$i"};
489 $description = $form->{"totop100_description_$i"};
490 $unit = $form->{"totop100_unit_$i"};
491 $sellprice = $form->{"totop100_sellprice_$i"};
492 $soldtotal = $form->{"totop100_soldtotal_$i"};
495 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
496 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
497 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
498 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
499 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
507 <input class=submit type=submit name=action value="|
508 . $locale->text('list') . qq|">
513 $lxdebug->leave_sub();
517 $lxdebug->enter_sub();
520 if (($form->{partnumber} eq "") and ($form->{description} eq "")) {
521 IC->get_parts(\%myconfig, \%$form, "");
523 if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) {
524 IC->get_parts(\%myconfig, \%$form, "partnumber");
526 if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) {
527 IC->get_parts(\%myconfig, \%$form, "description");
529 IC->get_parts(\%myconfig, \%$form, "all");
534 $form->{title} = $locale->text('Top 100 hinzufuegen');
540 <form method=post action=ic.pl>
543 <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
546 <tr class=listheading>
548 <th class=listheading>| . $locale->text('Part Number') . qq|</th>
549 <th class=listheading>| . $locale->text('Part Description') . qq|</th>
550 <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
551 <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
552 <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
556 my $i = $form->{rows};
558 for ($j = 1; $j <= $i; $j++) {
561 <tr class=listrow1>|;
564 <td><input name=ndx class=radio type=radio value=$j checked></td>|;
567 <td><input name=ndx class=radio type=radio value=$j></td>|;
570 <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
571 <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
572 <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
573 <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
574 <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
577 <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
587 <input type=hidden name=path value=$form->{path}>
588 <input type=hidden name=login value=$form->{login}>
589 <input type=hidden name=password value=$form->{password}>
591 <input type=hidden name=itemstatus value="$form->{itemstatus}">
592 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
593 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
594 <input type=hidden name=l_description value="$form->{l_description}">
595 <input type=hidden name=l_onhand value="$form->{l_onhand}">
596 <input type=hidden name=l_unit value="$form->{l_unit}">
597 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
598 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
599 <input type=hidden name=sort value="$form->{sort}">
600 <input type=hidden name=revers value="$form->{revers}">
601 <input type=hidden name=lastsort value="$form->{lastsort}">
603 <input type=hidden name=bom value="$form->{bom}">
604 <input type=hidden name=titel value="$form->{titel}">
605 <input type=hidden name=searchitems value="$form->{searchitems}">
607 <input type=hidden name=row value=$j>
609 <input type=hidden name=nextsub value=item_selected>
611 <input name=lastndx type=hidden value=$lastndx>
613 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
617 if (($form->{ndxs_counter}) > 0) {
618 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
619 $j1 = $form->{"totop100_partnumber_$i"};
620 $j2 = $form->{"totop100_description_$i"};
621 $j3 = $form->{"totop100_unit_$i"};
622 $j4 = $form->{"totop100_sellprice_$i"};
623 $j5 = $form->{"totop100_soldtotal_$i"};
632 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
633 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
634 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
635 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
636 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
644 <input class=submit type=submit name=action value="|
645 . $locale->text('TOP100') . qq|">
651 $lxdebug->leave_sub();
655 $lxdebug->enter_sub();
658 $form->{ndxs_counter}++;
660 if ($form->{ndxs_counter} > 0) {
662 $index = $form->{ndx};
664 $j1 = $form->{"new_partnumber_$index"};
665 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $j1;
666 $j2 = $form->{"new_description_$index"};
667 $form->{"totop100_description_$form->{ndxs_counter}"} = $j2;
668 $j3 = $form->{"new_unit_$index"};
669 $form->{"totop100_unit_$form->{ndxs_counter}"} = $j3;
670 $j4 = $form->{"new_sellprice_$index"};
671 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $j4;
672 $j5 = $form->{"new_soldtotal_$index"};
673 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $j5;
677 $lxdebug->leave_sub();
681 $lxdebug->enter_sub();
683 $form->{top100} = "top100";
684 $form->{l_soldtotal} = "Y";
685 $form->{soldtotal} = "soldtotal";
686 $form->{sort} = "soldtotal";
687 $form->{l_qty} = "N";
688 $callback .= "&form->{top100}=$form->{top100}";
689 $form->{l_linetotal} = "";
691 $form->{number} = "position";
692 $form->{l_number} = "Y";
696 $form->{title} = $locale->text('Top 100');
698 $revers = $form->{revers};
699 $lastsort = $form->{lastsort};
701 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
703 $form->{lastsort} = "partnumber";
704 $form->{sort} = "partnumber";
708 "$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="
709 . $form->escape($form->{title}, 1);
711 # if we have a serialnumber limit search
712 if ($form->{serialnumber} || $form->{l_serialnumber}) {
713 $form->{l_serialnumber} = "Y";
714 unless ( $form->{bought}
717 || $form->{quoted}) {
718 $form->{bought} = $form->{sold} = 1;
721 IC->all_parts(\%myconfig, \%$form);
723 if ($form->{itemstatus} eq 'active') {
724 $option .= $locale->text('Active') . " : ";
726 if ($form->{itemstatus} eq 'obsolete') {
727 $option .= $locale->text('Obsolete') . " : ";
729 if ($form->{itemstatus} eq 'orphaned') {
730 $option .= $locale->text('Orphaned') . " : ";
732 if ($form->{itemstatus} eq 'onhand') {
733 $option .= $locale->text('On Hand') . " : ";
734 $form->{l_onhand} = "Y";
736 if ($form->{itemstatus} eq 'short') {
737 $option .= $locale->text('Short') . " : ";
738 $form->{l_onhand} = "Y";
740 if ($form->{onorder}) {
741 $form->{l_ordnumber} = "Y";
742 $callback .= "&onorder=$form->{onorder}";
743 $option .= $locale->text('On Order') . " : ";
745 if ($form->{ordered}) {
746 $form->{l_ordnumber} = "Y";
747 $callback .= "&ordered=$form->{ordered}";
748 $option .= $locale->text('Ordered') . " : ";
751 $form->{l_quonumber} = "Y";
752 $callback .= "&rfq=$form->{rfq}";
753 $option .= $locale->text('RFQ') . " : ";
755 if ($form->{quoted}) {
756 $form->{l_quonumber} = "Y";
757 $callback .= ""ed=$form->{quoted}";
758 $option .= $locale->text('Quoted') . " : ";
760 if ($form->{bought}) {
761 $form->{l_invnumber} = "Y";
762 $callback .= "&bought=$form->{bought}";
763 $option .= $locale->text('Bought') . " : ";
766 $form->{l_invnumber} = "Y";
767 $callback .= "&sold=$form->{sold}";
768 $option .= $locale->text('Sold') . " : ";
775 || $form->{quoted}) {
777 $form->{l_lastcost} = "";
778 $form->{l_name} = "Y";
779 if ($form->{transdatefrom}) {
780 $callback .= "&transdatefrom=$form->{transdatefrom}";
782 . $locale->text('From')
784 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
786 if ($form->{transdateto}) {
787 $callback .= "&transdateto=$form->{transdateto}";
789 . $locale->text('To')
791 . $locale->date(\%myconfig, $form->{transdateto}, 1);
797 if ($form->{partnumber}) {
798 $callback .= "&partnumber=$form->{partnumber}";
799 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
801 if ($form->{partsgroup}) {
802 $callback .= "&partsgroup=$form->{partsgroup}";
803 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
805 if ($form->{serialnumber}) {
806 $callback .= "&serialnumber=$form->{serialnumber}";
808 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
810 if ($form->{description}) {
811 $callback .= "&description=$form->{description}";
812 $description = $form->{description};
816 $locale->text('Part Description') . qq| : $form->{description}<br>|;
819 $callback .= "&make=$form->{make}";
820 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
822 if ($form->{model}) {
823 $callback .= "&model=$form->{model}";
824 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
826 if ($form->{drawing}) {
827 $callback .= "&drawing=$form->{drawing}";
828 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
830 if ($form->{microfiche}) {
831 $callback .= "µfiche=$form->{microfiche}";
832 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
834 if ($form->{l_soldtotal}) {
835 $callback .= "&soldtotal=$form->{soldtotal}";
836 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
839 @columns = $form->sort_columns(
840 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)
843 if ($form->{l_linetotal}) {
844 $form->{l_onhand} = "Y";
845 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
846 if ($form->{l_lastcost}) {
847 $form->{l_linetotallastcost} = "Y";
848 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
849 $form->{l_linetotallastcost} = "";
852 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
855 if ($form->{searchitems} eq 'service') {
857 # remove bin, weight and rop from list
858 map { $form->{"l_$_"} = "" } qw(bin weight rop);
860 $form->{l_onhand} = "";
862 # qty is irrelevant unless bought or sold
868 || $form->{quoted}) {
869 $form->{l_onhand} = "Y";
871 $form->{l_linetotalsellprice} = "";
872 $form->{l_linetotallastcost} = "";
876 $form->{l_lastcost} = ""
877 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
879 foreach $item (@columns) {
880 if ($form->{"l_$item"} eq "Y") {
881 push @column_index, $item;
883 # add column to callback
884 $callback .= "&l_$item=Y";
888 if ($form->{l_subtotal} eq 'Y') {
889 $callback .= "&l_subtotal=Y";
892 $column_header{number} =
893 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
894 $column_header{partnumber} =
895 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
896 . $locale->text('Part Number')
898 $column_header{description} =
899 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
900 . $locale->text('Part Description')
902 $column_header{partsgroup} =
903 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
904 . $locale->text('Group')
906 $column_header{bin} =
907 qq|<th><a class=listheading href=$callback&sort=bin>|
908 . $locale->text('Bin')
910 $column_header{priceupdate} =
911 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
912 . $locale->text('Updated')
914 $column_header{onhand} =
915 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
916 . $locale->text('Qty')
918 $column_header{unit} =
919 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
920 $column_header{listprice} =
921 qq|<th class=listheading nowrap>|
922 . $locale->text('List Price')
924 $column_header{lastcost} =
925 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
926 $column_header{rop} =
927 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
928 $column_header{weight} =
929 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
931 $column_header{invnumber} =
932 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
933 . $locale->text('Invoice Number')
935 $column_header{ordnumber} =
936 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
937 . $locale->text('Order Number')
939 $column_header{quonumber} =
940 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
941 . $locale->text('Quotation')
944 $column_header{name} =
945 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
946 . $locale->text('Name')
949 $column_header{sellprice} =
950 qq|<th class=listheading nowrap>|
951 . $locale->text('Sell Price')
953 $column_header{linetotalsellprice} =
954 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
955 $column_header{linetotallastcost} =
956 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
957 $column_header{linetotallistprice} =
958 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
960 $column_header{image} =
961 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
962 $column_header{drawing} =
963 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
964 . $locale->text('Drawing')
966 $column_header{microfiche} =
967 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
968 . $locale->text('Microfiche')
971 $column_header{serialnumber} =
972 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
973 . $locale->text('Serial Number')
975 $column_header{soldtotal} =
976 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
977 . $locale->text('soldtotal')
981 $colspan = $#column_index + 1;
988 <th class=listtop colspan=$colspan>$form->{title}</th>
992 <tr><td colspan=$colspan>$option</td></tr>
994 <tr class=listheading>
997 map { print "\n$column_header{$_}" } @column_index;
1003 # add order to callback
1004 $form->{callback} = $callback .= "&sort=$form->{sort}";
1006 # escape callback for href
1007 $callback = $form->escape($callback);
1009 if (@{ $form->{parts} }) {
1010 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1013 # insert numbers for top100
1015 foreach $ref (@{ $form->{parts} }) {
1017 $ref->{number} = $j;
1020 # if avaible -> insert choice here
1021 if (($form->{ndxs_counter}) > 0) {
1022 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
1023 $partnumber = $form->{"totop100_partnumber_$i"};
1024 $description = $form->{"totop100_description_$i"};
1025 $unit = $form->{"totop100_unit_$i"};
1026 $sellprice = $form->{"totop100_sellprice_$i"};
1027 $soldtotal = $form->{"totop100_soldtotal_$i"};
1030 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
1031 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
1032 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
1033 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
1034 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
1038 push @{ $form->{parts} },
1040 partnumber => "$partnumber",
1041 description => "$description",
1043 sellprice => "$sellprice",
1044 soldtotal => "$soldtotal" };
1047 # build data for columns
1048 foreach $ref (@{ $form->{parts} }) {
1050 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1051 if ($sameitem ne $ref->{ $form->{sort} }) {
1053 $sameitem = $ref->{ $form->{sort} };
1057 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1058 $ref->{sellprice} *= $ref->{exchangerate};
1059 $ref->{listprice} *= $ref->{exchangerate};
1060 $ref->{lastcost} *= $ref->{exchangerate};
1062 # use this for assemblies
1063 $onhand = $ref->{onhand};
1066 if ($ref->{assemblyitem}) {
1068 $onhand = 0 if ($form->{sold});
1071 $ref->{description} =~ s/
1074 $column_data{number} =
1076 . $form->format_amount(\%myconfig, $ref->{number}, '', " ")
1078 $column_data{partnumber} =
1079 "<td align=$align>$ref->{partnumber} </a></td>";
1080 $column_data{description} = "<td>$ref->{description} </td>";
1081 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1083 $column_data{onhand} =
1085 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1087 $column_data{sellprice} =
1089 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1091 $column_data{listprice} =
1093 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1095 $column_data{lastcost} =
1097 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1100 $column_data{linetotalsellprice} = "<td align=right>"
1101 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1104 $column_data{linetotallastcost} = "<td align=right>"
1105 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1108 $column_data{linetotallistprice} = "<td align=right>"
1109 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1113 if (!$ref->{assemblyitem}) {
1114 $totalsellprice += $onhand * $ref->{sellprice};
1115 $totallastcost += $onhand * $ref->{lastcost};
1116 $totallistprice += $onhand * $ref->{listprice};
1118 $subtotalonhand += $onhand;
1119 $subtotalsellprice += $onhand * $ref->{sellprice};
1120 $subtotallastcost += $onhand * $ref->{lastcost};
1121 $subtotallistprice += $onhand * $ref->{listprice};
1126 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1127 $column_data{weight} =
1129 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1131 $column_data{unit} = "<td>$ref->{unit} </td>";
1132 $column_data{bin} = "<td>$ref->{bin} </td>";
1133 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1135 $column_data{invnumber} =
1136 ($ref->{module} ne 'oe')
1137 ? "<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>"
1138 : "<td>$ref->{invnumber}</td>";
1139 $column_data{ordnumber} =
1140 ($ref->{module} eq 'oe')
1141 ? "<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>"
1142 : "<td>$ref->{ordnumber}</td>";
1143 $column_data{quonumber} =
1144 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1145 ? "<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>"
1146 : "<td>$ref->{quonumber}</td>";
1148 $column_data{name} = "<td>$ref->{name}</td>";
1150 $column_data{image} =
1152 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1153 : "<td> </td>";
1154 $column_data{drawing} =
1156 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1157 : "<td> </td>";
1158 $column_data{microfiche} =
1159 ($ref->{microfiche})
1160 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1161 : "<td> </td>";
1163 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1165 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
1169 print "<tr class=listrow$i>";
1171 map { print "\n$column_data{$_}" } @column_index;
1178 if ($form->{l_subtotal} eq 'Y') {
1182 if ($form->{"l_linetotal"}) {
1183 map { $column_data{$_} = "<td> </td>" } @column_index;
1184 $column_data{linetotalsellprice} =
1185 "<th class=listtotal align=right>"
1186 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1188 $column_data{linetotallastcost} =
1189 "<th class=listtotal align=right>"
1190 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1192 $column_data{linetotallistprice} =
1193 "<th class=listtotal align=right>"
1194 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1197 print "<tr class=listtotal>";
1199 map { print "\n$column_data{$_}" } @column_index;
1206 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1215 <form method=post action=$form->{script}>
1217 <input type=hidden name=path value=$form->{path}>
1218 <input type=hidden name=login value=$form->{login}>
1219 <input type=hidden name=password value=$form->{password}>
1221 <input type=hidden name=itemstatus value="$form->{itemstatus}">
1222 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
1223 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
1224 <input type=hidden name=l_description value="$form->{l_description}">
1225 <input type=hidden name=l_onhand value="$form->{l_onhand}">
1226 <input type=hidden name=l_unit value="$form->{l_unit}">
1227 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
1228 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
1229 <input type=hidden name=sort value="$form->{sort}">
1230 <input type=hidden name=revers value="$form->{revers}">
1231 <input type=hidden name=lastsort value="$form->{lastsort}">
1232 <input type=hidden name=parts value="$form->{parts}">
1234 <input type=hidden name=bom value="$form->{bom}">
1235 <input type=hidden name=titel value="$form->{titel}">
1236 <input type=hidden name=searchitems value="$form->{searchitems}">|;
1241 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
1243 <input class=submit type=submit name=action value="|
1244 . $locale->text('choice') . qq|">|;
1246 if ($form->{menubar}) {
1247 require "$form->{path}/menu.pl";
1258 $lxdebug->leave_sub();
1261 sub generate_report {
1262 $lxdebug->enter_sub();
1264 $revers = $form->{revers};
1265 $lastsort = $form->{lastsort};
1267 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1268 $form->{revers} = 0;
1269 $form->{lastsort} = "partnumber";
1270 $form->{sort} = "partnumber";
1273 # switch between backward sorting of tables
1274 if ($form->{lastsort} eq $form->{sort}) {
1275 if ($form->{revers} == 0) {
1276 $form->{revers} = 1;
1278 $form->{revers} = 0;
1281 $form->{revers} == 0;
1282 $form->{lastsort} = $form->{sort};
1287 "$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="
1288 . $form->escape($form->{title}, 1);
1290 # if we have a serialnumber limit search
1291 if ($form->{serialnumber} || $form->{l_serialnumber}) {
1292 $form->{l_serialnumber} = "Y";
1293 unless ( $form->{bought}
1296 || $form->{quoted}) {
1297 $form->{bought} = $form->{sold} = 1;
1301 IC->all_parts(\%myconfig, \%$form);
1303 if ($form->{itemstatus} eq 'active') {
1304 $option .= $locale->text('Active') . " : ";
1306 if ($form->{itemstatus} eq 'obsolete') {
1307 $option .= $locale->text('Obsolete') . " : ";
1309 if ($form->{itemstatus} eq 'orphaned') {
1310 $option .= $locale->text('Orphaned') . " : ";
1312 if ($form->{itemstatus} eq 'onhand') {
1313 $option .= $locale->text('On Hand') . " : ";
1314 $form->{l_onhand} = "Y";
1316 if ($form->{itemstatus} eq 'short') {
1317 $option .= $locale->text('Short') . " : ";
1318 $form->{l_onhand} = "Y";
1320 if ($form->{onorder}) {
1321 $form->{l_ordnumber} = "Y";
1322 $callback .= "&onorder=$form->{onorder}";
1323 $option .= $locale->text('On Order') . " : ";
1325 if ($form->{ordered}) {
1326 $form->{l_ordnumber} = "Y";
1327 $callback .= "&ordered=$form->{ordered}";
1328 $option .= $locale->text('Ordered') . " : ";
1331 $form->{l_quonumber} = "Y";
1332 $callback .= "&rfq=$form->{rfq}";
1333 $option .= $locale->text('RFQ') . " : ";
1335 if ($form->{quoted}) {
1336 $form->{l_quonumber} = "Y";
1337 $callback .= ""ed=$form->{quoted}";
1338 $option .= $locale->text('Quoted') . " : ";
1340 if ($form->{bought}) {
1341 $form->{l_invnumber} = "Y";
1342 $callback .= "&bought=$form->{bought}";
1343 $option .= $locale->text('Bought') . " : ";
1345 if ($form->{sold}) {
1346 $form->{l_invnumber} = "Y";
1347 $callback .= "&sold=$form->{sold}";
1348 $option .= $locale->text('Sold') . " : ";
1350 if ( $form->{bought}
1355 || $form->{quoted}) {
1357 $form->{l_lastcost} = "";
1358 $form->{l_name} = "Y";
1359 if ($form->{transdatefrom}) {
1360 $callback .= "&transdatefrom=$form->{transdatefrom}";
1362 . $locale->text('From')
1364 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1366 if ($form->{transdateto}) {
1367 $callback .= "&transdateto=$form->{transdateto}";
1369 . $locale->text('To')
1371 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1377 if ($form->{partnumber}) {
1378 $callback .= "&partnumber=$form->{partnumber}";
1379 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
1381 if ($form->{partsgroup}) {
1382 $callback .= "&partsgroup=$form->{partsgroup}";
1383 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
1385 if ($form->{serialnumber}) {
1386 $callback .= "&serialnumber=$form->{serialnumber}";
1388 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
1390 if ($form->{description}) {
1391 $callback .= "&description=$form->{description}";
1392 $description = $form->{description};
1396 $locale->text('Part Description') . qq| : $form->{description}<br>|;
1398 if ($form->{make}) {
1399 $callback .= "&make=$form->{make}";
1400 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
1402 if ($form->{model}) {
1403 $callback .= "&model=$form->{model}";
1404 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
1406 if ($form->{drawing}) {
1407 $callback .= "&drawing=$form->{drawing}";
1408 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
1410 if ($form->{microfiche}) {
1411 $callback .= "µfiche=$form->{microfiche}";
1412 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
1415 # table soldtotal aktive
1416 if ($form->{l_soldtotal}) {
1417 $callback .= "&soldtotal=$form->{soldtotal}";
1418 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1421 @columns = $form->sort_columns(
1422 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)
1425 if ($form->{l_linetotal}) {
1426 $form->{l_onhand} = "Y";
1427 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1428 if ($form->{l_lastcost}) {
1429 $form->{l_linetotallastcost} = "Y";
1430 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1431 $form->{l_linetotallastcost} = "";
1434 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1437 if ($form->{searchitems} eq 'service') {
1439 # remove bin, weight and rop from list
1440 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1442 $form->{l_onhand} = "";
1444 # qty is irrelevant unless bought or sold
1445 if ( $form->{bought}
1450 || $form->{quoted}) {
1451 $form->{l_onhand} = "Y";
1453 $form->{l_linetotalsellprice} = "";
1454 $form->{l_linetotallastcost} = "";
1458 $form->{l_lastcost} = ""
1459 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1461 foreach $item (@columns) {
1462 if ($form->{"l_$item"} eq "Y") {
1463 push @column_index, $item;
1465 # add column to callback
1466 $callback .= "&l_$item=Y";
1470 if ($form->{l_subtotal} eq 'Y') {
1471 $callback .= "&l_subtotal=Y";
1473 $column_header{partnumber} =
1474 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1475 . $locale->text('Part Number')
1477 $column_header{description} =
1478 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1479 . $locale->text('Part Description')
1481 $column_header{partsgroup} =
1482 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
1483 . $locale->text('Group')
1485 $column_header{bin} =
1486 qq|<th><a class=listheading href=$callback&sort=bin>|
1487 . $locale->text('Bin')
1489 $column_header{priceupdate} =
1490 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
1491 . $locale->text('Updated')
1493 $column_header{onhand} =
1494 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1495 . $locale->text('Qty')
1497 $column_header{unit} =
1498 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
1499 $column_header{listprice} =
1500 qq|<th class=listheading nowrap>|
1501 . $locale->text('List Price')
1503 $column_header{lastcost} =
1504 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
1505 $column_header{rop} =
1506 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
1507 $column_header{weight} =
1508 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
1510 $column_header{invnumber} =
1511 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
1512 . $locale->text('Invoice Number')
1514 $column_header{ordnumber} =
1515 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
1516 . $locale->text('Order Number')
1518 $column_header{quonumber} =
1519 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
1520 . $locale->text('Quotation')
1523 $column_header{name} =
1524 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
1525 . $locale->text('Name')
1528 $column_header{sellprice} =
1529 qq|<th class=listheading nowrap>|
1530 . $locale->text('Sell Price')
1532 $column_header{linetotalsellprice} =
1533 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1534 $column_header{linetotallastcost} =
1535 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1536 $column_header{linetotallistprice} =
1537 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1539 $column_header{image} =
1540 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
1541 $column_header{drawing} =
1542 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
1543 . $locale->text('Drawing')
1545 $column_header{microfiche} =
1546 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
1547 . $locale->text('Microfiche')
1550 $column_header{serialnumber} =
1551 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
1552 . $locale->text('Serial Number')
1554 $column_header{soldtotal} =
1555 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1556 . $locale->text('soldtotal')
1560 $colspan = $#column_index + 1;
1567 <th class=listtop colspan=$colspan>$form->{title}</th>
1569 <tr height="5"></tr>
1571 <tr><td colspan=$colspan>$option</td></tr>
1573 <tr class=listheading>
1576 map { print "\n$column_header{$_}" } @column_index;
1582 # add order to callback
1583 $form->{callback} = $callback .= "&sort=$form->{sort}";
1585 # escape callback for href
1586 $callback = $form->escape($callback);
1588 if (@{ $form->{parts} }) {
1589 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1592 foreach $ref (@{ $form->{parts} }) {
1594 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1595 if ($sameitem ne $ref->{ $form->{sort} }) {
1597 $sameitem = $ref->{ $form->{sort} };
1601 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1602 $ref->{sellprice} *= $ref->{exchangerate};
1603 $ref->{listprice} *= $ref->{exchangerate};
1604 $ref->{lastcost} *= $ref->{exchangerate};
1606 # use this for assemblies
1607 $onhand = $ref->{onhand};
1610 if ($ref->{assemblyitem}) {
1612 $onhand = 0 if ($form->{sold});
1615 $ref->{description} =~ s/
1618 $column_data{partnumber} =
1619 "<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>";
1620 $column_data{description} = "<td>$ref->{description} </td>";
1621 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1623 $column_data{onhand} =
1625 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1627 $column_data{sellprice} =
1629 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1631 $column_data{listprice} =
1633 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1635 $column_data{lastcost} =
1637 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1640 $column_data{linetotalsellprice} = "<td align=right>"
1641 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1644 $column_data{linetotallastcost} = "<td align=right>"
1645 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1648 $column_data{linetotallistprice} = "<td align=right>"
1649 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1653 if (!$ref->{assemblyitem}) {
1654 $totalsellprice += $onhand * $ref->{sellprice};
1655 $totallastcost += $onhand * $ref->{lastcost};
1656 $totallistprice += $onhand * $ref->{listprice};
1658 $subtotalonhand += $onhand;
1659 $subtotalsellprice += $onhand * $ref->{sellprice};
1660 $subtotallastcost += $onhand * $ref->{lastcost};
1661 $subtotallistprice += $onhand * $ref->{listprice};
1666 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1667 $column_data{weight} =
1669 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1671 $column_data{unit} = "<td>$ref->{unit} </td>";
1672 $column_data{bin} = "<td>$ref->{bin} </td>";
1673 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1675 $column_data{invnumber} =
1676 ($ref->{module} ne 'oe')
1677 ? "<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>"
1678 : "<td>$ref->{invnumber}</td>";
1679 $column_data{ordnumber} =
1680 ($ref->{module} eq 'oe')
1681 ? "<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>"
1682 : "<td>$ref->{ordnumber}</td>";
1683 $column_data{quonumber} =
1684 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1685 ? "<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>"
1686 : "<td>$ref->{quonumber}</td>";
1688 $column_data{name} = "<td>$ref->{name}</td>";
1690 $column_data{image} =
1692 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1693 : "<td> </td>";
1694 $column_data{drawing} =
1696 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1697 : "<td> </td>";
1698 $column_data{microfiche} =
1699 ($ref->{microfiche})
1700 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1701 : "<td> </td>";
1703 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1705 $column_data{soldtotal} =
1707 . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ")
1712 print "<tr class=listrow$i>";
1714 map { print "\n$column_data{$_}" } @column_index;
1722 if ($form->{l_subtotal} eq 'Y') {
1726 if ($form->{"l_linetotal"}) {
1727 map { $column_data{$_} = "<td> </td>" } @column_index;
1728 $column_data{linetotalsellprice} =
1729 "<th class=listtotal align=right>"
1730 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1732 $column_data{linetotallastcost} =
1733 "<th class=listtotal align=right>"
1734 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1736 $column_data{linetotallistprice} =
1737 "<th class=listtotal align=right>"
1738 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1741 print "<tr class=listtotal>";
1743 map { print "\n$column_data{$_}" } @column_index;
1750 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1759 <form method=post action=$form->{script}>
1761 <input name=callback type=hidden value="$form->{callback}">
1763 <input type=hidden name=item value=$form->{searchitems}>
1765 <input type=hidden name=path value=$form->{path}>
1766 <input type=hidden name=login value=$form->{login}>
1767 <input type=hidden name=password value=$form->{password}>|;
1770 <input class=submit type=submit name=action value="|
1771 . $locale->text('Add') . qq|">|;
1773 if ($form->{menubar}) {
1774 require "$form->{path}/menu.pl";
1785 $lxdebug->leave_sub();
1786 } #end generate_report
1788 sub parts_subtotal {
1789 $lxdebug->enter_sub();
1791 map { $column_data{$_} = "<td> </td>" } @column_index;
1792 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1794 $column_data{onhand} =
1795 "<th class=listsubtotal align=right>"
1796 . $form->format_amount(\%myconfig, $subtotalonhand, '', " ")
1799 $column_data{linetotalsellprice} =
1800 "<th class=listsubtotal align=right>"
1801 . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ")
1803 $column_data{linetotallistprice} =
1804 "<th class=listsubtotal align=right>"
1805 . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ")
1807 $column_data{linetotallastcost} =
1808 "<th class=listsubtotal align=right>"
1809 . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ")
1812 $subtotalonhand = 0;
1813 $subtotalsellprice = 0;
1814 $subtotallistprice = 0;
1815 $subtotallastcost = 0;
1817 print "<tr class=listsubtotal>";
1819 map { print "\n$column_data{$_}" } @column_index;
1825 $lxdebug->leave_sub();
1829 $lxdebug->enter_sub();
1831 IC->get_part(\%myconfig, \%$form);
1833 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1838 $lxdebug->leave_sub();
1842 $lxdebug->enter_sub();
1844 IC->create_links("IC", \%myconfig, \%$form);
1847 map { $form->{selectcurrency} .= "<option>$_\n" } split /:/,
1848 $form->{currencies};
1850 # parts and assemblies have the same links
1851 $item = $form->{item};
1852 if ($form->{item} eq 'assembly') {
1856 # build the popup menus
1857 $form->{taxaccounts} = "";
1858 foreach $key (keys %{ $form->{IC_links} }) {
1859 foreach $ref (@{ $form->{IC_links}{$key} }) {
1861 # if this is a tax field
1862 if ($key =~ /IC_tax/) {
1863 if ($key =~ /$item/) {
1864 $form->{taxaccounts} .= "$ref->{accno} ";
1865 $form->{"IC_tax_$ref->{accno}_description"} =
1866 "$ref->{accno}--$ref->{description}";
1869 if ($form->{amount}{ $ref->{accno} }) {
1870 $form->{"IC_tax_$ref->{accno}"} = "checked";
1873 $form->{"IC_tax_$ref->{accno}"} = "checked";
1878 $form->{"select$key"} .=
1879 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1880 if ($form->{amount}{$key} eq $ref->{accno}) {
1881 $form->{$key} = "$ref->{accno}--$ref->{description}";
1887 chop $form->{taxaccounts};
1889 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1890 $form->{selectIC_income} = $form->{selectIC_sale};
1891 $form->{selectIC_expense} = $form->{selectIC_cogs};
1892 $form->{IC_income} = $form->{IC_sale};
1893 $form->{IC_expense} = $form->{IC_cogs};
1896 delete $form->{IC_links};
1897 delete $form->{amount};
1899 $form->get_partsgroup(\%myconfig, { all => 1 });
1901 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1903 if (@{ $form->{all_partsgroup} }) {
1904 $form->{selectpartsgroup} = qq|<option>\n|;
1906 $form->{selectpartsgroup} .=
1907 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1908 } @{ $form->{all_partsgroup} };
1911 if ($form->{item} eq 'assembly') {
1913 foreach $i (1 .. $form->{assembly_rows}) {
1914 if ($form->{"partsgroup_id_$i"}) {
1915 $form->{"partsgroup_$i"} =
1916 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1919 $form->get_partsgroup(\%myconfig);
1921 if (@{ $form->{all_partsgroup} }) {
1922 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1925 $form->{selectassemblypartsgroup} .=
1926 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1927 } @{ $form->{all_partsgroup} };
1930 $lxdebug->leave_sub();
1934 $lxdebug->enter_sub();
1938 #decimalplaces for listprice
1939 ($dec) = ($form->{listprice} =~ /\.(\d+)/);
1941 my $decimalplaces = ($dec > 2) ? $dec : 2;
1942 $form->{listprice} =
1943 $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces);
1945 #decimalplaces for sellprice and gv
1946 ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
1948 my $decimalplaces = ($dec > 2) ? $dec : 2;
1952 $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
1955 ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
1957 my $decimalplaces = ($dec > 2) ? $dec : 2;
1960 $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
1962 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
1963 qw(weight rop stock);
1965 foreach $item (qw(partnumber description unit notes)) {
1966 $form->{$item} =~ s/\"/"/g;
1969 if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
1974 qq|<textarea name=notes rows=$rows cols=40 wrap=soft>$form->{notes}</textarea>|;
1975 if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
1977 qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
1980 qq|<input name=description size=40 value="$form->{description}">|;
1983 foreach $item (split / /, $form->{taxaccounts}) {
1984 $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
1988 foreach $item (qw(IC IC_income IC_expense)) {
1989 if ($form->{$item}) {
1990 if ($form->{id} && $form->{orphaned}) {
1991 $form->{"select$item"} =~ s/ selected//;
1992 $form->{"select$item"} =~
1993 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
1995 $form->{"select$item"} = qq|<option selected>$form->{$item}|;
2000 if ($form->{selectpartsgroup}) {
2001 $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2003 qq|<input type=hidden name=selectpartsgroup value="|
2004 . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
2005 $form->{selectpartsgroup} =~
2006 s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
2009 qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
2010 $group = $locale->text('Group');
2014 foreach $item (split / /, $form->{taxaccounts}) {
2016 <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
2017 <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
2021 $form->{obsolete} = "checked" if $form->{obsolete};
2025 <th align="right" nowrap="true">|
2026 . $locale->text('Last Cost') . qq|</th>
2027 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2033 <th align=right>| . $locale->text('Inventory') . qq|</th>
2034 <td><select name=IC>$form->{selectIC}</select></td>
2035 <input name=selectIC type=hidden value="$form->{selectIC}">
2039 if ($form->{item} eq "part") {
2041 $linkaccounts .= qq|
2043 <th align=right>| . $locale->text('Revenue') . qq|</th>
2044 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2045 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2048 <th align=right>| . $locale->text('COGS') . qq|</th>
2049 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2050 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2056 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2061 <input name=weight size=10 value=$form->{weight}>
2066 <input type=hidden name=weightunit value=$form->{weightunit}>
2076 if ($form->{item} eq "assembly") {
2082 <th align=right>| . $locale->text('Revenue') . qq|</th>
2083 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2084 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2090 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2095 $form->{weight}
2096 <input type=hidden name=weight value=$form->{weight}>
2101 <input type=hidden name=weightunit value=$form->{weightunit}>
2111 if ($form->{item} eq "service") {
2115 <th align=right>| . $locale->text('Revenue') . qq|</th>
2116 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2117 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2120 <th align=right>| . $locale->text('Expense') . qq|</th>
2121 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2122 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2128 if ($form->{item} ne 'service') {
2129 $n = ($form->{onhand} > 0) ? "1" : "0";
2132 <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2133 <th align=left nowrap class="plus$n"> |
2134 . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
2138 if ($form->{item} eq 'assembly') {
2141 <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
2142 <td><input name=stock size=10 value=$form->{stock}></td>
2149 <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
2150 <td><input name=rop size=10 value=$form->{rop}></td>
2156 <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
2157 <td><input name=bin size=10 value=$form->{bin}></td>
2162 <th align="right" nowrap="true">|
2163 . $locale->text('Verrechnungseinheit') . qq|</th>
2164 <td><input name=ve size=10 value=$form->{ve}></td>
2167 <th align="right" nowrap="true">|
2168 . $locale->text('Geschäftsvolumen') . qq|</th>
2169 <td><input name=gv size=10 value=$form->{gv}></td>
2177 <th align=right nowrap>| . $locale->text('Image') . qq|</th>
2178 <td><input name=image size=40 value="$form->{image}"></td>
2179 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
2180 <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
2183 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
2184 <td><input name=drawing size=40 value="$form->{drawing}"></td>
2196 <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
2197 <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
2201 $shopok = $form->{shop} == 1 ? "checked" : "";
2204 <th align=right nowrap>|
2205 . $locale->text('Shopartikel') . qq|</th>
2206 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2210 # type=submit $locale->text('Add Part')
2211 # type=submit $locale->text('Add Service')
2212 # type=submit $locale->text('Add Assembly')
2214 # type=submit $locale->text('Edit Part')
2215 # type=submit $locale->text('Edit Service')
2216 # type=submit $locale->text('Edit Assembly')
2217 # use JavaScript Calendar or not
2218 $form->{jsscript} = $jscalendar;
2220 if ($form->{jsscript}) {
2222 # with JavaScript Calendar
2224 <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2225 <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2226 . $locale->text('button') . qq|></td>
2231 Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1");
2234 # without JavaScript Calendar
2236 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
2239 $form->{fokus} = "ic.partnumber";
2243 <body onLoad="fokus()">
2246 <form method=post name="ic" action=$form->{script}>
2248 <input name=id type=hidden value=$form->{id}>
2249 <input name=item type=hidden value=$form->{item}>
2250 <input name=title type=hidden value="$form->{title}">
2251 <input name=makemodel type=hidden value="$form->{makemodel}">
2252 <input name=alternate type=hidden value="$form->{alternate}">
2253 <input name=onhand type=hidden value=$form->{onhand}>
2254 <input name=orphaned type=hidden value=$form->{orphaned}>
2255 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2256 <input name=rowcount type=hidden value=$form->{rowcount}>
2257 <input name=eur type=hidden value=$eur>
2259 <table width="100%">
2261 <th class=listtop>$form->{title}</th>
2263 <tr height="5"></tr>
2266 <table width="100%">
2268 <th align=left>| . $locale->text('Part Number') . qq|</th>
2269 <th align=left>| . $locale->text('Part Description') . qq|</th>
2270 <th align=left>$group</th>
2273 <td><input name=partnumber value="$form->{partnumber}" size=20></td>
2274 <td>$description</td>
2275 <td>$partsgroup</td>
2276 <input type=hidden name=oldpartsgroup value="$form->{oldpartsgroup}">
2283 <table width="100%" height="100%">
2286 <table width="100%" height="100%">
2287 <tr class="listheading">
2288 <th class="listheading" align="center" colspan=2>|
2289 . $locale->text('Link Accounts') . qq|</th>
2293 <th align="left">| . $locale->text('Notes') . qq|</th>
2303 <table width="100%">
2305 <th align="right" nowrap="true">|
2306 . $locale->text('Updated') . qq|</th>
2310 <th align="right" nowrap="true">| . $locale->text('List Price') . qq|</th>
2311 <td><input name=listprice size=11 value=$form->{listprice}></td>
2314 <th align="right" nowrap="true">| . $locale->text('Sell Price') . qq|</th>
2315 <td><input name=sellprice size=11 value=$form->{sellprice}></td>
2319 <th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
2320 <td><input name=unit size=5 maxlength="10" value="$form->{unit}"></td>
2337 $lxdebug->leave_sub();
2341 $lxdebug->enter_sub();
2343 if ($form->{item} eq "assembly") {
2348 <table width="100%">
2350 <th colspan=2 align=right>|
2351 . $locale->text('Total') . qq| </th>
2353 . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
2358 <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
2363 <input type=hidden name=path value=$form->{path}>
2364 <input type=hidden name=login value=$form->{login}>
2365 <input type=hidden name=password value=$form->{password}>
2366 <input type=hidden name=callback value="$form->{callback}">
2367 <input type=hidden name=previousform value="$form->{previousform}">
2368 <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
2369 <input type=hidden name=vc value=$form->{vc}>
2371 <td><hr size=3 noshade></td>
2376 <input class=submit type=submit name=action value="|
2377 . $locale->text('Update') . qq|">
2380 unless ($form->{item} eq "service") {
2382 <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
2387 <input type=hidden name=price_rows value=$form->{price_rows}>|;
2390 <input class=submit type=submit name=action value="|
2391 . $locale->text('Save') . qq|">|;
2395 if (!$form->{previousform}) {
2397 <input class=submit type=submit name=action value="|
2398 . $locale->text('Save as new') . qq|">|;
2401 if ($form->{orphaned}) {
2402 if (!$form->{previousform}) {
2403 if ($form->{item} eq 'assembly') {
2404 if (!$form->{onhand}) {
2406 <input class=submit type=submit name=action value="|
2407 . $locale->text('Delete') . qq|">|;
2411 <input class=submit type=submit name=action value="|
2412 . $locale->text('Delete') . qq|">|;
2418 if (!$form->{previousform}) {
2419 if ($form->{menubar}) {
2420 require "$form->{path}/menu.pl";
2433 $lxdebug->leave_sub();
2437 $lxdebug->enter_sub();
2440 $form->{"make_$i"} =~ s/\"/"/g;
2441 $form->{"model_$i"} =~ s/\"/"/g;
2448 <th class="listheading">| . $locale->text('Make') . qq|</th>
2449 <th class="listheading">| . $locale->text('Model') . qq|</th>
2453 for $i (1 .. $numrows) {
2456 <td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
2457 <td width=50%><input name="model_$i" size=30 value="$form->{"model_$i"}"></td>
2468 $lxdebug->leave_sub();
2472 $lxdebug->enter_sub();
2476 qw(runningnumber qty unit bom partnumber description partsgroup total);
2478 if ($form->{previousform}) {
2480 @column_index = qw(qty unit bom partnumber description partsgroup total);
2484 $form->{old_callback} = $form->{callback};
2485 $callback = $form->{callback};
2486 $form->{callback} = "$form->{script}?action=display_form";
2489 map { delete $form->{$_} } qw(action header);
2493 # save form variables in a previousform variable
2494 foreach $key (sort keys %$form) {
2497 $form->{$key} =~ s/&/%26/g;
2498 $previousform .= qq|$key=$form->{$key}&|;
2501 $previousform = $form->escape($form->escape($previousform, 1));
2502 $form->{callback} = $callback;
2504 $form->{assemblytotal} = 0;
2505 $form->{weight} = 0;
2508 $column_header{runningnumber} =
2509 qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
2510 $column_header{qty} =
2511 qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
2512 $column_header{unit} =
2513 qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
2514 $column_header{partnumber} =
2515 qq|<th align=left nowrap width=20%>|
2516 . $locale->text('Part Number')
2518 $column_header{description} =
2519 qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
2520 $column_header{total} =
2521 qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
2522 $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
2523 $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
2526 <tr class=listheading>
2527 <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
2535 map { print "\n$column_header{$_}" } @column_index;
2541 for $i (1 .. $numrows) {
2542 $form->{"partnumber_$i"} =~ s/\"/"/g;
2545 $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
2546 $form->{assemblytotal} += $linetotal;
2548 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
2550 $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
2552 if (($i >= 1) && ($i == $numrows)) {
2555 map { $column_data{$_} = qq|<td></td>| }
2556 qw(qty unit partnumber description bom partsgroup);
2559 map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
2562 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2563 $column_data{partnumber} =
2564 qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
2565 $column_data{description} =
2566 qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
2567 $column_data{partsgroup} =
2568 qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
2574 if ($form->{previousform}) {
2575 $column_data{partnumber} =
2576 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
2578 qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
2581 qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
2582 $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
2583 $column_data{bom} .= qq|</td>|;
2585 $column_data{partsgroup} =
2586 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2590 qq|$form->{script}?action=edit&id=$form->{"id_$i"}&path=$form->{path}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
2591 $column_data{partnumber} =
2592 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
2593 $column_data{runningnumber} =
2594 qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
2596 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2598 $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
2600 qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
2602 $column_data{partsgroup} =
2603 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2606 $column_data{unit} =
2607 qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
2608 $column_data{description} =
2609 qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
2612 $column_data{total} = qq|<td align=right>$linetotal</td>|;
2617 map { print "\n$column_data{$_}" } @column_index;
2621 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2622 <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
2623 <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
2633 $lxdebug->leave_sub();
2637 $lxdebug->enter_sub();
2639 if ($form->{item} eq "assembly") {
2640 $i = $form->{assembly_rows};
2642 # if last row is empty check the form otherwise retrieve item
2643 if ( ($form->{"partnumber_$i"} eq "")
2644 && ($form->{"description_$i"} eq "")
2645 && ($form->{"partsgroup_$i"} eq "")) {
2651 IC->assembly_item(\%myconfig, \%$form);
2653 $rows = scalar @{ $form->{item_list} };
2656 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2659 $form->{makemodel_rows}--;
2663 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
2664 qw(partnumber description unit partsgroup);
2665 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
2666 keys %{ $form->{item_list}[0] };
2667 $form->{"runningnumber_$i"} = $form->{assembly_rows};
2668 $form->{assembly_rows}++;
2676 $form->{rowcount} = $i;
2677 $form->{assembly_rows}++;
2685 if ($form->{item} eq "part") {
2689 if ($form->{item} eq 'service') {
2690 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2691 qw(sellprice listprice);
2696 $lxdebug->leave_sub();
2700 $lxdebug->enter_sub();
2702 # check if there is a part number
2703 # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
2705 if ($form->{obsolete}) {
2708 "Inventory quantity must be zero before you can set this $form->{item} obsolete!"
2710 if ($form->{onhand});
2713 # expand dynamic strings
2714 # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
2715 # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
2716 # $locale->text('Part Number missing!')
2717 # $locale->text('Service Number missing!')
2718 # $locale->text('Assembly Number missing!')
2721 $lxdebug->message(LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n");
2722 $rc = IC->save(\%myconfig, \%$form);
2724 $form->error($locale->text('Partnumber not unique!'));
2726 $parts_id = $form->{id};
2728 # load previous variables
2729 if ($form->{previousform}) {
2731 # save the new form variables before splitting previousform
2732 map { $newform{$_} = $form->{$_} } keys %$form;
2734 $previousform = $form->unescape($form->{previousform});
2736 # don't trample on previous variables
2737 map { delete $form->{$_} } keys %newform;
2739 # now take it apart and restore original values
2740 foreach $item (split /&/, $previousform) {
2741 ($key, $value) = split /=/, $item, 2;
2742 $value =~ s/%26/&/g;
2743 $form->{$key} = $value;
2745 $form->{taxaccounts} = $newform{taxaccount2};
2747 if ($form->{item} eq 'assembly') {
2749 # undo number formatting
2750 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2751 qw(weight listprice sellprice rop);
2753 $form->{assembly_rows}--;
2754 $i = $newform{rowcount};
2755 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2757 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
2758 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
2760 # change/add values for assembly item
2761 map { $form->{"${_}_$i"} = $newform{$_} }
2762 qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno);
2764 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
2765 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
2769 # set values for last invoice/order item
2770 $i = $form->{rowcount};
2771 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2773 map { $form->{"${_}_$i"} = $newform{$_} }
2774 qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice);
2775 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
2776 if ($form->{exchangerate} != 0) {
2777 $form->{"sellprice_$i"} /= $form->{exchangerate};
2779 $lxdebug->message(LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = |.$form->{"sellprice_$i"}.qq|\n|);
2780 map { $form->{"taxaccounts_$i"} .= "$_ " } split / /,
2781 $newform{taxaccount};
2782 chop $form->{"taxaccounts_$i"};
2783 foreach $item (qw(description rate taxnumber)) {
2784 $index = $form->{"taxaccounts_$i"} . "_$item";
2785 $form->{$index} = $newform{$index};
2788 # credit remaining calculation
2790 $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
2792 map { $form->{"${_}_base"} += $amount }
2793 (split / /, $form->{"taxaccounts_$i"});
2794 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
2795 split / /, $form->{"taxaccounts_$i"}
2796 if !$form->{taxincluded};
2798 $form->{creditremaining} -= $amount;
2800 # redo number formatting, because invoice parse them!
2801 $i = $form->{rowcount};
2802 map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) }
2803 qw(weight listprice sellprice rop);
2806 $form->{"id_$i"} = $parts_id;
2807 delete $form->{action};
2809 # restore original callback
2810 $callback = $form->unescape($form->{callback});
2811 $form->{callback} = $form->unescape($form->{old_callback});
2812 delete $form->{old_callback};
2814 $form->{makemodel_rows}--;
2816 # put callback together
2817 foreach $key (keys %$form) {
2819 # do single escape for Apache 2.0
2820 $value = $form->escape($form->{$key}, 1);
2821 $callback .= qq|&$key=$value|;
2823 $form->{callback} = $callback;
2825 $lxdebug->message(LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = |.$form->{"sellprice_$i"}.qq|\n|);
2829 $lxdebug->leave_sub();
2833 $lxdebug->enter_sub();
2838 $lxdebug->leave_sub();
2842 $lxdebug->enter_sub();
2844 $rc = IC->delete(\%myconfig, \%$form);
2847 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
2848 $form->error($locale->text('Cannot delete item!'));
2850 $lxdebug->leave_sub();
2853 sub stock_assembly {
2854 $lxdebug->enter_sub();
2856 $form->{title} = $locale->text('Stock Assembly');
2863 <form method=post action=$form->{script}>
2865 <table width="100%">
2867 <th class=listtop>$form->{title}</th>
2869 <tr height="5"></tr>
2874 <th align="right" nowrap="true">|
2875 . $locale->text('Part Number') . qq|</th>
2876 <td><input name=partnumber size=20></td>
2880 <th align="right" nowrap="true">|
2881 . $locale->text('Part Description') . qq|</th>
2882 <td><input name=description size=40></td>
2887 <tr><td><hr size=3 noshade></td></tr>
2890 <input type=hidden name=path value=$form->{path}>
2891 <input type=hidden name=login value=$form->{login}>
2892 <input type=hidden name=password value=$form->{password}>
2894 <input type=hidden name=nextsub value=list_assemblies>
2897 <input class=submit type=submit name=action value="|
2898 . $locale->text('Continue') . qq|">
2905 $lxdebug->leave_sub();
2908 sub list_assemblies {
2909 $lxdebug->enter_sub();
2911 IC->retrieve_assemblies(\%myconfig, \%$form);
2913 $column_header{partnumber} =
2914 qq|<th class=listheading>| . $locale->text('Part Number') . qq|</th>|;
2915 $column_header{description} =
2916 qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
2917 $column_header{bin} =
2918 qq|<th class=listheading>| . $locale->text('Bin') . qq|</th>|;
2919 $column_header{onhand} =
2920 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
2921 $column_header{rop} =
2922 qq|<th class=listheading>| . $locale->text('ROP') . qq|</th>|;
2923 $column_header{stock} =
2924 qq|<th class=listheading>| . $locale->text('Add') . qq|</th>|;
2926 @column_index = (qw(partnumber description bin onhand rop stock));
2928 $form->{title} = $locale->text('Stock Assembly');
2931 "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2935 $colspan = $#column_index + 1;
2940 <form method=post action=$form->{script}>
2944 <th class=listtop colspan=$colspan>$form->{title}</th>
2947 <tr class=listheading>|;
2949 map { print "\n$column_header{$_}" } @column_index;
2956 foreach $ref (@{ $form->{assembly_items} }) {
2958 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description);
2960 $column_data{partnumber} = qq|<td width=20%>$ref->{partnumber}</td>|;
2961 $column_data{description} =
2962 qq|<td width=50%>$ref->{description} </td>|;
2963 $column_data{bin} = qq|<td>$ref->{bin} </td>|;
2964 $column_data{onhand} =
2965 qq|<td align=right>|
2966 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
2969 qq|<td align=right>|
2970 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ")
2972 $column_data{stock} = qq|<td width=10%><input name="qty_$i" size=10></td>|;
2977 qq|<tr class=listrow$j><input name="id_$i" type=hidden value=$ref->{id}>\n|;
2979 map { print "\n$column_data{$_}" } @column_index;
2992 <td colspan=6><hr size=3 noshade>
2995 <input name=rowcount type=hidden value="$i">
2997 <input type=hidden name=path value=$form->{path}>
2998 <input type=hidden name=login value=$form->{login}>
2999 <input type=hidden name=password value=$form->{password}>
3001 <input name=callback type=hidden value="$form->{callback}">
3003 <input type=hidden name=nextsub value=restock_assemblies>
3006 <input class=submit type=submit name=action value="|
3007 . $locale->text('Continue') . qq|">
3015 $lxdebug->leave_sub();
3018 sub restock_assemblies {
3019 $lxdebug->enter_sub();
3021 $form->redirect($locale->text('Assemblies restocked!'))
3022 if (IC->restock_assemblies(\%myconfig, \%$form));
3023 $form->error($locale->text('Cannot stock assemblies!'));
3025 $lxdebug->leave_sub();
3029 $lxdebug->enter_sub();
3038 <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
3039 <th class="listheading">| . $locale->text('Preis') . qq|</th>
3042 for $i (1 .. $numrows) {
3045 <td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
3046 <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
3047 <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
3058 $lxdebug->leave_sub();
3061 sub continue { &{ $form->{nextsub} } }