Revision da804bf2
Von G. Richardson vor mehr als 14 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
277 | 277 |
} |
278 | 278 |
my $baseqty = $form->{"qty_$i"} * $basefactor; |
279 | 279 |
|
280 |
$form->{"lastcost_$i"} *= 1; |
|
281 |
|
|
282 | 280 |
# set values to 0 if nothing entered |
283 | 281 |
$form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}); |
284 | 282 |
$form->{"sellprice_$i"} = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
283 |
$form->{"lastcost_$i"} = $form->parse_amount($myconfig, $form->{"lastcost_$i"}); |
|
285 | 284 |
|
286 | 285 |
$price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1; |
287 | 286 |
my $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); |
SL/IS.pm | ||
---|---|---|
591 | 591 |
my $baseqty; |
592 | 592 |
|
593 | 593 |
$form->{"marge_percent_$i"} = $form->parse_amount($myconfig, $form->{"marge_percent_$i"}) * 1; |
594 |
$form->{"marge_total_$i"} = $form->parse_amount($myconfig, $form->{"marge_total_$i"}) * 1;
|
|
595 |
$form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1;
|
|
594 |
$form->{"marge_absolut_$i"} = $form->parse_amount($myconfig, $form->{"marge_absolut_$i"}) * 1;
|
|
595 |
$form->{"lastcost_$i"} = $form->parse_amount($myconfig, $form->{"lastcost_$i"}) * 1;
|
|
596 | 596 |
|
597 | 597 |
if ($form->{storno}) { |
598 | 598 |
$form->{"qty_$i"} *= -1; |
... | ... | |
717 | 717 |
$form->{"serialnumber_$i"}, conv_i($pricegroup_id), |
718 | 718 |
$form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}), |
719 | 719 |
$form->{"cusordnumber_$i"}, $baseqty, $form->{"subtotal_$i"} ? 't' : 'f', |
720 |
$form->{"marge_percent_$i"}, $form->{"marge_total_$i"},
|
|
720 |
$form->{"marge_percent_$i"}, $form->{"marge_absolut_$i"},
|
|
721 | 721 |
$form->{"lastcost_$i"}, |
722 | 722 |
conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), |
723 | 723 |
conv_i($form->{"marge_price_factor_$i"})); |
SL/OE.pm | ||
---|---|---|
337 | 337 |
my $baseqty = $form->{"qty_$i"} * $basefactor; |
338 | 338 |
|
339 | 339 |
$form->{"marge_percent_$i"} = $form->parse_amount($myconfig, $form->{"marge_percent_$i"}) * 1; |
340 |
$form->{"marge_total_$i"} = $form->parse_amount($myconfig, $form->{"marge_total_$i"}) * 1; |
|
341 |
$form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1; |
|
340 |
$form->{"marge_absolut_$i"} = $form->parse_amount($myconfig, $form->{"marge_absolut_$i"}) * 1; |
|
341 |
|
|
342 |
$form->{"lastcost_$i"} = $form->parse_amount($myconfig, $form->{"lastcost_$i"}); |
|
342 | 343 |
|
343 | 344 |
# set values to 0 if nothing entered |
344 | 345 |
$form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100; |
... | ... | |
428 | 429 |
$form->{"serialnumber_$i"}, $form->{"ship_$i"}, conv_i($pricegroup_id), |
429 | 430 |
$form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}), |
430 | 431 |
$form->{"cusordnumber_$i"}, $form->{"subtotal_$i"} ? 't' : 'f', |
431 |
$form->{"marge_percent_$i"}, $form->{"marge_total_$i"},
|
|
432 |
$form->{"marge_percent_$i"}, $form->{"marge_absolut_$i"},
|
|
432 | 433 |
$form->{"lastcost_$i"}, |
433 | 434 |
conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), |
434 | 435 |
conv_i($form->{"marge_price_factor_$i"})); |
bin/mozilla/do.pl | ||
---|---|---|
235 | 235 |
$form->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"}; |
236 | 236 |
|
237 | 237 |
$form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); |
238 |
$form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces); |
|
238 | 239 |
|
239 | 240 |
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); |
240 | 241 |
$dec_qty = length $dec_qty; |
... | ... | |
374 | 375 |
|
375 | 376 |
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor}; |
376 | 377 |
$form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}); |
378 |
$form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}); |
|
377 | 379 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); |
378 | 380 |
} |
379 | 381 |
|
... | ... | |
736 | 738 |
# und keinen anderen discount wert an $i ... |
737 | 739 |
$form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir den kundenrabatt |
738 | 740 |
} |
739 |
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice basefactor); |
|
741 |
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor);
|
|
740 | 742 |
} |
741 | 743 |
|
742 | 744 |
$form->{type} = "invoice"; |
... | ... | |
769 | 771 |
$form->{"deliverydate_$i"} = $form->{"reqdate_$i"} |
770 | 772 |
unless $form->{"deliverydate_$i"}; |
771 | 773 |
|
774 |
|
|
772 | 775 |
$form->{"sellprice_$i"} = |
773 | 776 |
$form->format_amount(\%myconfig, $form->{"sellprice_$i"}, |
774 | 777 |
$decimalplaces); |
775 | 778 |
|
779 |
$form->{"lastcost_$i"} = |
|
780 |
$form->format_amount(\%myconfig, $form->{"lastcost_$i"}, |
|
781 |
$decimalplaces); |
|
782 |
|
|
776 | 783 |
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); |
777 | 784 |
$dec_qty = length $dec_qty; |
778 | 785 |
$form->{"qty_$i"} = |
bin/mozilla/ic.pl | ||
---|---|---|
1871 | 1871 |
$form->{creditremaining} -= $amount; |
1872 | 1872 |
|
1873 | 1873 |
# redo number formatting, because invoice parse them! |
1874 |
map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } qw(weight listprice sellprice rop); |
|
1874 |
map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } qw(weight listprice sellprice lastcost rop);
|
|
1875 | 1875 |
} |
1876 | 1876 |
|
1877 | 1877 |
$form->{"id_$i"} = $parts_id; |
bin/mozilla/io.pl | ||
---|---|---|
159 | 159 |
); |
160 | 160 |
my @column_index = map { $_->{id} } grep { $_->{display} } @HEADER; |
161 | 161 |
|
162 |
|
|
162 | 163 |
# cache units |
163 | 164 |
my $all_units = AM->retrieve_units(\%myconfig, $form); |
164 | 165 |
|
... | ... | |
209 | 210 |
my %column_data = (); |
210 | 211 |
|
211 | 212 |
# undo formatting |
212 |
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty discount sellprice price_new price_old) unless ($form->{simple_save}); |
|
213 |
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } |
|
214 |
qw(qty discount sellprice lastcost price_new price_old) |
|
215 |
unless ($form->{simple_save}); |
|
213 | 216 |
|
214 | 217 |
# unit begin |
215 | 218 |
$form->{"unit_old_$i"} ||= $form->{"unit_$i"}; |
... | ... | |
294 | 297 |
} |
295 | 298 |
$column_data{sellprice} = $cgi->textfield(-name => "sellprice_$i", -size => 10, -onBlur => "check_right_number_format(this)", -value => |
296 | 299 |
$form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces)); |
300 |
|
|
297 | 301 |
} |
298 | 302 |
$column_data{discount} = $cgi->textfield(-name => "discount_$i", -size => 3, -value => $form->format_amount(\%myconfig, $form->{"discount_$i"})); |
299 | 303 |
$column_data{linetotal} = $form->format_amount(\%myconfig, $linetotal, 2); |
... | ... | |
338 | 342 |
|
339 | 343 |
map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent); |
340 | 344 |
|
341 |
push @ROW2, { value => sprintf qq|<font %s><b>%s</b> %s %s%% </font> <b>%s</b> %s <b>%s</b> %s|, |
|
345 |
push @ROW2, { value => sprintf qq| |
|
346 |
<font %s><b>%s</b> %s %s%% </font> |
|
347 |
<b>%s</b> %s |
|
348 |
<b>%s</b> <input size="5" name="lastcost_$i" value="%s">|, |
|
342 | 349 |
$marge_color, $locale->text('Ertrag'),$form->{"marge_absolut_$i"}, $form->{"marge_percent_$i"}, |
343 | 350 |
$locale->text('LP'), $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2), |
344 | 351 |
$locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) } |
... | ... | |
361 | 368 |
my @hidden_vars; |
362 | 369 |
|
363 | 370 |
if ($is_delivery_order) { |
364 |
map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount); |
|
365 |
push @hidden_vars, qw(sellprice discount price_factor_id); |
|
371 |
map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost);
|
|
372 |
push @hidden_vars, qw(sellprice discount price_factor_id lastcost);
|
|
366 | 373 |
push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}"; |
367 | 374 |
} |
368 | 375 |
|
... | ... | |
372 | 379 |
map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" } |
373 | 380 |
(qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes |
374 | 381 |
income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber |
375 |
longdescription basefactor marge_absolut marge_percent marge_price_factor lastcost), @hidden_vars)
|
|
382 |
longdescription basefactor marge_absolut marge_percent marge_price_factor), @hidden_vars) |
|
376 | 383 |
); |
377 | 384 |
|
378 | 385 |
map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"})); |
bin/mozilla/is.pl | ||
---|---|---|
263 | 263 |
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); |
264 | 264 |
$dec_qty = length $dec_qty; |
265 | 265 |
|
266 |
$form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces); |
|
267 |
|
|
266 | 268 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); |
267 | 269 |
|
268 | 270 |
$form->{rowcount} = $i; |
... | ... | |
544 | 546 |
|
545 | 547 |
$form->{creditremaining} -= $amount; |
546 | 548 |
|
547 |
map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) } qw(sellprice listprice); |
|
549 |
map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) } qw(sellprice listprice lastcost);
|
|
548 | 550 |
|
549 | 551 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); |
550 | 552 |
|
bin/mozilla/oe.pl | ||
---|---|---|
283 | 283 |
$form->{"reqdate_$i"} ||= $form->{"deliverydate_$i"}; |
284 | 284 |
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * ($format_discounts ? 100 : 1)); |
285 | 285 |
$form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}); |
286 |
$form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}); |
|
286 | 287 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); |
287 | 288 |
} |
288 | 289 |
|
... | ... | |
554 | 555 |
# select discount as customer_discount from customer |
555 | 556 |
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"$form->{vc}_discount"} * 100); |
556 | 557 |
|
558 |
$form->{"lastcost_$i"} = $form->parse_amount(\%myconfig, $form->{"lastcost_$i"}); |
|
559 |
|
|
557 | 560 |
if ($rows) { |
558 | 561 |
$form->{"qty_$i"} = 1 unless ($form->parse_amount(\%myconfig, $form->{"qty_$i"})); |
559 | 562 |
|
... | ... | |
599 | 602 |
$form->{creditremaining} -= $amount; |
600 | 603 |
|
601 | 604 |
$form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); |
605 |
$form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces); |
|
602 | 606 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); |
603 | 607 |
|
604 | 608 |
# get pricegroups for parts |
... | ... | |
1761 | 1765 |
# reset |
1762 | 1766 |
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber); |
1763 | 1767 |
|
1764 |
# if purchase_order was generated from sales_order, use lastcost_$i as sellprice_$i |
|
1768 |
# if purchase_order was generated from sales_order, use lastcost_$i as sellprice_$i
|
|
1765 | 1769 |
if ( $form->{sales_order_to_purchase_order} ) { |
1766 | 1770 |
for my $i (1 .. $form->{rowcount}) { |
1767 | 1771 |
$form->{"sellprice_${i}"} = $form->format_amount(\%myconfig,$form->{"lastcost_${i}"}); |
... | ... | |
1829 | 1833 |
delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)}; |
1830 | 1834 |
|
1831 | 1835 |
for my $i (1 .. $form->{rowcount}) { |
1832 |
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount); |
|
1836 |
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount);
|
|
1833 | 1837 |
} |
1834 | 1838 |
|
1835 | 1839 |
my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor); |
Auch abrufbar als: Unified diff
EK-Preis editierbar gemacht und marge_total repariert
Der EK-Preis ist jetzt in Angebot/Auftrag/Rechnung editierbar.
Dies ist praktisch für Händler/Wiederverkäufer, bei denen sich der EK-Preis
häufig ändert, und es sich nicht lohnt, diesen in den Stammdaten zu pflegen.
Der EK-Preis wird (als lastcost) zusammen mit marge_total und marge_percent für
jeden Artikel in orderitems/invoice in der DB gespeichert. (Bei marge_total gab
es hier einen Bug, der falsche Variablenname wurde benutzt und marge_total war
immer leer.)
Der Stammdaten-EK-Preis wird nicht verändert, wenn man einen abweichenden
EK-Preis eingibt.