X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=933602fa158f2780b4be0c8d370967f6f4b10f24;hb=2dc09cf507b099b014a405001a6d67aa58cd124d;hp=975cb9479ac46c786e13a8bb10e6d649d61f05ed;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 975cb9479..933602fa1 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -31,10 +31,11 @@ # #====================================================================== +use SL::FU; use SL::IS; use SL::PE; use Data::Dumper; -use List::Util qw(max); +use List::Util qw(max sum); require "bin/mozilla/io.pl"; require "bin/mozilla/invoice_io.pl"; @@ -336,7 +337,7 @@ sub form_header { my @values = (undef); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { push(@values, $item->{"cp_id"}); - $labels{$item->{"cp_id"}} = $item->{"cp_name"} . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : ""); + $labels{$item->{"cp_id"}} = join(',', $item->{"cp_name"}, $item->{"cp_givenname"}) . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : ""); } my $contact; if (scalar @values > 1) { @@ -574,6 +575,11 @@ sub form_header { } $credittext = $locale->text('Credit Limit exceeded!!!'); + + my $follow_up_vc = $form->{customer}; + $follow_up_vc =~ s/--.*?//; + my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; + $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()| : ($form->{resubmit}) ? qq|document.invoice.submit()| : ($creditwarning) ? qq|alert('$credittext')| @@ -599,6 +605,7 @@ sub form_header { +
| ; @@ -607,13 +614,19 @@ sub form_header { creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax - shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts), + shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts cursor_fokus + convert_from_do_ids convert_from_oe_ids), map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} ); print qq|

$form->{saved_message}

| if $form->{saved_message}; print qq| + + + + +
$form->{title}
@@ -860,6 +873,20 @@ sub form_footer { $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0); + my $follow_ups_block; + if ($form->{id}) { + my $follow_ups = FU->follow_ups('trans_id' => $form->{id}); + + if (@{ $follow_ups} ) { + my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups }; + $follow_ups_block = qq| + + | . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq| + +|; + } + } + print qq| @@ -878,6 +905,7 @@ sub form_footer { + $follow_ups_block @@ -1095,18 +1123,18 @@ if ($form->{type} eq "credit_note") { print qq| |; - if ($form->{id} && !($form->{type} eq "credit_note")) { - print qq| + if ($form->{id} && !($form->{type} eq "credit_note")) { + print qq| |; - } + } if ($form->{radier}) { print qq| |; - } + } if ($invdate > $closedto) { @@ -1116,6 +1144,11 @@ if ($form->{type} eq "credit_note") { |; } + print qq| + |; + } else { if ($invdate > $closedto) { print qq|{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate); - $form->{"exchangerate_$i"} = $exchangerate if - $form->{"forex_$i"} = $exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'); + $form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'); + $form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"}; } $i = $form->{rowcount}; @@ -1324,7 +1357,7 @@ sub post_payment { $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); $form->error($locale->text('Cannot post payment for a closed period!')) - if ($datepaid <= $closedto); + if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); if ($form->{currency} ne $form->{defaultcurrency}) { $form->{"exchangerate_$i"} = $form->{exchangerate} @@ -1354,6 +1387,8 @@ sub post { $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); $form->isblank("invdate", $locale->text('Invoice Date missing!')); $form->isblank("customer", $locale->text('Customer missing!')); + $form->error($locale->text('Cannot post invoice for a closed period!')) + if ($form->date_closed($form->{"invdate"}, \%myconfig)); $form->{invnumber} =~ s/^\s*//g; $form->{invnumber} =~ s/\s*$//g; @@ -1385,7 +1420,7 @@ sub post { $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); $form->error($locale->text('Cannot post payment for a closed period!')) - if ($datepaid <= $closedto); + if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); if ($form->{currency} ne $form->{defaultcurrency}) { $form->{"exchangerate_$i"} = $form->{exchangerate} @@ -1586,15 +1621,8 @@ sub credit_note { &invoice_links; $form->{currency} = $currency; - $form->{exchangerate} = ""; - $form->{forex} = ""; - $form->{exchangerate} = $exchangerate - if ( - $form->{forex} = ( - $exchangerate = - $form->check_exchangerate( - \%myconfig, $form->{currency}, $form->{invdate}, $buysell - ))); + $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{invdate}, $buysell); + $form->{exchangerate} = $form->{forex} || ''; $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});