X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=caf48362feb16f359d1d0fd09cedf9018b13472e;hb=ea2e84cc75e2879141eea5e957439936280682bf;hp=c95d0c7fba1ccb1c99ce09288a0421e9837fdaff;hpb=5e984449bf2da02189d95d332182ef9bbdbe0b84;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index c95d0c7fb..caf48362f 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -214,7 +214,7 @@ sub form_header { my ($title, $readonly, $exchangerate, $rows); my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project); my ($jsscript, $button1, $button2, $onload); - my ($selectAR_amount, $selectAR_paid, $korrektur_checked, $ARselected, $tax); + my ($selectAR_amount, $selectAR_paid, $ARselected, $tax); my (@column_index, %column_data); @@ -340,12 +340,13 @@ sub form_header { map({ push(@old_project_ids, $form->{"project_id_$_"}) if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 0, - "old_id" => \@old_project_ids }, - "charts" => { "key" => "ALL_CHARTS", - "transdate" => $form->{transdate} }, - "taxcharts" => "ALL_TAXCHARTS"); + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }, + "charts" => { "key" => "ALL_CHARTS", + "transdate" => $form->{transdate} }, + "taxcharts" => { "key" => "ALL_TAXCHARTS", + "module" => "AR" },); map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; } @{ $form->{ALL_CHARTS} }); @@ -544,8 +545,6 @@ $jsscript | . $locale->text('Tax') . qq| | - . $locale->text('Korrektur') . qq| - | . $locale->text('Taxkey') . qq| | . $locale->text('Project') . qq| @@ -600,8 +599,6 @@ $jsscript '-default' => $selected_taxchart)) . qq||; - $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : ''); - my $projectnumber = NTI($cgi->popup_menu('-name' => "project_id_$i", '-values' => \@project_values, @@ -612,8 +609,7 @@ $jsscript $selectAR_amount {"amount_$i"}> - {"tax_$i"}> - + $form->{"tax_$i"} $tax $projectnumber @@ -932,17 +928,15 @@ sub update { if ($form->{"amount_$i"}) { push @a, {}; my $j = $#a; - if (!$form->{"korrektur_$i"}) { - my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); - if ($taxkey > 1) { - if ($form->{taxincluded}) { - $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate; - } else { - $form->{"tax_$i"} = $form->{"amount_$i"} * $rate; - } + my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); + if ($taxkey > 1) { + if ($form->{taxincluded}) { + $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate; } else { - $form->{"tax_$i"} = 0; + $form->{"tax_$i"} = $form->{"amount_$i"} * $rate; } + } else { + $form->{"tax_$i"} = 0; } $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2); @@ -1009,7 +1003,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); @@ -1050,7 +1044,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}; @@ -1067,7 +1061,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); @@ -1457,7 +1451,7 @@ sub ar_transactions { $form->{customer} = $form->unescape($form->{customer}); ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer}); - $form->{sort} ||= 'transdate'; + report_generator_set_default_sort('transdate', 1); AR->ar_transactions(\%myconfig, \%$form); @@ -1500,9 +1494,9 @@ sub ar_transactions { 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), }, ); - foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid - employee shippingpoint shipvia)) { - $column_defs{$name}->{link} = $href . "&sort=$name"; + foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia transaction_description)) { + my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; + $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } my %column_alignment = map { $_ => 'right' } qw(netamount tax amount paid due); @@ -1515,7 +1509,7 @@ sub ar_transactions { $report->set_export_options('ar_transactions', @hidden_variables); - $report->set_sort_indicator($form->{sort}, 1); + $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my @options; if ($form->{customer}) { @@ -1538,10 +1532,10 @@ sub ar_transactions { push @options, $locale->text('Transaction description') . " : $form->{transaction_description}"; } if ($form->{transdatefrom}) { - push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1); + push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1); } if ($form->{transdateto}) { - push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1); + push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1); } if ($form->{open}) { push @options, $locale->text('Open'); @@ -1583,8 +1577,8 @@ sub ar_transactions { map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent); - my $is_storno = $ar->{storno} && !$ar->{storno_id}; - my $has_storno = $ar->{storno} && $ar->{storno_id}; + my $is_storno = $ar->{storno} && $ar->{storno_id}; + my $has_storno = $ar->{storno} && !$ar->{storno_id}; $ar->{type} = $has_storno ? $locale->text("Invoice with Storno (abbreviation)") :