# Inventory Control module
#
#======================================================================
-#$locale->text('ea');
use POSIX qw(strftime);
+use List::Util qw(max);
use SL::IC;
use SL::ReportGenerator;
# type=submit $locale->text('Edit Part')
# type=submit $locale->text('Edit Service')
# type=submit $locale->text('Edit Assembly')
+# $locale->text('Parts')
+# $locale->text('Services')
+# $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
+# $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
+# $locale->text('Part Number missing!')
+# $locale->text('Service Number missing!')
+# $locale->text('Assembly Number missing!')
+# $locale->text('ea');
# end of main
$auth->assert('part_service_assembly_edit');
- $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
-
- $form->{callback} =
- "$form->{script}?action=add&item=$form->{item}"
- unless $form->{callback};
-
- $form->{"unit_changeable"} = 1;
+ $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
+ $form->{callback} = "$form->{script}?action=add&item=$form->{item}" unless $form->{callback};
+ $form->{unit_changeable} = 1;
IC->get_pricegroups(\%myconfig, \%$form);
&link_part;
$auth->assert('part_service_assembly_edit');
- # switch for backward sorting
- $form->{revers} = 0;
-
- # memory for which table was sort at last time
- $form->{lastsort} = "";
-
- # counter for added entries to top100
- $form->{ndxs_counter} = 0;
+ $form->{revers} = 0; # switch for backward sorting
+ $form->{lastsort} = ""; # memory for which table was sort at last time
+ $form->{ndxs_counter} = 0; # counter for added entries to top100
- # $locale->text('Parts')
- # $locale->text('Services')
-
- my $is_service = $form->{searchitems} eq 'service';
- my $is_assembly = $form->{searchitems} eq 'assembly';
+ my %is_xyz = map { +"is_$_" => ($form->{searchitems} eq $_) } qw(part service assembly);
$form->{title} = (ucfirst $form->{searchitems}) . "s";
$form->{title} = $locale->text($form->{title});
- $form->{title} = $locale->text('Assemblies') if $is_assembly;
+ $form->{title} = $locale->text('Assemblies') if ($is_xyz{assembly});
$form->{jsscript} = 1;
$form->header;
- print $form->parse_html_template('ic/search', { is_assembly => $is_assembly,
- is_service => $is_service,
- dateformat => $myconfig{dateformat}, });
+ print $form->parse_html_template('ic/search', { %is_xyz,
+ dateformat => $myconfig{dateformat}, });
$lxdebug->leave_sub();
} #end search()
$lxdebug->leave_sub();
}
-sub choice {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- our ($j, $lastndx);
- my ($totop100);
-
- $form->{title} = $locale->text('Top 100 hinzufuegen');
-
- $form->header;
-
- push @custom_hiddens, qw(searchitems title bom titel revers lastsort sort ndxs_counter extras);
- push @custom_hiddens, qw(itemstatus l_linetotal l_partnumber l_description l_onhand l_unit l_sellprice l_linetotalsellprice);
- my @HIDDENS = (
- +{ name => 'row', value => $j },
- +{ name => 'nextsub', value => 'item_selected' },
- +{ name => 'test', value => 'item_selected' },
- +{ name => 'lastndx', value => $lastndx },
- map(+{ name => $_, value => $form->{$_} }, @custom_hiddens),
- );
-
- my ($partnumber, $description, $unit, $sellprice, $soldtotal);
- # if choice set data
-# if ($form->{ndx}) {
-# for my $i (0 .. $form->{ndxs_counter}) {
+#sub choice {
+# $lxdebug->enter_sub();
#
-# # insert data into top100
-# push @{ $form->{parts} },
-# { number => "",
-# partnumber => $form->{"totop100_partnumber_$j"},
-# description => $form->{"totop100_description_$j"},
-# unit => $form->{"totop100_unit_$j"},
-# sellprice => $form->{"totop100_sellprice_$j"},
-# soldtotal => $form->{"totop100_soldtotal_$j"},
-# };
-# } #rof
-# } #fi
-
- $totop100 = "";
-
- # set data for next page
- for my $i (1 .. $form->{ndxs_counter}) {
- $partnumber = $form->{"totop100_partnumber_$i"};
- $description = $form->{"totop100_description_$i"};
- $unit = $form->{"totop100_unit_$i"};
- $sellprice = $form->{"totop100_sellprice_$i"};
- $soldtotal = $form->{"totop100_soldtotal_$i"};
-
- push @PARTS, {
- totop100_partnumber => $form->{"totop100_partnumber_$i"},
- totop100_description => $form->{"totop100_description_$i"},
- totop100_unit => $form->{"totop100_unit_$i"},
- totop100_sellprice => $form->{"totop100_sellprice_$i"},
- totop100_soldtotal => $form->{"totop100_soldtotal_$i"},
- }
+# $auth->assert('part_service_assembly_edit');
+#
+# our ($j, $lastndx);
+# my ($totop100);
+#
+# $form->{title} = $locale->text('Top 100 hinzufuegen');
+#
+# $form->header;
+#
+# push @custom_hiddens, qw(searchitems title bom titel revers lastsort sort ndxs_counter extras);
+# push @custom_hiddens, qw(itemstatus l_linetotal l_partnumber l_description l_onhand l_unit l_sellprice l_linetotalsellprice);
+# my @HIDDENS = (
+# +{ name => 'row', value => $j },
+# +{ name => 'nextsub', value => 'item_selected' },
+# +{ name => 'test', value => 'item_selected' },
+# +{ name => 'lastndx', value => $lastndx },
+# map(+{ name => $_, value => $form->{$_} }, @custom_hiddens),
+# );
+#
+# my ($partnumber, $description, $unit, $sellprice, $soldtotal);
+# # if choice set data
+## if ($form->{ndx}) {
+## for my $i (0 .. $form->{ndxs_counter}) {
+##
+## # insert data into top100
+## push @{ $form->{parts} },
+## { number => "",
+## partnumber => $form->{"totop100_partnumber_$j"},
+## description => $form->{"totop100_description_$j"},
+## unit => $form->{"totop100_unit_$j"},
+## sellprice => $form->{"totop100_sellprice_$j"},
+## soldtotal => $form->{"totop100_soldtotal_$j"},
+## };
+## } #rof
+## } #fi
+#
+# $totop100 = "";
+#
+# # set data for next page
+# for my $i (1 .. $form->{ndxs_counter}) {
+# $partnumber = $form->{"totop100_partnumber_$i"};
+# $description = $form->{"totop100_description_$i"};
+# $unit = $form->{"totop100_unit_$i"};
+# $sellprice = $form->{"totop100_sellprice_$i"};
+# $soldtotal = $form->{"totop100_soldtotal_$i"};
+#
+# push @PARTS, {
+# totop100_partnumber => $form->{"totop100_partnumber_$i"},
+# totop100_description => $form->{"totop100_description_$i"},
+# totop100_unit => $form->{"totop100_unit_$i"},
+# totop100_sellprice => $form->{"totop100_sellprice_$i"},
+# totop100_soldtotal => $form->{"totop100_soldtotal_$i"},
+# }
+#
+## $totop100 .= qq|
+##<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
+##<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
+##<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
+##<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
+##<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
+## |;
+# } #rof
+#
+# print $form->parse_html_template('ic/choice', +{ HIDDENS => \@HIDDENS, PARTS => \@PARTS });
+#
+# $lxdebug->leave_sub();
+#} #end choice
-# $totop100 .= qq|
+#sub list {
+# $lxdebug->enter_sub();
+#
+# $auth->assert('part_service_assembly_edit');
+#
+# our ($lastndx);
+# our ($partnumber, $description, $unit, $sellprice, $soldtotal);
+#
+# my @sortorders = ("", "partnumber", "description", "all");
+# my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)];
+# IC->get_parts(\%myconfig, \%$form, $sortorder);
+#
+# $form->{title} = $locale->text('Top 100 hinzufuegen');
+#
+# $form->header;
+#
+# print qq|
+#<body>
+# <form method=post action=ic.pl>
+# <table width=100%>
+# <tr>
+# <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
+# </tr>
+# <tr height="5"></tr>
+# <tr class=listheading>
+# <th> </th>
+# <th class=listheading>| . $locale->text('Part Number') . qq|</th>
+# <th class=listheading>| . $locale->text('Part Description') . qq|</th>
+# <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
+# <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
+# <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
+# </tr>|;
+#
+# my $j = 0;
+# my $i = $form->{rows};
+#
+# for ($j = 1; $j <= $i; $j++) {
+#
+# print qq|
+# <tr class=listrow| . ($j % 2) . qq|>|;
+# if ($j == 1) {
+# print qq|
+# <td><input name=ndx class=radio type=radio value=$j checked></td>|;
+# } else {
+# print qq|
+# <td><input name=ndx class=radio type=radio value=$j></td>|;
+# }
+# print qq|
+# <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
+# <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
+# <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
+# <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
+# <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
+# </tr>
+#
+# <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
+# }
+#
+# print qq|
+#
+#</table>
+#
+#<br>
+#
+#
+#<input type=hidden name=itemstatus value="$form->{itemstatus}">
+#<input type=hidden name=l_linetotal value="$form->{l_linetotal}">
+#<input type=hidden name=l_partnumber value="$form->{l_partnumber}">
+#<input type=hidden name=l_description value="$form->{l_description}">
+#<input type=hidden name=l_onhand value="$form->{l_onhand}">
+#<input type=hidden name=l_unit value="$form->{l_unit}">
+#<input type=hidden name=l_sellprice value="$form->{l_sellprice}">
+#<input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
+#<input type=hidden name=sort value="$form->{sort}">
+#<input type=hidden name=revers value="$form->{revers}">
+#<input type=hidden name=lastsort value="$form->{lastsort}">
+#
+#<input type=hidden name=bom value="$form->{bom}">
+#<input type=hidden name=titel value="$form->{titel}">
+#<input type=hidden name=searchitems value="$form->{searchitems}">
+#
+#<input type=hidden name=row value=$j>
+#
+#<input type=hidden name=nextsub value=item_selected>
+#
+#<input name=lastndx type=hidden value=$lastndx>
+#
+#<input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
+#
+# my $totop100 = "";
+#
+# if (($form->{ndxs_counter}) > 0) {
+# for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
+#
+# $partnumber = $form->{"totop100_partnumber_$i"};
+# $description = $form->{"totop100_description_$i"};
+# $unit = $form->{"totop100_unit_$i"};
+# $sellprice = $form->{"totop100_sellprice_$i"};
+# $soldtotal = $form->{"totop100_soldtotal_$i"};
+#
+# $totop100 .= qq|
#<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
#<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
#<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
#<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
#<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
-# |;
- } #rof
-
- print $form->parse_html_template('ic/choice', +{ HIDDENS => \@HIDDENS, PARTS => \@PARTS });
-
- $lxdebug->leave_sub();
-} #end choice
-
-sub list {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- our ($lastndx);
- our ($partnumber, $description, $unit, $sellprice, $soldtotal);
-
- my @sortorders = ("", "partnumber", "description", "all");
- my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)];
- IC->get_parts(\%myconfig, \%$form, $sortorder);
-
- $form->{title} = $locale->text('Top 100 hinzufuegen');
-
- $form->header;
-
- print qq|
-<body>
- <form method=post action=ic.pl>
- <table width=100%>
- <tr>
- <th class=listtop colspan=6>| . $locale->text('choice part') . qq|</th>
- </tr>
- <tr height="5"></tr>
- <tr class=listheading>
- <th> </th>
- <th class=listheading>| . $locale->text('Part Number') . qq|</th>
- <th class=listheading>| . $locale->text('Part Description') . qq|</th>
- <th class=listheading>| . $locale->text('Unit of measure') . qq|</th>
- <th class=listheading>| . $locale->text('Sell Price') . qq|</th>
- <th class=listheading>| . $locale->text('soldtotal') . qq|</th>
- </tr>|;
-
- my $j = 0;
- my $i = $form->{rows};
-
- for ($j = 1; $j <= $i; $j++) {
-
- print qq|
- <tr class=listrow1>|;
- if ($j == 1) {
- print qq|
- <td><input name=ndx class=radio type=radio value=$j checked></td>|;
- } else {
- print qq|
- <td><input name=ndx class=radio type=radio value=$j></td>|;
- }
- print qq|
- <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td>
- <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td>
- <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td>
- <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td>
- <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td>
- </tr>
-
- <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|;
- }
-
- print qq|
-
-</table>
-
-<br>
-
-
-<input type=hidden name=itemstatus value="$form->{itemstatus}">
-<input type=hidden name=l_linetotal value="$form->{l_linetotal}">
-<input type=hidden name=l_partnumber value="$form->{l_partnumber}">
-<input type=hidden name=l_description value="$form->{l_description}">
-<input type=hidden name=l_onhand value="$form->{l_onhand}">
-<input type=hidden name=l_unit value="$form->{l_unit}">
-<input type=hidden name=l_sellprice value="$form->{l_sellprice}">
-<input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}">
-<input type=hidden name=sort value="$form->{sort}">
-<input type=hidden name=revers value="$form->{revers}">
-<input type=hidden name=lastsort value="$form->{lastsort}">
-
-<input type=hidden name=bom value="$form->{bom}">
-<input type=hidden name=titel value="$form->{titel}">
-<input type=hidden name=searchitems value="$form->{searchitems}">
-
-<input type=hidden name=row value=$j>
-
-<input type=hidden name=nextsub value=item_selected>
-
-<input name=lastndx type=hidden value=$lastndx>
-
-<input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
-
- my $totop100 = "";
-
- if (($form->{ndxs_counter}) > 0) {
- for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
-
- $partnumber = $form->{"totop100_partnumber_$i"};
- $description = $form->{"totop100_description_$i"};
- $unit = $form->{"totop100_unit_$i"};
- $sellprice = $form->{"totop100_sellprice_$i"};
- $soldtotal = $form->{"totop100_soldtotal_$i"};
-
- $totop100 .= qq|
-<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
-<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}>
-<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}>
-<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}>
-<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}>
- |;
- } #rof
- } #fi
-
- print $totop100;
-
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('TOP100') . qq|">
-
-</form>
-</body>
-</html>
-|;
- $lxdebug->leave_sub();
-} #end list()
+# |;
+# } #rof
+# } #fi
+#
+# print $totop100;
+#
+# print qq|
+#<input class=submit type=submit name=action value="|
+# . $locale->text('TOP100') . qq|">
+#
+#</form>
+#</body>
+#</html>
+#|;
+# $lxdebug->leave_sub();
+#} #end list()
sub top100 {
$lxdebug->enter_sub();
$form->{top100} = "top100";
$form->{l_soldtotal} = "Y";
-# $form->{soldtotal} = "soldtotal";
+ $form->{soldtotal} = "soldtotal";
$form->{sort} = "soldtotal";
$form->{l_qty} = "N";
$form->{l_linetotal} = "";
} #rof
} #fi
# build data for columns
+ my $i = 0;
foreach my $ref (@{ $form->{parts} }) {
- my $i = 0;
if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
if ($sameitem ne $ref->{ $form->{sort} }) {
print $totop100;
print qq|
- <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
+<!-- <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">-->
<input class=submit type=submit name=action value="|
. $locale->text('choice') . qq|">
my ($revers, $lastsort, $description);
$form->{title} = (ucfirst $form->{searchitems}) . "s";
+ $form->{title} =~ s/ys$/ies/;
$form->{title} = $locale->text($form->{title});
my $revers = $form->{revers};
$form->{eur} = $eur; # config dumps into namespace - yuck
$form->{pg_keys} = sub { "$_[0]->{partsgroup}--$_[0]->{id}" };
$form->{description_area} = ($form->{rows} = $form->numtextrows($form->{description}, 40)) > 1;
+ $form->{notes_rows} = max 4, $form->numtextrows($form->{notes}, 40), $form->numtextrows($form->{formel}, 40);
map { $form->{"is_$_"} = ($form->{item} eq $_) } qw(part service assembly);
map { $form->{$_} =~ s/"/"/g; } qw(unit);
- $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
-
- $rows = 4 if $rows = $form->numtextrows($form->{notes}, 40) < 2;
- $form->{notes_rows} = $rows;
+ $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS',
+ 'partsgroup' => 'all_partsgroup');
IC->retrieve_buchungsgruppen(\%myconfig, $form);
@{ $form->{BUCHUNGSGRUPPEN} } = grep { $_->{id} eq $form->{buchungsgruppen_id} || ($form->{id} && $form->{orphaned}) || !$form->{id} } @{ $form->{BUCHUNGSGRUPPEN} };
# use JavaScript Calendar or not (yes!)
$form->{jsscript} = 1;
- $units = AM->retrieve_units(\%myconfig, $form, $form->{"item"} eq "service" ? "service" : "dimension");
+ $units = AM->retrieve_units(\%myconfig, $form);
$form->{ALL_UNITS} = [ map +{ name => $_ }, sort { $units->{$a}{sortkey} <=> $units->{$b}{sortkey} } keys %$units ];
$form->{fokus} = "ic.partnumber";
$auth->assert('part_service_assembly_edit');
- if ($form->{item} eq "assembly") {
-
- print qq|
- <tr>
- <td>
- <table width="100%">
- <tr>
- <th colspan=2 align=right>| . $locale->text('Total') . qq| </th>
- <th align=right>| . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
- </tr>
- </table>
- </td>
- </tr>
- <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
-|;
- }
-
- print qq|
- <input type=hidden name=callback value="$form->{callback}">
- <input type=hidden name=previousform value="$form->{previousform}">
- <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
- <input type=hidden name=vc value=$form->{vc}>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- |;
-
- unless ($form->{item} eq "service") {
- print qq|
- <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
- |;
- }
-
- print qq|
- <input type=hidden name=price_rows value=$form->{price_rows}>|;
-
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Save') . qq|">|;
-
- if ($form->{id}) {
-
- if (!$form->{previousform}) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Save as new') . qq|">|;
- }
-
- if ($form->{orphaned}) {
- if (!$form->{previousform}) {
- if ($form->{item} eq 'assembly') {
- if (!$form->{onhand}) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">|;
- }
- } else {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">|;
- }
- }
- }
- }
-
- if (!$form->{previousform}) {
- if ($form->{menubar}) {
- require "bin/mozilla/menu.pl";
- &menubar;
- }
- }
-# button for saving history
- if($form->{id} ne "") {
- print qq|
- <input type=button class=submit onclick=set_history_window(|
- . $form->{id}
- . qq|); name=history id=history value=|
- . $locale->text('history')
- . qq|>|;
- }
-# /button for saving history
- print qq|
-
-</form>
-
-<script type="text/javascript" src="js/wz_tooltip.js"></script>
-
-</body>
-</html>
-|;
+ print $form->parse_html_template('ic/form_footer');
$lxdebug->leave_sub();
}
$lxdebug->enter_sub();
my ($numrows) = @_;
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th class="listheading">| . $locale->text('Make') . qq|</th>
- <th class="listheading">| . $locale->text('Model') . qq|</th>
- </tr>
-|;
-
- for my $i (1 .. $numrows) {
- $form->{"make_$i"} =~ s/\"/"/g;
- $form->{"model_$i"} =~ s/\"/"/g;
- print qq|
- <tr>
- <td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
- <td width=50%><input name="model_$i" size=30 value="$form->{"model_$i"}"></td>
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
-|;
+ my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows;
+ print $form->parse_html_template('ic/makemodel', { MM_DATA => [ @mm_data, {} ], mm_rows => scalar @mm_data + 1 });
$lxdebug->leave_sub();
}
$form->error($locale->text('Description must not be empty!')) unless $form->{description};
$form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber};
- # expand dynamic strings
- # $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
- # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
- # $locale->text('Part Number missing!')
- # $locale->text('Service Number missing!')
- # $locale->text('Assembly Number missing!')
-
# save part
$lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n");
if (IC->save(\%myconfig, \%$form) == 3) {
map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id);
+ $form->{"longdescription_$i"} = $newform{notes};
+
$form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
if ($form->{exchangerate} != 0) {
my ($numrows) = @_;
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
- <th class="listheading">| . $locale->text('Preis') . qq|</th>
- </tr>
-|;
- for my $i (1 .. $numrows) {
- print qq|
- <tr>
- <td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
- <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
- <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
- </tr>
-|;
- }
+ my @PRICES = map +{
+ pricegroup => $form->{"pricegroup_$_"},
+ pricegroup_id => $form->{"pricegroup_id_$_"},
+ price => $form->{"price_$_"},
+ }, 1 .. $numrows;
- print qq|
- </table>
- </td>
- </tr>
-|;
+ print $form->parse_html_template('ic/price_row', { PRICES => \@PRICES });
$lxdebug->leave_sub();
}