Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 18942bd7

Von Udo Spallek vor fast 18 Jahren hinzugefügt

  • ID 18942bd70d66bd2348c6550887bc2994dfcaf358
  • Vorgänger 7643cf44
  • Nachfolger 635dd08d

USTVA: Patch zur besseren Unterstuetzung der oesterreichischen Verhaeltnisse.

Unterschiede anzeigen:

SL/USTVA.pm
594 594
    $form->{"$item"} = 0;
595 595
  }
596 596

  
597
  $form->{coa} = coa_get($dbh);
598
  $main::lxdebug->message(LXDebug::DEBUG2, "COA: $form->{coa}");
599

  
597 600
  &get_accounts_ustva($dbh, $last_period, $form->{fromdate}, $form->{todate},
598 601
                      $form, $category);
599 602

  
603
  ###########################################
604
  #
605
  # Nationspecific Modfications
606
  #
607
  ###########################################
608
  
609
  # Germany
610
  
611
  if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU'){
612
  
613
    # 16%/19% Umstellung
614
    # Umordnen der Kennziffern
615
    if ( $form->{year} < 2007) {
616
      $form->{35} += $form->{81};
617
      $form->{36} += $form->{811};
618
      $form->{95} += $form->{89};
619
      $form->{98} += $form->{891};
620
      map { delete $form->{$_} } qw(81 811 89 891);
621
    } else {
622
      $form->{35} += $form->{51};
623
      $form->{36} += $form->{511};
624
      $form->{95} += $form->{97};
625
      $form->{98} += $form->{971};
626
      map { delete $form->{$_} } qw(51 511 97 971);
627
    }
600 628

  
601
  # 16%/19% Umstellung
602
  # Umordnen der Kennziffern
603
  if ( $form->{year} < 2007) {
604
    $form->{35} += $form->{81};
605
    $form->{36} += $form->{811};
606
    $form->{95} += $form->{89};
607
    $form->{98} += $form->{891};
608
    map { delete $form->{$_} } qw(81 811 89 891);
609
  } else {
610
    $form->{35} += $form->{51};
611
    $form->{36} += $form->{511};
612
    $form->{95} += $form->{97};
613
    $form->{98} += $form->{971};
614
    map { delete $form->{$_} } qw(51 511 97 971);
615 629
  }
616 630

  
617 631

  
632
  # Fixme: Wird auch noch f?r Oesterreich gebraucht, 
633
  # weil kein eigenes Ausgabeformular
634
  # sotte aber aus der allgem?inen Steuerberechnung verschwinden
618 635
  #
619 636
  # Berechnung der USTVA Formularfelder laut Bogen 207
620 637
  #
......
646 663
  $main::lxdebug->leave_sub();
647 664
}
648 665

  
666
sub coa_get {
667

  
668
  my ($dbh) = @_;
669
  
670
  my $query= qq|SELECT coa FROM defaults|;
671

  
672
  my $sth = $dbh->prepare($query);
673
  
674
  $sth->execute || $form->dberror($query);
675
    
676
  ($ref) = $sth->fetchrow_array;
677
  
678
  return $ref;
679

  
680
};
681

  
649 682
sub get_accounts_ustva {
650 683
  $main::lxdebug->enter_sub();
651 684

  
......
664 697
  my $APwhere  = '';
665 698
  my $arwhere  = "";
666 699
  my $item;
667
  my $gltaxkey_where = "(tk.pos_ustva>=59 AND tk.pos_ustva<=66)";
700

  
701
    my $gltaxkey_where = "(tk.pos_ustva>=59 AND tk.pos_ustva<=66)";
668 702

  
669 703
  if ($fromdate) {
670 704
    if ($form->{method} eq 'cash') {
......
679 713
  if ($todate) {
680 714
    $where    .= " AND ac.transdate <= '$todate'";
681 715
    $ARwhere  .= " AND acc.transdate <= '$todate'";
682
    $subwhere .= " AND transdate <= '$todate'";
683
    $APwhere  .= " AND AP.transdate <= '$todate'";     
684 716
  }
685 717

  
686 718
  if ($department_id) {
......
806 838
         sum(ac.amount) AS amount, 
807 839
         tk.pos_ustva
808 840
       FROM acc_trans ac
809
       JOIN AP ON (AP.id = ac.trans_id )
841
       JOIN ap ON (ap.id = ac.trans_id )
810 842
       JOIN chart c ON (c.id = ac.chart_id)
811 843
       LEFT JOIN taxkeys tk ON (
812 844
           tk.id = (
813 845
             SELECT id FROM taxkeys 
814 846
             WHERE chart_id=ac.chart_id 
815
               --AND taxkey_id=ac.taxkey 
847
               AND taxkey_id = ac.taxkey 
816 848
               AND startdate <= COALESCE(AP.transdate)
817 849
             ORDER BY startdate DESC LIMIT 1
818 850
           )
819 851
       )
820 852
       WHERE
821 853
       1=1
822
       $APwhere
854
       $where
823 855
       $dpt_where
824 856
       $project
825 857
       GROUP BY tk.pos_ustva
......
836 868
         tk.id = (
837 869
           SELECT id FROM taxkeys 
838 870
           WHERE chart_id=ac.chart_id 
839
             --AND taxkey_id=ac.taxkey
840 871
             AND NOT $gltaxkey_where  
841 872
             AND startdate <= COALESCE(ac.transdate)
842 873
           ORDER BY startdate DESC LIMIT 1
......
863 894
         tk.id = (
864 895
           SELECT id FROM taxkeys 
865 896
           WHERE chart_id=ac.chart_id 
866
             --AND taxkey_id=ac.taxkey
867 897
             AND $gltaxkey_where 
868 898
             AND startdate <= COALESCE(ac.transdate)
869 899
           ORDER BY startdate DESC LIMIT 1

Auch abrufbar als: Unified diff