- if ($form->{amount}{$key} eq $ref->{accno}) {
- $form->{$key} = "$ref->{accno}--$ref->{description}";
- }
-
- }
- }
- }
- 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 $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 $dec = '';
-
- #decimalplaces for listprice
- ($dec) = ($form->{listprice} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec > 2) ? $dec : 2;
- $form->{listprice} =
- $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces);
-
- #decimalplaces for sellprice and gv
- ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec > 2) ? $dec : 2;
-
- map {
- $form->{$_} =
- $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
- } qw(sellprice gv);
-
- ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec > 2) ? $dec : 2;
-
- $form->{lastcost} =
- $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
-
- map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
- qw(weight rop stock);
-
- foreach $item (qw(partnumber description unit notes)) {
- $form->{$item} =~ s/\"/"/g;
- }
-
- if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) {
- $rows = 2;
- }
-
- $notes =
- qq|<textarea name=notes rows=$rows cols=40 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}">|;
- }
-
- foreach $item (split / /, $form->{taxaccounts}) {
- $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
- }
-
- # set option
- foreach $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 $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('COGS') . 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>
- <th>
-
- $form->{weightunit}
- <input type=hidden name=weightunit value=$form->{weightunit}>
- </th>
- </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>
- <th>
-
- $form->{weightunit}
- <input type=hidden name=weightunit value=$form->{weightunit}>
- </th>
- </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>
-|;
-
- }
-
- 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('Geschäftsvolumen') . qq|</th>
- <td><input name=gv size=10 value=$form->{gv}></td>
- </tr>
-|;
- $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>
-|;