- $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;
- }
-
- $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;
-
- 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 class="listheading">
- <th class="listheading" align="center" colspan=2>|
- . $locale->text('') . qq|</th>
- </tr>
- <td colspan=2>
- <table>
- $buchungsgruppe
- $linkaccounts
- </table>
- </td>
- <tr>
- <th align="left">| . $locale->text('Notes') . qq|</th>
- <th align="left">| . $locale->text('Formula') . qq|</th>
- </tr>
- <tr>
- <td>
- $notes
- </td>
- <td>
- $formel
- </td>
- </tr>
- <tr>
- <td colspan=2>
- <button type="button" onclick="parts_language_selection_window('language_values')">| . $locale->text('Set Language Values') . qq|</button>
- </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
- <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