X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=0f237830953c16b785b8a7a796de8cc16fc9c41d;hb=cd15b41168a4c4752e89e2a28f47f254d533e5d3;hp=3551efab4cc1d48a8940c0a05663bab89cc9e93a;hpb=75cd107d1bb8f3c8a1023d1dab1f198fe99d967f;p=kivitendo-erp.git diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 3551efab4..0f2378309 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -637,6 +637,7 @@ sub get_accounts_ustva { my $glwhere = ""; my $subwhere = ""; my $ARwhere = ""; + my $APwhere = ''; my $arwhere = ""; my $item; @@ -645,6 +646,7 @@ sub get_accounts_ustva { $subwhere .= " AND transdate >= '$fromdate'"; $glwhere = " AND ac.transdate >= '$fromdate'"; $ARwhere .= " AND acc.transdate >= '$fromdate'"; + $APwhere .= " AND AP.transdate >= '$fromdate'"; } $where .= " AND ac.transdate >= '$fromdate'"; } @@ -653,6 +655,7 @@ sub get_accounts_ustva { $where .= " AND ac.transdate <= '$todate'"; $ARwhere .= " AND acc.transdate <= '$todate'"; $subwhere .= " AND transdate <= '$todate'"; + $APwhere .= " AND AP.transdate <= '$todate'"; } if ($department_id) { @@ -708,18 +711,19 @@ sub get_accounts_ustva { UNION -- alle Ausgaben AP erfassen - SELECT sum(ac.amount) AS amount, c.$category - FROM acc_trans ac - JOIN chart c ON (c.id = ac.chart_id) - $dpt_join - WHERE - $where - AND c.link LIKE '%AP_amount%' - $dpt_where - $project - GROUP BY c.$category - - UNION -- alle Ausgaben und Einnahmen direkter gl Buchungen erfassen + SELECT + sum(ac.amount) AS amount, pos_ustva + FROM acc_trans ac + JOIN AP ON (AP.id = ac.trans_id ) + JOIN chart c ON (c.id = ac.chart_id AND pos_ustva NOT LIKE '') + WHERE + 1=1 + $APwhere + $dpt_where + $project + GROUP BY pos_ustva + + UNION -- alle Ausgaben und Einnahmen direkter gl Buchungen erfassen SELECT sum (