projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
82ff545
)
Liquiditätsübersicht: Auftragswertperiodizität von wied. Rechnungen berücksichtigen
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Thu, 5 Feb 2015 12:44:16 +0000
(13:44 +0100)
committer
Sven Schöling
<s.schoeling@linet-services.de>
Thu, 5 Mar 2015 10:45:47 +0000
(11:45 +0100)
SL/LiquidityProjection.pm
patch
|
blob
|
history
diff --git
a/SL/LiquidityProjection.pm
b/SL/LiquidityProjection.pm
index
03a1894
..
710c099
100644
(file)
--- a/
SL/LiquidityProjection.pm
+++ b/
SL/LiquidityProjection.pm
@@
-5,6
+5,7
@@
use strict;
use List::MoreUtils qw(uniq);
use SL::DBUtils;
use List::MoreUtils qw(uniq);
use SL::DBUtils;
+use SL::DB::PeriodicInvoicesConfig;
sub new {
my $package = shift;
sub new {
my $package = shift;
@@
-128,7
+129,7
@@
SQL
SELECT (oi.qty * (1 - oi.discount) * oi.sellprice) AS linetotal,
bg.description AS buchungsgruppe,
CASE WHEN COALESCE(e.name, '') = '' THEN e.login ELSE e.name END AS salesman,
SELECT (oi.qty * (1 - oi.discount) * oi.sellprice) AS linetotal,
bg.description AS buchungsgruppe,
CASE WHEN COALESCE(e.name, '') = '' THEN e.login ELSE e.name END AS salesman,
- pcfg.periodicity, pcfg.id AS config_id,
+ pcfg.periodicity, pcfg.
order_value_periodicity, pcfg.
id AS config_id,
EXTRACT(year FROM pcfg.start_date) AS start_year, EXTRACT(month FROM pcfg.start_date) AS start_month
FROM orderitems oi
LEFT JOIN oe ON (oi.trans_id = oe.id)
EXTRACT(year FROM pcfg.start_date) AS start_year, EXTRACT(month FROM pcfg.start_date) AS start_month
FROM orderitems oi
LEFT JOIN oe ON (oi.trans_id = oe.id)
@@
-140,7
+141,6
@@
SQL
SQL
# 3. Iterieren über Saldierungsintervalle, vormerken
SQL
# 3. Iterieren über Saldierungsintervalle, vormerken
- my %periodicities = ( 'm' => 1, 'q' => 3, 'y' => 12 );
my @scentries;
$sth = prepare_execute_query($::form, $dbh, $query);
while ($ref = $sth->fetchrow_hashref) {
my @scentries;
$sth = prepare_execute_query($::form, $dbh, $query);
while ($ref = $sth->fetchrow_hashref) {
@@
-148,15
+148,20
@@
SQL
my $date;
while (($date = _the_date($year, $month)) le $self->{max_date}) {
my $date;
while (($date = _the_date($year, $month)) le $self->{max_date}) {
+ my $billing_len = $SL::DB::PeriodicInvoicesConfig::PERIOD_LENGTHS{ $ref->{periodicity} } || 1;
+
if (($date ge $self->{min_date}) && (!$periodic_invoices{ $ref->{config_id} } || !$periodic_invoices{ $ref->{config_id} }->{$date})) {
if (($date ge $self->{min_date}) && (!$periodic_invoices{ $ref->{config_id} } || !$periodic_invoices{ $ref->{config_id} }->{$date})) {
+ my $order_value_periodicity = $ref->{order_value_periodicity} eq 'p' ? $ref->{periodicity} : $ref->{order_value_periodicity};
+ my $order_value_len = $SL::DB::PeriodicInvoicesConfig::ORDER_VALUE_PERIOD_LENGTHS{$order_value_periodicity} || 1;
+
push @scentries, { buchungsgruppe => $ref->{buchungsgruppe},
salesman => $ref->{salesman},
push @scentries, { buchungsgruppe => $ref->{buchungsgruppe},
salesman => $ref->{salesman},
- linetotal => $ref->{linetotal},
+ linetotal => $ref->{linetotal}
* $billing_len / $order_value_len
,
date => $date,
};
}
date => $date,
};
}
- ($year, $month) = _fix_date($year, $month +
($periodicities{ $ref->{periodicity} } || 1)
);
+ ($year, $month) = _fix_date($year, $month +
$billing_len
);
}
}
$sth->finish;
}
}
$sth->finish;