X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fis.pl;h=7d79ba9f2bd5529583c11ef9e3d11f66b394bedb;hb=626e02403cbcee241b2be41f3c2d827663864523;hp=5b9df52c9dd104cc832978a78cc9dbf23f15fc1d;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 5b9df52c9..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(); @@ -315,14 +324,12 @@ sub form_header { $button1 = qq| {invdate}> text('button') - . qq|> + . $locale->text('button') . qq|> |; $button2 = qq| {duedate}> text('button') - . qq|> + . $locale->text('button') . qq|> |; #write Trigger @@ -337,16 +344,21 @@ sub form_header { $button2 = qq|{duedate}>|; } - + if ($form->{resubmit}) { + $onload = "document.invoice.submit()"; + } else { + $onload = "fokus()"; + } $form->header; print qq| - +
{script}> {id}> +{action}> {type}> {media}> @@ -386,11 +398,11 @@ sub form_header { | . $locale->text('Customer') . qq| $customer + {customer_klass}> {customer_id}> | - . $locale->text('Contact Person') - . qq| + . $locale->text('Contact Person') . qq| $contact @@ -477,7 +489,7 @@ sub form_header { $jsscript - + @@ -533,8 +545,7 @@ sub form_footer { if ($form->{taxaccounts}) { $taxincluded = qq| {taxincluded}> | - . $locale->text('Tax Included') - . qq|

|; + . $locale->text('Tax Included') . qq|

|; } if (!$form->{taxincluded}) { @@ -645,7 +656,7 @@ sub form_footer {
- + Dokumente im Webdav-Repository @@ -654,7 +665,7 @@ sub form_footer { |; foreach $file (keys %{ $form->{WEBDAV} }) { $webdav_list .= qq| - + @@ -673,8 +684,7 @@ sub form_footer {
$file $form->{WEBDAV}{$file}
+ . $locale->text('Incoming Payments') . qq| |; @@ -753,7 +763,9 @@ sub form_footer { {oldinvtotal}> -
| - . $locale->text('Incoming Payments') - . qq|
+{print_and_post}> +{second_run}> + @@ -813,9 +825,11 @@ sub form_footer { + . $locale->text('Preview') . qq|"> + |; } @@ -851,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; @@ -969,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; @@ -999,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!')); @@ -1008,6 +1028,9 @@ sub post { &update; exit; } + if ($form->{second_run}) { + $form->{print_and_post} = 0; + } &validate_items; @@ -1047,18 +1070,51 @@ sub post { $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber") unless $form->{invnumber}; - - $form->redirect( + if ($print_post) { + if (!(IS->post_invoice(\%myconfig, \%$form))) { + $form->error($locale->text('Cannot post invoice!')); + } + } else { + $form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!')) - if (IS->post_invoice(\%myconfig, \%$form)); - $form->error($locale->text('Cannot post invoice!')); + if (IS->post_invoice(\%myconfig, \%$form)); + $form->error($locale->text('Cannot post invoice!')); + } $lxdebug->leave_sub(); } -sub delete { +sub print_and_post { + $lxdebug->enter_sub(); + + $old_form = new Form; + $print_post = 1; + $form->{print_and_post} = 1; + &post(); + + &display_form(); + $lxdebug->leave_sub(); + +} + +sub preview { $lxdebug->enter_sub(); + $form->{preview} = 1; + $old_form = new Form; + for (keys %$form) { $old_form->{$_} = $form->{$_} } + $old_form->{rowcount}++; + + &print_form($old_form); + $lxdebug->leave_sub(); + +} + +sub delete { + $lxdebug->enter_sub(); + if ($form->{second_run}) { + $form->{print_and_post} = 0; + } $form->header; print qq| @@ -1101,4 +1157,3 @@ sub yes { $lxdebug->leave_sub(); } -