664 |
664 |
my $APwhere = '';
|
665 |
665 |
my $arwhere = "";
|
666 |
666 |
my $item;
|
|
667 |
my $gltaxkey_where = "(tk.pos_ustva>=59 AND tk.pos_ustva<=66)";
|
667 |
668 |
|
668 |
669 |
if ($fromdate) {
|
669 |
670 |
if ($form->{method} eq 'cash') {
|
670 |
671 |
$subwhere .= " AND transdate >= '$fromdate'";
|
671 |
672 |
$glwhere = " AND ac.transdate >= '$fromdate'";
|
672 |
|
$ARwhere .= " AND acc.transdate >= '$fromdate'";
|
673 |
|
$APwhere .= " AND AP.transdate >= '$fromdate'";
|
|
673 |
$ARwhere .= " AND acc.transdate >= '$fromdate'";
|
674 |
674 |
}
|
|
675 |
$APwhere .= " AND AP.transdate >= '$fromdate'";
|
675 |
676 |
$where .= " AND ac.transdate >= '$fromdate'";
|
676 |
677 |
}
|
677 |
678 |
|
... | ... | |
738 |
739 |
SELECT id FROM taxkeys
|
739 |
740 |
WHERE chart_id = ac.chart_id
|
740 |
741 |
-- AND taxkey_id = ac.taxkey
|
741 |
|
AND startdate <= COALESCE(ar.deliverydate, ar.transdate)
|
|
742 |
AND startdate <= COALESCE(ar.transdate)
|
742 |
743 |
ORDER BY startdate DESC LIMIT 1
|
743 |
744 |
)
|
744 |
745 |
)
|
... | ... | |
776 |
777 |
tk.id = (
|
777 |
778 |
SELECT id FROM taxkeys
|
778 |
779 |
WHERE chart_id = ac.chart_id
|
779 |
|
AND startdate <= COALESCE(ar.deliverydate, ar.transdate)
|
|
780 |
AND startdate <= COALESCE(ar.transdate)
|
780 |
781 |
ORDER BY startdate DESC LIMIT 1
|
781 |
782 |
)
|
782 |
783 |
)
|
... | ... | |
823 |
824 |
$project
|
824 |
825 |
GROUP BY tk.pos_ustva
|
825 |
826 |
|
826 |
|
UNION -- alle Ausgaben und Einnahmen direkter gl Buchungen erfassen
|
|
827 |
UNION -- Einnahmen direkter gl Buchungen erfassen
|
827 |
828 |
|
828 |
829 |
SELECT sum
|
829 |
830 |
( - ac.amount) AS amount,
|
... | ... | |
835 |
836 |
tk.id = (
|
836 |
837 |
SELECT id FROM taxkeys
|
837 |
838 |
WHERE chart_id=ac.chart_id
|
838 |
|
--AND taxkey_id=ac.taxkey
|
|
839 |
--AND taxkey_id=ac.taxkey
|
|
840 |
AND NOT $gltaxkey_where
|
839 |
841 |
AND startdate <= COALESCE(ac.transdate)
|
840 |
842 |
ORDER BY startdate DESC LIMIT 1
|
841 |
843 |
)
|
... | ... | |
847 |
849 |
$dpt_from
|
848 |
850 |
$project
|
849 |
851 |
GROUP BY tk.pos_ustva
|
|
852 |
|
|
853 |
|
|
854 |
UNION -- Ausgaben direkter gl Buchungen erfassen
|
|
855 |
|
|
856 |
SELECT sum
|
|
857 |
(ac.amount) AS amount,
|
|
858 |
tk.pos_ustva
|
|
859 |
FROM acc_trans ac
|
|
860 |
JOIN chart c ON (c.id = ac.chart_id)
|
|
861 |
JOIN gl a ON (a.id = ac.trans_id)
|
|
862 |
LEFT JOIN taxkeys tk ON (
|
|
863 |
tk.id = (
|
|
864 |
SELECT id FROM taxkeys
|
|
865 |
WHERE chart_id=ac.chart_id
|
|
866 |
--AND taxkey_id=ac.taxkey
|
|
867 |
AND $gltaxkey_where
|
|
868 |
AND startdate <= COALESCE(ac.transdate)
|
|
869 |
ORDER BY startdate DESC LIMIT 1
|
|
870 |
)
|
|
871 |
)
|
|
872 |
|
|
873 |
$dpt_join
|
|
874 |
WHERE 1 = 1
|
|
875 |
$where
|
|
876 |
$dpt_from
|
|
877 |
$project
|
|
878 |
GROUP BY tk.pos_ustva
|
|
879 |
|
850 |
880 |
|;
|
851 |
881 |
|
852 |
882 |
my @accno;
|
2 Fehler im USTVA Modul beseitigt. Zwei Steuerkonten wurden nicht beruecksichtigt und bei
GL-Buchungen wurde die Steuer nicht immer korrekt aufsummiert