Revision ef92528c
Von G. Richardson vor fast 14 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
1997 | 1997 |
my ($price, $selectedpricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"}); |
1998 | 1998 |
|
1999 | 1999 |
my $pricegroup_old = $form->{"pricegroup_old_$i"}; |
2000 |
|
|
2001 |
# sellprice has format 13,0000 or 0,00000, can't check for 0 numerically |
|
2002 |
my $sellprice = $form->{"sellprice_$i"}; |
|
2003 |
my $pricegroup_id = $form->{"pricegroup_id_$i"}; |
|
2000 | 2004 |
$form->{"new_pricegroup_$i"} = $selectedpricegroup_id; |
2001 | 2005 |
$form->{"old_pricegroup_$i"} = $pricegroup_old; |
2002 | 2006 |
|
... | ... | |
2075 | 2079 |
$pkr->{price} = $form->format_amount($myconfig, $pkr->{price}, 5); |
2076 | 2080 |
|
2077 | 2081 |
if ($selectedpricegroup_id eq undef) { |
2078 |
if ($pkr->{pricegroup_id} eq $form->{customer_klass}) { |
|
2079 |
|
|
2082 |
# new entries in article list, either old invoice was loaded (edit) or a new article was added |
|
2083 |
# Case A: open old invoice, no pricegroup selected |
|
2084 |
# Case B: add new article to invoice, no pricegroup selected |
|
2085 |
|
|
2086 |
# to distinguish case A and B the variable pricegroup_id_$i is used |
|
2087 |
# for new articles this variable isn't defined, for loaded articles it is |
|
2088 |
# sellprice can't be used, as it already has 0,00 set |
|
2089 |
|
|
2090 |
if ($pkr->{pricegroup_id} eq $form->{"pricegroup_id_$i"} and defined $form->{"pricegroup_id_$i"}) { |
|
2091 |
# Case A |
|
2080 | 2092 |
$pkr->{selected} = ' selected'; |
2081 | 2093 |
|
2094 |
} elsif ($pkr->{pricegroup_id} eq $form->{customer_klass} |
|
2095 |
and not defined $form->{"pricegroup_id_$i"} |
|
2096 |
and $pkr->{price} != 0 # only use customer pricegroup price if it has a value, else use default_sellprice |
|
2097 |
# for the case where pricegroup prices haven't been set |
|
2098 |
) { |
|
2099 |
# Case B: use default pricegroup of customer |
|
2100 |
|
|
2101 |
$pkr->{selected} = ' selected'; # unless $form->{selected}; |
|
2102 |
|
|
2082 | 2103 |
# no customer pricesgroup set |
2083 | 2104 |
if ($pkr->{price} == $pkr->{default_sellprice}) { |
2084 | 2105 |
|
... | ... | |
2087 | 2108 |
} else { |
2088 | 2109 |
|
2089 | 2110 |
# this sub should not set anything and only return. --sschoeling, 20090506 |
2090 |
# $form->{"sellprice_$i"} = $pkr->{price}; |
|
2111 |
# is this correct? put in again... -- grichardson 20110119 |
|
2112 |
$form->{"sellprice_$i"} = $pkr->{price}; |
|
2091 | 2113 |
} |
2092 | 2114 |
|
2093 |
} elsif ($pkr->{price} == $pkr->{default_sellprice}) { |
|
2115 |
} elsif ($pkr->{price} == $pkr->{default_sellprice} and $pkr->{default_sellprice} != 0) {
|
|
2094 | 2116 |
$pkr->{price} = $form->{"sellprice_$i"}; |
2095 | 2117 |
$pkr->{selected} = ' selected'; |
2096 | 2118 |
} |
2097 |
} else { |
|
2119 |
} |
|
2120 |
|
|
2121 |
# existing article: pricegroup or price changed |
|
2122 |
if ($selectedpricegroup_id or $selectedpricegroup_id == 0) { |
|
2098 | 2123 |
if ($selectedpricegroup_id ne $pricegroup_old) { |
2124 |
# pricegroup has changed |
|
2099 | 2125 |
if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) { |
2100 | 2126 |
$pkr->{selected} = ' selected'; |
2101 | 2127 |
} |
2102 |
} elsif ( ( $form->parse_amount($myconfig, $price_new)
|
|
2103 |
!= $form->parse_amount($myconfig, $form->{"sellprice_$i"}))
|
|
2104 |
and ($price_new ne 0)) {
|
|
2128 |
} elsif (($price_new != $form->{"sellprice_$i"}) and ($price_new ne 0) and defined $price_new) {
|
|
2129 |
# sellprice has changed
|
|
2130 |
# when loading existing invoices $price_new is NULL
|
|
2105 | 2131 |
if ($pkr->{pricegroup_id} == 0) { |
2106 | 2132 |
$pkr->{price} = $form->{"sellprice_$i"}; |
2107 | 2133 |
$pkr->{selected} = ' selected'; |
2108 | 2134 |
} |
2109 | 2135 |
} elsif ($pkr->{pricegroup_id} eq $selectedpricegroup_id) { |
2136 |
# neither sellprice nor pricegroup changed |
|
2110 | 2137 |
$pkr->{selected} = ' selected'; |
2111 |
if ( ($pkr->{pricegroup_id} == 0) |
|
2112 |
and ($pkr->{price} == $form->{"sellprice_$i"})) { |
|
2138 |
if ( ($pkr->{pricegroup_id} == 0) and ($pkr->{price} == $form->{"sellprice_$i"})) { |
|
2113 | 2139 |
# $pkr->{price} = $form->{"sellprice_$i"}; |
2114 | 2140 |
} else { |
2115 | 2141 |
$pkr->{price} = $form->{"sellprice_$i"}; |
bin/mozilla/invoice_io.pl | ||
---|---|---|
126 | 126 |
if ($item->{selected} && ($pricegroup_id != 0)) { |
127 | 127 |
$form->{"pricegroup_old_$j"} = $pricegroup_id; |
128 | 128 |
$form->{"price_new_$j"} = $price; |
129 |
$form->{"sellprice_$j"} = $price; |
|
129 |
# edit: don't change the sellprice here |
|
130 |
# $form->{"sellprice_$j"} = $price; # this must only be updated for existing articles, not new ones |
|
130 | 131 |
} |
131 | 132 |
if ($pricegroup_id == 0) { |
132 | 133 |
$form->{"price_new_$j"} = $form->{"sellprice_$j"}; |
bin/mozilla/io.pl | ||
---|---|---|
288 | 288 |
# for last row and report |
289 | 289 |
# set pricegroup drop down list from report menu |
290 | 290 |
if ($form->{"sellprice_$i"} != 0) { |
291 |
# remember the pricegroup_id in pricegroup_old |
|
292 |
# but don't overwrite it |
|
291 | 293 |
$form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"}; |
292 | 294 |
my $default_option = $form->{"sellprice_$i"}.'--'.$form->{"pricegroup_id_$i"}; |
293 |
$column_data{sellprice_pg} = NTI($cgi->popup_menu("sellpricepg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' })); |
|
295 |
$column_data{sellprice_pg} = NTI($cgi->popup_menu("sellprice_pg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' }));
|
|
294 | 296 |
} else { |
295 | 297 |
$column_data{sellprice_pg} = qq| |; |
296 | 298 |
} |
bin/mozilla/is.pl | ||
---|---|---|
266 | 266 |
|
267 | 267 |
# get pricegroups for parts |
268 | 268 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
269 |
set_pricegroup($_) for 1 .. $form->{rowcount}; |
|
269 |
|
|
270 |
# Problem: set_pricegroup resets the sellprice of old invoices to the price |
|
271 |
# currently defined in the pricegroup, which is a problem if the price has |
|
272 |
# changed, as the old invoice gets the new price |
|
273 |
# set_pricegroup must never be called, when an old invoice is initially loaded |
|
274 |
|
|
275 |
# set_pricegroup($_) for 1 .. $form->{rowcount}; |
|
270 | 276 |
} |
271 | 277 |
$main::lxdebug->leave_sub(); |
272 | 278 |
} |
... | ... | |
780 | 786 |
$form->{paidaccounts} = 1; |
781 | 787 |
$form->{rowcount}--; |
782 | 788 |
$form->{invdate} = $form->current_date(\%myconfig); |
789 |
|
|
790 |
# remember pricegroups for "use as template" |
|
791 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
792 |
set_pricegroup($_) for 1 .. $form->{rowcount}; |
|
793 |
|
|
783 | 794 |
&display_form; |
784 | 795 |
|
785 | 796 |
$main::lxdebug->leave_sub(); |
bin/mozilla/oe.pl | ||
---|---|---|
1419 | 1419 |
|
1420 | 1420 |
} |
1421 | 1421 |
|
1422 |
# show pricegroup in newly loaded invoice when creating invoice from quotation/order |
|
1423 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
1424 |
set_pricegroup($_) for 1 .. $form->{rowcount}; |
|
1425 |
|
|
1422 | 1426 |
&display_form; |
1423 | 1427 |
|
1424 | 1428 |
$main::lxdebug->leave_sub(); |
Auch abrufbar als: Unified diff
Preisgruppen verbessert
Bei Hinzufügen neuer Artikel wird die Preisgruppe des Kunden berücksichtigt
Bei Wechseln von Preisgruppen wird der Preisgruppenpreis gesetzt
Laden von alten Angeboten/Aufträgen/Rechnungen funktioniert, Preisgruppen
werden korrekt in DB gespeichert
Workflow getestet:
Angebot -> Auftrag -> Rechnung
Angebot -> Rechnung
Workflow mit Lieferschein dazwischen funktioniert nicht
Das Verhalten, ob direkt nach Laden/Speichern/Workflow alle
Preisgruppenoptionen im Dropdownmenü angezeigt werden, oder nur die gewählte,
ist nicht in allen Masken einheitlich. Spätestens nach einem Erneuern stehen
aber alle Preisgruppen wieder zur Verfügung.
Ändert sich der Preisgruppenpreis einer Ware wird beim Aufrufen alter
Rechnungen nicht mehr der neue Preisgruppenpreis, sondern der korrekte Wert aus
der DB angezeigt. (Bug 1426)
Bug 1206 trifft auch nicht mehr zu.