530 |
530 |
attribute => 'position',
|
531 |
531 |
dec_places => '2',
|
532 |
532 |
});
|
533 |
|
|
|
533 |
push @category_cent, ("pos_ustva_811b_kivi", "pos_ustva_861b_kivi");
|
534 |
534 |
if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') {
|
535 |
535 |
push @category_cent, qw(Z43 Z45 Z53 Z54 Z62 Z65 Z67);
|
536 |
536 |
}
|
... | ... | |
541 |
541 |
attribute => 'position',
|
542 |
542 |
dec_places => '0',
|
543 |
543 |
});
|
544 |
|
|
|
544 |
push @category_euro, ("pos_ustva_81b_kivi", "pos_ustva_86b_kivi");
|
545 |
545 |
@{$form->{category_cent}} = @category_cent;
|
546 |
546 |
@{$form->{category_euro}} = @category_euro;
|
547 |
547 |
$form->{decimalplaces} *= 1;
|
... | ... | |
687 |
687 |
SUM( ac.amount *
|
688 |
688 |
-- Bezahlt / Rechnungssumme
|
689 |
689 |
(
|
690 |
|
SELECT SUM(acc.amount)
|
|
690 |
SELECT SUM(acc.amount), t.rate
|
691 |
691 |
FROM acc_trans acc
|
692 |
692 |
INNER JOIN chart c ON (acc.chart_id = c.id
|
693 |
693 |
AND c.link like '%AR_paid%')
|
... | ... | |
705 |
705 |
FROM acc_trans ac
|
706 |
706 |
LEFT JOIN chart c ON (c.id = ac.chart_id)
|
707 |
707 |
LEFT JOIN ar ON (ar.id = ac.trans_id)
|
|
708 |
LEFT JOIN tax t ON (t.id = ac.tax_id)
|
708 |
709 |
LEFT JOIN taxkeys tk ON (
|
709 |
710 |
tk.id = (
|
710 |
711 |
SELECT id FROM taxkeys
|
... | ... | |
716 |
717 |
)
|
717 |
718 |
WHERE
|
718 |
719 |
$acc_trans_where
|
719 |
|
GROUP BY tk.pos_ustva
|
|
720 |
GROUP BY tk.pos_ustva, t.rate
|
720 |
721 |
|;
|
721 |
722 |
|
722 |
723 |
} elsif ($form->{accounting_method} eq 'accrual') {
|
... | ... | |
728 |
729 |
-- Alle Einnahmen AR und pos_ustva erfassen
|
729 |
730 |
SELECT
|
730 |
731 |
- sum(ac.amount) AS amount,
|
731 |
|
tk.pos_ustva
|
|
732 |
tk.pos_ustva, t.rate
|
732 |
733 |
FROM acc_trans ac
|
733 |
734 |
JOIN chart c ON (c.id = ac.chart_id)
|
734 |
735 |
JOIN ar ON (ar.id = ac.trans_id)
|
|
736 |
JOIN tax t ON (t.id = ac.tax_id)
|
735 |
737 |
JOIN taxkeys tk ON (
|
736 |
738 |
tk.id = (
|
737 |
739 |
SELECT id FROM taxkeys
|
... | ... | |
743 |
745 |
$dpt_join
|
744 |
746 |
WHERE 1 = 1
|
745 |
747 |
$where
|
746 |
|
GROUP BY tk.pos_ustva
|
|
748 |
GROUP BY tk.pos_ustva, t.rate
|
747 |
749 |
|;
|
748 |
750 |
|
749 |
751 |
} else {
|
... | ... | |
761 |
763 |
|
762 |
764 |
SELECT
|
763 |
765 |
sum(ac.amount) AS amount,
|
764 |
|
tk.pos_ustva
|
|
766 |
tk.pos_ustva, t.rate
|
765 |
767 |
FROM acc_trans ac
|
766 |
768 |
JOIN ap ON (ap.id = ac.trans_id )
|
767 |
769 |
JOIN chart c ON (c.id = ac.chart_id)
|
|
770 |
JOIN tax t ON (t.id = ac.tax_id)
|
768 |
771 |
LEFT JOIN taxkeys tk ON (
|
769 |
772 |
tk.id = (
|
770 |
773 |
SELECT id FROM taxkeys
|
... | ... | |
778 |
781 |
WHERE
|
779 |
782 |
1=1
|
780 |
783 |
$where
|
781 |
|
GROUP BY tk.pos_ustva
|
|
784 |
GROUP BY tk.pos_ustva, t.rate
|
782 |
785 |
|
783 |
786 |
UNION -- Einnahmen direkter gl Buchungen erfassen
|
784 |
787 |
|
785 |
788 |
SELECT sum
|
786 |
789 |
( - ac.amount) AS amount,
|
787 |
|
tk.pos_ustva
|
|
790 |
tk.pos_ustva, t.rate
|
788 |
791 |
FROM acc_trans ac
|
789 |
792 |
JOIN chart c ON (c.id = ac.chart_id)
|
790 |
793 |
JOIN gl a ON (a.id = ac.trans_id)
|
|
794 |
JOIN tax t ON (t.id = ac.tax_id)
|
791 |
795 |
LEFT JOIN taxkeys tk ON (
|
792 |
796 |
tk.id = (
|
793 |
797 |
SELECT id FROM taxkeys
|
... | ... | |
801 |
805 |
$dpt_join
|
802 |
806 |
WHERE 1 = 1
|
803 |
807 |
$where
|
804 |
|
GROUP BY tk.pos_ustva
|
|
808 |
GROUP BY tk.pos_ustva, t.rate
|
805 |
809 |
|
806 |
810 |
|
807 |
811 |
UNION -- Ausgaben direkter gl Buchungen erfassen
|
808 |
812 |
|
809 |
813 |
SELECT sum
|
810 |
814 |
(ac.amount) AS amount,
|
811 |
|
tk.pos_ustva
|
|
815 |
tk.pos_ustva, t.rate
|
812 |
816 |
FROM acc_trans ac
|
813 |
817 |
JOIN chart c ON (c.id = ac.chart_id)
|
814 |
818 |
JOIN gl a ON (a.id = ac.trans_id)
|
|
819 |
JOIN tax t ON (t.id = ac.tax_id)
|
815 |
820 |
LEFT JOIN taxkeys tk ON (
|
816 |
821 |
tk.id = (
|
817 |
822 |
SELECT id FROM taxkeys
|
... | ... | |
825 |
830 |
$dpt_join
|
826 |
831 |
WHERE 1 = 1
|
827 |
832 |
$where
|
828 |
|
GROUP BY tk.pos_ustva
|
|
833 |
GROUP BY tk.pos_ustva, t.rate
|
829 |
834 |
|
830 |
835 |
|;
|
831 |
836 |
|
... | ... | |
845 |
850 |
next unless $ref->{$category};
|
846 |
851 |
$ref->{amount} *= -1;
|
847 |
852 |
$form->{ $ref->{$category} } += $ref->{amount};
|
|
853 |
|
|
854 |
# umsatzsteuer 16% temp
|
|
855 |
if ($ref->{rate} == 0.16 && $ref->{pos_ustva} ne '66') {
|
|
856 |
if ($ref->{pos_ustva} eq '35') {
|
|
857 |
$form->{"pos_ustva_81b_kivi"} += $ref->{amount};
|
|
858 |
} elsif ($ref->{pos_ustva} eq '36') {
|
|
859 |
$form->{"pos_ustva_811b_kivi"} += $ref->{amount};
|
|
860 |
} else { die "Kein pos_ustva Eintrag!" . Dumper($ref); }
|
|
861 |
}
|
|
862 |
# umsatzsteuer 5% temp
|
|
863 |
if ($ref->{rate} == 0.05 && $ref->{pos_ustva} ne '66') {
|
|
864 |
if ($ref->{pos_ustva} eq '35') {
|
|
865 |
$form->{"pos_ustva_86b_kivi"} += $ref->{amount};
|
|
866 |
} elsif ($ref->{pos_ustva} eq '36') {
|
|
867 |
$form->{"pos_ustva_861b_kivi"} += $ref->{amount};
|
|
868 |
} else { die "Kein pos_ustva Eintrag!" . Dumper($ref); }
|
|
869 |
}
|
|
870 |
|
848 |
871 |
}
|
849 |
872 |
|
850 |
873 |
$sth->finish;
|
USTVA kivi Infofelder für temporäre Mehrwertsteuer