- chop $form->{taxaccounts};
-
- if (($form->{item} eq "part") || ($form->{item} eq "assembly")) {
- $form->{selectIC_income} = $form->{selectIC_sale};
- $form->{selectIC_expense} = $form->{selectIC_cogs};
- $form->{IC_income} = $form->{IC_sale};
- $form->{IC_expense} = $form->{IC_cogs};
- }
-
- delete $form->{IC_links};
- delete $form->{amount};
-
- $form->get_partsgroup(\%myconfig, { all => 1 });
-
- $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
-
- if (@{ $form->{all_partsgroup} }) {
- $form->{selectpartsgroup} = qq|<option>\n|;
- map {
- $form->{selectpartsgroup} .=
- qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
- } @{ $form->{all_partsgroup} };
- }
-
- if ($form->{item} eq 'assembly') {
-
- foreach my $i (1 .. $form->{assembly_rows}) {
- if ($form->{"partsgroup_id_$i"}) {
- $form->{"partsgroup_$i"} =
- qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
- }
- }
- $form->get_partsgroup(\%myconfig);
-
- if (@{ $form->{all_partsgroup} }) {
- $form->{selectassemblypartsgroup} = qq|<option>\n|;
-
- map {
- $form->{selectassemblypartsgroup} .=
- qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n|
- } @{ $form->{all_partsgroup} };
- }
- }
- $lxdebug->leave_sub();
-}
-
-sub form_header {
- $lxdebug->enter_sub();
-
- my ($payment, $rows, $notes, $description, $ean, $buchungsgruppe, $partsgroup, $group, $tax, $lastcost, $eur, $linkaccounts, $weight, $n, $rop, $bin, $vegv);
- my ($notdiscountableok, $notdiscountable);
- my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop);
-
- $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
-
- map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) }
- qw(sellprice listprice lastcost gv));
-
- map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
- qw(weight rop stock);
-
- foreach my $item (qw(partnumber description unit notes)) {
- $form->{$item} =~ s/\"/"/g;
- }
-
- $payment = qq|<option value=""></option>|;
- foreach my $item (@{ $form->{payment_terms} }) {
- if ($form->{payment_id} eq $item->{id}) {
- $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
- } else {
- $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
- }
- }
-
-
- if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
- $rows = 4;
- }
-
- $notes =
- qq|<textarea name=notes rows=$rows cols=45 wrap=soft>$form->{notes}</textarea>|;
- if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
- $description =
- qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
- } else {
- $description =
- qq|<input name=description size=40 value="$form->{description}">|;
- }
-
- $ean = qq|<input name=ean size=40 value="$form->{ean}">|;
-
- foreach my $item (split / /, $form->{taxaccounts}) {
- $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
- }
-
- IC->retrieve_buchungsgruppen(\%myconfig, $form);
- if (@{ $form->{BUCHUNGSGRUPPEN} }) {
- foreach my $item (@{ $form->{BUCHUNGSGRUPPEN} }) {
- if ($item->{id} == $form->{buchungsgruppen_id}) {
- $form->{selectbuchungsgruppe} .=
- "<option value=$item->{id} selected>$item->{description}\n";
- } elsif (($form->{id} && $form->{orphaned}) || (!$form->{id})) {
- $form->{selectbuchungsgruppe} .=
- "<option value=$item->{id}>$item->{description}\n";
- }
-
- }
- }
-
- $buchungsgruppe = qq|
- <tr>
- <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
- <td><select name=buchungsgruppen_id>$form->{selectbuchungsgruppe}</select></td>
- </tr>|;
-
-
- # set option
- foreach my $item (qw(IC IC_income IC_expense)) {
- if ($form->{$item}) {
- if ($form->{id} && $form->{orphaned}) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- } else {
- $form->{"select$item"} = qq|<option selected>$form->{$item}|;
- }
- }
- }
-
- if ($form->{selectpartsgroup}) {
- $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
- $partsgroup =
- qq|<input type=hidden name=selectpartsgroup value="|
- . $form->escape($form->{selectpartsgroup}, 1) . qq|">|;
- $form->{selectpartsgroup} =~
- s/(<option value="\Q$form->{partsgroup}\E")/$1 selected/;
-
- $partsgroup .=
- qq|<select name=partsgroup>$form->{selectpartsgroup}</select>|;
- $group = $locale->text('Group');
- }
-
- # tax fields
- foreach my $item (split / /, $form->{taxaccounts}) {
- $tax .= qq|
- <input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
- <br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
-|;
- }
-
- $form->{obsolete} = "checked" if $form->{obsolete};
-
- $lastcost = qq|
- <tr>
- <th align="right" nowrap="true">|
- . $locale->text('Last Cost') . qq|</th>
- <td><input name=lastcost size=11 value=$form->{lastcost}></td>
- </tr>
-|;
- if (!$eur) {
- $linkaccounts = qq|
- <tr>
- <th align=right>| . $locale->text('Inventory') . qq|</th>
- <td><select name=IC>$form->{selectIC}</select></td>
- <input name=selectIC type=hidden value="$form->{selectIC}">
- </tr>|;
- }
-
- if ($form->{item} eq "part") {
-
- $linkaccounts .= qq|
- <tr>
- <th align=right>| . $locale->text('Revenue') . qq|</th>
- <td><select name=IC_income>$form->{selectIC_income}</select></td>
- <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
- </tr>
- <tr>
- <th align=right>| . $locale->text('Expense') . qq|</th>
- <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
- <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
- </tr>
-|;
-
- $weight = qq|
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
- <td>
- <table>
- <tr>
- <td>
- <input name=weight size=10 value=$form->{weight}>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-|;
-
- }
-
- if ($form->{item} eq "assembly") {
-
- $lastcost = "";
-
- $linkaccounts = qq|
- <tr>
- <th align=right>| . $locale->text('Revenue') . qq|</th>
- <td><select name=IC_income>$form->{selectIC_income}</select></td>
- <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
- </tr>
-|;
-
- $weight = qq|
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Weight') . qq|</th>
- <td>
- <table>
- <tr>
- <td>
- $form->{weight}
- <input type=hidden name=weight value=$form->{weight}>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-|;
-
- }
-
- if ($form->{item} eq "service") {
-
- $linkaccounts = qq|
- <tr>
- <th align=right>| . $locale->text('Revenue') . qq|</th>
- <td><select name=IC_income>$form->{selectIC_income}</select></td>
- <input name=selectIC_income type=hidden value="$form->{selectIC_income}">
- </tr>
- <tr>
- <th align=right>| . $locale->text('Expense') . qq|</th>
- <td><select name=IC_expense>$form->{selectIC_expense}</select></td>
- <input name=selectIC_expense type=hidden value="$form->{selectIC_expense}">
- </tr>
-|;
-
- }
- $linkaccounts = qq|<input type=hidden name=IC_income value="$form->{IC_income_default}">|;
-
- if ($form->{IC_cogs_default}) {
- $form->{IC_expense_default} = $form->{IC_cogs_default};
- }
-
- if (($form->{item} eq "service") || ($form->{item} eq "part")) {
- $linkaccounts .= qq|<input type=hidden name=IC_expense value="$form->{IC_expense_default}">|;
- }
- if ($form->{item} eq "part") {
- $linkaccounts .= qq|<input type=hidden name=IC value="$form->{IC_default}">|;
- }
-
- if ($form->{item} ne 'service') {
- $n = ($form->{onhand} > 0) ? "1" : "0";
- $rop = qq|
- <tr>
- <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
- <th align=left nowrap class="plus$n"> |
- . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
- </tr>
-|;
-
- if ($form->{item} eq 'assembly') {
- $rop .= qq|
- <tr>
- <th align="right" nowrap>| . $locale->text('Stock') . qq|</th>
- <td><input name=stock size=10 value=$form->{stock}></td>
- </tr>
-|;
- }
-
- $rop .= qq|
- <tr>
- <th align="right" nowrap="true">| . $locale->text('ROP') . qq|</th>
- <td><input name=rop size=10 value=$form->{rop}></td>
- </tr>
-|;
-
- $bin = qq|
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Bin') . qq|</th>
- <td><input name=bin size=10 value=$form->{bin}></td>
- </tr>
-|;
- $vegv = qq|
- <tr>
- <th align="right" nowrap="true">|
- . $locale->text('Verrechnungseinheit') . qq|</th>
- <td><input name=ve size=10 value=$form->{ve}></td>
- </tr>
- <tr>
- <th align="right" nowrap="true">|
- . $locale->text('Business Volume') . qq|</th>
- <td><input name=gv size=10 value=$form->{gv}></td>
- </tr>
-|;
- $notdiscountableok = ($form->{not_discountable}) == 1 ? "checked" : "";
- $notdiscountable .= qq|
- <tr>
- <th align=right nowrap>|
- . $locale->text('Not Discountable') . qq|</th>
- <td><input class=checkbox type=checkbox name=not_discountable value=1 $notdiscountableok></td>
- </tr>
-|;
-
- $formula =
- qq|<ilayer><layer onmouseover="this.T_STICKY=true;this.T_STATIC=true;return escape('| . $locale->text('The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>') . qq|')"><textarea name=formel rows=4 cols=30 wrap=soft>$form->{formel}</textarea></layer><ilayer>|;
-
- $formula_label = $locale->text('Formula');
-
- $imagelinks = qq|
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th align=right nowrap>| . $locale->text('Image') . qq|</th>
- <td><input name=image size=40 value="$form->{image}"></td>
- <th align=right nowrap>| . $locale->text('Microfiche') . qq|</th>
- <td><input name=microfiche size=20 value="$form->{microfiche}"></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Drawing') . qq|</th>
- <td><input name=drawing size=40 value="$form->{drawing}"></td>
- </tr>
- </table>
- </td>
- </tr>
-|;
-
- }
-
- if ($form->{id}) {
- $obsolete = qq|
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Obsolete') . qq|</th>
- <td><input name=obsolete type=checkbox class=checkbox value=1 $form->{obsolete}></td>
- </tr>
-|;
- }
- $shopok = $form->{shop} == 1 ? "checked" : "";
- $shop .= qq|
- <tr>
- <th align=right nowrap>|
- . $locale->text('Shopartikel') . qq|</th>
- <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
- </tr>
-|;
-
-
- # type=submit $locale->text('Add Part')
- # type=submit $locale->text('Add Service')
- # type=submit $locale->text('Add Assembly')
-
- # type=submit $locale->text('Edit Part')
- # type=submit $locale->text('Edit Service')
- # type=submit $locale->text('Edit Assembly')
- # use JavaScript Calendar or not
- my ($jsscript, $button1);
- $form->{jsscript} = 1;
- $jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td width="13"><input name=priceupdate id=priceupdate size=11 title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
- <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1");
- } else {
-
- # without JavaScript Calendar
- $button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
- }
-
- my $unit_select = '<input type="hidden" name="unit_changeable" value="' . $form->{"unit_changeable"} . '">';
- if (!$form->{"unit_changeable"}) {
- $unit_select .= '<input type="hidden" name="unit" value="' . $form->{"unit"} . '">' . $form->{"unit"};
- } else {
- my $units = AM->retrieve_units(\%myconfig, $form, $form->{"item"} eq "service" ? "service" : "dimension");
- $unit_select .= AM->unit_select_html($units, "unit", $form->{"unit"});
- }
-
- my $price_factor;
- if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) {
- my @values = ('', map { $_->{id} } @{ $form->{ALL_PRICE_FACTORS} });
- my %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} };
-
- $price_factor =
- qq|<tr><th align="right">|
- . $locale->text('Price Factor')
- . qq|</th><td>|
- . NTI($cgi->popup_menu('-name' => 'price_factor_id',
- '-default' => $form->{price_factor_id},
- '-values' => \@values,
- '-labels' => \%labels))
- . qq|</td></tr>|;
- }
-
- $form->{fokus} = "ic.partnumber";
- $form->header;
-
- print qq|
- <body onLoad="fokus()">
- <script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript" src="js/parts_language_selection.js"></script>
-
-<form method=post name="ic" action=$form->{script}>
-
-<input name=id type=hidden value=$form->{id}>
-<input name=item type=hidden value=$form->{item}>
-<input name=title type=hidden value="$form->{title}">
-<input name=makemodel type=hidden value="$form->{makemodel}">
-<input name=alternate type=hidden value="$form->{alternate}">
-<input name=onhand type=hidden value=$form->{onhand}>
-<input name=orphaned type=hidden value=$form->{orphaned}>
-<input name=taxaccounts type=hidden value="$form->{taxaccounts}">
-<input name=rowcount type=hidden value=$form->{rowcount}>
-<input name=eur type=hidden value=$eur>
-<input name=language_values type=hidden value="$form->{language_values}">
-<input name="original_partnumber" type="hidden" value="| . $form->quote($form->{"original_partnumber"}) . qq|">
-
-<table width="100%">
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width="100%">
- <tr valign=top>
- <th align=left>| . $locale->text('Part Number') . qq|</th>
- <th align=left>| . $locale->text('Part Description') . qq|</th>
- <th align=left>$group</th>
- </tr>
- <tr valign=top>
- <td><input name=partnumber value="$form->{partnumber}" size=20></td>
- <td>$description</td>
- <td>$partsgroup</td>
- <input type=hidden name=oldpartsgroup value="$form->{oldpartsgroup}">
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table width="100%" height="100%">
- <tr valign=top>
- <td width=70%>
- <table width="100%" height="100%">
- <tr>
- <td colspan=2>
- <table>
- $buchungsgruppe
- $linkaccounts
- </table>
- </td>
- </tr>
- <tr>
- <th align="left">| . $locale->text('Notes') . qq|</th>
- <th align="left">$formula_label</th>
- </tr>
- <tr>
- <td>
- $notes
- </td>
- <td>
- $formula
- </td>
- </tr>
- <tr>
- <th align="left"></th>
- <th align="left">| . $locale->text('EAN-Code') . qq|</th>
- </tr>
- <tr>
- <td>
- <button type="button" onclick="parts_language_selection_window('language_values')">| . $locale->text('Set Language Values') . qq|</button>
- </td>
- <td>
- $ean
- </td>
- </tr>
- <tr>
- <td colspan=2>
- <table>
- <tr>
- <th align=right>| . $locale->text('Payment Terms') . qq|</th>
- <td><select name=payment_id>$payment</select></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- <td width="30%">
- <table width="100%">
- <tr>
- <th align="right" nowrap="true">|
- . $locale->text('Updated') . qq|</th>
- $button1
- </tr>
- <tr>
- <th align="right" nowrap="true">| . $locale->text('List Price') . qq|</th>
- <td><input name=listprice size=11 value=$form->{listprice}></td>
- </tr>
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Sell Price') . qq|</th>
- <td><input name=sellprice size=11 value=$form->{sellprice}></td>
- </tr>
- $lastcost
- $price_factor
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
- <td>$unit_select</td>
- </tr>
- $weight
- $rop
- $bin
- $notdiscountable
- $vegv
- $shop
- $obsolete
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- $imagelinks
-
-$jsscript
-|;
- $lxdebug->leave_sub();
-}
-
-sub form_footer {
- $lxdebug->enter_sub();
-
- 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=login value=$form->{login}>
- <input type=hidden name=password value=$form->{password}>
- <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>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub makemodel_row {
- $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>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub assembly_row {
- $lxdebug->enter_sub();
- my ($numrows) = @_;
- my (@column_index, %column_data, %column_header);
- my ($nochange, $callback, $previousform, $linetotal, $href);
-
- our ($deliverydate); # ToDO: cjeck if this indeed comes from global context
-
- @column_index =
- qw(runningnumber qty unit bom partnumber description partsgroup total);
-
- if ($form->{previousform}) {
- $nochange = 1;
- @column_index = qw(qty unit bom partnumber description partsgroup total);
- } else {
-
- # change callback
- $form->{old_callback} = $form->{callback};
- $callback = $form->{callback};
- $form->{callback} = "$form->{script}?action=display_form";
-
- # delete action
- map { delete $form->{$_} } qw(action header);
-
- $previousform = "";
-
- # save form variables in a previousform variable
- foreach my $key (sort keys %$form) {
-
- # escape ampersands
- $form->{$key} =~ s/&/%26/g;
- $previousform .= qq|$key=$form->{$key}&|;
- }
- chop $previousform;
- $previousform = $form->escape($form->escape($previousform, 1));
- $form->{callback} = $callback;
-
- $form->{assemblytotal} = 0;
- $form->{weight} = 0;
-
- }
- $column_header{runningnumber} =
- qq|<th nowrap width=5%>| . $locale->text('No.') . qq|</th>|;
- $column_header{qty} =
- qq|<th align=left nowrap width=10%>| . $locale->text('Qty') . qq|</th>|;
- $column_header{unit} =
- qq|<th align=left nowrap width=5%>| . $locale->text('Unit') . qq|</th>|;
- $column_header{partnumber} =
- qq|<th align=left nowrap width=20%>|
- . $locale->text('Part Number')
- . qq|</th>|;
- $column_header{description} =
- qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
- $column_header{total} =
- qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
- $column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
- $column_header{partsgroup} = qq|<th>| . $locale->text('Group') . qq|</th>|;
-
- print qq|
- <tr class=listheading>
- <th class=listheading>| . $locale->text('Individual Items') . qq|</th>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr>
-|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- for my $i (1 .. $numrows) {
- $form->{"partnumber_$i"} =~ s/\"/"/g;
-
- $linetotal =
- $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
- $form->{assemblytotal} += $linetotal;
-
- $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
-
- $linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
-
- if (($i >= 1) && ($i == $numrows)) {
-
- if ($nochange) {
- map { $column_data{$_} = qq|<td></td>| }
- qw(qty unit partnumber description bom partsgroup);
- } else {
-
- map { $column_data{$_} = qq|<td></td>| } qw(runningnumber unit bom);
-
- $column_data{qty} =
- qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
- $column_data{partnumber} =
- qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}"></td>|;
- $column_data{description} =
- qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
- $column_data{partsgroup} =
- qq|<td><input name="partsgroup_$i" size=10 value="$form->{"partsgroup_$i"}"></td>|;
-
- }
-
- } else {
-
- if ($form->{previousform}) {
- $column_data{partnumber} =
- qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}">$form->{"partnumber_$i"}</td>|;
- $column_data{qty} =
- qq|<td align=right><input type=hidden name="qty_$i" value="$form->{"qty_$i"}">$form->{"qty_$i"}</td>|;
-
- $column_data{bom} =
- qq|<td align=center><input type=hidden name="bom_$i" value=$form->{"bom_$i"}>|;
- $column_data{bom} .= ($form->{"bom_$i"}) ? "x" : " ";
- $column_data{bom} .= qq|</td>|;
-
- $column_data{partsgroup} =
- qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
-
- } else {
- $href =
- qq|$form->{script}?action=edit&id=$form->{"id_$i"}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
- $column_data{partnumber} =
- qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
- $column_data{runningnumber} =
- qq|<td><input name="runningnumber_$i" size=3 value="$i"></td>|;
- $column_data{qty} =
- qq|<td><input name="qty_$i" size=5 value="$form->{"qty_$i"}"></td>|;
-
- $form->{"bom_$i"} = ($form->{"bom_$i"}) ? "checked" : "";
- $column_data{bom} =
- qq|<td align=center><input name="bom_$i" type=checkbox class=checkbox value=1 $form->{"bom_$i"}></td>|;
-
- $column_data{partsgroup} =
- qq|<td><input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">$form->{"partsgroup_$i"}</td>|;
- }
-
- $column_data{unit} =
- qq|<td><input type=hidden name="unit_$i" value="$form->{"unit_$i"}">$form->{"unit_$i"}</td>|;
- $column_data{description} =
- qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
- }
-
- $column_data{total} = qq|<td align=right>$linetotal</td>|;
-
- $column_data{deliverydate} = qq|<td align=right>$deliverydate</td>|;
-
- print qq|
- <tr>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
- <input type=hidden name="id_$i" value=$form->{"id_$i"}>
- <input type=hidden name="sellprice_$i" value=$form->{"sellprice_$i"}>
- <input type=hidden name="weight_$i" value=$form->{"weight_$i"}>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub update {
- $lxdebug->enter_sub();
-
- if ($form->{item} eq "assembly") {
- my $i = $form->{assembly_rows};
-
- # if last row is empty check the form otherwise retrieve item
- if ( ($form->{"partnumber_$i"} eq "")
- && ($form->{"description_$i"} eq "")
- && ($form->{"partsgroup_$i"} eq "")) {
-
- &check_form;
-
- } else {
-
- IC->assembly_item(\%myconfig, \%$form);
-
- my $rows = scalar @{ $form->{item_list} };
-
- if ($rows) {
- $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
-
- if ($rows > 1) {
- $form->{makemodel_rows}--;
- &select_item;
- exit;
- } else {
- map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
- qw(partnumber description unit partsgroup);
- map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
- keys %{ $form->{item_list}[0] };
- $form->{"runningnumber_$i"} = $form->{assembly_rows};
- $form->{assembly_rows}++;
-
- &check_form;
-
- }
-
- } else {
-
- $form->{rowcount} = $i;
- $form->{assembly_rows}++;
-
- &new_item;
-
- }
- }
-
- } elsif (($form->{item} eq 'part') || ($form->{item} eq 'service')) {
- &check_form;
- }
-
- $lxdebug->leave_sub();