- 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')