Revision 75cd107d
Von Udo Spallek vor mehr als 18 Jahren hinzugefügt
SL/USTVA.pm | ||
---|---|---|
669 | 669 |
AND ac.project_id = $form->{project_id} |
670 | 670 |
|; |
671 | 671 |
} |
672 |
######################################### |
|
673 |
# Method eq 'cash' = IST Versteuerung |
|
674 |
######################################### |
|
672 | 675 |
|
673 |
if ($form->{method} eq 'cash') { |
|
676 |
if ($form->{method} eq 'cash') {
|
|
674 | 677 |
|
675 | 678 |
$query = qq| |
676 |
|
|
677 | 679 |
SELECT |
678 |
SUM( ac.amount * |
|
680 |
-- Alle tatsaechlichen Zahlungseingaenge |
|
681 |
-- im Voranmeldezeitraum erfassen |
|
682 |
-- (Teilzahlungen werden prozentual auf verschiedene Steuern aufgeteilt) |
|
683 |
SUM( ac.amount * |
|
679 | 684 |
-- Bezahlt / Rechnungssumme |
680 | 685 |
( |
681 | 686 |
SELECT SUM(acc.amount) |
... | ... | |
700 | 705 |
-- Here no where, please. All Transactions ever should be |
701 | 706 |
-- testet if they are paied in the USTVA report period. |
702 | 707 |
GROUP BY c.pos_ustva |
703 |
UNION |
|
704 |
|
|
705 |
SELECT sum(ac.amount) AS amount, |
|
706 |
c.$category |
|
707 |
FROM acc_trans ac |
|
708 |
JOIN chart c ON (c.id = ac.chart_id) |
|
709 |
JOIN ap a ON (a.id = ac.trans_id) |
|
710 |
$dpt_join |
|
711 |
WHERE $where |
|
712 |
$dpt_where |
|
713 |
AND ac.trans_id IN |
|
714 |
( |
|
715 |
SELECT trans_id |
|
716 |
FROM acc_trans |
|
717 |
JOIN chart ON (chart_id = id) |
|
718 |
WHERE link LIKE '%AP_amount%' |
|
719 |
$subwhere |
|
720 |
) |
|
721 |
|
|
722 |
$project |
|
723 |
GROUP BY c.$category |
|
724 |
|
|
725 |
UNION |
|
726 |
|
|
727 |
SELECT sum( |
|
728 |
CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1 |
|
729 |
WHEN c.link LIKE '%AP%' THEN ac.amount * 1 |
|
730 |
END |
|
731 |
) AS amount, |
|
732 |
c.$category |
|
733 |
FROM acc_trans ac |
|
734 |
JOIN chart c ON (c.id = ac.chart_id) |
|
735 |
JOIN gl a ON (a.id = ac.trans_id) |
|
736 |
$dpt_join |
|
737 |
WHERE $where |
|
738 |
$dpt_from |
|
739 |
AND NOT (c.link = 'AR' OR c.link = 'AP') |
|
740 |
$project |
|
741 |
GROUP BY c.$category |
|
742 | 708 |
|
743 |
|;
|
|
709 |
UNION -- alle Ausgaben AP erfassen
|
|
744 | 710 |
|
745 |
} else { |
|
711 |
SELECT sum(ac.amount) AS amount, c.$category |
|
712 |
FROM acc_trans ac |
|
713 |
JOIN chart c ON (c.id = ac.chart_id) |
|
714 |
$dpt_join |
|
715 |
WHERE |
|
716 |
$where |
|
717 |
AND c.link LIKE '%AP_amount%' |
|
718 |
$dpt_where |
|
719 |
$project |
|
720 |
GROUP BY c.$category |
|
721 |
|
|
722 |
UNION -- alle Ausgaben und Einnahmen direkter gl Buchungen erfassen |
|
723 |
|
|
724 |
SELECT sum |
|
725 |
( |
|
726 |
CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1 |
|
727 |
WHEN c.link LIKE '%AP%' THEN ac.amount * 1 |
|
728 |
END |
|
729 |
) AS amount, c.$category |
|
730 |
FROM acc_trans ac |
|
731 |
JOIN chart c ON (c.id = ac.chart_id) |
|
732 |
JOIN gl a ON (a.id = ac.trans_id) |
|
733 |
$dpt_join |
|
734 |
WHERE $where |
|
735 |
$dpt_from |
|
736 |
AND NOT (c.link = 'AR' OR c.link = 'AP') |
|
737 |
$project |
|
738 |
GROUP BY c.$category |
|
739 |
|; |
|
740 |
|
|
741 |
} else { |
|
742 |
######################################### |
|
743 |
# Method eq 'accrual' = Soll Versteuerung |
|
744 |
######################################### |
|
746 | 745 |
|
747 | 746 |
if ($department_id) { |
748 | 747 |
$dpt_join = qq| |
... | ... | |
754 | 753 |
} |
755 | 754 |
|
756 | 755 |
$query = qq| |
757 |
|
|
758 |
SELECT sum( |
|
759 |
CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1 |
|
760 |
WHEN c.link LIKE '%AP%' THEN ac.amount * 1 |
|
761 |
END |
|
762 |
|
|
763 |
) AS amount, |
|
764 |
c.$category |
|
765 |
FROM acc_trans ac |
|
766 |
JOIN chart c ON (c.id = ac.chart_id) |
|
767 |
$dpt_join |
|
768 |
WHERE $where |
|
769 |
$dpt_where |
|
770 |
$project |
|
771 |
GROUP BY c.$category |
|
772 |
|; |
|
756 |
SELECT sum |
|
757 |
( |
|
758 |
CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1 |
|
759 |
WHEN c.link LIKE '%AP%' THEN ac.amount * 1 |
|
760 |
END |
|
761 |
) AS amount, c.$category |
|
762 |
FROM acc_trans ac |
|
763 |
JOIN chart c ON (c.id = ac.chart_id) |
|
764 |
$dpt_join |
|
765 |
WHERE $where |
|
766 |
$dpt_where |
|
767 |
$project |
|
768 |
GROUP BY c.$category |
|
769 |
|; |
|
773 | 770 |
} |
774 | 771 |
|
775 | 772 |
my @accno; |
Auch abrufbar als: Unified diff
Solved Bug: 385 Skontokonzept (WIKI) und USTVA vertragen sich wieder.