-sub display_row {
- $lxdebug->enter_sub();
- my $numrows = shift;
- if ($lizenzen && $form->{vc} eq "customer") {
- if ($form->{type} =~ /sales_order/) {
- @column_index = (runningnumber, partnumber, description, ship, qty);
- } elsif ($form->{type} =~ /sales_quotation/) {
- @column_index = (runningnumber, partnumber, description, qty);
- } else {
- @column_index = (runningnumber, partnumber, description, qty);
- }
- } else {
- if ( ($form->{type} =~ /purchase_order/)
- || ($form->{type} =~ /sales_order/)) {
- @column_index = (runningnumber, partnumber, description, ship, qty);
- } else {
- @column_index = (runningnumber, partnumber, description, qty);
- }
- }
-############## ENDE Neueintrag ##################
-
- push @column_index, qw(unit);
-
- #for pricegroups column
- if ( $form->{type} =~ (/sales_quotation/)
- or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/))
- or (($form->{level} eq undef) and ($form->{type} =~ /invoice/))
- or ($form->{type} =~ /sales_order/)) {
- push @column_index, qw(sellprice_drag);
- }
-
- push @column_index, qw(sellprice);
-
- if ($form->{vc} eq 'customer') {
- push @column_index, qw(discount);
- }
-
- push @column_index, "linetotal";
-
- my $colspan = $#column_index + 1;
-
- $form->{invsubtotal} = 0;
- map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
-
-########################################
- # Eintrag fuer Version 2.2.0 geaendert #
- # neue Optik im Rechnungsformular #
-########################################
- $column_data{runningnumber} =
- qq|<th align=left nowrap width=5 class=listheading>|
- . $locale->text('No.')
- . qq|</th>|;
- $column_data{partnumber} =
- qq|<th align=left nowrap width=12 class=listheading>|
- . $locale->text('Number')
- . qq|</th>|;
- $column_data{description} =
- qq|<th align=left nowrap width=30 class=listheading>|
- . $locale->text('Part Description')
- . qq|</th>|;
- $column_data{ship} =
- qq|<th align=left nowrap width=5 class=listheading>|
- . $locale->text('Ship')
- . qq|</th>|;
- $column_data{qty} =
- qq|<th align=left nowrap width=5 class=listheading>|
- . $locale->text('Qty')
- . qq|</th>|;
- $column_data{unit} =
- qq|<th align=left nowrap width=5 class=listheading>|
- . $locale->text('Unit')
- . qq|</th>|;
- $column_data{license} =
- qq|<th align=left nowrap width=10 class=listheading>|
- . $locale->text('License')
- . qq|</th>|;
- $column_data{serialnr} =
- qq|<th align=left nowrap width=10 class=listheading>|
- . $locale->text('Serial No.')
- . qq|</th>|;
- $column_data{projectnr} =
- qq|<th align=left nowrap width=10 class=listheading>|
- . $locale->text('Project')
- . qq|</th>|;
- $column_data{sellprice} =
- qq|<th align=left nowrap width=15 class=listheading>|
- . $locale->text('Price')
- . qq|</th>|;
- $column_data{sellprice_drag} =
- qq|<th align=left nowrap width=15 class=listheading>|
- . $locale->text('Pricegroup')
- . qq|</th>|;
- $column_data{discount} =
- qq|<th align=left class=listheading>|
- . $locale->text('Discount')
- . qq|</th>|;
- $column_data{linetotal} =
- qq|<th align=left nowrap width=10 class=listheading>|
- . $locale->text('Extended')
- . qq|</th>|;
- $column_data{bin} =
- qq|<th align=left nowrap width=10 class=listheading>|
- . $locale->text('Bin')
- . qq|</th>|;
-############## ENDE Neueintrag ##################
-
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- $runningnumber = $locale->text('No.');
- $deliverydate = $locale->text('Delivery Date');
- $serialnumber = $locale->text('Serial No.');
- $projectnumber = $locale->text('Project');
- $partsgroup = $locale->text('Group');
-
- $delvar = 'deliverydate';
-
- if ($form->{type} =~ /_order$/ || $form->{type} =~ /_quotation$/) {
- $deliverydate = $locale->text('Required by');
- $delvar = 'reqdate';
- }
-
- for $i (1 .. $numrows) {
-
- # undo formatting
- map {
- $form->{"${_}_$i"} =
- $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
- } qw(qty ship discount sellprice price_new price_old);
-
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
- $dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
-
- $discount =
- $form->round_amount(
- $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100,
- $decimalplaces);
-
- $linetotal =
- $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
- $linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2);
-
- # convert " to "
- map { $form->{"${_}_$i"} =~ s/\"/"/g }
- qw(partnumber description unit);
-
-########################################
- # Eintrag fuer Version 2.2.0 geaendert #
- # neue Optik im Rechnungsformular #
-########################################
- $column_data{runningnumber} =
- qq|<td><input name="runningnumber_$i" size=5 value=$i></td>|; # HuT
-############## ENDE Neueintrag ##################
-
- $column_data{partnumber} =
- qq|<td><input name="partnumber_$i" size=12 value="$form->{"partnumber_$i"}"></td>|;
-
- if (($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) {
- $column_data{description} =
- qq|<td><textarea name="description_$i" rows=$rows cols=30 wrap=soft>$form->{"description_$i"}</textarea></td>|;
- } else {
- $column_data{description} =
- qq|<td><input name="description_$i" size=30 value="$form->{"description_$i"}"></td>|;
- }
-
- (my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/);
- $qty_dec = length $qty_dec;
-
- $column_data{qty} =
- qq|<td align=right><input name="qty_$i" size=5 value=|
- . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)
- . qq|></td>|;
- $column_data{ship} =
- qq|<td align=right><input name="ship_$i" size=5 value=|
- . $form->format_amount(\%myconfig, $form->{"ship_$i"})
- . qq|></td>|;
- $column_data{unit} =
- qq|<td><input name="unit_$i" size=5 value="$form->{"unit_$i"}"></td>|;
-
- # build in dragdrop for pricesgroups
- if ($form->{"prices_$i"}) {
- $price_tmp =
- $form->format_amount(\%myconfig, $form->{"price_new_$i"}, 2);
-
- $column_data{sellprice_drag} =
- qq|<td align=right><select name="sellprice_drag_$i">$form->{"prices_$i"}</select></td>|;
- $column_data{sellprice} =
- qq|<td><input name="sellprice_$i" size=5 value=$price_tmp></td>|;
- } else {
-
- # for last row and report
- # set pricegroup dragdrop from report menu
- if ($form->{"sellprice_$i"} != 0) {
- $prices =
- qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|;
-
- $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
-
- $column_data{sellprice_drag} =
- qq|<td align=right><select name="sellprice_drag_$i">$prices</select></td>|;
-
- } else {
-
- # for last row
- $column_data{sellprice_drag} =
- qq|<td align=right><input name="sellprice_$i" size=9 value=|
- . $form->format_amount(\%myconfig, $form->{"prices_$i"},
- $decimalplaces)
- . qq|></td>|;
- }
-
- $column_data{sellprice} =
- qq|<td><input name="sellprice_$i" size=5 value=|
- . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
- $decimalplaces)
- . qq|></td>|;
- }
- $column_data{discount} =
- qq|<td align=right><input name="discount_$i" size=3 value=|
- . $form->format_amount(\%myconfig, $form->{"discount_$i"})
- . qq|></td>|;
- $column_data{linetotal} =
- qq|<td align=right>|
- . $form->format_amount(\%myconfig, $linetotal, 2)
- . qq|</td>|;
- $column_data{bin} = qq|<td>$form->{"bin_$i"}</td>|;
-
-########################################
- # Eintrag fuer Version 2.2.0 geaendert #
- # neue Optik im Rechnungsformular #
-########################################
- # if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
- # $column_data{license} = qq|<td><select name="licensenumber_$i">$form->{"lizenzen_$i"}></select></td>|;
- # }
- #
- # if ($form->{type} !~ /_quotation/) {
- # $column_data{serialnr} = qq|<td><input name="serialnumber_$i" size=10 value="$form->{"serialnumber_$i"}"></td>|;
- # }
- #
- # $column_data{projectnr} = qq|<td><input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}"></td>|;
-############## ENDE Neueintrag ##################
-
- print qq|
- <tr valign=top>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-
-<input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
-<input type=hidden name="bo_$i" value=$form->{"bo_$i"}>
-
-<input type=hidden name="pricegroup_old_$i" value=$form->{"pricegroup_old_$i"}>
-<input type=hidden name="price_old_$i" value=$form->{"price_old_$i"}>
-<input type=hidden name="price_new_$i" value=|
- . $form->format_amount(\%myconfig, $form->{"price_new_$i"}) . qq|>
-
-<input type=hidden name="id_$i" value=$form->{"id_$i"}>
-<input type=hidden name="inventory_accno_$i" value=$form->{"inventory_accno_$i"}>
-<input type=hidden name="bin_$i" value="$form->{"bin_$i"}">
-<input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
-<input type=hidden name="partnotes_$i" value="$form->{"partnotes_$i"}">
-<input type=hidden name="income_accno_$i" value=$form->{"income_accno_$i"}>
-<input type=hidden name="expense_accno_$i" value=$form->{"expense_accno_$i"}>
-<input type=hidden name="listprice_$i" value="$form->{"listprice_$i"}">
-<input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
-<input type=hidden name="taxaccounts_$i" value="$form->{"taxaccounts_$i"}">
-<input type=hidden name="ordnumber_$i" value="$form->{"ordnumber_$i"}">
-<input type=hidden name="transdate_$i" value="$form->{"transdate_$i"}">
-<input type=hidden name="cusordnumber_$i" value="$form->{"cusordnumber_$i"}">
-
-|;
-
-########################################
- # Eintrag fuer Version 2.2.0 geaendert #
- # neue Optik im Rechnungsformular #
-########################################
- # print second row
- print qq|
- <tr>
- <td colspan=$colspan>
-|;
- if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
- my $selected = $form->{"licensenumber_$i"};
- my $lizenzen_quoted;
- $form->{"lizenzen_$i"} =~ s/ selected//g;
- $form->{"lizenzen_$i"} =~
- s/value="${selected}"\>/value="${selected}" selected\>/;
- $lizenzen_quoted = $form->{"lizenzen_$i"};
- $lizenzen_quoted =~ s/\"/"/g;
- print qq|
- <b>Lizenz\#</b> <select name="licensenumber_$i" size=1>
- $form->{"lizenzen_$i"}
- </select>
- <input type=hidden name="lizenzen_$i" value="${lizenzen_quoted}">
-|;
- }
- if ($form->{type} !~ /_quotation/) {
- print qq|
- <b>$serialnumber</b> <input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}">|;
- }
-
- print qq|
- <b>$projectnumber</b> <input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}">
- <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}">
- <input type=hidden name="project_id_$i" value="$form->{"project_id_$i"}">
- </td>
- </tr>
-
-|;
-
-############## ENDE Neueintrag ##################
-
- map { $form->{"${_}_base"} += $linetotal }
- (split / /, $form->{"taxaccounts_$i"});
-
- $form->{invsubtotal} += $linetotal;
- }
-
- print qq|
- </table>
- </td>
- </tr>
-|;
-
- $lxdebug->leave_sub();
-}