X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdo.pl;h=8299a1abf8c499bd0e308691c18417b96d96492b;hb=f00d7ebe7c70add2e433d0000c2f88f0e5842538;hp=bf76cdd8b24c82ef40e4518960990f1c52b65eba;hpb=8c6da40329649dd3015da8364e831e0e47155694;p=kivitendo-erp.git
diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl
index bf76cdd8b..8299a1abf 100644
--- a/bin/mozilla/do.pl
+++ b/bin/mozilla/do.pl
@@ -179,9 +179,9 @@ sub order_links {
# get customer / vendor
if ($form->{vc} eq 'vendor') {
IR->get_vendor(\%myconfig, \%$form);
+ $form->{discount} = $form->{vendor_discount};
} else {
IS->get_customer(\%myconfig, \%$form);
- # OFFEN tritt bug 1284 auch bei vendor auf?
$form->{discount} = $form->{customer_discount};
}
@@ -551,6 +551,7 @@ sub orders {
'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time),
);
$report->set_options_from_form();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
# add sort and escape callback, this one we use for the add sub
$form->{callback} = $href .= "&sort=$form->{sort}";
@@ -732,9 +733,9 @@ sub invoice {
for my $i (1 .. $form->{rowcount}) {
# für bug 1284
- if ($form->{discount}){ # Falls wir einen Kundenrabatt haben
+ if ($form->{discount}){ # Falls wir einen Lieferanten-/Kundenrabatt haben
# und keinen anderen discount wert an $i ...
- $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir den kundenrabatt
+ $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir diesen Rabatt
}
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor);
}
@@ -845,15 +846,35 @@ sub invoice_multi {
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued);
+ # get vendor or customer discount
+ my $vc_discount;
+ my $saved_form = save_form();
+ if ($form->{vc} eq 'vendor') {
+ IR->get_vendor(\%myconfig, \%$form);
+ $vc_discount = $form->{vendor_discount};
+ } else {
+ IS->get_customer(\%myconfig, \%$form);
+ $vc_discount = $form->parse_amount(\%myconfig, $form->{customer_discount});
+ }
+ restore_form($saved_form);
+
$form->{rowcount} = 0;
foreach my $ref (@{ $form->{form_details} }) {
$form->{rowcount}++;
$ref->{reqdate} ||= $ref->{dord_transdate}; # copy transdates into each invoice row
map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref };
- map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice discount lastcost);
+ map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice lastcost);
+
+ if ($vc_discount){ # falls wir einen Lieferanten/Kundenrabatt haben
+ # und keinen anderen discount wert an $i ...
+ $form->{"discount_$form->{rowcount}"} ||= $vc_discount; # ... nehmen wir diesen Rabatt
+ }
+
$form->{"discount_$form->{rowcount}"} = $form->{"discount_$form->{rowcount}"} * 100; #s.a. Bug 1151
# Anm.: Eine Ãnderung des discounts in der SL/DO.pm->retrieve (select (doi.discount * 100) as discount) ergibt in psql einen
# Wert von 10.0000001490116. Ferner ist der Rabatt in der Rechnung dann bei 1.0 (?). Deswegen lasse ich das hier. jb 10.10.09
+
+ $form->{"discount_$form->{rowcount}"} = $form->format_amount(\%myconfig, $form->{"discount_$form->{rowcount}"});
}
delete $form->{form_details};
@@ -938,7 +959,7 @@ sub calculate_stock_in_out {
'amount_unit' => $all_units->{$form->{"partunit_$i"}}->{base_unit},
'conv_units' => 'convertible_not_smaller',
'max_places' => 2);
- $content .= qq| |;
+ $content = qq|${content} |;
$main::lxdebug->leave_sub();
@@ -1061,6 +1082,18 @@ sub display_stock_in_form {
$main::lxdebug->leave_sub();
}
+sub _stock_in_out_set_qty_display {
+ my $stock_info = shift;
+ my $form = $::form;
+ my $all_units = AM->retrieve_all_units();
+ my $sum = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $stock_info });
+ $form->{qty_display} = $form->format_amount_units(amount => $sum * 1,
+ part_unit => $form->{partunit},
+ amount_unit => $all_units->{ $form->{partunit} }->{base_unit},
+ conv_units => 'convertible_not_smaller',
+ max_places => 2);
+}
+
sub set_stock_in {
$main::lxdebug->enter_sub();
@@ -1079,6 +1112,8 @@ sub set_stock_in {
$form->{stock} = YAML::Dump($stock_info);
+ _stock_in_out_set_qty_display($stock_info);
+
$form->header();
print $form->parse_html_template('do/set_stock_in_out');
@@ -1172,6 +1207,8 @@ sub set_stock_out {
stock_in_out_form();
} else {
+ _stock_in_out_set_qty_display($stock_info);
+
$form->header();
print $form->parse_html_template('do/set_stock_in_out');
}