X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Far.pl;h=a8937506f6356b0626e3ad20e142f39ee57b9aff;hb=2dacd2790bb5e0990ec5fe89a9d59370b018c25c;hp=3e6e9069883a958dbdbe0ecd7a0a16e9c023c74d;hpb=ff71dc3fb3a632a6a5856d94c3b336aa5ef6d6d2;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 3e6e90698..a8937506f 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -32,7 +32,7 @@ #====================================================================== use POSIX qw(strftime); -use List::Util qw(sum); +use List::Util qw(sum first); use SL::AR; use SL::FU; @@ -40,20 +40,13 @@ use SL::IS; use SL::PE; use SL::ReportGenerator; -# use strict; -#use warnings; - -# imports -our ($cgi, $form, $lxdebug, $locale, %myconfig); - require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; require "bin/mozilla/reportgenerator.pl"; -1; - -# end of main +use strict; +#use warnings; # this is for our long dates # $locale->text('January') @@ -83,12 +76,17 @@ require "bin/mozilla/reportgenerator.pl"; # $locale->text('Nov') # $locale->text('Dec') +my $totalpaid; + sub add { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); - $auth->assert('general_ledger'); + my $form = $main::form; + my %myconfig = %main::myconfig; - return $lxdebug->leave_sub() if (load_draft_maybe()); + return $main::lxdebug->leave_sub() if (load_draft_maybe()); # saving the history if(!exists $form->{addition} && ($form->{id} ne "")) { @@ -96,8 +94,8 @@ sub add { $form->{addition} = "ADDED"; $form->save_history($form->dbconnect(\%myconfig)); } - # /saving the history - + # /saving the history + $form->{title} = "Add"; $form->{callback} = "ar.pl?action=add" unless $form->{callback}; @@ -106,13 +104,15 @@ sub add { &create_links; $form->{transdate} = $form->{initial_transdate}; &display_form; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub edit { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $auth->assert('general_ledger'); + $main::auth->assert('general_ledger'); + + my $form = $main::form; # show history button $form->{javascript} = qq||; @@ -123,24 +123,29 @@ sub edit { &create_links; &display_form; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub display_form { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); - $auth->assert('general_ledger'); + my $form = $main::form; &form_header; &form_footer; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub create_links { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $auth->assert('general_ledger'); + $main::auth->assert('general_ledger'); + + my $form = $main::form; + my %myconfig = %main::myconfig; my ($duedate, $taxincluded, @curr); @@ -203,13 +208,18 @@ sub create_links { ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub form_header { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); - $auth->assert('general_ledger'); + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + my $cgi = $main::cgi; my ($title, $readonly, $exchangerate, $rows); my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project); @@ -318,8 +328,8 @@ sub form_header { my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; - $customer = ($form->{selectcustomer}) - ? qq|| + $customer = ($form->{selectcustomer}) + ? qq|| : qq||; $employee = qq| @@ -472,7 +482,7 @@ sub form_header {
| . $locale->text('Customer') . qq| | -$customer | +$customer | @@ -577,7 +587,13 @@ $jsscript $selected_taxchart = "$item->{id}--$item->{rate}"; } - $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"}); + if (!$form->{"taxchart_$i"}) { + if ($form->{"AR_amount_$i"} =~ m/.--./) { + $selected_taxchart = join '--', map { ($_->{id}, $_->{rate}) } first { $_->{id} == $item->{tax_id} } @{ $form->{ALL_TAXCHARTS} }; + } else { + $selected_taxchart = $taxchart_init; + } + } $selectAR_amount = NTI($cgi->popup_menu('-name' => "AR_amount_$i", @@ -679,8 +695,8 @@ $jsscript $column_data{exchangerate} = "" . $locale->text('Exch') . " | "; $column_data{AR_paid} = "" . $locale->text('Account') . " | "; $column_data{source} = "" . $locale->text('Source') . " | "; - $column_data{memo} = "" . $locale->text('Memo') . " | "; - $column_data{paid_project_id} = "" . $locale->text('Project Number') . " | "; + $column_data{memo} = "" . $locale->text('Memo') . " | "; + $column_data{paid_project_id} = "" . $locale->text('Project Number') . " | "; print "||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|