X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Far.pl;h=0498e117dfd05bc9f68e88b2ff103c29612c0ca0;hb=b3bcbbe95b29ae60ac00589d944d97c288671da6;hp=ae15aed9ad6c87b18b986423faa6b8d8c3106391;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index ae15aed9a..0498e117d 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -32,8 +32,10 @@ #====================================================================== use POSIX qw(strftime); +use List::Util qw(sum); use SL::AR; +use SL::FU; use SL::IS; use SL::PE; use SL::ReportGenerator; @@ -259,13 +261,8 @@ sub form_header { s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } - $form->{exchangerate} = $exchangerate - if ( - $form->{forex} = ( - $exchangerate = - $form->check_exchangerate( - \%myconfig, $form->{currency}, $form->{transdate}, 'buy' - ))); + $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy'); + $form->{exchangerate} = $form->{forex} if $form->{forex}; # format amounts $form->{exchangerate} = @@ -431,9 +428,14 @@ sub form_header { qq||; } + my $follow_up_vc = $form->{customer}; + $follow_up_vc =~ s/--.*?//; + my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; + $form->{javascript} .= qq|| . - qq||; + qq|| . + qq||; $form->header; $onload = qq|focus()|; @@ -449,6 +451,10 @@ sub form_header { {closedto}> {locked}> + + + + | . ($form->{saved_message} ? qq|

$form->{saved_message}

| : "") . qq| @@ -800,8 +806,20 @@ sub form_footer { my ($transdate, $closedto); + 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| +$follow_ups_block + @@ -842,7 +860,10 @@ sub form_footer { |; } print qq| - |; + + |; } else { if ($transdate > $closedto) { @@ -935,13 +956,8 @@ sub update { $form->{rowcount} = $count + 1; map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount}); - $form->{exchangerate} = $exchangerate - if ( - $form->{forex} = ( - $exchangerate = - $form->check_exchangerate( - \%myconfig, $form->{currency}, $form->{transdate}, 'buy' - ))); + $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy'); + $form->{exchangerate} = $form->{forex} if $form->{forex}; $form->{invdate} = $form->{transdate}; my $save_AR = $form->{AR}; @@ -960,13 +976,8 @@ sub update { $totalpaid += $form->{"paid_$i"}; - $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"}; } } @@ -998,7 +1009,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); + $form->error($locale->text('Cannot post payment for a closed period!')) if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); if ($form->{currency} ne $form->{defaultcurrency}) { # $form->{"exchangerate_$i"} = $form->{exchangerate} if ($invdate == $datepaid); @@ -1039,7 +1050,7 @@ sub post { my $closedto = $form->datetonum($form->{closedto}, \%myconfig); my $transdate = $form->datetonum($form->{transdate}, \%myconfig); - $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto); + $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig)); $form->error($locale->text('Zero amount posting!')) unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount}; @@ -1056,7 +1067,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} if ($transdate == $datepaid); @@ -1366,7 +1377,7 @@ sub search { | . $locale->text('Notes') . qq| - + | . $locale->text('Salesperson') . qq| | . $locale->text('Shipping Point') . qq| @@ -1374,10 +1385,12 @@ sub search { | . $locale->text('Ship via') . qq| - | - . $locale->text('Ertrag') . qq| - | - . $locale->text('Ertrag prozentual') . qq| + + | . $locale->text('Ertrag') . qq| + + | . $locale->text('Ertrag prozentual') . qq| + + | . $locale->text('Employee') . qq| @@ -1454,7 +1467,7 @@ sub ar_transactions { @columns = qw(transdate id type invnumber ordnumber name netamount tax amount paid - datepaid due duedate transaction_description notes employee shippingpoint shipvia + datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia marge_total marge_percent globalprojectnumber); my @hidden_variables = map { "l_${_}" } @columns; @@ -1478,7 +1491,8 @@ sub ar_transactions { 'duedate' => { 'text' => $locale->text('Due Date'), }, 'transaction_description' => { 'text' => $locale->text('Transaction description'), }, 'notes' => { 'text' => $locale->text('Notes'), }, - 'employee' => { 'text' => $locale->text('Salesperson'), }, + 'salesman' => { 'text' => $locale->text('Salesperson'), }, + 'employee' => { 'text' => $locale->text('Employee'), }, 'shippingpoint' => { 'text' => $locale->text('Shipping Point'), }, 'shipvia' => { 'text' => $locale->text('Ship via'), }, 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },