From: Stephan Köhler Date: Fri, 25 Nov 2005 11:12:24 +0000 (+0000) Subject: Merge von 599 aus unstable: Funktion fuer Druckvorschau und Drucken+Buchen zu Verkauf... X-Git-Tag: release-2.2.0~101 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=383022aec2779e0845e154238a3bdd885f5edc10;p=kivitendo-erp.git Merge von 599 aus unstable: Funktion fuer Druckvorschau und Drucken+Buchen zu Verkaufsrechnungen hinzugefuegt --- diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index d0e813f57..2a47a6249 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -199,7 +199,8 @@ sub display_row { # undo formatting map { - $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) + $form->{"${_}_$i"} = + $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty ship discount sellprice); ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); @@ -643,7 +644,32 @@ sub display_form { &{"$form->{display_form}"}; exit; } + if ( $form->{print_and_post} + && $form->{second_run} + && ($form->{action} eq "display_form")) { + for (keys %$form) { $old_form->{$_} = $form->{$_} } + $old_form->{rowcount}++; + #$form->{rowcount}--; + #$form->{rowcount}--; + + $form->{print_and_post} = 0; + + &print_form($old_form); + exit; + } + + $form->{action} = ""; + $form->{resubmit} = 0; + + if ($form->{print_and_post} && !$form->{second_run}) { + $form->{second_run} = 1; + $form->{action} = "display_form"; + $form->{rowcount}--; + + $form->{resubmit} = 1; + + } &form_header; $numrows = ++$form->{rowcount}; @@ -672,6 +698,10 @@ sub display_form { &form_footer; + # if ($form->{print_and_post}) { + # &display_form; + # } + $lxdebug->leave_sub(); } @@ -680,7 +710,7 @@ sub check_form { my @a = (); my $count = 0; - my @flds = ( + my @flds = ( qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup) ); @@ -1323,7 +1353,7 @@ sub print_form { # $locale->text('Quotation Date missing!') # assign number - if (!$form->{"${inv}number"}) { + if (!$form->{"${inv}number"} && !$form->{preview}) { $form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld); if ($form->{media} ne 'email') { $form->{rowcount}--; @@ -1513,6 +1543,8 @@ sub print_form { ? $locale->text('sent to printer') : $locale->text('emailed to') . " $form->{email}"; $form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|); + } else { + &{"$display_form"}; } $lxdebug->leave_sub(); @@ -1553,6 +1585,7 @@ sub ship_to { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining); $form_id = $form->{id}; + # get details for name &{"$form->{vc}_details"}; $form->{id} = $form_id; @@ -1579,11 +1612,9 @@ sub ship_to { + . $locale->text('Billing Address') . qq| + . $locale->text('Shipping Address') . qq| diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 4673ccb06..4e6a066db 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -315,14 +315,12 @@ sub form_header { $button1 = qq| + . $locale->text('button') . qq|> |; $button2 = qq| + . $locale->text('button') . qq|> |; #write Trigger @@ -337,16 +335,21 @@ sub form_header { $button2 = qq||; } - + if ($form->{resubmit}) { + $onload = "document.invoice.submit()"; + } else { + $onload = "fokus()"; + } $form->header; print qq| - +{script}> {id}> +{action}> {type}> {media}> @@ -389,8 +392,7 @@ sub form_header { {customer_id}> + . $locale->text('Contact Person') . qq| @@ -533,8 +535,7 @@ sub form_footer { if ($form->{taxaccounts}) { $taxincluded = qq| {taxincluded}> | - . $locale->text('Tax Included') - . qq|

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

|; } if (!$form->{taxincluded}) { @@ -673,8 +674,7 @@ sub form_footer {
| - . $locale->text('Billing Address') - . qq| | - . $locale->text('Shipping Address') - . qq|
{invdate}> text('button') - . qq|>{duedate}> text('button') - . qq|>{duedate}>
| - . $locale->text('Contact Person') - . qq| $contact
+ . $locale->text('Incoming Payments') . qq| |; @@ -753,7 +753,9 @@ sub form_footer { {oldinvtotal}> -
| - . $locale->text('Incoming Payments') - . qq|
+{print_and_post}> +{second_run}> + @@ -813,9 +815,11 @@ sub form_footer { + . $locale->text('Preview') . qq|"> + |; } @@ -1047,15 +1051,45 @@ 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 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();