X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=7d79ba9f2bd5529583c11ef9e3d11f66b394bedb;hb=4d73998317d83187d5307f686f30c695ecc68c73;hp=4e6a066dbe5c4690375c13161416b374c53719a3;hpb=c103dedd31b5aeb5899c191f2950d2db95e12a79;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 4e6a066db..7d79ba9f2 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -33,6 +33,7 @@ use SL::IS; use SL::PE; +use Data::Dumper; require "$form->{path}/io.pl"; require "$form->{path}/arap.pl"; @@ -194,12 +195,14 @@ sub prepare_invoice { map { $form->{$_} =~ s/\"/"/g } qw(invnumber ordnumber quonumber shippingpoint shipvia notes intnotes); + # # get pricegroups for parts + # IS->get_pricegroups_for_parts(\%myconfig, \%$form); + foreach $ref (@{ $form->{invoice_details} }) { $i++; map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); - ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); $dec = length $dec; $decimalplaces = ($dec > 2) ? $dec : 2; @@ -207,11 +210,17 @@ sub prepare_invoice { $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); - $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); + + (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); + $dec_qty = length $dec_qty; + + $form->{"qty_$i"} = + $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit partnotes); $form->{rowcount} = $i; + } } $lxdebug->leave_sub(); @@ -389,6 +398,7 @@ sub form_header { | . $locale->text('Customer') . qq| $customer + {customer_klass}> {customer_id}> | @@ -855,7 +865,9 @@ sub update { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining); - + if ($form->{second_run}) { + $form->{print_and_post} = 0; + } &check_name(customer); &check_project; @@ -973,6 +985,11 @@ sub update { } } + # get pricegroups for parts + IS->get_pricegroups_for_parts(\%myconfig, \%$form); + + # build up html code for prices_$i + &set_pricegroup($i); } &display_form; @@ -1003,7 +1020,6 @@ sub update { sub post { $lxdebug->enter_sub(); - $form->isblank("invdate", $locale->text('Invoice Date missing!')); $form->isblank("customer", $locale->text('Customer missing!')); @@ -1012,6 +1028,9 @@ sub post { &update; exit; } + if ($form->{second_run}) { + $form->{print_and_post} = 0; + } &validate_items; @@ -1072,6 +1091,7 @@ sub print_and_post { $print_post = 1; $form->{print_and_post} = 1; &post(); + &display_form(); $lxdebug->leave_sub(); @@ -1092,7 +1112,9 @@ sub preview { sub delete { $lxdebug->enter_sub(); - + if ($form->{second_run}) { + $form->{print_and_post} = 0; + } $form->header; print qq|