X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=148ac0be9aba49aa68e2934dfb2e8155012051a0;hb=cff1389b37e5adfde7734718a02290421aa1bf9a;hp=88ace44fe5076843f549afaca769735ee9142eea;hpb=e24e657067548d45e6a23ff56ee4c3ee69b5687b;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 88ace44fe..148ac0be9 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -33,12 +33,14 @@ use POSIX qw(strftime); use List::Util qw(sum first max); +use List::UtilsBy qw(sort_by); use SL::AR; use SL::FU; use SL::IS; use SL::PE; use SL::DB::Default; +use SL::DB::Invoice; use SL::ReportGenerator; require "bin/mozilla/arap.pl"; @@ -148,6 +150,7 @@ sub create_links { my %myconfig = %main::myconfig; $form->create_links("AR", \%myconfig, "customer"); + $form->{invoice_obj} = $form->{id} ? SL::DB::Invoice->new(id => $form->{id})->load : undef; my %saved; if (!$params{dont_save}) { @@ -409,8 +412,8 @@ sub form_header { gldate => $form->{"gldate_$i"}, }; - # default account for current assets (i.e. 1801 - SKR04) if no account is selected - $form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); + # default account for current assets (i.e. 1801 - SKR04) if no account is selected + $form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); $payment->{selectAR_paid} = NTI($cgi->popup_menu('-name' => "AR_paid_$i", @@ -429,6 +432,12 @@ sub form_header { push @payments, $payment; } + my @empty = grep { $_->{paid} eq '' } @payments; + @payments = ( + (sort_by { DateTime->from_kivitendo($_->{datepaid}) } grep { $_->{paid} ne '' } @payments), + @empty, + ); + $form->{totalpaid} = sum map { $_->{paid} } @payments; $form->header; @@ -442,6 +451,7 @@ sub form_header { ARselected => $ARselected, title_str => $title, follow_up_trans_info => $follow_up_trans_info, + today => DateTime->today, }); $main::lxdebug->leave_sub(); @@ -912,7 +922,7 @@ sub ar_transactions { @columns = qw(transdate id type invnumber ordnumber cusordnumber name netamount tax amount paid datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia - marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype); + marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype direct_debit dunning_description); my $ct_cvar_configs = CVar->get_configs('module' => 'CT'); my @ct_includeable_custom_variables = grep { $_->{includeable} } @{ $ct_cvar_configs }; @@ -958,10 +968,12 @@ sub ar_transactions { 'payment_terms' => { 'text' => $locale->text('Payment Terms'), }, 'charts' => { 'text' => $locale->text('Buchungskonto'), }, 'customertype' => { 'text' => $locale->text('Customer type'), }, + 'direct_debit' => { 'text' => $locale->text('direct debit'), }, + dunning_description => { 'text' => $locale->text('Dunning level'), }, %column_defs_cvars, ); - foreach my $name (qw(id transdate duedate invnumber ordnumber cusordnumber name datepaid employee shippingpoint shipvia transaction_description)) { + foreach my $name (qw(id transdate duedate invnumber ordnumber cusordnumber name datepaid employee shippingpoint shipvia transaction_description direct_debit)) { my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } @@ -1078,6 +1090,8 @@ sub ar_transactions { $ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") : $locale->text("AR Transaction (abbreviation)"); + $ar->{direct_debit} = $ar->{direct_debit} ? $::locale->text('yes') : $::locale->text('no'); + my $row = { }; foreach my $column (@columns) {