Revision 0d37f1e8
Von Moritz Bunkus vor mehr als 9 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
32 | 32 |
#====================================================================== |
33 | 33 |
|
34 | 34 |
use POSIX qw(strftime); |
35 |
use List::Util qw(sum); |
|
35 |
use List::Util qw(max sum); |
|
36 |
use List::UtilsBy qw(sort_by); |
|
36 | 37 |
|
37 | 38 |
use SL::AP; |
38 | 39 |
use SL::FU; |
... | ... | |
187 | 188 |
$main::lxdebug->leave_sub(); |
188 | 189 |
} |
189 | 190 |
|
191 |
sub _sort_payments { |
|
192 |
my @fields = qw(acc_trans_id gldate datepaid source memo paid AR_paid paid_project_id); |
|
193 |
my @payments = |
|
194 |
grep { $_->{paid} != 0 } |
|
195 |
map { |
|
196 |
my $idx = $_; |
|
197 |
+{ map { ($_ => delete($::form->{"${_}_${idx}"})) } @fields } |
|
198 |
} (1..$::form->{paidaccounts}); |
|
199 |
|
|
200 |
@payments = sort_by { DateTime->from_kivitendo($_->{datepaid}) } @payments; |
|
201 |
|
|
202 |
$::form->{paidaccounts} = max scalar(@payments), 1; |
|
203 |
|
|
204 |
foreach my $idx (1 .. scalar(@payments)) { |
|
205 |
my $payment = $payments[$idx - 1]; |
|
206 |
$::form->{"${_}_${idx}"} = $payment->{$_} for @fields; |
|
207 |
} |
|
208 |
} |
|
209 |
|
|
190 | 210 |
sub form_header { |
191 | 211 |
$main::lxdebug->enter_sub(); |
192 | 212 |
|
... | ... | |
372 | 392 |
|
373 | 393 |
$form->{totalpaid} = 0; |
374 | 394 |
|
395 |
_sort_payments(); |
|
396 |
|
|
375 | 397 |
if ( $form->{'paid_'. $form->{paidaccounts}} ) { |
376 | 398 |
$form->{paidaccounts}++; |
377 | 399 |
} |
bin/mozilla/ar.pl | ||
---|---|---|
33 | 33 |
|
34 | 34 |
use POSIX qw(strftime); |
35 | 35 |
use List::Util qw(sum first max); |
36 |
use List::UtilsBy qw(sort_by); |
|
36 | 37 |
|
37 | 38 |
use SL::AR; |
38 | 39 |
use SL::FU; |
... | ... | |
409 | 410 |
gldate => $form->{"gldate_$i"}, |
410 | 411 |
}; |
411 | 412 |
|
412 |
# default account for current assets (i.e. 1801 - SKR04) if no account is selected |
|
413 |
$form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); |
|
413 |
# default account for current assets (i.e. 1801 - SKR04) if no account is selected
|
|
414 |
$form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form);
|
|
414 | 415 |
|
415 | 416 |
$payment->{selectAR_paid} = |
416 | 417 |
NTI($cgi->popup_menu('-name' => "AR_paid_$i", |
... | ... | |
429 | 430 |
push @payments, $payment; |
430 | 431 |
} |
431 | 432 |
|
433 |
my @empty = grep { $_->{paid} eq '' } @payments; |
|
434 |
@payments = ( |
|
435 |
(sort_by { DateTime->from_kivitendo($_->{datepaid}) } grep { $_->{paid} ne '' } @payments), |
|
436 |
@empty, |
|
437 |
); |
|
438 |
|
|
432 | 439 |
$form->{totalpaid} = sum map { $_->{paid} } @payments; |
433 | 440 |
|
434 | 441 |
$form->header; |
bin/mozilla/ir.pl | ||
---|---|---|
37 | 37 |
use SL::PE; |
38 | 38 |
use SL::DB::Default; |
39 | 39 |
use List::Util qw(max sum); |
40 |
use List::UtilsBy qw(sort_by); |
|
40 | 41 |
|
41 | 42 |
require "bin/mozilla/io.pl"; |
42 | 43 |
require "bin/mozilla/invoice_io.pl"; |
... | ... | |
349 | 350 |
$main::lxdebug->leave_sub(); |
350 | 351 |
} |
351 | 352 |
|
353 |
sub _sort_payments { |
|
354 |
my @fields = qw(acc_trans_id gldate datepaid source memo paid AR_paid); |
|
355 |
my @payments = |
|
356 |
grep { $_->{paid} != 0 } |
|
357 |
map { |
|
358 |
my $idx = $_; |
|
359 |
+{ map { ($_ => delete($::form->{"${_}_${idx}"})) } @fields } |
|
360 |
} (1..$::form->{paidaccounts}); |
|
361 |
|
|
362 |
@payments = sort_by { DateTime->from_kivitendo($_->{datepaid}) } @payments; |
|
363 |
|
|
364 |
$::form->{paidaccounts} = max scalar(@payments), 1; |
|
365 |
|
|
366 |
foreach my $idx (1 .. scalar(@payments)) { |
|
367 |
my $payment = $payments[$idx - 1]; |
|
368 |
$::form->{"${_}_${idx}"} = $payment->{$_} for @fields; |
|
369 |
} |
|
370 |
} |
|
371 |
|
|
352 | 372 |
sub form_footer { |
353 | 373 |
$main::lxdebug->enter_sub(); |
354 | 374 |
|
... | ... | |
391 | 411 |
} |
392 | 412 |
|
393 | 413 |
# payments |
414 |
_sort_payments(); |
|
415 |
|
|
394 | 416 |
my $totalpaid = 0; |
395 | 417 |
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); |
396 | 418 |
$form->{paid_indices} = [ 1 .. $form->{paidaccounts} ]; |
bin/mozilla/is.pl | ||
---|---|---|
39 | 39 |
use DateTime; |
40 | 40 |
use List::MoreUtils qw(uniq); |
41 | 41 |
use List::Util qw(max sum); |
42 |
use List::UtilsBy qw(sort_by); |
|
42 | 43 |
use English qw(-no_match_vars); |
43 | 44 |
|
44 | 45 |
use SL::DB::Default; |
... | ... | |
400 | 401 |
$main::lxdebug->leave_sub(); |
401 | 402 |
} |
402 | 403 |
|
404 |
sub _sort_payments { |
|
405 |
my @fields = qw(acc_trans_id gldate datepaid source memo paid AR_paid); |
|
406 |
my @payments = |
|
407 |
grep { $_->{paid} != 0 } |
|
408 |
map { |
|
409 |
my $idx = $_; |
|
410 |
+{ map { ($_ => delete($::form->{"${_}_${idx}"})) } @fields } |
|
411 |
} (1..$::form->{paidaccounts}); |
|
412 |
|
|
413 |
@payments = sort_by { DateTime->from_kivitendo($_->{datepaid}) } @payments; |
|
414 |
|
|
415 |
$::form->{paidaccounts} = max scalar(@payments), 1; |
|
416 |
|
|
417 |
foreach my $idx (1 .. scalar(@payments)) { |
|
418 |
my $payment = $payments[$idx - 1]; |
|
419 |
$::form->{"${_}_${idx}"} = $payment->{$_} for @fields; |
|
420 |
} |
|
421 |
} |
|
422 |
|
|
403 | 423 |
sub form_footer { |
404 | 424 |
$main::lxdebug->enter_sub(); |
405 | 425 |
|
... | ... | |
446 | 466 |
} |
447 | 467 |
|
448 | 468 |
# payments |
469 |
_sort_payments(); |
|
470 |
|
|
449 | 471 |
my $totalpaid = 0; |
450 | 472 |
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); |
451 | 473 |
$form->{paid_indices} = [ 1 .. $form->{paidaccounts} ]; |
Auch abrufbar als: Unified diff
Rechnungen: Zahlungsein-/-ausgänge nach Datum sortieren