Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2567740e

Von Jan Büren vor mehr als 4 Jahren hinzugefügt

  • ID 2567740ec63137b5a51542d11ea69428d17b3783
  • Vorgänger 875dfae7
  • Nachfolger e655480e

USTVA temp MwSt Konten anzeigen

Unterschiede anzeigen:

SL/USTVA.pm
568 568

  
569 569
  # Germany
570 570

  
571
  if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU'){
571
  if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') {
572 572

  
573 573
    # 16%/19% Umstellung
574 574
    # Umordnen der Kennziffern
......
687 687
         SUM( ac.amount *
688 688
            -- Bezahlt / Rechnungssumme
689 689
           (
690
             SELECT SUM(acc.amount), t.rate
690
             SELECT SUM(acc.amount), t.rate, c.accno
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%')
......
717 717
       )
718 718
       WHERE
719 719
       $acc_trans_where
720
       GROUP BY tk.pos_ustva, t.rate
720
       GROUP BY tk.pos_ustva, t.rate, c.accno
721 721
    |;
722 722

  
723 723
  } elsif ($form->{accounting_method} eq 'accrual') {
......
729 729
       -- Alle Einnahmen AR und pos_ustva erfassen
730 730
       SELECT
731 731
         - sum(ac.amount) AS amount,
732
         tk.pos_ustva, t.rate
732
         tk.pos_ustva, t.rate, c.accno
733 733
       FROM acc_trans ac
734 734
       JOIN chart c ON (c.id = ac.chart_id)
735 735
       JOIN ar ON (ar.id = ac.trans_id)
......
745 745
       $dpt_join
746 746
       WHERE 1 = 1
747 747
       $where
748
       GROUP BY tk.pos_ustva, t.rate
748
       GROUP BY tk.pos_ustva, t.rate, c.accno
749 749
  |;
750 750

  
751 751
  } else {
......
763 763

  
764 764
       SELECT
765 765
         sum(ac.amount) AS amount,
766
         tk.pos_ustva, t.rate
766
         tk.pos_ustva, t.rate, c.accno
767 767
       FROM acc_trans ac
768 768
       JOIN ap ON (ap.id = ac.trans_id )
769 769
       JOIN chart c ON (c.id = ac.chart_id)
......
781 781
       WHERE
782 782
       1=1
783 783
       $where
784
       GROUP BY tk.pos_ustva, t.rate
784
       GROUP BY tk.pos_ustva, t.rate, c.accno
785 785

  
786 786
     UNION -- Einnahmen direkter gl Buchungen erfassen
787 787

  
788 788
       SELECT sum
789 789
         ( - ac.amount) AS amount,
790
         tk.pos_ustva, t.rate
790
         tk.pos_ustva, t.rate, c.accno
791 791
       FROM acc_trans ac
792 792
       JOIN chart c ON (c.id = ac.chart_id)
793 793
       JOIN gl a ON (a.id = ac.trans_id)
......
805 805
       $dpt_join
806 806
       WHERE 1 = 1
807 807
       $where
808
       GROUP BY tk.pos_ustva, t.rate
808
       GROUP BY tk.pos_ustva, t.rate, c.accno
809 809

  
810 810

  
811 811
     UNION -- Ausgaben direkter gl Buchungen erfassen
812 812

  
813 813
       SELECT sum
814 814
         (ac.amount) AS amount,
815
         tk.pos_ustva, t.rate
815
         tk.pos_ustva, t.rate, c.accno
816 816
       FROM acc_trans ac
817 817
       JOIN chart c ON (c.id = ac.chart_id)
818 818
       JOIN gl a ON (a.id = ac.trans_id)
......
830 830
       $dpt_join
831 831
       WHERE 1 = 1
832 832
       $where
833
       GROUP BY tk.pos_ustva, t.rate
833
       GROUP BY tk.pos_ustva, t.rate, c.accno
834 834

  
835 835
  |;
836 836

  
......
845 845
  my $sth = $dbh->prepare($query);
846 846

  
847 847
  $sth->execute || $form->dberror($query);
848

  
848
  # ugly, but we need to use static accnos
849
  my $accno_five    = 3803; # SKR04
850
  my $accno_sixteen = 3805; # SKR04
851
  if ($form->{coa} eq 'Germany-DATEV-SKR03EU') {
852
    $accno_five    = 1773;
853
    $accno_sixteen = 1775;
854
  }
849 855
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
850 856
    next unless $ref->{$category};
851 857
    $ref->{amount} *= -1;
852 858
    $form->{ $ref->{$category} } += $ref->{amount};
853 859

  
854
    # umsatzsteuer 16% temp
855
    if ($ref->{rate} == 0.16 && $ref->{pos_ustva} ne '66') {
856
      if ($ref->{pos_ustva} eq '35') {
860
    # umsatzsteuer 16% pos 35
861
    if ($ref->{pos_ustva} eq '35') {
862
      if ($ref->{rate} == 0.16) {
857 863
        $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') {
864
      } elsif ($ref->{rate} == 0.05) {
865 865
        $form->{"pos_ustva_86b_kivi"} += $ref->{amount};
866
      } elsif ($ref->{pos_ustva} eq '36') {
866
      } else {die ("No valid tax rate for pos 35"); }
867
    }
868
    if ($ref->{pos_ustva} eq '36') {
869
      if ($ref->{accno} eq $accno_sixteen) {
870
        $form->{"pos_ustva_811b_kivi"} += $ref->{amount};
871
      } elsif ($ref->{accno} eq $accno_five) {
867 872
        $form->{"pos_ustva_861b_kivi"} += $ref->{amount};
868
      } else { die "Kein pos_ustva Eintrag!" . Dumper($ref); }
873
      } else { die "No valid accno for pos 36"; }
869 874
    }
875
    # umsatzsteuer 5% temp
876
    #if ($ref->{rate} == 0.05 && $ref->{pos_ustva} ne '66') {
877
    #  if ($ref->{pos_ustva} eq '35') {
878
    #    $form->{"pos_ustva_86b_kivi"} += $ref->{amount};
879
    #  } elsif ($ref->{pos_ustva} eq '36') {
880
    #    $form->{"pos_ustva_861b_kivi"} += $ref->{amount};
881
    #  } else { die "Kein pos_ustva Eintrag!" . Dumper($ref); }
882
    #}
870 883

  
871 884
  }
872 885

  

Auch abrufbar als: Unified diff