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 #======================================================================
37 require "$form->{path}/io.pl";
44 $lxdebug->enter_sub();
46 $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
49 "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
50 unless $form->{callback};
53 ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea');
54 IC->get_pricegroups(\%myconfig, \%$form);
58 $lxdebug->leave_sub();
62 $lxdebug->enter_sub();
64 $form->{title} = (ucfirst $form->{searchitems}) . "s";
65 $form->{title} = $locale->text($form->{title});
67 # switch for backward sorting
70 # memory for which table was sort at last time
71 $form->{lastsort} = "";
73 # counter for added entries to top100
74 $form->{ndxs_counter} = 0;
76 # $locale->text('Parts')
77 # $locale->text('Services')
79 # use JavaScript Calendar or not
80 $form->{jsscript} = $jscalendar;
82 if ($form->{jsscript}) {
84 # with JavaScript Calendar
86 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
87 <td><input type=button name=transdatefrom id="trigger1" value=|
88 . $locale->text('button') . qq|></td>
91 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
92 <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
93 . $locale->text('button') . qq|></td>
98 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1",
99 "transdateto", "BL", "trigger2");
102 # without JavaScript Calendar
104 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
106 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
109 unless ($form->{searchitems} eq 'service') {
112 <input name=itemstatus class=radio type=radio value=onhand> |
113 . $locale->text('On Hand') . qq|
114 <input name=itemstatus class=radio type=radio value=short> |
115 . $locale->text('Short') . qq|
120 <th align=right nowrap>| . $locale->text('Make') . qq|</th>
121 <td><input name=make size=20></td>
122 <th align=right nowrap>| . $locale->text('Model') . qq|</th>
123 <td><input name=model size=20></td>
128 <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th>
129 <td><input name=serialnumber size=20></td>
132 $l_serialnumber = qq|
133 <td><input name=l_serialnumber class=checkbox type=checkbox value=Y> |
134 . $locale->text('Serial Number') . qq|</td>
139 if ($form->{searchitems} eq 'assembly') {
141 $form->{title} = $locale->text('Assemblies');
147 <input name=null class=radio type=radio value=1 checked> |
148 . $locale->text('Top Level') . qq|
149 <input name=bom class=checkbox type=checkbox value=1> |
150 . $locale->text('Individual Items') . qq|
164 <td><input name=sold class=checkbox type=checkbox value=1></td>
165 <td nowrap>| . $locale->text('Sold') . qq|</td>
168 <td colspan=2><hr size=1 noshade></td>
171 <td><input name=ordered class=checkbox type=checkbox value=1></td>
172 <td nowrap>| . $locale->text('Ordered') . qq|</td>
175 <td colspan=4><hr size=1 noshade></td>
178 <td><input name=quoted class=checkbox type=checkbox value=1></td>
179 <td nowrap>| . $locale->text('Quoted') . qq|</td>
183 <td width=5%> </td>
184 <th>| . $locale->text('From') . qq|</th>
186 <th>| . $locale->text('To') . qq|</th>
205 <td><input name=bought class=checkbox type=checkbox value=1></td>
206 <td nowrap>| . $locale->text('Bought') . qq|</td>
207 <td><input name=sold class=checkbox type=checkbox value=1></td>
208 <td nowrap>| . $locale->text('Sold') . qq|</td>
211 <td colspan=4><hr size=1 noshade></td>
214 <td><input name=onorder class=checkbox type=checkbox value=1></td>
215 <td nowrap>| . $locale->text('On Order') . qq|</td>
216 <td><input name=ordered class=checkbox type=checkbox value=1></td>
217 <td nowrap>| . $locale->text('Ordered') . qq|</td>
220 <td colspan=4><hr size=1 noshade></td>
223 <td><input name=rfq class=checkbox type=checkbox value=1></td>
224 <td nowrap>| . $locale->text('RFQ') . qq|</td>
225 <td><input name=quoted class=checkbox type=checkbox value=1></td>
226 <td nowrap>| . $locale->text('Quoted') . qq|</td>
230 <td width=5%> </td>
234 <th>| . $locale->text('From') . qq|</th>
236 <th>| . $locale->text('To') . qq|</th>
253 <form method=post action=$form->{script}>
255 <input type=hidden name=searchitems value=$form->{searchitems}>
256 <input type=hidden name=title value="$form->{title}">
258 <input type=hidden name=revers value="$form->{revers}">
259 <input type=hidden name=lastsort value="$form->{lastsort}">
262 <tr><th class=listtop>$form->{title}</th></tr>
268 <th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
269 <td><input name=partnumber size=20></td>
272 <th align=right nowrap>|
273 . $locale->text('Part Description') . qq|</th>
274 <td colspan=3><input name=description size=40></td>
277 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
278 <td><input name=partsgroup size=20></td>
283 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
284 <td><input name=drawing size=20></td>
285 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
286 <td><input name=microfiche size=20></td>
292 <input name=itemstatus class=radio type=radio value=active checked> |
293 . $locale->text('Active') . qq|
295 <input name=itemstatus class=radio type=radio value=obsolete> |
296 . $locale->text('Obsolete') . qq|
297 <input name=itemstatus class=radio type=radio value=orphaned> |
298 . $locale->text('Orphaned') . qq|
309 <th align=right nowrap>|
310 . $locale->text('Include in Report') . qq|</th>
314 <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked> |
315 . $locale->text('Part Number') . qq|</td>
316 <td><input name=l_description class=checkbox type=checkbox value=Y checked> |
317 . $locale->text('Part Description') . qq|</td>
319 <td><input name=l_unit class=checkbox type=checkbox value=Y checked> |
320 . $locale->text('Unit of measure') . qq|</td>
323 <td><input name=l_listprice class=checkbox type=checkbox value=Y> |
324 . $locale->text('List Price') . qq|</td>
325 <td><input name=l_sellprice class=checkbox type=checkbox value=Y checked> |
326 . $locale->text('Sell Price') . qq|</td>
327 <td><input name=l_lastcost class=checkbox type=checkbox value=Y> |
328 . $locale->text('Last Cost') . qq|</td>
329 <td><input name=l_linetotal class=checkbox type=checkbox value=Y checked> |
330 . $locale->text('Line Total') . qq|</td>
333 <td><input name=l_priceupdate class=checkbox type=checkbox value=Y> |
334 . $locale->text('Updated') . qq|</td>
335 <td><input name=l_bin class=checkbox type=checkbox value=Y> |
336 . $locale->text('Bin') . qq|</td>
337 <td><input name=l_rop class=checkbox type=checkbox value=Y> |
338 . $locale->text('ROP') . qq|</td>
339 <td><input name=l_weight class=checkbox type=checkbox value=Y> |
340 . $locale->text('Weight') . qq|</td>
343 <td><input name=l_image class=checkbox type=checkbox value=Y> |
344 . $locale->text('Image') . qq|</td>
345 <td><input name=l_drawing class=checkbox type=checkbox value=Y> |
346 . $locale->text('Drawing') . qq|</td>
347 <td><input name=l_microfiche class=checkbox type=checkbox value=Y> |
348 . $locale->text('Microfiche') . qq|</td>
349 <td><input name=l_partsgroup class=checkbox type=checkbox value=Y> |
350 . $locale->text('Group') . qq|</td>
353 <td><input name=l_subtotal class=checkbox type=checkbox value=Y> |
354 . $locale->text('Subtotal') . qq|</td>
355 <td><input name=l_soldtotal class=checkbox type=checkbox value=Y> |
356 . $locale->text('soldtotal') . qq|</td>
364 <tr><td colspan=4><hr size=3 noshade></td></tr>
369 <input type=hidden name=nextsub value=generate_report>
371 <input type=hidden name=path value=$form->{path}>
372 <input type=hidden name=login value=$form->{login}>
373 <input type=hidden name=password value=$form->{password}>
375 <input type=hidden name=revers value="$form->{revers}">
376 <input type=hidden name=lastsort value="$form->{lastsort}">
378 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
381 <input class=submit type=submit name=action value="|
382 . $locale->text('Continue') . qq|">
383 <input class=submit type=submit name=action value="|
384 . $locale->text('TOP100') . qq|">
390 $lxdebug->leave_sub();
394 $lxdebug->enter_sub();
396 $form->{title} = $locale->text('Top 100 hinzufuegen');
403 <form method=post action=$form->{script}>
405 <input type=hidden name=searchitems value=$form->{searchitems}>
406 <input type=hidden name=title value="$form->{title}">
408 <input type=hidden name=revers value="$form->{revers}">
409 <input type=hidden name=lastsort value="$form->{lastsort}">|;
413 <tr class=listheading>
414 <th class=listheading nowrap>|
415 . $locale->text('Part Number') . qq|</th>
416 <th class=listheading nowrap>|
417 . $locale->text('Part Description') . qq|</th>
420 <td><input type=text name=partnumber size=20 value=></td>
421 <td><input type=text name=description size=30 value=></td>
428 <input type=hidden name=path value=$form->{path}>
429 <input type=hidden name=login value=$form->{login}>
430 <input type=hidden name=password value=$form->{password}>
432 <input type=hidden name=itemstatus value="$form->{itemstatus}">
433 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
434 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
435 <input type=hidden name=l_description value="$form->{l_description}">
436 <input type=hidden name=l_onhand value="$form->{l_onhand}">
437 <input type=hidden name=l_unit value="$form->{l_unit}">
438 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
439 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
440 <input type=hidden name=sort value="$form->{sort}">
441 <input type=hidden name=revers value="$form->{revers}">
442 <input type=hidden name=lastsort value="$form->{lastsort}">
444 <input type=hidden name=bom value="$form->{bom}">
445 <input type=hidden name=titel value="$form->{titel}">
446 <input type=hidden name=searchitems value="$form->{searchitems}">
448 <input type=hidden name=row value=$j>
450 <input type=hidden name=nextsub value=item_selected>
452 <input type=hidden name=test value=item_selected>
454 <input name=lastndx type=hidden value=$lastndx>
456 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>
458 <input name=extras type=hidden value=$form->{extras}>|;
462 for ($i = 0; $i < $form->{ndxs_counter}; $i++) {
465 $partnumber = $form->{"totop100_partnumber_$j"};
466 $description = $form->{"totop100_description_$j"};
467 $unit = $form->{"totop100_unit_$j"};
468 $sellprice = $form->{"totop100_sellprice_$j"};
469 $soldtotal = $form->{"totop100_soldtotal_$j"};
471 # insert data into top100
472 push @{ $form->{parts} },
474 partnumber => "$partnumber",
475 description => "$description",
477 sellprice => "$sellprice",
478 soldtotal => "$soldtotal" };
484 # set data for next page
485 if (($form->{ndxs_counter}) > 0) {
486 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
487 $partnumber = $form->{"totop100_partnumber_$i"};
488 $description = $form->{"totop100_description_$i"};
489 $unit = $form->{"totop100_unit_$i"};
490 $sellprice = $form->{"totop100_sellprice_$i"};
491 $soldtotal = $form->{"totop100_soldtotal_$i"};
494 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
495 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
496 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
497 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
498 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
506 <input class=submit type=submit name=action value="|
507 . $locale->text('list') . qq|">
512 $lxdebug->leave_sub();
516 $lxdebug->enter_sub();
519 if (($form->{partnumber} eq "") and ($form->{description} eq "")) {
520 IC->get_parts(\%myconfig, \%$form, "");
522 if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) {
523 IC->get_parts(\%myconfig, \%$form, "partnumber");
525 if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) {
526 IC->get_parts(\%myconfig, \%$form, "description");
528 IC->get_parts(\%myconfig, \%$form, "all");
533 $form->{title} = $locale->text('Top 100 hinzufuegen');
539 <form method=post action=ic.pl>
542 <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
545 <tr class=listheading>
547 <th class=listheading>| . $locale->text('Part Number') . qq|</th>
548 <th class=listheading>| . $locale->text('Part Description') . qq|</th>
549 <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
550 <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
551 <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
555 my $i = $form->{rows};
557 for ($j = 1; $j <= $i; $j++) {
560 <tr class=listrow1>|;
563 <td><input name=ndx class=radio type=radio value=$j checked></td>|;
566 <td><input name=ndx class=radio type=radio value=$j></td>|;
569 <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
570 <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
571 <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
572 <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
573 <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
576 <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
586 <input type=hidden name=path value=$form->{path}>
587 <input type=hidden name=login value=$form->{login}>
588 <input type=hidden name=password value=$form->{password}>
590 <input type=hidden name=itemstatus value="$form->{itemstatus}">
591 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
592 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
593 <input type=hidden name=l_description value="$form->{l_description}">
594 <input type=hidden name=l_onhand value="$form->{l_onhand}">
595 <input type=hidden name=l_unit value="$form->{l_unit}">
596 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
597 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
598 <input type=hidden name=sort value="$form->{sort}">
599 <input type=hidden name=revers value="$form->{revers}">
600 <input type=hidden name=lastsort value="$form->{lastsort}">
602 <input type=hidden name=bom value="$form->{bom}">
603 <input type=hidden name=titel value="$form->{titel}">
604 <input type=hidden name=searchitems value="$form->{searchitems}">
606 <input type=hidden name=row value=$j>
608 <input type=hidden name=nextsub value=item_selected>
610 <input name=lastndx type=hidden value=$lastndx>
612 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
616 if (($form->{ndxs_counter}) > 0) {
617 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
618 $j1 = $form->{"totop100_partnumber_$i"};
619 $j2 = $form->{"totop100_description_$i"};
620 $j3 = $form->{"totop100_unit_$i"};
621 $j4 = $form->{"totop100_sellprice_$i"};
622 $j5 = $form->{"totop100_soldtotal_$i"};
631 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
632 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
633 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
634 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
635 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
643 <input class=submit type=submit name=action value="|
644 . $locale->text('TOP100') . qq|">
650 $lxdebug->leave_sub();
654 $lxdebug->enter_sub();
657 $form->{ndxs_counter}++;
659 if ($form->{ndxs_counter} > 0) {
661 $index = $form->{ndx};
663 $j1 = $form->{"new_partnumber_$index"};
664 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $j1;
665 $j2 = $form->{"new_description_$index"};
666 $form->{"totop100_description_$form->{ndxs_counter}"} = $j2;
667 $j3 = $form->{"new_unit_$index"};
668 $form->{"totop100_unit_$form->{ndxs_counter}"} = $j3;
669 $j4 = $form->{"new_sellprice_$index"};
670 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $j4;
671 $j5 = $form->{"new_soldtotal_$index"};
672 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $j5;
676 $lxdebug->leave_sub();
680 $lxdebug->enter_sub();
682 $form->{top100} = "top100";
683 $form->{l_soldtotal} = "Y";
684 $form->{soldtotal} = "soldtotal";
685 $form->{sort} = "soldtotal";
686 $form->{l_qty} = "N";
687 $callback .= "&form->{top100}=$form->{top100}";
688 $form->{l_linetotal} = "";
690 $form->{number} = "position";
691 $form->{l_number} = "Y";
695 $form->{title} = $locale->text('Top 100');
697 $revers = $form->{revers};
698 $lastsort = $form->{lastsort};
700 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
702 $form->{lastsort} = "partnumber";
703 $form->{sort} = "partnumber";
707 "$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="
708 . $form->escape($form->{title}, 1);
710 # if we have a serialnumber limit search
711 if ($form->{serialnumber} || $form->{l_serialnumber}) {
712 $form->{l_serialnumber} = "Y";
713 unless ( $form->{bought}
716 || $form->{quoted}) {
717 $form->{bought} = $form->{sold} = 1;
720 IC->all_parts(\%myconfig, \%$form);
722 if ($form->{itemstatus} eq 'active') {
723 $option .= $locale->text('Active') . " : ";
725 if ($form->{itemstatus} eq 'obsolete') {
726 $option .= $locale->text('Obsolete') . " : ";
728 if ($form->{itemstatus} eq 'orphaned') {
729 $option .= $locale->text('Orphaned') . " : ";
731 if ($form->{itemstatus} eq 'onhand') {
732 $option .= $locale->text('On Hand') . " : ";
733 $form->{l_onhand} = "Y";
735 if ($form->{itemstatus} eq 'short') {
736 $option .= $locale->text('Short') . " : ";
737 $form->{l_onhand} = "Y";
739 if ($form->{onorder}) {
740 $form->{l_ordnumber} = "Y";
741 $callback .= "&onorder=$form->{onorder}";
742 $option .= $locale->text('On Order') . " : ";
744 if ($form->{ordered}) {
745 $form->{l_ordnumber} = "Y";
746 $callback .= "&ordered=$form->{ordered}";
747 $option .= $locale->text('Ordered') . " : ";
750 $form->{l_quonumber} = "Y";
751 $callback .= "&rfq=$form->{rfq}";
752 $option .= $locale->text('RFQ') . " : ";
754 if ($form->{quoted}) {
755 $form->{l_quonumber} = "Y";
756 $callback .= ""ed=$form->{quoted}";
757 $option .= $locale->text('Quoted') . " : ";
759 if ($form->{bought}) {
760 $form->{l_invnumber} = "Y";
761 $callback .= "&bought=$form->{bought}";
762 $option .= $locale->text('Bought') . " : ";
765 $form->{l_invnumber} = "Y";
766 $callback .= "&sold=$form->{sold}";
767 $option .= $locale->text('Sold') . " : ";
774 || $form->{quoted}) {
776 $form->{l_lastcost} = "";
777 $form->{l_name} = "Y";
778 if ($form->{transdatefrom}) {
779 $callback .= "&transdatefrom=$form->{transdatefrom}";
781 . $locale->text('From')
783 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
785 if ($form->{transdateto}) {
786 $callback .= "&transdateto=$form->{transdateto}";
788 . $locale->text('To')
790 . $locale->date(\%myconfig, $form->{transdateto}, 1);
796 if ($form->{partnumber}) {
797 $callback .= "&partnumber=$form->{partnumber}";
798 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
800 if ($form->{partsgroup}) {
801 $callback .= "&partsgroup=$form->{partsgroup}";
802 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
804 if ($form->{serialnumber}) {
805 $callback .= "&serialnumber=$form->{serialnumber}";
807 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
809 if ($form->{description}) {
810 $callback .= "&description=$form->{description}";
811 $description = $form->{description};
815 $locale->text('Part Description') . qq| : $form->{description}<br>|;
818 $callback .= "&make=$form->{make}";
819 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
821 if ($form->{model}) {
822 $callback .= "&model=$form->{model}";
823 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
825 if ($form->{drawing}) {
826 $callback .= "&drawing=$form->{drawing}";
827 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
829 if ($form->{microfiche}) {
830 $callback .= "µfiche=$form->{microfiche}";
831 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
833 if ($form->{l_soldtotal}) {
834 $callback .= "&soldtotal=$form->{soldtotal}";
835 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
838 @columns = $form->sort_columns(
839 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)
842 if ($form->{l_linetotal}) {
843 $form->{l_onhand} = "Y";
844 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
845 if ($form->{l_lastcost}) {
846 $form->{l_linetotallastcost} = "Y";
847 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
848 $form->{l_linetotallastcost} = "";
851 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
854 if ($form->{searchitems} eq 'service') {
856 # remove bin, weight and rop from list
857 map { $form->{"l_$_"} = "" } qw(bin weight rop);
859 $form->{l_onhand} = "";
861 # qty is irrelevant unless bought or sold
867 || $form->{quoted}) {
868 $form->{l_onhand} = "Y";
870 $form->{l_linetotalsellprice} = "";
871 $form->{l_linetotallastcost} = "";
875 $form->{l_lastcost} = ""
876 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
878 foreach $item (@columns) {
879 if ($form->{"l_$item"} eq "Y") {
880 push @column_index, $item;
882 # add column to callback
883 $callback .= "&l_$item=Y";
887 if ($form->{l_subtotal} eq 'Y') {
888 $callback .= "&l_subtotal=Y";
891 $column_header{number} =
892 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
893 $column_header{partnumber} =
894 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
895 . $locale->text('Part Number')
897 $column_header{description} =
898 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
899 . $locale->text('Part Description')
901 $column_header{partsgroup} =
902 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
903 . $locale->text('Group')
905 $column_header{bin} =
906 qq|<th><a class=listheading href=$callback&sort=bin>|
907 . $locale->text('Bin')
909 $column_header{priceupdate} =
910 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
911 . $locale->text('Updated')
913 $column_header{onhand} =
914 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
915 . $locale->text('Qty')
917 $column_header{unit} =
918 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
919 $column_header{listprice} =
920 qq|<th class=listheading nowrap>|
921 . $locale->text('List Price')
923 $column_header{lastcost} =
924 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
925 $column_header{rop} =
926 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
927 $column_header{weight} =
928 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
930 $column_header{invnumber} =
931 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
932 . $locale->text('Invoice Number')
934 $column_header{ordnumber} =
935 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
936 . $locale->text('Order Number')
938 $column_header{quonumber} =
939 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
940 . $locale->text('Quotation')
943 $column_header{name} =
944 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
945 . $locale->text('Name')
948 $column_header{sellprice} =
949 qq|<th class=listheading nowrap>|
950 . $locale->text('Sell Price')
952 $column_header{linetotalsellprice} =
953 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
954 $column_header{linetotallastcost} =
955 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
956 $column_header{linetotallistprice} =
957 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
959 $column_header{image} =
960 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
961 $column_header{drawing} =
962 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
963 . $locale->text('Drawing')
965 $column_header{microfiche} =
966 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
967 . $locale->text('Microfiche')
970 $column_header{serialnumber} =
971 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
972 . $locale->text('Serial Number')
974 $column_header{soldtotal} =
975 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
976 . $locale->text('soldtotal')
980 $colspan = $#column_index + 1;
987 <th class=listtop colspan=$colspan>$form->{title}</th>
991 <tr><td colspan=$colspan>$option</td></tr>
993 <tr class=listheading>
996 map { print "\n$column_header{$_}" } @column_index;
1002 # add order to callback
1003 $form->{callback} = $callback .= "&sort=$form->{sort}";
1005 # escape callback for href
1006 $callback = $form->escape($callback);
1008 if (@{ $form->{parts} }) {
1009 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1012 # insert numbers for top100
1014 foreach $ref (@{ $form->{parts} }) {
1016 $ref->{number} = $j;
1019 # if avaible -> insert choice here
1020 if (($form->{ndxs_counter}) > 0) {
1021 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
1022 $partnumber = $form->{"totop100_partnumber_$i"};
1023 $description = $form->{"totop100_description_$i"};
1024 $unit = $form->{"totop100_unit_$i"};
1025 $sellprice = $form->{"totop100_sellprice_$i"};
1026 $soldtotal = $form->{"totop100_soldtotal_$i"};
1029 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
1030 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
1031 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
1032 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
1033 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
1037 push @{ $form->{parts} },
1039 partnumber => "$partnumber",
1040 description => "$description",
1042 sellprice => "$sellprice",
1043 soldtotal => "$soldtotal" };
1046 # build data for columns
1047 foreach $ref (@{ $form->{parts} }) {
1049 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1050 if ($sameitem ne $ref->{ $form->{sort} }) {
1052 $sameitem = $ref->{ $form->{sort} };
1056 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1057 $ref->{sellprice} *= $ref->{exchangerate};
1058 $ref->{listprice} *= $ref->{exchangerate};
1059 $ref->{lastcost} *= $ref->{exchangerate};
1061 # use this for assemblies
1062 $onhand = $ref->{onhand};
1065 if ($ref->{assemblyitem}) {
1067 $onhand = 0 if ($form->{sold});
1070 $ref->{description} =~ s/
1073 $column_data{number} =
1075 . $form->format_amount(\%myconfig, $ref->{number}, '', " ")
1077 $column_data{partnumber} =
1078 "<td align=$align>$ref->{partnumber} </a></td>";
1079 $column_data{description} = "<td>$ref->{description} </td>";
1080 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1082 $column_data{onhand} =
1084 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1086 $column_data{sellprice} =
1088 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1090 $column_data{listprice} =
1092 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1094 $column_data{lastcost} =
1096 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1099 $column_data{linetotalsellprice} = "<td align=right>"
1100 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1103 $column_data{linetotallastcost} = "<td align=right>"
1104 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1107 $column_data{linetotallistprice} = "<td align=right>"
1108 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1112 if (!$ref->{assemblyitem}) {
1113 $totalsellprice += $onhand * $ref->{sellprice};
1114 $totallastcost += $onhand * $ref->{lastcost};
1115 $totallistprice += $onhand * $ref->{listprice};
1117 $subtotalonhand += $onhand;
1118 $subtotalsellprice += $onhand * $ref->{sellprice};
1119 $subtotallastcost += $onhand * $ref->{lastcost};
1120 $subtotallistprice += $onhand * $ref->{listprice};
1125 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1126 $column_data{weight} =
1128 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1130 $column_data{unit} = "<td>$ref->{unit} </td>";
1131 $column_data{bin} = "<td>$ref->{bin} </td>";
1132 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1134 $column_data{invnumber} =
1135 ($ref->{module} ne 'oe')
1136 ? "<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>"
1137 : "<td>$ref->{invnumber}</td>";
1138 $column_data{ordnumber} =
1139 ($ref->{module} eq 'oe')
1140 ? "<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>"
1141 : "<td>$ref->{ordnumber}</td>";
1142 $column_data{quonumber} =
1143 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1144 ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
1145 : "<td>$ref->{quonumber}</td>";
1147 $column_data{name} = "<td>$ref->{name}</td>";
1149 $column_data{image} =
1151 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1152 : "<td> </td>";
1153 $column_data{drawing} =
1155 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1156 : "<td> </td>";
1157 $column_data{microfiche} =
1158 ($ref->{microfiche})
1159 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1160 : "<td> </td>";
1162 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1164 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
1168 print "<tr class=listrow$i>";
1170 map { print "\n$column_data{$_}" } @column_index;
1177 if ($form->{l_subtotal} eq 'Y') {
1181 if ($form->{"l_linetotal"}) {
1182 map { $column_data{$_} = "<td> </td>" } @column_index;
1183 $column_data{linetotalsellprice} =
1184 "<th class=listtotal align=right>"
1185 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1187 $column_data{linetotallastcost} =
1188 "<th class=listtotal align=right>"
1189 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1191 $column_data{linetotallistprice} =
1192 "<th class=listtotal align=right>"
1193 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1196 print "<tr class=listtotal>";
1198 map { print "\n$column_data{$_}" } @column_index;
1205 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1214 <form method=post action=$form->{script}>
1216 <input type=hidden name=path value=$form->{path}>
1217 <input type=hidden name=login value=$form->{login}>
1218 <input type=hidden name=password value=$form->{password}>
1220 <input type=hidden name=itemstatus value="$form->{itemstatus}">
1221 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
1222 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
1223 <input type=hidden name=l_description value="$form->{l_description}">
1224 <input type=hidden name=l_onhand value="$form->{l_onhand}">
1225 <input type=hidden name=l_unit value="$form->{l_unit}">
1226 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
1227 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
1228 <input type=hidden name=sort value="$form->{sort}">
1229 <input type=hidden name=revers value="$form->{revers}">
1230 <input type=hidden name=lastsort value="$form->{lastsort}">
1231 <input type=hidden name=parts value="$form->{parts}">
1233 <input type=hidden name=bom value="$form->{bom}">
1234 <input type=hidden name=titel value="$form->{titel}">
1235 <input type=hidden name=searchitems value="$form->{searchitems}">|;
1240 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
1242 <input class=submit type=submit name=action value="|
1243 . $locale->text('choice') . qq|">|;
1245 if ($form->{menubar}) {
1246 require "$form->{path}/menu.pl";
1257 $lxdebug->leave_sub();
1260 sub generate_report {
1261 $lxdebug->enter_sub();
1263 $revers = $form->{revers};
1264 $lastsort = $form->{lastsort};
1266 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1267 $form->{revers} = 0;
1268 $form->{lastsort} = "partnumber";
1269 $form->{sort} = "partnumber";
1272 # switch between backward sorting of tables
1273 if ($form->{lastsort} eq $form->{sort}) {
1274 if ($form->{revers} == 0) {
1275 $form->{revers} = 1;
1277 $form->{revers} = 0;
1280 $form->{revers} == 0;
1281 $form->{lastsort} = $form->{sort};
1286 "$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="
1287 . $form->escape($form->{title}, 1);
1289 # if we have a serialnumber limit search
1290 if ($form->{serialnumber} || $form->{l_serialnumber}) {
1291 $form->{l_serialnumber} = "Y";
1292 unless ( $form->{bought}
1295 || $form->{quoted}) {
1296 $form->{bought} = $form->{sold} = 1;
1300 IC->all_parts(\%myconfig, \%$form);
1302 if ($form->{itemstatus} eq 'active') {
1303 $option .= $locale->text('Active') . " : ";
1305 if ($form->{itemstatus} eq 'obsolete') {
1306 $option .= $locale->text('Obsolete') . " : ";
1308 if ($form->{itemstatus} eq 'orphaned') {
1309 $option .= $locale->text('Orphaned') . " : ";
1311 if ($form->{itemstatus} eq 'onhand') {
1312 $option .= $locale->text('On Hand') . " : ";
1313 $form->{l_onhand} = "Y";
1315 if ($form->{itemstatus} eq 'short') {
1316 $option .= $locale->text('Short') . " : ";
1317 $form->{l_onhand} = "Y";
1319 if ($form->{onorder}) {
1320 $form->{l_ordnumber} = "Y";
1321 $callback .= "&onorder=$form->{onorder}";
1322 $option .= $locale->text('On Order') . " : ";
1324 if ($form->{ordered}) {
1325 $form->{l_ordnumber} = "Y";
1326 $callback .= "&ordered=$form->{ordered}";
1327 $option .= $locale->text('Ordered') . " : ";
1330 $form->{l_quonumber} = "Y";
1331 $callback .= "&rfq=$form->{rfq}";
1332 $option .= $locale->text('RFQ') . " : ";
1334 if ($form->{quoted}) {
1335 $form->{l_quonumber} = "Y";
1336 $callback .= ""ed=$form->{quoted}";
1337 $option .= $locale->text('Quoted') . " : ";
1339 if ($form->{bought}) {
1340 $form->{l_invnumber} = "Y";
1341 $callback .= "&bought=$form->{bought}";
1342 $option .= $locale->text('Bought') . " : ";
1344 if ($form->{sold}) {
1345 $form->{l_invnumber} = "Y";
1346 $callback .= "&sold=$form->{sold}";
1347 $option .= $locale->text('Sold') . " : ";
1349 if ( $form->{bought}
1354 || $form->{quoted}) {
1356 $form->{l_lastcost} = "";
1357 $form->{l_name} = "Y";
1358 if ($form->{transdatefrom}) {
1359 $callback .= "&transdatefrom=$form->{transdatefrom}";
1361 . $locale->text('From')
1363 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1365 if ($form->{transdateto}) {
1366 $callback .= "&transdateto=$form->{transdateto}";
1368 . $locale->text('To')
1370 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1376 if ($form->{partnumber}) {
1377 $callback .= "&partnumber=$form->{partnumber}";
1378 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
1380 if ($form->{partsgroup}) {
1381 $callback .= "&partsgroup=$form->{partsgroup}";
1382 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
1384 if ($form->{serialnumber}) {
1385 $callback .= "&serialnumber=$form->{serialnumber}";
1387 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
1389 if ($form->{description}) {
1390 $callback .= "&description=$form->{description}";
1391 $description = $form->{description};
1395 $locale->text('Part Description') . qq| : $form->{description}<br>|;
1397 if ($form->{make}) {
1398 $callback .= "&make=$form->{make}";
1399 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
1401 if ($form->{model}) {
1402 $callback .= "&model=$form->{model}";
1403 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
1405 if ($form->{drawing}) {
1406 $callback .= "&drawing=$form->{drawing}";
1407 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
1409 if ($form->{microfiche}) {
1410 $callback .= "µfiche=$form->{microfiche}";
1411 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
1414 # table soldtotal aktive
1415 if ($form->{l_soldtotal}) {
1416 $callback .= "&soldtotal=$form->{soldtotal}";
1417 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1420 @columns = $form->sort_columns(
1421 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)
1424 if ($form->{l_linetotal}) {
1425 $form->{l_onhand} = "Y";
1426 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1427 if ($form->{l_lastcost}) {
1428 $form->{l_linetotallastcost} = "Y";
1429 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1430 $form->{l_linetotallastcost} = "";
1433 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1436 if ($form->{searchitems} eq 'service') {
1438 # remove bin, weight and rop from list
1439 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1441 $form->{l_onhand} = "";
1443 # qty is irrelevant unless bought or sold
1444 if ( $form->{bought}
1449 || $form->{quoted}) {
1450 $form->{l_onhand} = "Y";
1452 $form->{l_linetotalsellprice} = "";
1453 $form->{l_linetotallastcost} = "";
1457 $form->{l_lastcost} = ""
1458 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1460 foreach $item (@columns) {
1461 if ($form->{"l_$item"} eq "Y") {
1462 push @column_index, $item;
1464 # add column to callback
1465 $callback .= "&l_$item=Y";
1469 if ($form->{l_subtotal} eq 'Y') {
1470 $callback .= "&l_subtotal=Y";
1472 $column_header{partnumber} =
1473 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1474 . $locale->text('Part Number')
1476 $column_header{description} =
1477 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1478 . $locale->text('Part Description')
1480 $column_header{partsgroup} =
1481 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
1482 . $locale->text('Group')
1484 $column_header{bin} =
1485 qq|<th><a class=listheading href=$callback&sort=bin>|
1486 . $locale->text('Bin')
1488 $column_header{priceupdate} =
1489 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
1490 . $locale->text('Updated')
1492 $column_header{onhand} =
1493 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1494 . $locale->text('Qty')
1496 $column_header{unit} =
1497 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
1498 $column_header{listprice} =
1499 qq|<th class=listheading nowrap>|
1500 . $locale->text('List Price')
1502 $column_header{lastcost} =
1503 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
1504 $column_header{rop} =
1505 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
1506 $column_header{weight} =
1507 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
1509 $column_header{invnumber} =
1510 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
1511 . $locale->text('Invoice Number')
1513 $column_header{ordnumber} =
1514 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
1515 . $locale->text('Order Number')
1517 $column_header{quonumber} =
1518 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
1519 . $locale->text('Quotation')
1522 $column_header{name} =
1523 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
1524 . $locale->text('Name')
1527 $column_header{sellprice} =
1528 qq|<th class=listheading nowrap>|
1529 . $locale->text('Sell Price')
1531 $column_header{linetotalsellprice} =
1532 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1533 $column_header{linetotallastcost} =
1534 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1535 $column_header{linetotallistprice} =
1536 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1538 $column_header{image} =
1539 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
1540 $column_header{drawing} =
1541 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
1542 . $locale->text('Drawing')
1544 $column_header{microfiche} =
1545 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
1546 . $locale->text('Microfiche')
1549 $column_header{serialnumber} =
1550 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
1551 . $locale->text('Serial Number')
1553 $column_header{soldtotal} =
1554 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1555 . $locale->text('soldtotal')
1559 $colspan = $#column_index + 1;
1566 <th class=listtop colspan=$colspan>$form->{title}</th>
1568 <tr height="5"></tr>
1570 <tr><td colspan=$colspan>$option</td></tr>
1572 <tr class=listheading>
1575 map { print "\n$column_header{$_}" } @column_index;
1581 # add order to callback
1582 $form->{callback} = $callback .= "&sort=$form->{sort}";
1584 # escape callback for href
1585 $callback = $form->escape($callback);
1587 if (@{ $form->{parts} }) {
1588 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1591 foreach $ref (@{ $form->{parts} }) {
1593 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1594 if ($sameitem ne $ref->{ $form->{sort} }) {
1596 $sameitem = $ref->{ $form->{sort} };
1600 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1601 $ref->{sellprice} *= $ref->{exchangerate};
1602 $ref->{listprice} *= $ref->{exchangerate};
1603 $ref->{lastcost} *= $ref->{exchangerate};
1605 # use this for assemblies
1606 $onhand = $ref->{onhand};
1609 if ($ref->{assemblyitem}) {
1611 $onhand = 0 if ($form->{sold});
1614 $ref->{description} =~ s/
1617 $column_data{partnumber} =
1618 "<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>";
1619 $column_data{description} = "<td>$ref->{description} </td>";
1620 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1622 $column_data{onhand} =
1624 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1626 $column_data{sellprice} =
1628 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1630 $column_data{listprice} =
1632 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1634 $column_data{lastcost} =
1636 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1639 $column_data{linetotalsellprice} = "<td align=right>"
1640 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1643 $column_data{linetotallastcost} = "<td align=right>"
1644 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1647 $column_data{linetotallistprice} = "<td align=right>"
1648 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1652 if (!$ref->{assemblyitem}) {
1653 $totalsellprice += $onhand * $ref->{sellprice};
1654 $totallastcost += $onhand * $ref->{lastcost};
1655 $totallistprice += $onhand * $ref->{listprice};
1657 $subtotalonhand += $onhand;
1658 $subtotalsellprice += $onhand * $ref->{sellprice};
1659 $subtotallastcost += $onhand * $ref->{lastcost};
1660 $subtotallistprice += $onhand * $ref->{listprice};
1665 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1666 $column_data{weight} =
1668 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1670 $column_data{unit} = "<td>$ref->{unit} </td>";
1671 $column_data{bin} = "<td>$ref->{bin} </td>";
1672 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1674 $column_data{invnumber} =
1675 ($ref->{module} ne 'oe')
1676 ? "<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>"
1677 : "<td>$ref->{invnumber}</td>";
1678 $column_data{ordnumber} =
1679 ($ref->{module} eq 'oe')
1680 ? "<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>"
1681 : "<td>$ref->{ordnumber}</td>";
1682 $column_data{quonumber} =
1683 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1684 ? "<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>"
1685 : "<td>$ref->{quonumber}</td>";
1687 $column_data{name} = "<td>$ref->{name}</td>";
1689 $column_data{image} =
1691 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1692 : "<td> </td>";
1693 $column_data{drawing} =
1695 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1696 : "<td> </td>";
1697 $column_data{microfiche} =
1698 ($ref->{microfiche})
1699 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1700 : "<td> </td>";
1702 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1704 $column_data{soldtotal} =
1706 . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ")
1711 print "<tr class=listrow$i>";
1713 map { print "\n$column_data{$_}" } @column_index;
1721 if ($form->{l_subtotal} eq 'Y') {
1725 if ($form->{"l_linetotal"}) {
1726 map { $column_data{$_} = "<td> </td>" } @column_index;
1727 $column_data{linetotalsellprice} =
1728 "<th class=listtotal align=right>"
1729 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1731 $column_data{linetotallastcost} =
1732 "<th class=listtotal align=right>"
1733 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1735 $column_data{linetotallistprice} =
1736 "<th class=listtotal align=right>"
1737 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1740 print "<tr class=listtotal>";
1742 map { print "\n$column_data{$_}" } @column_index;
1749 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1758 <form method=post action=$form->{script}>
1760 <input name=callback type=hidden value="$form->{callback}">
1762 <input type=hidden name=item value=$form->{searchitems}>
1764 <input type=hidden name=path value=$form->{path}>
1765 <input type=hidden name=login value=$form->{login}>
1766 <input type=hidden name=password value=$form->{password}>|;
1769 <input class=submit type=submit name=action value="|
1770 . $locale->text('Add') . qq|">|;
1772 if ($form->{menubar}) {
1773 require "$form->{path}/menu.pl";
1784 $lxdebug->leave_sub();
1785 } #end generate_report
1787 sub parts_subtotal {
1788 $lxdebug->enter_sub();
1790 map { $column_data{$_} = "<td> </td>" } @column_index;
1791 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1793 $column_data{onhand} =
1794 "<th class=listsubtotal align=right>"
1795 . $form->format_amount(\%myconfig, $subtotalonhand, '', " ")
1798 $column_data{linetotalsellprice} =
1799 "<th class=listsubtotal align=right>"
1800 . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ")
1802 $column_data{linetotallistprice} =
1803 "<th class=listsubtotal align=right>"
1804 . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ")
1806 $column_data{linetotallastcost} =
1807 "<th class=listsubtotal align=right>"
1808 . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ")
1811 $subtotalonhand = 0;
1812 $subtotalsellprice = 0;
1813 $subtotallistprice = 0;
1814 $subtotallastcost = 0;
1816 print "<tr class=listsubtotal>";
1818 map { print "\n$column_data{$_}" } @column_index;
1824 $lxdebug->leave_sub();
1828 $lxdebug->enter_sub();
1830 IC->get_part(\%myconfig, \%$form);
1832 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1837 $lxdebug->leave_sub();
1841 $lxdebug->enter_sub();
1843 IC->create_links("IC", \%myconfig, \%$form);
1846 map { $form->{selectcurrency} .= "<option>$_\n" } split /:/,
1847 $form->{currencies};
1849 # parts and assemblies have the same links
1850 $item = $form->{item};
1851 if ($form->{item} eq 'assembly') {
1855 # build the popup menus
1856 $form->{taxaccounts} = "";
1857 foreach $key (keys %{ $form->{IC_links} }) {
1858 foreach $ref (@{ $form->{IC_links}{$key} }) {
1860 # if this is a tax field
1861 if ($key =~ /IC_tax/) {
1862 if ($key =~ /$item/) {
1863 $form->{taxaccounts} .= "$ref->{accno} ";
1864 $form->{"IC_tax_$ref->{accno}_description"} =
1865 "$ref->{accno}--$ref->{description}";
1868 if ($form->{amount}{ $ref->{accno} }) {
1869 $form->{"IC_tax_$ref->{accno}"} = "checked";
1872 $form->{"IC_tax_$ref->{accno}"} = "checked";
1877 $form->{"select$key"} .=
1878 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1879 if ($form->{amount}{$key} eq $ref->{accno}) {
1880 $form->{$key} = "$ref->{accno}--$ref->{description}";
1886 chop $form->{taxaccounts};
1888 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1889 $form->{selectIC_income} = $form->{selectIC_sale};
1890 $form->{selectIC_expense} = $form->{selectIC_cogs};
1891 $form->{IC_income} = $form->{IC_sale};
1892 $form->{IC_expense} = $form->{IC_cogs};
1895 delete $form->{IC_links};
1896 delete $form->{amount};
1898 $form->get_partsgroup(\%myconfig, { all => 1 });
1900 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1902 if (@{ $form->{all_partsgroup} }) {
1903 $form->{selectpartsgroup} = qq|<option>\n|;
1905 $form->{selectpartsgroup} .=
1906 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1907 } @{ $form->{all_partsgroup} };
1910 if ($form->{item} eq 'assembly') {
1912 foreach $i (1 .. $form->{assembly_rows}) {
1913 if ($form->{"partsgroup_id_$i"}) {
1914 $form->{"partsgroup_$i"} =
1915 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1918 $form->get_partsgroup(\%myconfig);
1920 if (@{ $form->{all_partsgroup} }) {
1921 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1924 $form->{selectassemblypartsgroup} .=
1925 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1926 } @{ $form->{all_partsgroup} };
1929 $lxdebug->leave_sub();
1933 $lxdebug->enter_sub();
1937 #decimalplaces for listprice
1938 ($dec) = ($form->{listprice} =~ /\.(\d+)/);
1940 my $decimalplaces = ($dec > 2) ? $dec : 2;
1941 $form->{listprice} =
1942 $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces);
1944 #decimalplaces for sellprice and gv
1945 ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
1947 my $decimalplaces = ($dec > 2) ? $dec : 2;
1951 $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
1954 ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
1956 my $decimalplaces = ($dec > 2) ? $dec : 2;
1959 $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
1961 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
1962 qw(weight rop stock);
1964 foreach $item (qw(partnumber description unit notes)) {
1965 $form->{$item} =~ s/\"/"/g;
1968 if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
1973 qq|<textarea name=notes rows=$rows cols=40 wrap=soft>$form->{notes}</textarea>|;
1974 if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
1976 qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
1979 qq|<input name=description size=40 value="$form->{description}">|;
1982 foreach $item (split / /, $form->{taxaccounts}) {
1983 $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
1987 foreach $item (qw(IC IC_income IC_expense)) {
1988 if ($form->{$item}) {
1989 if ($form->{id} && $form->{orphaned}) {
1990 $form->{"select$item"} =~ s/ selected//;
1991 $form->{"select$item"} =~
1992 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
1994 $form->{"select$item"} = qq|<option selected>$form->{$item}|;
1999 if ($form->{selectpartsgroup}) {
2000 $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2002 qq|<input type=hidden name=selectpartsgroup value="|
2003 . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
2004 $form->{selectpartsgroup} =~
2005 s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
2008 qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
2009 $group = $locale->text('Group');
2013 foreach $item (split / /, $form->{taxaccounts}) {
2015 <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
2016 <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
2020 $form->{obsolete} = "checked" if $form->{obsolete};
2024 <th align="right" nowrap="true">|
2025 . $locale->text('Last Cost') . qq|</th>
2026 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2032 <th align=right>| . $locale->text('Inventory') . qq|</th>
2033 <td><select name=IC>$form->{selectIC}</select></td>
2034 <input name=selectIC type=hidden value="$form->{selectIC}">
2038 if ($form->{item} eq "part") {
2040 $linkaccounts .= qq|
2042 <th align=right>| . $locale->text('Revenue') . qq|</th>
2043 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2044 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2047 <th align=right>| . $locale->text('COGS') . qq|</th>
2048 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2049 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2055 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2060 <input name=weight size=10 value=$form->{weight}>
2065 <input type=hidden name=weightunit value=$form->{weightunit}>
2075 if ($form->{item} eq "assembly") {
2081 <th align=right>| . $locale->text('Revenue') . qq|</th>
2082 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2083 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2089 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2094 $form->{weight}
2095 <input type=hidden name=weight value=$form->{weight}>
2100 <input type=hidden name=weightunit value=$form->{weightunit}>
2110 if ($form->{item} eq "service") {
2114 <th align=right>| . $locale->text('Revenue') . qq|</th>
2115 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2116 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2119 <th align=right>| . $locale->text('Expense') . qq|</th>
2120 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2121 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2127 if ($form->{item} ne 'service') {
2128 $n = ($form->{onhand} > 0) ? "1" : "0";
2131 <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2132 <th align=left nowrap class="plus$n"> |
2133 . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
2137 if ($form->{item} eq 'assembly') {
2140 <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
2141 <td><input name=stock size=10 value=$form->{stock}></td>
2148 <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
2149 <td><input name=rop size=10 value=$form->{rop}></td>
2155 <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
2156 <td><input name=bin size=10 value=$form->{bin}></td>
2161 <th align="right" nowrap="true">|
2162 . $locale->text('Verrechnungseinheit') . qq|</th>
2163 <td><input name=ve size=10 value=$form->{ve}></td>
2166 <th align="right" nowrap="true">|
2167 . $locale->text('Geschäftsvolumen') . qq|</th>
2168 <td><input name=gv size=10 value=$form->{gv}></td>
2176 <th align=right nowrap>| . $locale->text('Image') . qq|</th>
2177 <td><input name=image size=40 value="$form->{image}"></td>
2178 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
2179 <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
2182 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
2183 <td><input name=drawing size=40 value="$form->{drawing}"></td>
2195 <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
2196 <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
2200 $shopok = $form->{shop} == 1 ? "checked" : "";
2203 <th align=right nowrap>|
2204 . $locale->text('Shopartikel') . qq|</th>
2205 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2209 # type=submit $locale->text('Add Part')
2210 # type=submit $locale->text('Add Service')
2211 # type=submit $locale->text('Add Assembly')
2213 # type=submit $locale->text('Edit Part')
2214 # type=submit $locale->text('Edit Service')
2215 # type=submit $locale->text('Edit Assembly')
2216 # use JavaScript Calendar or not
2217 $form->{jsscript} = $jscalendar;
2219 if ($form->{jsscript}) {
2221 # with JavaScript Calendar
2223 <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2224 <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2225 . $locale->text('button') . qq|></td>
2230 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 $rc = IC->save(\%myconfig, \%$form);
2723 $form->error($locale->text('Partnumber not unique!'));
2725 $parts_id = $form->{id};
2727 # load previous variables
2728 if ($form->{previousform}) {
2730 # save the new form variables before splitting previousform
2731 map { $newform{$_} = $form->{$_} } keys %$form;
2733 $previousform = $form->unescape($form->{previousform});
2735 # don't trample on previous variables
2736 map { delete $form->{$_} } keys %newform;
2738 # now take it apart and restore original values
2739 foreach $item (split /&/, $previousform) {
2740 ($key, $value) = split /=/, $item, 2;
2741 $value =~ s/%26/&/g;
2742 $form->{$key} = $value;
2744 $form->{taxaccounts} = $newform{taxaccount2};
2746 if ($form->{item} eq 'assembly') {
2748 # undo number formatting
2749 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2750 qw(weight listprice sellprice rop);
2752 $form->{assembly_rows}--;
2753 $i = $newform{rowcount};
2754 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2756 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
2757 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
2759 # change/add values for assembly item
2760 map { $form->{"${_}_$i"} = $newform{$_} }
2761 qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno);
2763 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
2764 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
2768 # set values for last invoice/order item
2769 $i = $form->{rowcount};
2770 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2772 map { $form->{"${_}_$i"} = $newform{$_} }
2773 qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice);
2774 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
2776 if ($form->{exchangerate} != 0) {
2777 $form->{"sellprice_$i"} /= $form->{exchangerate};
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;
2802 $form->{"id_$i"} = $parts_id;
2803 delete $form->{action};
2805 # restore original callback
2806 $callback = $form->unescape($form->{callback});
2807 $form->{callback} = $form->unescape($form->{old_callback});
2808 delete $form->{old_callback};
2810 $form->{makemodel_rows}--;
2812 # put callback together
2813 foreach $key (keys %$form) {
2815 # do single escape for Apache 2.0
2816 $value = $form->escape($form->{$key}, 1);
2817 $callback .= qq|&$key=$value|;
2819 $form->{callback} = $callback;
2825 $lxdebug->leave_sub();
2829 $lxdebug->enter_sub();
2834 $lxdebug->leave_sub();
2838 $lxdebug->enter_sub();
2840 $rc = IC->delete(\%myconfig, \%$form);
2843 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
2844 $form->error($locale->text('Cannot delete item!'));
2846 $lxdebug->leave_sub();
2849 sub stock_assembly {
2850 $lxdebug->enter_sub();
2852 $form->{title} = $locale->text('Stock Assembly');
2859 <form method=post action=$form->{script}>
2861 <table width="100%">
2863 <th class=listtop>$form->{title}</th>
2865 <tr height="5"></tr>
2870 <th align="right" nowrap="true">|
2871 . $locale->text('Part Number') . qq|</th>
2872 <td><input name=partnumber size=20></td>
2876 <th align="right" nowrap="true">|
2877 . $locale->text('Part Description') . qq|</th>
2878 <td><input name=description size=40></td>
2883 <tr><td><hr size=3 noshade></td></tr>
2886 <input type=hidden name=path value=$form->{path}>
2887 <input type=hidden name=login value=$form->{login}>
2888 <input type=hidden name=password value=$form->{password}>
2890 <input type=hidden name=nextsub value=list_assemblies>
2893 <input class=submit type=submit name=action value="|
2894 . $locale->text('Continue') . qq|">
2901 $lxdebug->leave_sub();
2904 sub list_assemblies {
2905 $lxdebug->enter_sub();
2907 IC->retrieve_assemblies(\%myconfig, \%$form);
2909 $column_header{partnumber} =
2910 qq|<th class=listheading>| . $locale->text('Part Number') . qq|</th>|;
2911 $column_header{description} =
2912 qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
2913 $column_header{bin} =
2914 qq|<th class=listheading>| . $locale->text('Bin') . qq|</th>|;
2915 $column_header{onhand} =
2916 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
2917 $column_header{rop} =
2918 qq|<th class=listheading>| . $locale->text('ROP') . qq|</th>|;
2919 $column_header{stock} =
2920 qq|<th class=listheading>| . $locale->text('Add') . qq|</th>|;
2922 @column_index = (qw(partnumber description bin onhand rop stock));
2924 $form->{title} = $locale->text('Stock Assembly');
2927 "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2931 $colspan = $#column_index + 1;
2936 <form method=post action=$form->{script}>
2940 <th class=listtop colspan=$colspan>$form->{title}</th>
2943 <tr class=listheading>|;
2945 map { print "\n$column_header{$_}" } @column_index;
2952 foreach $ref (@{ $form->{assembly_items} }) {
2954 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description);
2956 $column_data{partnumber} = qq|<td width=20%>$ref->{partnumber}</td>|;
2957 $column_data{description} =
2958 qq|<td width=50%>$ref->{description} </td>|;
2959 $column_data{bin} = qq|<td>$ref->{bin} </td>|;
2960 $column_data{onhand} =
2961 qq|<td align=right>|
2962 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
2965 qq|<td align=right>|
2966 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ")
2968 $column_data{stock} = qq|<td width=10%><input name="qty_$i" size=10></td>|;
2973 qq|<tr class=listrow$j><input name="id_$i" type=hidden value=$ref->{id}>\n|;
2975 map { print "\n$column_data{$_}" } @column_index;
2988 <td colspan=6><hr size=3 noshade>
2991 <input name=rowcount type=hidden value="$i">
2993 <input type=hidden name=path value=$form->{path}>
2994 <input type=hidden name=login value=$form->{login}>
2995 <input type=hidden name=password value=$form->{password}>
2997 <input name=callback type=hidden value="$form->{callback}">
2999 <input type=hidden name=nextsub value=restock_assemblies>
3002 <input class=submit type=submit name=action value="|
3003 . $locale->text('Continue') . qq|">
3011 $lxdebug->leave_sub();
3014 sub restock_assemblies {
3015 $lxdebug->enter_sub();
3017 $form->redirect($locale->text('Assemblies restocked!'))
3018 if (IC->restock_assemblies(\%myconfig, \%$form));
3019 $form->error($locale->text('Cannot stock assemblies!'));
3021 $lxdebug->leave_sub();
3025 $lxdebug->enter_sub();
3034 <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
3035 <th class="listheading">| . $locale->text('Preis') . qq|</th>
3038 for $i (1 .. $numrows) {
3041 <td width=50%><input type=hidden name="pricegroup_$i" size=30 value=$form->{"pricegroup_$i"}>$form->{"pricegroup_$i"}</td>
3042 <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
3043 <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
3054 $lxdebug->leave_sub();
3057 sub continue { &{ $form->{nextsub} } }