- $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;
- }
-
- $payment = qq|<option value=""></option>|;
- foreach $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=50 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" : "";
- }
-
- IC->retrieve_buchungsgruppen(\%myconfig, $form);
- if (@{ $form->{BUCHUNGSGRUPPEN} }) {
- foreach $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 $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('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>
- <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>
-|;
-
- }
- $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('Geschäftsvolumen') . 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>
-|;
-
- $formel =
- 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=40 wrap=soft>$form->{formel}</textarea></layer><ilayer>|;
- $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
- $form->{jsscript} = $jscalendar;
- $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"});
- }
-
- $form->{fokus} = "ic.partnumber";
- $form->header;