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 #======================================================================
36 require "$form->{path}/io.pl";
43 $lxdebug->enter_sub();
45 $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
48 "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
49 unless $form->{callback};
52 ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea');
57 $lxdebug->leave_sub();
61 $lxdebug->enter_sub();
63 $form->{title} = (ucfirst $form->{searchitems}) . "s";
64 $form->{title} = $locale->text($form->{title});
66 # switch for backward sorting
69 # memory for which table was sort at last time
70 $form->{lastsort} = "";
72 # counter for added entries to top100
73 $form->{ndxs_counter} = 0;
75 # $locale->text('Parts')
76 # $locale->text('Services')
78 # use JavaScript Calendar or not
79 $form->{jsscript} = $jscalendar;
81 if ($form->{jsscript}) {
83 # with JavaScript Calendar
85 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
86 <td><input type=button name=transdatefrom id="trigger1" value=|
87 . $locale->text('button')
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')
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')
141 if ($form->{searchitems} eq 'assembly') {
143 $form->{title} = $locale->text('Assemblies');
149 <input name=null class=radio type=radio value=1 checked> |
150 . $locale->text('Top Level') . qq|
151 <input name=bom class=checkbox type=checkbox value=1> |
152 . $locale->text('Individual Items') . qq|
166 <td><input name=sold class=checkbox type=checkbox value=1></td>
167 <td nowrap>| . $locale->text('Sold') . qq|</td>
170 <td colspan=2><hr size=1 noshade></td>
173 <td><input name=ordered class=checkbox type=checkbox value=1></td>
174 <td nowrap>| . $locale->text('Ordered') . qq|</td>
177 <td colspan=4><hr size=1 noshade></td>
180 <td><input name=quoted class=checkbox type=checkbox value=1></td>
181 <td nowrap>| . $locale->text('Quoted') . qq|</td>
185 <td width=5%> </td>
186 <th>| . $locale->text('From') . qq|</th>
188 <th>| . $locale->text('To') . qq|</th>
207 <td><input name=bought class=checkbox type=checkbox value=1></td>
208 <td nowrap>| . $locale->text('Bought') . qq|</td>
209 <td><input name=sold class=checkbox type=checkbox value=1></td>
210 <td nowrap>| . $locale->text('Sold') . qq|</td>
213 <td colspan=4><hr size=1 noshade></td>
216 <td><input name=onorder class=checkbox type=checkbox value=1></td>
217 <td nowrap>| . $locale->text('On Order') . qq|</td>
218 <td><input name=ordered class=checkbox type=checkbox value=1></td>
219 <td nowrap>| . $locale->text('Ordered') . qq|</td>
222 <td colspan=4><hr size=1 noshade></td>
225 <td><input name=rfq class=checkbox type=checkbox value=1></td>
226 <td nowrap>| . $locale->text('RFQ') . qq|</td>
227 <td><input name=quoted class=checkbox type=checkbox value=1></td>
228 <td nowrap>| . $locale->text('Quoted') . qq|</td>
232 <td width=5%> </td>
236 <th>| . $locale->text('From') . qq|</th>
238 <th>| . $locale->text('To') . qq|</th>
255 <form method=post action=$form->{script}>
257 <input type=hidden name=searchitems value=$form->{searchitems}>
258 <input type=hidden name=title value="$form->{title}">
260 <input type=hidden name=revers value="$form->{revers}">
261 <input type=hidden name=lastsort value="$form->{lastsort}">
264 <tr><th class=listtop>$form->{title}</th></tr>
270 <th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
271 <td><input name=partnumber size=20></td>
274 <th align=right nowrap>|
275 . $locale->text('Part Description')
277 <td colspan=3><input name=description size=40></td>
280 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
281 <td><input name=partsgroup size=20></td>
286 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
287 <td><input name=drawing size=20></td>
288 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
289 <td><input name=microfiche size=20></td>
295 <input name=itemstatus class=radio type=radio value=active checked> |
296 . $locale->text('Active') . qq|
298 <input name=itemstatus class=radio type=radio value=obsolete> |
299 . $locale->text('Obsolete') . qq|
300 <input name=itemstatus class=radio type=radio value=orphaned> |
301 . $locale->text('Orphaned') . qq|
312 <th align=right nowrap>|
313 . $locale->text('Include in Report')
318 <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked> |
319 . $locale->text('Part Number')
321 <td><input name=l_description class=checkbox type=checkbox value=Y checked> |
322 . $locale->text('Part Description')
325 <td><input name=l_unit class=checkbox type=checkbox value=Y checked> |
326 . $locale->text('Unit of measure')
330 <td><input name=l_listprice class=checkbox type=checkbox value=Y> |
331 . $locale->text('List Price')
333 <td><input name=l_sellprice class=checkbox type=checkbox value=Y checked> |
334 . $locale->text('Sell Price')
336 <td><input name=l_lastcost class=checkbox type=checkbox value=Y> |
337 . $locale->text('Last Cost')
339 <td><input name=l_linetotal class=checkbox type=checkbox value=Y checked> |
340 . $locale->text('Line Total')
344 <td><input name=l_priceupdate class=checkbox type=checkbox value=Y> |
345 . $locale->text('Updated')
347 <td><input name=l_bin class=checkbox type=checkbox value=Y> |
348 . $locale->text('Bin')
350 <td><input name=l_rop class=checkbox type=checkbox value=Y> |
351 . $locale->text('ROP')
353 <td><input name=l_weight class=checkbox type=checkbox value=Y> |
354 . $locale->text('Weight')
358 <td><input name=l_image class=checkbox type=checkbox value=Y> |
359 . $locale->text('Image')
361 <td><input name=l_drawing class=checkbox type=checkbox value=Y> |
362 . $locale->text('Drawing')
364 <td><input name=l_microfiche class=checkbox type=checkbox value=Y> |
365 . $locale->text('Microfiche')
367 <td><input name=l_partsgroup class=checkbox type=checkbox value=Y> |
368 . $locale->text('Group')
372 <td><input name=l_subtotal class=checkbox type=checkbox value=Y> |
373 . $locale->text('Subtotal')
375 <td><input name=l_soldtotal class=checkbox type=checkbox value=Y> |
376 . $locale->text('soldtotal')
385 <tr><td colspan=4><hr size=3 noshade></td></tr>
390 <input type=hidden name=nextsub value=generate_report>
392 <input type=hidden name=path value=$form->{path}>
393 <input type=hidden name=login value=$form->{login}>
394 <input type=hidden name=password value=$form->{password}>
396 <input type=hidden name=revers value="$form->{revers}">
397 <input type=hidden name=lastsort value="$form->{lastsort}">
399 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
402 <input class=submit type=submit name=action value="|
403 . $locale->text('Continue') . qq|">
404 <input class=submit type=submit name=action value="|
405 . $locale->text('TOP100') . qq|">
411 $lxdebug->leave_sub();
415 $lxdebug->enter_sub();
417 $form->{title} = $locale->text('Top 100 hinzufuegen');
424 <form method=post action=$form->{script}>
426 <input type=hidden name=searchitems value=$form->{searchitems}>
427 <input type=hidden name=title value="$form->{title}">
429 <input type=hidden name=revers value="$form->{revers}">
430 <input type=hidden name=lastsort value="$form->{lastsort}">|;
434 <tr class=listheading>
435 <th class=listheading nowrap>|
436 . $locale->text('Part Number')
438 <th class=listheading nowrap>|
439 . $locale->text('Part Description')
443 <td><input type=text name=partnumber size=20 value=></td>
444 <td><input type=text name=description size=30 value=></td>
451 <input type=hidden name=path value=$form->{path}>
452 <input type=hidden name=login value=$form->{login}>
453 <input type=hidden name=password value=$form->{password}>
455 <input type=hidden name=itemstatus value="$form->{itemstatus}">
456 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
457 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
458 <input type=hidden name=l_description value="$form->{l_description}">
459 <input type=hidden name=l_onhand value="$form->{l_onhand}">
460 <input type=hidden name=l_unit value="$form->{l_unit}">
461 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
462 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
463 <input type=hidden name=sort value="$form->{sort}">
464 <input type=hidden name=revers value="$form->{revers}">
465 <input type=hidden name=lastsort value="$form->{lastsort}">
467 <input type=hidden name=bom value="$form->{bom}">
468 <input type=hidden name=titel value="$form->{titel}">
469 <input type=hidden name=searchitems value="$form->{searchitems}">
471 <input type=hidden name=row value=$j>
473 <input type=hidden name=nextsub value=item_selected>
475 <input type=hidden name=test value=item_selected>
477 <input name=lastndx type=hidden value=$lastndx>
479 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>
481 <input name=extras type=hidden value=$form->{extras}>|;
485 for ($i = 0; $i < $form->{ndxs_counter}; $i++) {
488 $partnumber = $form->{"totop100_partnumber_$j"};
489 $description = $form->{"totop100_description_$j"};
490 $unit = $form->{"totop100_unit_$j"};
491 $sellprice = $form->{"totop100_sellprice_$j"};
492 $soldtotal = $form->{"totop100_soldtotal_$j"};
494 # insert data into top100
495 push @{ $form->{parts} },
497 partnumber => "$partnumber",
498 description => "$description",
500 sellprice => "$sellprice",
501 soldtotal => "$soldtotal" };
507 # set data for next page
508 if (($form->{ndxs_counter}) > 0) {
509 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
510 $partnumber = $form->{"totop100_partnumber_$i"};
511 $description = $form->{"totop100_description_$i"};
512 $unit = $form->{"totop100_unit_$i"};
513 $sellprice = $form->{"totop100_sellprice_$i"};
514 $soldtotal = $form->{"totop100_soldtotal_$i"};
517 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
518 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
519 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
520 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
521 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
529 <input class=submit type=submit name=action value="|
530 . $locale->text('list') . qq|">
535 $lxdebug->leave_sub();
539 $lxdebug->enter_sub();
542 if (($form->{partnumber} eq "") and ($form->{description} eq "")) {
543 IC->get_parts(\%myconfig, \%$form, "");
545 if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) {
546 IC->get_parts(\%myconfig, \%$form, "partnumber");
548 if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) {
549 IC->get_parts(\%myconfig, \%$form, "description");
551 IC->get_parts(\%myconfig, \%$form, "all");
556 $form->{title} = $locale->text('Top 100 hinzufuegen');
562 <form method=post action=ic.pl>
565 <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
568 <tr class=listheading>
570 <th class=listheading>| . $locale->text('Part Number') . qq|</th>
571 <th class=listheading>| . $locale->text('Part Description') . qq|</th>
572 <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
573 <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
574 <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
578 my $i = $form->{rows};
580 for ($j = 1; $j <= $i; $j++) {
583 <tr class=listrow1>|;
586 <td><input name=ndx class=radio type=radio value=$j checked></td>|;
589 <td><input name=ndx class=radio type=radio value=$j></td>|;
592 <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
593 <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
594 <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
595 <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
596 <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
599 <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
609 <input type=hidden name=path value=$form->{path}>
610 <input type=hidden name=login value=$form->{login}>
611 <input type=hidden name=password value=$form->{password}>
613 <input type=hidden name=itemstatus value="$form->{itemstatus}">
614 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
615 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
616 <input type=hidden name=l_description value="$form->{l_description}">
617 <input type=hidden name=l_onhand value="$form->{l_onhand}">
618 <input type=hidden name=l_unit value="$form->{l_unit}">
619 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
620 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
621 <input type=hidden name=sort value="$form->{sort}">
622 <input type=hidden name=revers value="$form->{revers}">
623 <input type=hidden name=lastsort value="$form->{lastsort}">
625 <input type=hidden name=bom value="$form->{bom}">
626 <input type=hidden name=titel value="$form->{titel}">
627 <input type=hidden name=searchitems value="$form->{searchitems}">
629 <input type=hidden name=row value=$j>
631 <input type=hidden name=nextsub value=item_selected>
633 <input name=lastndx type=hidden value=$lastndx>
635 <input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
639 if (($form->{ndxs_counter}) > 0) {
640 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
641 $j1 = $form->{"totop100_partnumber_$i"};
642 $j2 = $form->{"totop100_description_$i"};
643 $j3 = $form->{"totop100_unit_$i"};
644 $j4 = $form->{"totop100_sellprice_$i"};
645 $j5 = $form->{"totop100_soldtotal_$i"};
654 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
655 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
656 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
657 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
658 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
666 <input class=submit type=submit name=action value="|
667 . $locale->text('TOP100') . qq|">
673 $lxdebug->leave_sub();
677 $lxdebug->enter_sub();
680 $form->{ndxs_counter}++;
682 if ($form->{ndxs_counter} > 0) {
684 $index = $form->{ndx};
686 $j1 = $form->{"new_partnumber_$index"};
687 $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $j1;
688 $j2 = $form->{"new_description_$index"};
689 $form->{"totop100_description_$form->{ndxs_counter}"} = $j2;
690 $j3 = $form->{"new_unit_$index"};
691 $form->{"totop100_unit_$form->{ndxs_counter}"} = $j3;
692 $j4 = $form->{"new_sellprice_$index"};
693 $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $j4;
694 $j5 = $form->{"new_soldtotal_$index"};
695 $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $j5;
699 $lxdebug->leave_sub();
703 $lxdebug->enter_sub();
705 $form->{top100} = "top100";
706 $form->{l_soldtotal} = "Y";
707 $form->{soldtotal} = "soldtotal";
708 $form->{sort} = "soldtotal";
709 $form->{l_qty} = "N";
710 $callback .= "&form->{top100}=$form->{top100}";
711 $form->{l_linetotal} = "";
713 $form->{number} = "position";
714 $form->{l_number} = "Y";
718 $form->{title} = $locale->text('Top 100');
720 $revers = $form->{revers};
721 $lastsort = $form->{lastsort};
723 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
725 $form->{lastsort} = "partnumber";
726 $form->{sort} = "partnumber";
730 "$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="
731 . $form->escape($form->{title}, 1);
733 # if we have a serialnumber limit search
734 if ($form->{serialnumber} || $form->{l_serialnumber}) {
735 $form->{l_serialnumber} = "Y";
736 unless ( $form->{bought}
739 || $form->{quoted}) {
740 $form->{bought} = $form->{sold} = 1;
743 IC->all_parts(\%myconfig, \%$form);
745 if ($form->{itemstatus} eq 'active') {
746 $option .= $locale->text('Active') . " : ";
748 if ($form->{itemstatus} eq 'obsolete') {
749 $option .= $locale->text('Obsolete') . " : ";
751 if ($form->{itemstatus} eq 'orphaned') {
752 $option .= $locale->text('Orphaned') . " : ";
754 if ($form->{itemstatus} eq 'onhand') {
755 $option .= $locale->text('On Hand') . " : ";
756 $form->{l_onhand} = "Y";
758 if ($form->{itemstatus} eq 'short') {
759 $option .= $locale->text('Short') . " : ";
760 $form->{l_onhand} = "Y";
762 if ($form->{onorder}) {
763 $form->{l_ordnumber} = "Y";
764 $callback .= "&onorder=$form->{onorder}";
765 $option .= $locale->text('On Order') . " : ";
767 if ($form->{ordered}) {
768 $form->{l_ordnumber} = "Y";
769 $callback .= "&ordered=$form->{ordered}";
770 $option .= $locale->text('Ordered') . " : ";
773 $form->{l_quonumber} = "Y";
774 $callback .= "&rfq=$form->{rfq}";
775 $option .= $locale->text('RFQ') . " : ";
777 if ($form->{quoted}) {
778 $form->{l_quonumber} = "Y";
779 $callback .= ""ed=$form->{quoted}";
780 $option .= $locale->text('Quoted') . " : ";
782 if ($form->{bought}) {
783 $form->{l_invnumber} = "Y";
784 $callback .= "&bought=$form->{bought}";
785 $option .= $locale->text('Bought') . " : ";
788 $form->{l_invnumber} = "Y";
789 $callback .= "&sold=$form->{sold}";
790 $option .= $locale->text('Sold') . " : ";
797 || $form->{quoted}) {
799 $form->{l_lastcost} = "";
800 $form->{l_name} = "Y";
801 if ($form->{transdatefrom}) {
802 $callback .= "&transdatefrom=$form->{transdatefrom}";
804 . $locale->text('From')
806 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
808 if ($form->{transdateto}) {
809 $callback .= "&transdateto=$form->{transdateto}";
811 . $locale->text('To')
813 . $locale->date(\%myconfig, $form->{transdateto}, 1);
819 if ($form->{partnumber}) {
820 $callback .= "&partnumber=$form->{partnumber}";
821 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
823 if ($form->{partsgroup}) {
824 $callback .= "&partsgroup=$form->{partsgroup}";
825 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
827 if ($form->{serialnumber}) {
828 $callback .= "&serialnumber=$form->{serialnumber}";
830 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
832 if ($form->{description}) {
833 $callback .= "&description=$form->{description}";
834 $description = $form->{description};
838 $locale->text('Part Description') . qq| : $form->{description}<br>|;
841 $callback .= "&make=$form->{make}";
842 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
844 if ($form->{model}) {
845 $callback .= "&model=$form->{model}";
846 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
848 if ($form->{drawing}) {
849 $callback .= "&drawing=$form->{drawing}";
850 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
852 if ($form->{microfiche}) {
853 $callback .= "µfiche=$form->{microfiche}";
854 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
856 if ($form->{l_soldtotal}) {
857 $callback .= "&soldtotal=$form->{soldtotal}";
858 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
863 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)
866 if ($form->{l_linetotal}) {
867 $form->{l_onhand} = "Y";
868 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
869 if ($form->{l_lastcost}) {
870 $form->{l_linetotallastcost} = "Y";
871 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
872 $form->{l_linetotallastcost} = "";
875 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
878 if ($form->{searchitems} eq 'service') {
880 # remove bin, weight and rop from list
881 map { $form->{"l_$_"} = "" } qw(bin weight rop);
883 $form->{l_onhand} = "";
885 # qty is irrelevant unless bought or sold
891 || $form->{quoted}) {
892 $form->{l_onhand} = "Y";
894 $form->{l_linetotalsellprice} = "";
895 $form->{l_linetotallastcost} = "";
899 $form->{l_lastcost} = ""
900 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
902 foreach $item (@columns) {
903 if ($form->{"l_$item"} eq "Y") {
904 push @column_index, $item;
906 # add column to callback
907 $callback .= "&l_$item=Y";
911 if ($form->{l_subtotal} eq 'Y') {
912 $callback .= "&l_subtotal=Y";
915 $column_header{number} =
916 qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|;
917 $column_header{partnumber} =
918 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
919 . $locale->text('Part Number')
921 $column_header{description} =
922 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
923 . $locale->text('Part Description')
925 $column_header{partsgroup} =
926 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
927 . $locale->text('Group')
929 $column_header{bin} =
930 qq|<th><a class=listheading href=$callback&sort=bin>|
931 . $locale->text('Bin')
933 $column_header{priceupdate} =
934 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
935 . $locale->text('Updated')
937 $column_header{onhand} =
938 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
939 . $locale->text('Qty')
941 $column_header{unit} =
942 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
943 $column_header{listprice} =
944 qq|<th class=listheading nowrap>|
945 . $locale->text('List Price')
947 $column_header{lastcost} =
948 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
949 $column_header{rop} =
950 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
951 $column_header{weight} =
952 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
954 $column_header{invnumber} =
955 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
956 . $locale->text('Invoice Number')
958 $column_header{ordnumber} =
959 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
960 . $locale->text('Order Number')
962 $column_header{quonumber} =
963 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
964 . $locale->text('Quotation')
967 $column_header{name} =
968 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
969 . $locale->text('Name')
972 $column_header{sellprice} =
973 qq|<th class=listheading nowrap>|
974 . $locale->text('Sell Price')
976 $column_header{linetotalsellprice} =
977 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
978 $column_header{linetotallastcost} =
979 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
980 $column_header{linetotallistprice} =
981 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
983 $column_header{image} =
984 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
985 $column_header{drawing} =
986 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
987 . $locale->text('Drawing')
989 $column_header{microfiche} =
990 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
991 . $locale->text('Microfiche')
994 $column_header{serialnumber} =
995 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
996 . $locale->text('Serial Number')
998 $column_header{soldtotal} =
999 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1000 . $locale->text('soldtotal')
1004 $colspan = $#column_index + 1;
1011 <th class=listtop colspan=$colspan>$form->{title}</th>
1013 <tr height="5"></tr>
1015 <tr><td colspan=$colspan>$option</td></tr>
1017 <tr class=listheading>
1020 map { print "\n$column_header{$_}" } @column_index;
1026 # add order to callback
1027 $form->{callback} = $callback .= "&sort=$form->{sort}";
1029 # escape callback for href
1030 $callback = $form->escape($callback);
1032 if (@{ $form->{parts} }) {
1033 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1036 # insert numbers for top100
1038 foreach $ref (@{ $form->{parts} }) {
1040 $ref->{number} = $j;
1043 # if avaible -> insert choice here
1044 if (($form->{ndxs_counter}) > 0) {
1045 for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
1046 $partnumber = $form->{"totop100_partnumber_$i"};
1047 $description = $form->{"totop100_description_$i"};
1048 $unit = $form->{"totop100_unit_$i"};
1049 $sellprice = $form->{"totop100_sellprice_$i"};
1050 $soldtotal = $form->{"totop100_soldtotal_$i"};
1053 <input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
1054 <input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
1055 <input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
1056 <input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
1057 <input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
1061 push @{ $form->{parts} },
1063 partnumber => "$partnumber",
1064 description => "$description",
1066 sellprice => "$sellprice",
1067 soldtotal => "$soldtotal" };
1070 # build data for columns
1071 foreach $ref (@{ $form->{parts} }) {
1073 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1074 if ($sameitem ne $ref->{ $form->{sort} }) {
1076 $sameitem = $ref->{ $form->{sort} };
1080 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1081 $ref->{sellprice} *= $ref->{exchangerate};
1082 $ref->{listprice} *= $ref->{exchangerate};
1083 $ref->{lastcost} *= $ref->{exchangerate};
1085 # use this for assemblies
1086 $onhand = $ref->{onhand};
1089 if ($ref->{assemblyitem}) {
1091 $onhand = 0 if ($form->{sold});
1094 $ref->{description} =~ s/
1097 $column_data{number} =
1099 . $form->format_amount(\%myconfig, $ref->{number}, '', " ")
1101 $column_data{partnumber} =
1102 "<td align=$align>$ref->{partnumber} </a></td>";
1103 $column_data{description} = "<td>$ref->{description} </td>";
1104 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1106 $column_data{onhand} =
1108 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1110 $column_data{sellprice} =
1112 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1114 $column_data{listprice} =
1116 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1118 $column_data{lastcost} =
1120 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1123 $column_data{linetotalsellprice} = "<td align=right>"
1124 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1127 $column_data{linetotallastcost} = "<td align=right>"
1128 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1131 $column_data{linetotallistprice} = "<td align=right>"
1132 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1136 if (!$ref->{assemblyitem}) {
1137 $totalsellprice += $onhand * $ref->{sellprice};
1138 $totallastcost += $onhand * $ref->{lastcost};
1139 $totallistprice += $onhand * $ref->{listprice};
1141 $subtotalonhand += $onhand;
1142 $subtotalsellprice += $onhand * $ref->{sellprice};
1143 $subtotallastcost += $onhand * $ref->{lastcost};
1144 $subtotallistprice += $onhand * $ref->{listprice};
1149 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1150 $column_data{weight} =
1152 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1154 $column_data{unit} = "<td>$ref->{unit} </td>";
1155 $column_data{bin} = "<td>$ref->{bin} </td>";
1156 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1158 $column_data{invnumber} =
1159 ($ref->{module} ne 'oe')
1160 ? "<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>"
1161 : "<td>$ref->{invnumber}</td>";
1162 $column_data{ordnumber} =
1163 ($ref->{module} eq 'oe')
1164 ? "<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>"
1165 : "<td>$ref->{ordnumber}</td>";
1166 $column_data{quonumber} =
1167 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1168 ? "<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>"
1169 : "<td>$ref->{quonumber}</td>";
1171 $column_data{name} = "<td>$ref->{name}</td>";
1173 $column_data{image} =
1175 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1176 : "<td> </td>";
1177 $column_data{drawing} =
1179 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1180 : "<td> </td>";
1181 $column_data{microfiche} =
1182 ($ref->{microfiche})
1183 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1184 : "<td> </td>";
1186 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1188 $column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>";
1192 print "<tr class=listrow$i>";
1194 map { print "\n$column_data{$_}" } @column_index;
1201 if ($form->{l_subtotal} eq 'Y') {
1205 if ($form->{"l_linetotal"}) {
1206 map { $column_data{$_} = "<td> </td>" } @column_index;
1207 $column_data{linetotalsellprice} =
1208 "<th class=listtotal align=right>"
1209 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1211 $column_data{linetotallastcost} =
1212 "<th class=listtotal align=right>"
1213 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1215 $column_data{linetotallistprice} =
1216 "<th class=listtotal align=right>"
1217 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1220 print "<tr class=listtotal>";
1222 map { print "\n$column_data{$_}" } @column_index;
1229 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1238 <form method=post action=$form->{script}>
1240 <input type=hidden name=path value=$form->{path}>
1241 <input type=hidden name=login value=$form->{login}>
1242 <input type=hidden name=password value=$form->{password}>
1244 <input type=hidden name=itemstatus value="$form->{itemstatus}">
1245 <input type=hidden name=l_linetotal value="$form->{l_linetotal}">
1246 <input type=hidden name=l_partnumber value="$form->{l_partnumber}">
1247 <input type=hidden name=l_description value="$form->{l_description}">
1248 <input type=hidden name=l_onhand value="$form->{l_onhand}">
1249 <input type=hidden name=l_unit value="$form->{l_unit}">
1250 <input type=hidden name=l_sellprice value="$form->{l_sellprice}">
1251 <input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
1252 <input type=hidden name=sort value="$form->{sort}">
1253 <input type=hidden name=revers value="$form->{revers}">
1254 <input type=hidden name=lastsort value="$form->{lastsort}">
1255 <input type=hidden name=parts value="$form->{parts}">
1257 <input type=hidden name=bom value="$form->{bom}">
1258 <input type=hidden name=titel value="$form->{titel}">
1259 <input type=hidden name=searchitems value="$form->{searchitems}">|;
1264 <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
1266 <input class=submit type=submit name=action value="|
1267 . $locale->text('choice') . qq|">|;
1269 if ($form->{menubar}) {
1270 require "$form->{path}/menu.pl";
1281 $lxdebug->leave_sub();
1284 sub generate_report {
1285 $lxdebug->enter_sub();
1287 $revers = $form->{revers};
1288 $lastsort = $form->{lastsort};
1290 if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
1291 $form->{revers} = 0;
1292 $form->{lastsort} = "partnumber";
1293 $form->{sort} = "partnumber";
1296 # switch between backward sorting of tables
1297 if ($form->{lastsort} eq $form->{sort}) {
1298 if ($form->{revers} == 0) {
1299 $form->{revers} = 1;
1301 $form->{revers} = 0;
1304 $form->{revers} == 0;
1305 $form->{lastsort} = $form->{sort};
1310 "$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="
1311 . $form->escape($form->{title}, 1);
1313 # if we have a serialnumber limit search
1314 if ($form->{serialnumber} || $form->{l_serialnumber}) {
1315 $form->{l_serialnumber} = "Y";
1316 unless ( $form->{bought}
1319 || $form->{quoted}) {
1320 $form->{bought} = $form->{sold} = 1;
1324 IC->all_parts(\%myconfig, \%$form);
1326 if ($form->{itemstatus} eq 'active') {
1327 $option .= $locale->text('Active') . " : ";
1329 if ($form->{itemstatus} eq 'obsolete') {
1330 $option .= $locale->text('Obsolete') . " : ";
1332 if ($form->{itemstatus} eq 'orphaned') {
1333 $option .= $locale->text('Orphaned') . " : ";
1335 if ($form->{itemstatus} eq 'onhand') {
1336 $option .= $locale->text('On Hand') . " : ";
1337 $form->{l_onhand} = "Y";
1339 if ($form->{itemstatus} eq 'short') {
1340 $option .= $locale->text('Short') . " : ";
1341 $form->{l_onhand} = "Y";
1343 if ($form->{onorder}) {
1344 $form->{l_ordnumber} = "Y";
1345 $callback .= "&onorder=$form->{onorder}";
1346 $option .= $locale->text('On Order') . " : ";
1348 if ($form->{ordered}) {
1349 $form->{l_ordnumber} = "Y";
1350 $callback .= "&ordered=$form->{ordered}";
1351 $option .= $locale->text('Ordered') . " : ";
1354 $form->{l_quonumber} = "Y";
1355 $callback .= "&rfq=$form->{rfq}";
1356 $option .= $locale->text('RFQ') . " : ";
1358 if ($form->{quoted}) {
1359 $form->{l_quonumber} = "Y";
1360 $callback .= ""ed=$form->{quoted}";
1361 $option .= $locale->text('Quoted') . " : ";
1363 if ($form->{bought}) {
1364 $form->{l_invnumber} = "Y";
1365 $callback .= "&bought=$form->{bought}";
1366 $option .= $locale->text('Bought') . " : ";
1368 if ($form->{sold}) {
1369 $form->{l_invnumber} = "Y";
1370 $callback .= "&sold=$form->{sold}";
1371 $option .= $locale->text('Sold') . " : ";
1373 if ( $form->{bought}
1378 || $form->{quoted}) {
1380 $form->{l_lastcost} = "";
1381 $form->{l_name} = "Y";
1382 if ($form->{transdatefrom}) {
1383 $callback .= "&transdatefrom=$form->{transdatefrom}";
1385 . $locale->text('From')
1387 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1389 if ($form->{transdateto}) {
1390 $callback .= "&transdateto=$form->{transdateto}";
1392 . $locale->text('To')
1394 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1400 if ($form->{partnumber}) {
1401 $callback .= "&partnumber=$form->{partnumber}";
1402 $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
1404 if ($form->{partsgroup}) {
1405 $callback .= "&partsgroup=$form->{partsgroup}";
1406 $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
1408 if ($form->{serialnumber}) {
1409 $callback .= "&serialnumber=$form->{serialnumber}";
1411 $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
1413 if ($form->{description}) {
1414 $callback .= "&description=$form->{description}";
1415 $description = $form->{description};
1419 $locale->text('Part Description') . qq| : $form->{description}<br>|;
1421 if ($form->{make}) {
1422 $callback .= "&make=$form->{make}";
1423 $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
1425 if ($form->{model}) {
1426 $callback .= "&model=$form->{model}";
1427 $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
1429 if ($form->{drawing}) {
1430 $callback .= "&drawing=$form->{drawing}";
1431 $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
1433 if ($form->{microfiche}) {
1434 $callback .= "µfiche=$form->{microfiche}";
1435 $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
1438 # table soldtotal aktive
1439 if ($form->{l_soldtotal}) {
1440 $callback .= "&soldtotal=$form->{soldtotal}";
1441 $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1445 $form->sort_columns(
1446 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)
1449 if ($form->{l_linetotal}) {
1450 $form->{l_onhand} = "Y";
1451 $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
1452 if ($form->{l_lastcost}) {
1453 $form->{l_linetotallastcost} = "Y";
1454 if (($form->{searchitems} eq 'assembly') && !$form->{bom}) {
1455 $form->{l_linetotallastcost} = "";
1458 $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
1461 if ($form->{searchitems} eq 'service') {
1463 # remove bin, weight and rop from list
1464 map { $form->{"l_$_"} = "" } qw(bin weight rop);
1466 $form->{l_onhand} = "";
1468 # qty is irrelevant unless bought or sold
1469 if ( $form->{bought}
1474 || $form->{quoted}) {
1475 $form->{l_onhand} = "Y";
1477 $form->{l_linetotalsellprice} = "";
1478 $form->{l_linetotallastcost} = "";
1482 $form->{l_lastcost} = ""
1483 if ($form->{searchitems} eq 'assembly' && !$form->{bom});
1485 foreach $item (@columns) {
1486 if ($form->{"l_$item"} eq "Y") {
1487 push @column_index, $item;
1489 # add column to callback
1490 $callback .= "&l_$item=Y";
1494 if ($form->{l_subtotal} eq 'Y') {
1495 $callback .= "&l_subtotal=Y";
1497 $column_header{partnumber} =
1498 qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1499 . $locale->text('Part Number')
1501 $column_header{description} =
1502 qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1503 . $locale->text('Part Description')
1505 $column_header{partsgroup} =
1506 qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
1507 . $locale->text('Group')
1509 $column_header{bin} =
1510 qq|<th><a class=listheading href=$callback&sort=bin>|
1511 . $locale->text('Bin')
1513 $column_header{priceupdate} =
1514 qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
1515 . $locale->text('Updated')
1517 $column_header{onhand} =
1518 qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1519 . $locale->text('Qty')
1521 $column_header{unit} =
1522 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
1523 $column_header{listprice} =
1524 qq|<th class=listheading nowrap>|
1525 . $locale->text('List Price')
1527 $column_header{lastcost} =
1528 qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
1529 $column_header{rop} =
1530 qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
1531 $column_header{weight} =
1532 qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
1534 $column_header{invnumber} =
1535 qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
1536 . $locale->text('Invoice Number')
1538 $column_header{ordnumber} =
1539 qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
1540 . $locale->text('Order Number')
1542 $column_header{quonumber} =
1543 qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
1544 . $locale->text('Quotation')
1547 $column_header{name} =
1548 qq|<th nowrap><a class=listheading href=$callback&sort=name>|
1549 . $locale->text('Name')
1552 $column_header{sellprice} =
1553 qq|<th class=listheading nowrap>|
1554 . $locale->text('Sell Price')
1556 $column_header{linetotalsellprice} =
1557 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1558 $column_header{linetotallastcost} =
1559 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1560 $column_header{linetotallistprice} =
1561 qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
1563 $column_header{image} =
1564 qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
1565 $column_header{drawing} =
1566 qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
1567 . $locale->text('Drawing')
1569 $column_header{microfiche} =
1570 qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
1571 . $locale->text('Microfiche')
1574 $column_header{serialnumber} =
1575 qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
1576 . $locale->text('Serial Number')
1578 $column_header{soldtotal} =
1579 qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
1580 . $locale->text('soldtotal')
1584 $colspan = $#column_index + 1;
1591 <th class=listtop colspan=$colspan>$form->{title}</th>
1593 <tr height="5"></tr>
1595 <tr><td colspan=$colspan>$option</td></tr>
1597 <tr class=listheading>
1600 map { print "\n$column_header{$_}" } @column_index;
1606 # add order to callback
1607 $form->{callback} = $callback .= "&sort=$form->{sort}";
1609 # escape callback for href
1610 $callback = $form->escape($callback);
1612 if (@{ $form->{parts} }) {
1613 $sameitem = $form->{parts}->[0]->{ $form->{sort} };
1616 foreach $ref (@{ $form->{parts} }) {
1618 if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
1619 if ($sameitem ne $ref->{ $form->{sort} }) {
1621 $sameitem = $ref->{ $form->{sort} };
1625 $ref->{exchangerate} = 1 unless $ref->{exchangerate};
1626 $ref->{sellprice} *= $ref->{exchangerate};
1627 $ref->{listprice} *= $ref->{exchangerate};
1628 $ref->{lastcost} *= $ref->{exchangerate};
1630 # use this for assemblies
1631 $onhand = $ref->{onhand};
1634 if ($ref->{assemblyitem}) {
1636 $onhand = 0 if ($form->{sold});
1639 $ref->{description} =~ s/
1642 $column_data{partnumber} =
1643 "<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>";
1644 $column_data{description} = "<td>$ref->{description} </td>";
1645 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
1647 $column_data{onhand} =
1649 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
1651 $column_data{sellprice} =
1653 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
1655 $column_data{listprice} =
1657 . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
1659 $column_data{lastcost} =
1661 . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
1664 $column_data{linetotalsellprice} = "<td align=right>"
1665 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
1668 $column_data{linetotallastcost} = "<td align=right>"
1669 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
1672 $column_data{linetotallistprice} = "<td align=right>"
1673 . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
1677 if (!$ref->{assemblyitem}) {
1678 $totalsellprice += $onhand * $ref->{sellprice};
1679 $totallastcost += $onhand * $ref->{lastcost};
1680 $totallistprice += $onhand * $ref->{listprice};
1682 $subtotalonhand += $onhand;
1683 $subtotalsellprice += $onhand * $ref->{sellprice};
1684 $subtotallastcost += $onhand * $ref->{lastcost};
1685 $subtotallistprice += $onhand * $ref->{listprice};
1690 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
1691 $column_data{weight} =
1693 . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
1695 $column_data{unit} = "<td>$ref->{unit} </td>";
1696 $column_data{bin} = "<td>$ref->{bin} </td>";
1697 $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
1699 $column_data{invnumber} =
1700 ($ref->{module} ne 'oe')
1701 ? "<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>"
1702 : "<td>$ref->{invnumber}</td>";
1703 $column_data{ordnumber} =
1704 ($ref->{module} eq 'oe')
1705 ? "<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>"
1706 : "<td>$ref->{ordnumber}</td>";
1707 $column_data{quonumber} =
1708 ($ref->{module} eq 'oe' && !$ref->{ordnumber})
1709 ? "<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>"
1710 : "<td>$ref->{quonumber}</td>";
1712 $column_data{name} = "<td>$ref->{name}</td>";
1714 $column_data{image} =
1716 ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
1717 : "<td> </td>";
1718 $column_data{drawing} =
1720 ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
1721 : "<td> </td>";
1722 $column_data{microfiche} =
1723 ($ref->{microfiche})
1724 ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
1725 : "<td> </td>";
1727 $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
1729 $column_data{soldtotal} =
1731 . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ")
1736 print "<tr class=listrow$i>";
1738 map { print "\n$column_data{$_}" } @column_index;
1746 if ($form->{l_subtotal} eq 'Y') {
1750 if ($form->{"l_linetotal"}) {
1751 map { $column_data{$_} = "<td> </td>" } @column_index;
1752 $column_data{linetotalsellprice} =
1753 "<th class=listtotal align=right>"
1754 . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
1756 $column_data{linetotallastcost} =
1757 "<th class=listtotal align=right>"
1758 . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
1760 $column_data{linetotallistprice} =
1761 "<th class=listtotal align=right>"
1762 . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
1765 print "<tr class=listtotal>";
1767 map { print "\n$column_data{$_}" } @column_index;
1774 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
1783 <form method=post action=$form->{script}>
1785 <input name=callback type=hidden value="$form->{callback}">
1787 <input type=hidden name=item value=$form->{searchitems}>
1789 <input type=hidden name=path value=$form->{path}>
1790 <input type=hidden name=login value=$form->{login}>
1791 <input type=hidden name=password value=$form->{password}>|;
1794 <input class=submit type=submit name=action value="|
1795 . $locale->text('Add') . qq|">|;
1797 if ($form->{menubar}) {
1798 require "$form->{path}/menu.pl";
1809 $lxdebug->leave_sub();
1810 } #end generate_report
1812 sub parts_subtotal {
1813 $lxdebug->enter_sub();
1815 map { $column_data{$_} = "<td> </td>" } @column_index;
1816 $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
1818 $column_data{onhand} =
1819 "<th class=listsubtotal align=right>"
1820 . $form->format_amount(\%myconfig, $subtotalonhand, '', " ")
1823 $column_data{linetotalsellprice} =
1824 "<th class=listsubtotal align=right>"
1825 . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ")
1827 $column_data{linetotallistprice} =
1828 "<th class=listsubtotal align=right>"
1829 . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ")
1831 $column_data{linetotallastcost} =
1832 "<th class=listsubtotal align=right>"
1833 . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ")
1836 $subtotalonhand = 0;
1837 $subtotalsellprice = 0;
1838 $subtotallistprice = 0;
1839 $subtotallastcost = 0;
1841 print "<tr class=listsubtotal>";
1843 map { print "\n$column_data{$_}" } @column_index;
1849 $lxdebug->leave_sub();
1853 $lxdebug->enter_sub();
1855 IC->get_part(\%myconfig, \%$form);
1857 $form->{title} = $locale->text('Edit ' . ucfirst $form->{item});
1862 $lxdebug->leave_sub();
1866 $lxdebug->enter_sub();
1868 IC->create_links("IC", \%myconfig, \%$form);
1871 map { $form->{selectcurrency} .= "<option>$_\n" } split /:/,
1872 $form->{currencies};
1874 # parts and assemblies have the same links
1875 $item = $form->{item};
1876 if ($form->{item} eq 'assembly') {
1880 # build the popup menus
1881 $form->{taxaccounts} = "";
1882 foreach $key (keys %{ $form->{IC_links} }) {
1883 foreach $ref (@{ $form->{IC_links}{$key} }) {
1885 # if this is a tax field
1886 if ($key =~ /IC_tax/) {
1887 if ($key =~ /$item/) {
1888 $form->{taxaccounts} .= "$ref->{accno} ";
1889 $form->{"IC_tax_$ref->{accno}_description"} =
1890 "$ref->{accno}--$ref->{description}";
1893 if ($form->{amount}{ $ref->{accno} }) {
1894 $form->{"IC_tax_$ref->{accno}"} = "checked";
1897 $form->{"IC_tax_$ref->{accno}"} = "checked";
1902 $form->{"select$key"} .=
1903 "<option $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1904 if ($form->{amount}{$key} eq $ref->{accno}) {
1905 $form->{$key} = "$ref->{accno}--$ref->{description}";
1911 chop $form->{taxaccounts};
1913 if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
1914 $form->{selectIC_income} = $form->{selectIC_sale};
1915 $form->{selectIC_expense} = $form->{selectIC_cogs};
1916 $form->{IC_income} = $form->{IC_sale};
1917 $form->{IC_expense} = $form->{IC_cogs};
1920 delete $form->{IC_links};
1921 delete $form->{amount};
1923 $form->get_partsgroup(\%myconfig, { all => 1 });
1924 $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1925 if (@{ $form->{all_partsgroup} }) {
1926 $form->{selectpartsgroup} = qq|<option>\n|;
1928 $form->{selectpartsgroup} .=
1929 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1930 } @{ $form->{all_partsgroup} };
1933 if ($form->{item} eq 'assembly') {
1935 foreach $i (1 .. $form->{assembly_rows}) {
1936 if ($form->{"partsgroup_id_$i"}) {
1937 $form->{"partsgroup_$i"} =
1938 qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
1941 $form->get_partsgroup(\%myconfig);
1943 if (@{ $form->{all_partsgroup} }) {
1944 $form->{selectassemblypartsgroup} = qq|<option>\n|;
1947 $form->{selectassemblypartsgroup} .=
1948 qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
1949 } @{ $form->{all_partsgroup} };
1952 $lxdebug->leave_sub();
1956 $lxdebug->enter_sub();
1958 ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
1960 my $decimalplaces = ($dec > 2) ? $dec : 2;
1964 $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
1965 } qw(listprice sellprice gv);
1967 ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
1969 my $decimalplaces = ($dec > 2) ? $dec : 2;
1972 $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
1974 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
1975 qw(weight rop stock);
1977 foreach $item (qw(partnumber description unit notes)) {
1978 $form->{$item} =~ s/\"/"/g;
1981 if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
1986 qq|<textarea name=notes rows=$rows cols=40 wrap=soft>$form->{notes}</textarea>|;
1987 if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
1989 qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
1992 qq|<input name=description size=40 value="$form->{description}">|;
1995 foreach $item (split / /, $form->{taxaccounts}) {
1996 $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
2000 foreach $item (qw(IC IC_income IC_expense)) {
2001 if ($form->{$item}) {
2002 if ($form->{id} && $form->{orphaned}) {
2003 $form->{"select$item"} =~ s/ selected//;
2004 $form->{"select$item"} =~
2005 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2007 $form->{"select$item"} = qq|<option selected>$form->{$item}|;
2011 if ($form->{selectpartsgroup}) {
2012 $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2014 qq|<input type=hidden name=selectpartsgroup value="|
2015 . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
2016 $form->{selectpartsgroup} =~
2017 s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
2020 qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
2021 $group = $locale->text('Group');
2025 foreach $item (split / /, $form->{taxaccounts}) {
2027 <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
2028 <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
2032 $form->{obsolete} = "checked" if $form->{obsolete};
2036 <th align="right" nowrap="true">|
2037 . $locale->text('Last Cost')
2039 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2045 <th align=right>| . $locale->text('Inventory') . qq|</th>
2046 <td><select name=IC>$form->{selectIC}</select></td>
2047 <input name=selectIC type=hidden value="$form->{selectIC}">
2051 if ($form->{item} eq "part") {
2053 $linkaccounts .= qq|
2055 <th align=right>| . $locale->text('Revenue') . qq|</th>
2056 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2057 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2060 <th align=right>| . $locale->text('COGS') . qq|</th>
2061 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2062 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2068 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2073 <input name=weight size=10 value=$form->{weight}>
2078 <input type=hidden name=weightunit value=$form->{weightunit}>
2088 if ($form->{item} eq "assembly") {
2094 <th align=right>| . $locale->text('Revenue') . qq|</th>
2095 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2096 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2102 <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
2107 $form->{weight}
2108 <input type=hidden name=weight value=$form->{weight}>
2113 <input type=hidden name=weightunit value=$form->{weightunit}>
2123 if ($form->{item} eq "service") {
2127 <th align=right>| . $locale->text('Revenue') . qq|</th>
2128 <td><select name=IC_income>$form->{selectIC_income}</select></td>
2129 <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
2132 <th align=right>| . $locale->text('Expense') . qq|</th>
2133 <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
2134 <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
2140 if ($form->{item} ne 'service') {
2141 $n = ($form->{onhand} > 0) ? "1" : "0";
2144 <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2145 <th align=left nowrap class="plus$n"> |
2146 . $form->format_amount(\%myconfig, $form->{onhand})
2151 if ($form->{item} eq 'assembly') {
2154 <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
2155 <td><input name=stock size=10 value=$form->{stock}></td>
2162 <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
2163 <td><input name=rop size=10 value=$form->{rop}></td>
2169 <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
2170 <td><input name=bin size=10 value=$form->{bin}></td>
2175 <th align="right" nowrap="true">|
2176 . $locale->text('Verrechnungseinheit')
2178 <td><input name=ve size=10 value=$form->{ve}></td>
2181 <th align="right" nowrap="true">|
2182 . $locale->text('Geschäftsvolumen')
2184 <td><input name=gv size=10 value=$form->{gv}></td>
2192 <th align=right nowrap>| . $locale->text('Image') . qq|</th>
2193 <td><input name=image size=40 value="$form->{image}"></td>
2194 <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
2195 <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
2198 <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
2199 <td><input name=drawing size=40 value="$form->{drawing}"></td>
2211 <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
2212 <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
2216 $shopok = $form->{shop} == 1 ? "checked" : "";
2219 <th align=right nowrap>|
2220 . $locale->text('Shopartikel')
2222 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2226 # type=submit $locale->text('Add Part')
2227 # type=submit $locale->text('Add Service')
2228 # type=submit $locale->text('Add Assembly')
2230 # type=submit $locale->text('Edit Part')
2231 # type=submit $locale->text('Edit Service')
2232 # type=submit $locale->text('Edit Assembly')
2233 # use JavaScript Calendar or not
2234 $form->{jsscript} = $jscalendar;
2236 if ($form->{jsscript}) {
2238 # with JavaScript Calendar
2240 <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2241 <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2242 . $locale->text('button')
2248 Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1", "",
2252 # without JavaScript Calendar
2254 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
2257 $form->{fokus} = "ic.partnumber";
2261 <body onLoad="fokus()">
2264 <form method=post name="ic" action=$form->{script}>
2266 <input name=id type=hidden value=$form->{id}>
2267 <input name=item type=hidden value=$form->{item}>
2268 <input name=title type=hidden value="$form->{title}">
2269 <input name=makemodel type=hidden value="$form->{makemodel}">
2270 <input name=alternate type=hidden value="$form->{alternate}">
2271 <input name=onhand type=hidden value=$form->{onhand}>
2272 <input name=orphaned type=hidden value=$form->{orphaned}>
2273 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2274 <input name=rowcount type=hidden value=$form->{rowcount}>
2275 <input name=eur type=hidden value=$eur>
2277 <table width="100%">
2279 <th class=listtop>$form->{title}</th>
2281 <tr height="5"></tr>
2284 <table width="100%">
2286 <th align=left>| . $locale->text('Part Number') . qq|</th>
2287 <th align=left>| . $locale->text('Part Description') . qq|</th>
2288 <th align=left>$group</th>
2291 <td><input name=partnumber value="$form->{partnumber}" size=20></td>
2292 <td>$description</td>
2293 <td>$partsgroup</td>
2294 <input type=hidden name=oldpartsgroup value="$form->{oldpartsgroup}">
2301 <table width="100%" height="100%">
2304 <table width="100%" height="100%">
2305 <tr class="listheading">
2306 <th class="listheading" align="center" colspan=2>|
2307 . $locale->text('Link Accounts')
2312 <th align="left">| . $locale->text('Notes') . qq|</th>
2322 <table width="100%">
2324 <th align="right" nowrap="true">|
2325 . $locale->text('Updated')
2330 <th align="right" nowrap="true">| . $locale->text('List Price') . qq|</th>
2331 <td><input name=listprice size=11 value=$form->{listprice}></td>
2334 <th align="right" nowrap="true">| . $locale->text('Sell Price') . qq|</th>
2335 <td><input name=sellprice size=11 value=$form->{sellprice}></td>
2339 <th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
2340 <td><input name=unit size=5 maxlength="10" value="$form->{unit}"></td>
2357 $lxdebug->leave_sub();
2361 $lxdebug->enter_sub();
2363 if ($form->{item} eq "assembly") {
2368 <table width="100%">
2370 <th colspan=2 align=right>|
2371 . $locale->text('Total')
2374 . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2)
2380 <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
2385 <input type=hidden name=path value=$form->{path}>
2386 <input type=hidden name=login value=$form->{login}>
2387 <input type=hidden name=password value=$form->{password}>
2388 <input type=hidden name=callback value="$form->{callback}">
2389 <input type=hidden name=previousform value="$form->{previousform}">
2390 <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
2391 <input type=hidden name=vc value=$form->{vc}>
2393 <td><hr size=3 noshade></td>
2398 <input class=submit type=submit name=action value="|
2399 . $locale->text('Update') . qq|">
2402 unless ($form->{item} eq "service") {
2404 <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
2409 <input class=submit type=submit name=action value="|
2410 . $locale->text('Save') . qq|">|;
2414 if (!$form->{previousform}) {
2416 <input class=submit type=submit name=action value="|
2417 . $locale->text('Save as new') . qq|">|;
2420 if ($form->{orphaned}) {
2421 if (!$form->{previousform}) {
2422 if ($form->{item} eq 'assembly') {
2423 if (!$form->{onhand}) {
2425 <input class=submit type=submit name=action value="|
2426 . $locale->text('Delete') . qq|">|;
2430 <input class=submit type=submit name=action value="|
2431 . $locale->text('Delete') . qq|">|;
2437 if (!$form->{previousform}) {
2438 if ($form->{menubar}) {
2439 require "$form->{path}/menu.pl";
2452 $lxdebug->leave_sub();
2456 $lxdebug->enter_sub();
2459 $form->{"make_$i"} =~ s/\"/"/g;
2460 $form->{"model_$i"} =~ s/\"/"/g;
2467 <th class="listheading">| . $locale->text('Make') . qq|</th>
2468 <th class="listheading">| . $locale->text('Model') . qq|</th>
2472 for $i (1 .. $numrows) {
2475 <td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
2476 <td width=50%><input name="model_$i" size=30 value="$form->{"model_$i"}"></td>
2487 $lxdebug->leave_sub();
2491 $lxdebug->enter_sub();
2495 qw(runningnumber qty unit bom partnumber description partsgroup total);
2497 if ($form->{previousform}) {
2499 @column_index = qw(qty unit bom partnumber description partsgroup total);
2503 $form->{old_callback} = $form->{callback};
2504 $callback = $form->{callback};
2505 $form->{callback} = "$form->{script}?action=display_form";
2508 map { delete $form->{$_} } qw(action header);
2512 # save form variables in a previousform variable
2513 foreach $key (sort keys %$form) {
2516 $form->{$key} =~ s/&/%26/g;
2517 $previousform .= qq|$key=$form->{$key}&|;
2520 $previousform = $form->escape($form->escape($previousform, 1));
2521 $form->{callback} = $callback;
2523 $form->{assemblytotal} = 0;
2524 $form->{weight} = 0;
2527 $column_header{runningnumber} =
2528 qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
2529 $column_header{qty} =
2530 qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
2531 $column_header{unit} =
2532 qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
2533 $column_header{partnumber} =
2534 qq|<th align=left nowrap width=20%>|
2535 . $locale->text('Part Number')
2537 $column_header{description} =
2538 qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
2539 $column_header{total} =
2540 qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
2541 $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
2542 $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
2545 <tr class=listheading>
2546 <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
2554 map { print "\n$column_header{$_}" } @column_index;
2560 for $i (1 .. $numrows) {
2561 $form->{"partnumber_$i"} =~ s/\"/"/g;
2564 $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
2565 $form->{assemblytotal} += $linetotal;
2567 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
2569 $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
2571 if (($i >= 1) && ($i == $numrows)) {
2574 map { $column_data{$_} = qq|<td></td>| }
2575 qw(qty unit partnumber description bom partsgroup);
2578 map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
2581 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2582 $column_data{partnumber} =
2583 qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
2584 $column_data{description} =
2585 qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
2586 $column_data{partsgroup} =
2587 qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
2593 if ($form->{previousform}) {
2594 $column_data{partnumber} =
2595 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
2597 qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
2600 qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
2601 $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
2602 $column_data{bom} .= qq|</td>|;
2604 $column_data{partsgroup} =
2605 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2609 qq|$form->{script}?action=edit&id=$form->{"id_$i"}&path=$form->{path}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
2610 $column_data{partnumber} =
2611 qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
2612 $column_data{runningnumber} =
2613 qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
2615 qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
2617 $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
2619 qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
2621 $column_data{partsgroup} =
2622 qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
2625 $column_data{unit} =
2626 qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
2627 $column_data{description} =
2628 qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
2631 $column_data{total} = qq|<td align=right>$linetotal</td>|;
2636 map { print "\n$column_data{$_}" } @column_index;
2640 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2641 <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
2642 <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
2652 $lxdebug->leave_sub();
2656 $lxdebug->enter_sub();
2658 if ($form->{item} eq "assembly") {
2659 $i = $form->{assembly_rows};
2661 # if last row is empty check the form otherwise retrieve item
2662 if ( ($form->{"partnumber_$i"} eq "")
2663 && ($form->{"description_$i"} eq "")
2664 && ($form->{"partsgroup_$i"} eq "")) {
2670 IC->assembly_item(\%myconfig, \%$form);
2672 $rows = scalar @{ $form->{item_list} };
2675 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2678 $form->{makemodel_rows}--;
2682 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
2683 qw(partnumber description unit partsgroup);
2684 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
2685 keys %{ $form->{item_list}[0] };
2686 $form->{"runningnumber_$i"} = $form->{assembly_rows};
2687 $form->{assembly_rows}++;
2695 $form->{rowcount} = $i;
2696 $form->{assembly_rows}++;
2704 if ($form->{item} eq "part") {
2708 if ($form->{item} eq 'service') {
2709 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2710 qw(sellprice listprice);
2716 $lxdebug->leave_sub();
2720 $lxdebug->enter_sub();
2722 # check if there is a part number
2723 # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
2725 if ($form->{obsolete}) {
2728 "Inventory quantity must be zero before you can set this $form->{item} obsolete!"
2730 if ($form->{onhand});
2733 # expand dynamic strings
2734 # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
2735 # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
2736 # $locale->text('Part Number missing!')
2737 # $locale->text('Service Number missing!')
2738 # $locale->text('Assembly Number missing!')
2741 $rc = IC->save(\%myconfig, \%$form);
2743 $form->error($locale->text('Partnumber not unique!'));
2745 $parts_id = $form->{id};
2747 # load previous variables
2748 if ($form->{previousform}) {
2750 # save the new form variables before splitting previousform
2751 map { $newform{$_} = $form->{$_} } keys %$form;
2753 $previousform = $form->unescape($form->{previousform});
2755 # don't trample on previous variables
2756 map { delete $form->{$_} } keys %newform;
2758 # now take it apart and restore original values
2759 foreach $item (split /&/, $previousform) {
2760 ($key, $value) = split /=/, $item, 2;
2761 $value =~ s/%26/&/g;
2762 $form->{$key} = $value;
2764 $form->{taxaccounts} = $newform{taxaccount2};
2766 if ($form->{item} eq 'assembly') {
2768 # undo number formatting
2769 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2770 qw(weight listprice sellprice rop);
2772 $form->{assembly_rows}--;
2773 $i = $newform{rowcount};
2774 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2776 $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
2777 $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
2779 # change/add values for assembly item
2780 map { $form->{"${_}_$i"} = $newform{$_} }
2781 qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno);
2783 $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
2784 $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
2788 # set values for last invoice/order item
2789 $i = $form->{rowcount};
2790 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
2792 map { $form->{"${_}_$i"} = $newform{$_} }
2793 qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice);
2794 $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
2796 if ($form->{exchangerate} != 0) {
2797 $form->{"sellprice_$i"} /= $form->{exchangerate};
2800 map { $form->{"taxaccounts_$i"} .= "$_ " } split / /,
2801 $newform{taxaccount};
2802 chop $form->{"taxaccounts_$i"};
2803 foreach $item (qw(description rate taxnumber)) {
2804 $index = $form->{"taxaccounts_$i"} . "_$item";
2805 $form->{$index} = $newform{$index};
2808 # credit remaining calculation
2810 $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
2812 map { $form->{"${_}_base"} += $amount }
2813 (split / /, $form->{"taxaccounts_$i"});
2814 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
2815 split / /, $form->{"taxaccounts_$i"}
2816 if !$form->{taxincluded};
2818 $form->{creditremaining} -= $amount;
2822 $form->{"id_$i"} = $parts_id;
2823 delete $form->{action};
2825 # restore original callback
2826 $callback = $form->unescape($form->{callback});
2827 $form->{callback} = $form->unescape($form->{old_callback});
2828 delete $form->{old_callback};
2830 $form->{makemodel_rows}--;
2832 # put callback together
2833 foreach $key (keys %$form) {
2835 # do single escape for Apache 2.0
2836 $value = $form->escape($form->{$key}, 1);
2837 $callback .= qq|&$key=$value|;
2839 $form->{callback} = $callback;
2845 $lxdebug->leave_sub();
2849 $lxdebug->enter_sub();
2854 $lxdebug->leave_sub();
2858 $lxdebug->enter_sub();
2860 $rc = IC->delete(\%myconfig, \%$form);
2863 $form->redirect($locale->text('Item deleted!')) if ($rc > 0);
2864 $form->error($locale->text('Cannot delete item!'));
2866 $lxdebug->leave_sub();
2869 sub stock_assembly {
2870 $lxdebug->enter_sub();
2872 $form->{title} = $locale->text('Stock Assembly');
2879 <form method=post action=$form->{script}>
2881 <table width="100%">
2883 <th class=listtop>$form->{title}</th>
2885 <tr height="5"></tr>
2890 <th align="right" nowrap="true">|
2891 . $locale->text('Part Number')
2893 <td><input name=partnumber size=20></td>
2897 <th align="right" nowrap="true">|
2898 . $locale->text('Part Description')
2900 <td><input name=description size=40></td>
2905 <tr><td><hr size=3 noshade></td></tr>
2908 <input type=hidden name=path value=$form->{path}>
2909 <input type=hidden name=login value=$form->{login}>
2910 <input type=hidden name=password value=$form->{password}>
2912 <input type=hidden name=nextsub value=list_assemblies>
2915 <input class=submit type=submit name=action value="|
2916 . $locale->text('Continue') . qq|">
2923 $lxdebug->leave_sub();
2926 sub list_assemblies {
2927 $lxdebug->enter_sub();
2929 IC->retrieve_assemblies(\%myconfig, \%$form);
2931 $column_header{partnumber} =
2932 qq|<th class=listheading>| . $locale->text('Part Number') . qq|</th>|;
2933 $column_header{description} =
2934 qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
2935 $column_header{bin} =
2936 qq|<th class=listheading>| . $locale->text('Bin') . qq|</th>|;
2937 $column_header{onhand} =
2938 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
2939 $column_header{rop} =
2940 qq|<th class=listheading>| . $locale->text('ROP') . qq|</th>|;
2941 $column_header{stock} =
2942 qq|<th class=listheading>| . $locale->text('Add') . qq|</th>|;
2944 @column_index = (qw(partnumber description bin onhand rop stock));
2946 $form->{title} = $locale->text('Stock Assembly');
2949 "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2953 $colspan = $#column_index + 1;
2958 <form method=post action=$form->{script}>
2962 <th class=listtop colspan=$colspan>$form->{title}</th>
2965 <tr class=listheading>|;
2967 map { print "\n$column_header{$_}" } @column_index;
2974 foreach $ref (@{ $form->{assembly_items} }) {
2976 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description);
2978 $column_data{partnumber} = qq|<td width=20%>$ref->{partnumber}</td>|;
2979 $column_data{description} =
2980 qq|<td width=50%>$ref->{description} </td>|;
2981 $column_data{bin} = qq|<td>$ref->{bin} </td>|;
2982 $column_data{onhand} =
2983 qq|<td align=right>|
2984 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
2987 qq|<td align=right>|
2988 . $form->format_amount(\%myconfig, $ref->{rop}, '', " ")
2990 $column_data{stock} = qq|<td width=10%><input name="qty_$i" size=10></td>|;
2995 qq|<tr class=listrow$j><input name="id_$i" type=hidden value=$ref->{id}>\n|;
2997 map { print "\n$column_data{$_}" } @column_index;
3010 <td colspan=6><hr size=3 noshade>
3013 <input name=rowcount type=hidden value="$i">
3015 <input type=hidden name=path value=$form->{path}>
3016 <input type=hidden name=login value=$form->{login}>
3017 <input type=hidden name=password value=$form->{password}>
3019 <input name=callback type=hidden value="$form->{callback}">
3021 <input type=hidden name=nextsub value=restock_assemblies>
3024 <input class=submit type=submit name=action value="|
3025 . $locale->text('Continue') . qq|">
3033 $lxdebug->leave_sub();
3036 sub restock_assemblies {
3037 $lxdebug->enter_sub();
3039 $form->redirect($locale->text('Assemblies restocked!'))
3040 if (IC->restock_assemblies(\%myconfig, \%$form));
3041 $form->error($locale->text('Cannot stock assemblies!'));
3043 $lxdebug->leave_sub();
3046 sub continue { &{ $form->{nextsub} } }