1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #############################################################################
7 # Veraendert 2005-01-05 - Marco Welter <mawe@linux-studio.de> - Neue Optik #
8 #############################################################################
9 # SQL-Ledger, Accounting
10 # Copyright (c) 1998-2002
12 # Author: Dieter Simader
13 # Email: dsimader@sql-ledger.org
14 # Web: http://www.sql-ledger.org
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #######################################################################
32 # common routines used in is, ir but not in oe
34 #######################################################################
38 use List::Util qw(max);
44 require "bin/mozilla/common.pl";
46 # any custom scripts for this one
47 if (-f "bin/mozilla/custom_invoice_io.pl") {
48 eval { require "bin/mozilla/custom_ivvoice_io.pl"; };
50 if (-f "bin/mozilla/$form->{login}_invoice_io.pl") {
51 eval { require "bin/mozilla/$form->{login}_invoice_io.pl"; };
58 # this is for our long dates
59 # $locale->text('January')
60 # $locale->text('February')
61 # $locale->text('March')
62 # $locale->text('April')
63 # $locale->text('May ')
64 # $locale->text('June')
65 # $locale->text('July')
66 # $locale->text('August')
67 # $locale->text('September')
68 # $locale->text('October')
69 # $locale->text('November')
70 # $locale->text('December')
72 # this is for our short month
73 # $locale->text('Jan')
74 # $locale->text('Feb')
75 # $locale->text('Mar')
76 # $locale->text('Apr')
77 # $locale->text('May')
78 # $locale->text('Jun')
79 # $locale->text('Jul')
80 # $locale->text('Aug')
81 # $locale->text('Sep')
82 # $locale->text('Oct')
83 # $locale->text('Nov')
84 # $locale->text('Dec')
89 ########################################
90 # Eintrag fuer Version 2.2.0 geaendert #
91 # neue Optik im Rechnungsformular #
92 ########################################
94 $lxdebug->enter_sub();
98 (substr($form->{type}, 0, 6) eq "sales_")
99 || (($form->{type} eq "invoice") && ($form->{script} eq "is.pl"))
100 || ($form->{type} eq 'credit_note');
102 if ($lizenzen && $form->{vc} eq "customer") {
103 if ($form->{type} =~ /sales_order/) {
104 @column_index = (runningnumber, partnumber, description, ship, qty);
105 } elsif ($form->{type} =~ /sales_quotation/) {
106 @column_index = (runningnumber, partnumber, description, qty);
108 @column_index = (runningnumber, partnumber, description, qty);
111 if ( ($form->{type} =~ /purchase_order/)
112 || ($form->{type} =~ /sales_order/)) {
113 @column_index = (runningnumber, partnumber, description, ship, qty);
115 @column_index = (runningnumber, partnumber, description, qty);
118 ############## ENDE Neueintrag ##################
120 my $dimension_units = AM->retrieve_units(\%myconfig, $form, "dimension");
121 my $service_units = AM->retrieve_units(\%myconfig, $form, "service");
122 my $all_units = AM->retrieve_units(\%myconfig, $form);
124 my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} };
126 push @column_index, qw(unit);
128 #for pricegroups column
129 if ( $form->{type} =~ (/sales_quotation/)
130 or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/))
131 or (($form->{level} eq undef) and ($form->{type} =~ /invoice/))
132 or ($form->{type} =~ /sales_order/)) {
133 push @column_index, qw(sellprice_pg);
136 push @column_index, qw(sellprice);
138 if ($form->{vc} eq 'customer') {
139 push @column_index, qw(discount);
142 push @column_index, "linetotal";
144 my $colspan = $#column_index + 1;
146 $form->{invsubtotal} = 0;
147 map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts}));
149 ########################################
150 # Eintrag fuer Version 2.2.0 geaendert #
151 # neue Optik im Rechnungsformular #
152 ########################################
153 $column_data{runningnumber} =
154 qq|<th align="left" nowrap width="5" class="listheading">|
155 . $locale->text('No.')
157 $column_data{partnumber} =
158 qq|<th align="left" nowrap width="12" class="listheading">|
159 . $locale->text('Number')
161 $column_data{description} =
162 qq|<th align="left" nowrap width="30" class="listheading">|
163 . $locale->text('Part Description')
165 if ($form->{"type"} eq "purchase_order") {
167 qq|<th align="left" nowrap width="5" class="listheading">|
168 . $locale->text('Ship rcvd')
172 qq|<th align="left" nowrap width="5" class="listheading">|
173 . $locale->text('Ship')
177 qq|<th align="left" nowrap width="5" class="listheading">|
178 . $locale->text('Qty')
181 qq|<th align="left" nowrap width="5" class="listheading">|
182 . $locale->text('Unit')
184 $column_data{license} =
185 qq|<th align="left" nowrap width="10" class="listheading">|
186 . $locale->text('License')
188 $column_data{serialnr} =
189 qq|<th align="left" nowrap width="10" class="listheading">|
190 . $locale->text('Serial No.')
192 $column_data{projectnr} =
193 qq|<th align="left" nowrap width="10" class="listheading">|
194 . $locale->text('Project')
196 $column_data{sellprice} =
197 qq|<th align="left" nowrap width="15" class="listheading">|
198 . $locale->text('Price')
200 $column_data{sellprice_pg} =
201 qq|<th align="left" nowrap width="15" class="listheading">|
202 . $locale->text('Pricegroup')
204 $column_data{discount} =
205 qq|<th align="left" class="listheading">|
206 . $locale->text('Discount')
208 $column_data{linetotal} =
209 qq|<th align="left" nowrap width="10" class="listheading">|
210 . $locale->text('Extended')
213 qq|<th align="left" nowrap width="10" class="listheading">|
214 . $locale->text('Bin')
216 ############## ENDE Neueintrag ##################
218 $myconfig{"show_form_details"} = 1
219 unless (defined($myconfig{"show_form_details"}));
220 $form->{"show_details"} = $myconfig{"show_form_details"}
221 unless (defined($form->{"show_details"}));
222 $form->{"show_details"} = $form->{"show_details"} ? 1 : 0;
223 my $show_details_new = 1 - $form->{"show_details"};
224 my $show_details_checked = $form->{"show_details"} ? "checked" : "";
228 <td>| . $cgi->hidden("-name" => "show_details", "-value" => $form->{show_details}) . qq|
229 <input type="checkbox" id="cb_show_details" onclick="show_form_details($show_details_new);" $show_details_checked>
230 <label for="cb_show_details">| . $locale->text("Show details") . qq|</label><br>
232 <tr class="listheading">|;
234 map { print "\n$column_data{$_}" } @column_index;
240 $runningnumber = $locale->text('No.');
241 $deliverydate = $locale->text('Delivery Date');
242 $serialnumber = $locale->text('Serial No.');
243 $projectnumber = $locale->text('Project');
244 $partsgroup = $locale->text('Group');
245 $reqdate = $locale->text('Reqdate');
247 $delvar = 'deliverydate';
249 if ($form->{type} =~ /_order$/ || $form->{type} =~ /_quotation$/) {
250 $deliverydate = $locale->text('Required by');
254 $form->{marge_total} = 0;
255 $form->{sellprice_total} = 0;
256 $form->{lastcost_total} = 0;
257 my %projectnumber_labels = ();
258 my @projectnumber_values = ("");
259 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
260 push(@projectnumber_values, $item->{"id"});
261 $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"};
264 for $i (1 .. $numrows) {
269 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
270 } qw(qty ship discount sellprice price_new price_old) unless ($form->{simple_save});
272 if (!$form->{"unit_old_$i"}) {
273 # Neue Ware aus der Datenbank. In diesem Fall ist unit_$i die
274 # Einheit, wie sie in den Stammdaten hinterlegt wurde.
275 # Es sollte also angenommen werden, dass diese ausgewaehlt war.
276 $form->{"unit_old_$i"} = $form->{"unit_$i"};
279 # Die zuletzt ausgewaehlte mit der aktuell ausgewaehlten Einheit
280 # vergleichen und bei Unterschied den Preis entsprechend umrechnen.
281 $form->{"selected_unit_$i"} = $form->{"unit_$i"} unless ($form->{"selected_unit_$i"});
283 my $check_units = $form->{"inventory_accno_$i"} ? $dimension_units : $service_units;
284 if (!$check_units->{$form->{"selected_unit_$i"}} ||
285 ($check_units->{$form->{"selected_unit_$i"}}->{"base_unit"} ne
286 $all_units->{$form->{"unit_old_$i"}}->{"base_unit"})) {
287 # Die ausgewaehlte Einheit ist fuer diesen Artikel nicht gueltig
288 # (z.B. Dimensionseinheit war ausgewaehlt, es handelt sich aber
289 # um eine Dienstleistung). Dann keinerlei Umrechnung vornehmen.
290 $form->{"unit_old_$i"} = $form->{"selected_unit_$i"} = $form->{"unit_$i"};
292 if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) {
293 if ($form->{"unit_old_$i"} ne $form->{"selected_unit_$i"}) {
295 if (defined($all_units->{$form->{"unit_old_$i"}}->{"factor"}) &&
296 $all_units->{$form->{"unit_old_$i"}}->{"factor"}) {
297 $basefactor = $all_units->{$form->{"selected_unit_$i"}}->{"factor"} /
298 $all_units->{$form->{"unit_old_$i"}}->{"factor"};
300 $form->{"sellprice_$i"} *= $basefactor;
301 $form->{"unit_old_$i"} = $form->{"selected_unit_$i"};
305 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
306 $decimalplaces = max length($dec), 2;
308 $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1;
309 $discount = (100 - $form->{"discount_$i"} * 1) / 100;
311 $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} * $discount / $price_factor, $decimalplaces);
313 my $real_sellprice = $form->{"sellprice_$i"} * $discount / $price_factor;
316 my ($marge_font_start, $marge_font_end);
318 $form->{"lastcost_$i"} *= 1;
320 $marge_price_factor = $form->{"marge_price_factor_$i"} * 1 || 1;
322 if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
323 $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * 100 / $real_sellprice;
324 $myconfig{"marge_percent_warn"} = 15 unless (defined($myconfig{"marge_percent_warn"}));
326 if ($form->{"id_$i"} &&
327 ($form->{"marge_percent_$i"} < (1 * $myconfig{"marge_percent_warn"}))) {
328 $marge_font_start = "<font color=\"#ff0000\">";
329 $marge_font_end = "</font>";
333 $form->{"marge_percent_$i"} = 0;
336 my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
337 $form->{"marge_total_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note;
338 $form->{"marge_total"} += $form->{"marge_total_$i"};
339 $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"} / $marge_price_factor;
340 $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"};
342 map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_total marge_percent);
344 # convert " to "
345 map { $form->{"${_}_$i"} =~ s/\"/"/g }
346 qw(partnumber description unit unit_old);
348 ########################################
349 # Eintrag fuer Version 2.2.0 geaendert #
350 # neue Optik im Rechnungsformular #
351 ########################################
352 $column_data{runningnumber} =
353 qq|<td><input name="runningnumber_$i" size="5" value="$i"></td>|; # HuT
354 ############## ENDE Neueintrag ##################
356 $column_data{partnumber} =
357 qq|<td><input name="partnumber_$i" size=12 value="$form->{"partnumber_$i"}"></td>|;
359 if (($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) {
360 $column_data{description} =
361 qq|<td><textarea name="description_$i" rows="$rows" cols="30" wrap="soft">| . H($form->{"description_$i"}) . qq|</textarea><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
363 $column_data{description} =
364 qq|<td><input name="description_$i" size="30" value="| . $form->quote($form->{"description_$i"}) . qq|"><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
367 (my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/);
368 $qty_dec = length $qty_dec;
371 qq|<td align="right"><input name="qty_$i" size="5" value="|
372 . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec) .qq|">|;
373 if ($form->{"formel_$i"}) {
374 $column_data{qty} .= qq|<button type="button" onclick="calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)">| . $locale->text('*/') . qq|</button>|
375 . $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"});
377 $column_data{qty} .= qq|</td>|;
379 qq|<td align="right"><input name="ship_$i" size=5 value="|
380 . $form->format_amount(\%myconfig, $form->{"ship_$i"})
383 my $is_part = $form->{"inventory_accno_$i"};
384 my $is_assembly = $form->{"assembly_$i"};
385 my $is_assigned = $form->{"id_$i"};
386 my $this_unit = $form->{"unit_$i"};
387 if ($form->{"selected_unit_$i"} && $this_unit &&
388 $all_units->{$form->{"selected_unit_$i"}} && $all_units->{$this_unit} &&
389 ($all_units->{$form->{"selected_unit_$i"}}->{"base_unit"} eq $all_units->{$this_unit}->{"base_unit"})) {
390 $this_unit = $form->{"selected_unit_$i"};
391 } elsif (!$is_assigned ||
392 ($is_part && !$this_unit && ($all_units->{$this_unit} && ($all_units->{$this_unit}->{"base_unit"} eq $all_units->{"kg"}->{"base_unit"})))) {
396 my $price_factor_select;
397 if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) {
398 my @values = ('', map { $_->{id} } @{ $form->{ALL_PRICE_FACTORS} });
399 my %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} };
401 $price_factor_select =
402 NTI($cgi->popup_menu('-name' => "price_factor_id_$i",
403 '-default' => $form->{"price_factor_id_$i"},
404 '-values' => \@values,
405 '-labels' => \%labels,
406 '-style' => 'width:90px'))
410 $column_data{"unit"} = "<td>" .
411 $price_factor_select .
412 AM->unit_select_html($is_part || $is_assembly ? $dimension_units :
413 $is_assigned ? $service_units : $all_units,
414 "unit_$i", $this_unit,
415 $is_assigned ? $form->{"unit_$i"} : undef)
418 # build in drop down list for pricesgroups
419 if ($form->{"prices_$i"}) {
420 if ($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"}) {
421 $price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces);
423 $price_tmp = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
426 $column_data{sellprice_pg} =
427 qq|<td align="right"><select name="sellprice_pg_$i">$form->{"prices_$i"}</select></td>|;
428 $column_data{sellprice} =
429 qq|<td><input name="sellprice_$i" size="10" value="$price_tmp" onBlur=\"check_right_number_format(this)\"></td>|;
432 # for last row and report
433 # set pricegroup drop down list from report menu
434 if ($form->{"sellprice_$i"} != 0) {
436 qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|;
438 $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
440 $column_data{sellprice_pg} =
441 qq|<td align="right"><select name="sellprice_pg_$i">$prices</select></td>|;
446 $column_data{sellprice_pg} = qq|<td align="right"> </td>|;
449 $column_data{sellprice} =
450 qq|<td><input name="sellprice_$i" size="10" onBlur=\"check_right_number_format(this)\" value="|
451 . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
455 $column_data{discount} =
456 qq|<td align="right"><input name="discount_$i" size=3 value="|
457 . $form->format_amount(\%myconfig, $form->{"discount_$i"})
459 $column_data{linetotal} =
460 qq|<td align="right">|
461 . $form->format_amount(\%myconfig, $linetotal, 2)
463 $column_data{bin} = qq|<td>$form->{"bin_$i"}</td>|;
465 ########################################
466 # Eintrag fuer Version 2.2.0 geaendert #
467 # neue Optik im Rechnungsformular #
468 ########################################
469 # if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
470 # $column_data{license} = qq|<td><select name="licensenumber_$i">$form->{"lizenzen_$i"}></select></td>|;
473 # if ($form->{type} !~ /_quotation/) {
474 # $column_data{serialnr} = qq|<td><input name="serialnumber_$i" size=10 value="$form->{"serialnumber_$i"}"></td>|;
477 # $column_data{projectnr} = qq|<td><input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}"></td>|;
478 ############## ENDE Neueintrag ##################
482 <tr valign="top" class="listrow$j">|;
484 map { print "\n$column_data{$_}" } @column_index;
487 $cgi->hidden("-name" => "unit_old_$i",
488 "-value" => $form->{"selected_unit_$i"})
490 $cgi->hidden("-name" => "price_new_$i",
491 "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"}))
493 map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_}) . "\n"); }
494 ("orderitems_id_$i", "bo_$i", "pricegroup_old_$i", "price_old_$i",
495 "id_$i", "inventory_accno_$i", "bin_$i", "partsgroup_$i", "partnotes_$i",
496 "income_accno_$i", "expense_accno_$i", "listprice_$i", "assembly_$i",
497 "taxaccounts_$i", "ordnumber_$i", "transdate_$i", "cusordnumber_$i",
498 "longdescription_$i", "basefactor_$i", "marge_total_$i", "marge_percent_$i", "lastcost_$i",
499 "marge_price_factor_$i"));
501 ########################################
502 # Eintrag fuer Version 2.2.0 geaendert #
503 # neue Optik im Rechnungsformular #
504 ########################################
507 'style="display:none;"' if (!$form->{"show_details"});
511 <tr class="listrow$j" $row_style_attr>
512 <td colspan="$colspan">
514 if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
515 my $selected = $form->{"licensenumber_$i"};
517 $form->{"lizenzen_$i"} =~ s/ selected//g;
518 $form->{"lizenzen_$i"} =~
519 s/value="${selected}"\>/value="${selected}" selected\>/;
520 $lizenzen_quoted = $form->{"lizenzen_$i"};
521 $lizenzen_quoted =~ s/\"/"/g;
523 <b>Lizenz\#</b> <select name="licensenumber_$i" size="1">
524 $form->{"lizenzen_$i"}
526 <input type="hidden" name="lizenzen_$i" value="${lizenzen_quoted}">
529 if ($form->{type} !~ /_quotation/) {
531 <b>$serialnumber</b> <input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">|;
534 print qq|<b>$projectnumber</b> | .
535 NTI($cgi->popup_menu('-name' => "project_id_$i",
536 '-values' => \@projectnumber_values,
537 '-labels' => \%projectnumber_labels,
538 '-default' => $form->{"project_id_$i"}));
540 if ($form->{type} eq 'invoice' or $form->{type} =~ /order/) {
542 ($form->{type} eq 'invoice')
544 : 'reqdate'; # invoice uses a different term for the same thing.
546 <b>${$reqdate_term}</b> <input name="${reqdate_term}_$i" size="11" onBlur="check_right_date_format(this)" value="$form->{"${reqdate_term}_$i"}">
549 my $subtotalchecked = ($form->{"subtotal_$i"}) ? "checked" : "";
551 <b>|.$locale->text('Subtotal').qq|</b> <input type="checkbox" name="subtotal_$i" value="1" $subtotalchecked>
554 if ($form->{"id_$i"} && $is_sales) {
555 my $marge_price_factor;
557 $form->{"marge_price_factor_$i"} *= 1;
559 if ($form->{"marge_price_factor_$i"} && (1 != $form->{"marge_price_factor_$i"})) {
560 $marge_price_factor = '/' . $form->format_amount(\%myconfig, $form->{"marge_price_factor_$i"});
564 ${marge_font_start}<b>| . $locale->text('Ertrag') . qq|</b> $form->{"marge_total_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}|;
567 <b>| . $locale->text('LP') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq|
568 <b>| . $locale->text('EK') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) . $marge_price_factor;
576 ############## ENDE Neueintrag ##################
578 map { $form->{"${_}_base"} += $linetotal }
579 (split(/ /, $form->{"taxaccounts_$i"}));
581 $form->{invsubtotal} += $linetotal;
590 if (0 != ($form->{sellprice_total} * 1)) {
591 $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
594 $lxdebug->leave_sub();
598 $lxdebug->enter_sub();
599 my $rowcount = shift;
600 for $j (1 .. $rowcount) {
601 my $pricegroup_old = $form->{"pricegroup_old_$i"};
602 if ($form->{PRICES}{$j}) {
604 $prices = '<option value="--">' . $locale->text("none (pricegroup)") . '</option>';
606 foreach $item (@{ $form->{PRICES}{$j} }) {
608 #$price = $form->round_amount($myconfig, $item->{price}, 5);
609 #$price = $form->format_amount($myconfig, $item->{price}, 2);
610 $price = $item->{price};
611 $pricegroup_id = $item->{pricegroup_id};
612 $pricegroup = $item->{pricegroup};
614 # build drop down list for pricegroups
616 qq|<option value="$price--$pricegroup_id"$item->{selected}>$pricegroup</option>\n|;
621 # $form->{"${_}_$j"} =
622 # $form->format_amount(\%myconfig, $form->{"${_}_$j"})
623 # } qw(sellprice price_new price_old);
625 # set new selectedpricegroup_id and prices for "Preis"
626 if ($item->{selected} && ($pricegroup_id != 0)) {
627 $form->{"pricegroup_old_$j"} = $pricegroup_id;
628 $form->{"price_new_$j"} = $price;
629 $form->{"sellprice_$j"} = $price;
631 if ($pricegroup_id == 0) {
632 $form->{"price_new_$j"} = $form->{"sellprice_$j"};
635 $form->{"prices_$j"} = $prices;
638 $lxdebug->leave_sub();
642 $lxdebug->enter_sub();
646 my $new_rowcount = $form->{"rowcount"} * 1 + 1;
647 $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"};
649 $form->language_payment(\%myconfig);
651 # if we have a display_form
652 if ($form->{display_form}) {
653 call_sub($form->{"display_form"});
657 Common::webdav_folder($form) if ($webdav);
659 # if ( $form->{print_and_post}
660 # && $form->{second_run}
661 # && ($form->{action} eq "display_form")) {
662 # for (keys %$form) { $old_form->{$_} = $form->{$_} }
663 # $old_form->{rowcount}++;
665 # #$form->{rowcount}--;
666 # #$form->{rowcount}--;
668 # $form->{print_and_post} = 0;
670 # &print_form($old_form);
674 # $form->{action} = "";
675 # $form->{resubmit} = 0;
677 # if ($form->{print_and_post} && !$form->{second_run}) {
678 # $form->{second_run} = 1;
679 # $form->{action} = "display_form";
680 # $form->{rowcount}--;
681 # my $rowcount = $form->{rowcount};
683 # # get pricegroups for parts
684 # IS->get_pricegroups_for_parts(\%myconfig, \%$form);
686 # # build up html code for prices_$i
687 # set_pricegroup($rowcount);
689 # $form->{resubmit} = 1;
694 $numrows = ++$form->{rowcount};
695 $subroutine = "display_row";
697 if ($form->{item} eq 'part') {
699 #set preisgruppenanzahl
700 $numrows = $form->{price_rows};
701 $subroutine = "price_row";
703 &{$subroutine}($numrows);
705 $numrows = ++$form->{makemodel_rows};
706 $subroutine = "makemodel_row";
708 if ($form->{item} eq 'assembly') {
709 $numrows = $form->{price_rows};
710 $subroutine = "price_row";
712 &{$subroutine}($numrows);
714 $numrows = ++$form->{makemodel_rows};
715 $subroutine = "makemodel_row";
717 # create makemodel rows
718 &{$subroutine}($numrows);
720 $numrows = ++$form->{assembly_rows};
721 $subroutine = "assembly_row";
723 if ($form->{item} eq 'service') {
724 $numrows = $form->{price_rows};
725 $subroutine = "price_row";
727 &{$subroutine}($numrows);
733 &{$subroutine}($numrows) if $numrows;
737 $lxdebug->leave_sub();