Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 357d134d

Von Niclas Zimmermann vor fast 12 Jahren hinzugefügt

  • ID 357d134d265637fb37ed2cd47da2ce3ef44d015a
  • Vorgänger c7f777ac
  • Nachfolger da6d6eb0

tax_id in acc_trans

Dieser Commit enthält das Update-Script um eine neue Spalte Namens
'tax_id' in die Tabelle 'acc_trans' einzufügen. Diese Spalte ist
ein Pflichtfeld.

Das Pflichtfeld wird jetzt immer geschrieben bei:

-VK-Rechnungen (auch automatisch erzeugten)
-EK-Rechnungen
-Kreditorenbuchungen
-Debitorenbuchungen
-Dialogbuchungen

Durch das Feld 'tax_id' können in der Tabelle tax der
Steuerschlüssel und der Steuersatz ausgelesen werden.

In diesem Commit wird allerdings der Wert in tax_id nur geschrieben,
im Moment wird er noch nirgendwo ausgelesen.

Unterschiede anzeigen:

SL/IS.pm
818 818

  
819 819
  $project_id = conv_i($form->{"globalproject_id"});
820 820

  
821
  my $taxdate = $form->{deliverydate} ? $form->{deliverydate} : $form->{invdate};
822

  
821 823
  foreach my $trans_id (keys %{ $form->{amount_cogs} }) {
822 824
    foreach my $accno (keys %{ $form->{amount_cogs}{$trans_id} }) {
823 825
      next unless ($form->{expense_inventory} =~ /\Q$accno\E/);
......
826 828

  
827 829
      if (!$payments_only && ($form->{amount_cogs}{$trans_id}{$accno} != 0)) {
828 830
        $query =
829
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
830
               VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 0, ?)|;
831
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
832
               VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT id FROM tax WHERE taxkey=0), 0, ?)|;
831 833
        @values = (conv_i($trans_id), $accno, $form->{amount_cogs}{$trans_id}{$accno}, conv_date($form->{invdate}), conv_i($project_id));
832 834
        do_query($form, $dbh, $query, @values);
833 835
        $form->{amount_cogs}{$trans_id}{$accno} = 0;
......
839 841

  
840 842
      if (!$payments_only && ($form->{amount_cogs}{$trans_id}{$accno} != 0)) {
841 843
        $query =
842
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
843
               VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 0, ?)|;
844
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
845
               VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT id FROM tax WHERE taxkey=0), 0, ?)|;
844 846
        @values = (conv_i($trans_id), $accno, $form->{amount_cogs}{$trans_id}{$accno}, conv_date($form->{invdate}), conv_i($project_id));
845 847
        do_query($form, $dbh, $query, @values);
846 848
      }
......
855 857

  
856 858
      if (!$payments_only && ($form->{amount}{$trans_id}{$accno} != 0)) {
857 859
        $query =
858
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
860
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
859 861
             VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
862
                     (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1),
860 863
                     (SELECT taxkey_id  FROM chart WHERE accno = ?), ?)|;
861
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_i($project_id));
864
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_i($project_id));
862 865
        do_query($form, $dbh, $query, @values);
863 866
        $form->{amount}{$trans_id}{$accno} = 0;
864 867
      }
......
869 872

  
870 873
      if (!$payments_only && ($form->{amount}{$trans_id}{$accno} != 0)) {
871 874
        $query =
872
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
875
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
873 876
             VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
877
                     (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1),
874 878
                     (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
875
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_i($project_id));
879
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_i($project_id));
876 880
        do_query($form, $dbh, $query, @values);
877 881
      }
878 882
    }
......
918 922

  
919 923
      if ($form->{amount}{ $form->{id} }{ $form->{AR} } != 0) {
920 924
        $query =
921
        qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
925
        qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
922 926
           VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
927
                   (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1),
923 928
                   (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
924
        @values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, $project_id);
929
        @values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, conv_date($taxdate), $form->{AR}, $project_id);
925 930
        do_query($form, $dbh, $query, @values);
926 931
      }
927 932

  
......
930 935
      my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
931 936

  
932 937
      $query =
933
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id)
938
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, tax_id, taxkey, project_id)
934 939
         VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?,
940
                 (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1),
935 941
                 (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
936 942
      @values = (conv_i($form->{"id"}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
937
                 $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
943
                 $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, conv_date($taxdate), $accno, $project_id);
938 944
      do_query($form, $dbh, $query, @values);
939 945

  
940 946
      # exchangerate difference
......
974 980
      if ( $form->{fx}{$accno}{$transdate} != 0 ) {
975 981

  
976 982
        $query =
977
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id)
983
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, tax_id, taxkey, project_id)
978 984
             VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1',
979
             (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
980
        @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_i($project_id));
985
                 (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1),
986
                 (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
987
        @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_date($taxdate), $accno, conv_i($project_id));
981 988
        do_query($form, $dbh, $query, @values);
982 989
      }
983 990
    }

Auch abrufbar als: Unified diff