Revision 0b80cba3
Von Moritz Bunkus vor fast 2 Jahren hinzugefügt
SL/LiquidityProjection.pm | ||
---|---|---|
131 | 131 |
|
132 | 132 |
# 2. Auslesen aktiver Wartungsvertragskonfigurationen |
133 | 133 |
$query = <<SQL; |
134 |
SELECT (oi.qty * (1 - oi.discount) * oi.sellprice) AS linetotal, |
|
134 |
SELECT (oi.qty * (1 - oi.discount) * oi.sellprice) AS linetotal, oi.recurring_billing_mode,
|
|
135 | 135 |
bg.description AS buchungsgruppe, |
136 | 136 |
pg.partsgroup AS parts_group, |
137 | 137 |
CASE WHEN COALESCE(e.name, '') = '' THEN e.login ELSE e.name END AS salesman, |
... | ... | |
145 | 145 |
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) |
146 | 146 |
LEFT JOIN employee e ON (COALESCE(oe.salesman_id, oe.employee_id) = e.id) |
147 | 147 |
WHERE pcfg.active |
148 |
AND NOT pcfg.periodicity = 'o' |
|
148 |
AND (pcfg.periodicity <> 'o') |
|
149 |
AND ( (oi.recurring_billing_mode = 'always') |
|
150 |
OR ( (oi.recurring_billing_mode = 'once') |
|
151 |
AND (oi.recurring_billing_invoice_id IS NULL))) |
|
149 | 152 |
SQL |
150 | 153 |
|
151 | 154 |
# 3. Iterieren über Saldierungsintervalle, vormerken |
... | ... | |
159 | 162 |
my $billing_len = $SL::DB::PeriodicInvoicesConfig::PERIOD_LENGTHS{ $ref->{periodicity} } || 1; |
160 | 163 |
|
161 | 164 |
if (($date ge $self->{min_date}) && (!$periodic_invoices{ $ref->{config_id} } || !$periodic_invoices{ $ref->{config_id} }->{$date})) { |
165 |
if ($ref->{recurring_billing_mode} eq 'once') { |
|
166 |
push @scentries, { buchungsgruppe => $ref->{buchungsgruppe}, |
|
167 |
salesman => $ref->{salesman}, |
|
168 |
linetotal => $ref->{linetotal}, |
|
169 |
date => $date, |
|
170 |
}; |
|
171 |
last; |
|
172 |
} |
|
173 |
|
|
162 | 174 |
my $order_value_periodicity = $ref->{order_value_periodicity} eq 'p' ? $ref->{periodicity} : $ref->{order_value_periodicity}; |
163 | 175 |
my $order_value_len = $SL::DB::PeriodicInvoicesConfig::ORDER_VALUE_PERIOD_LENGTHS{$order_value_periodicity} || 1; |
164 | 176 |
|
Auch abrufbar als: Unified diff
Wiederkehrende Abrechnung Positionen: Liquiditätsübersicht