Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dceb9f20

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID dceb9f20c37fca889bb722293833a81cb876ac17
  • Vorgänger 3af5e2e0
  • Nachfolger 5ac0b1b2

Bugfix von chart_link und tax_id in acc_trans

Es gab noch einige Bugs bei VK- und EK-Rechnungen.

1. Der Steuerschlüssel wurde nicht richtig geschrieben.
2. tax_id war noch an einigen Stellen NULL.

Unterschiede anzeigen:

SL/IR.pm
269 269

  
270 270
            # allocated >= 0
271 271
            # add entry for inventory, this one is for the sold item
272
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?),
272
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?,
273
                               (SELECT taxkey_id 
274
                                FROM taxkeys 
275
                                WHERE chart_id= ?
276
                                AND startdate <= ?
277
                                ORDER BY startdate DESC LIMIT 1),
273 278
                               (SELECT tax_id 
274 279
                                FROM taxkeys 
275
                                WHERE chart_id= (SELECT id  
276
                                                 FROM chart 
277
                                                 WHERE accno = ?) 
280
                                WHERE chart_id= ?
278 281
                                AND startdate <= ?
279 282
                                ORDER BY startdate DESC LIMIT 1),
280 283
                               (SELECT chart_link FROM chart WHERE id = ?))|;
281
            @values = ($ref->{trans_id},  $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id}, $ref->{inventory_accno_id}, $ref->{transdate}, $ref->{inventory_accno_id});
284
            @values = ($ref->{trans_id},  $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id}, $ref->{transdate}, $ref->{inventory_accno_id}, $ref->{transdate}, 
285
                       $ref->{inventory_accno_id});
282 286
            do_query($form, $dbh, $query, @values);
283 287

  
284 288
# add expense
285
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?, (SELECT taxkey from tax WHERE chart_id = ?),
289
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?,
290
                                (SELECT taxkey_id 
291
                                 FROM taxkeys 
292
                                 WHERE chart_id= ?
293
                                 AND startdate <= ? 
294
                                 ORDER BY startdate DESC LIMIT 1),
286 295
                                (SELECT tax_id 
287 296
                                 FROM taxkeys 
288
                                 WHERE chart_id= (SELECT id  
289
                                                  FROM chart 
290
                                                  WHERE accno = ?) 
297
                                 WHERE chart_id= ?
291 298
                                 AND startdate <= ? 
292 299
                                 ORDER BY startdate DESC LIMIT 1),
293 300
                                (SELECT chart_link FROM chart WHERE id = ?))|;
294
            @values = ($ref->{trans_id},  $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id}, $ref->{expense_accno_id}, $ref->{transdate},  $ref->{expense_accno_id});
301
            @values = ($ref->{trans_id},  $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id}, $ref->{transdate}, $ref->{expense_accno_id}, $ref->{transdate},
302
                       $ref->{expense_accno_id});
295 303
            do_query($form, $dbh, $query, @values);
296 304
          }
297 305
        };
......
496 504

  
497 505
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id, chart_link)
498 506
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
499
                  (SELECT taxkey_id  FROM chart WHERE accno = ?), ?,
507
                  (SELECT taxkey_id 
508
                   FROM taxkeys 
509
                   WHERE chart_id= (SELECT id  
510
                                    FROM chart 
511
                                    WHERE accno = ?) 
512
                   AND startdate <= ? 
513
                   ORDER BY startdate DESC LIMIT 1),
514
                  ?,
500 515
                  (SELECT tax_id 
501 516
                   FROM taxkeys 
502 517
                   WHERE chart_id= (SELECT id  
......
506 521
                   ORDER BY startdate DESC LIMIT 1),
507 522
                  (SELECT link FROM chart WHERE accno = ?))|;
508 523
      @values = ($trans_id, $accno, $form->{amount}{$trans_id}{$accno},
509
                 conv_date($form->{invdate}), $accno, $project_id, $accno, conv_date($form->{invdate}), $accno);
524
                 conv_date($form->{invdate}), $accno, conv_date($form->{invdate}), $project_id, $accno, conv_date($form->{invdate}), $accno);
510 525
      do_query($form, $dbh, $query, @values);
511 526
    }
512 527
  }
......
543 558
    if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) {
544 559
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id, chart_link)
545 560
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
546
                          (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
561
                          (SELECT taxkey_id 
562
                           FROM taxkeys 
563
                           WHERE chart_id= (SELECT id  
564
                                            FROM chart 
565
                                            WHERE accno = ?) 
566
                           AND startdate <= ? 
567
                           ORDER BY startdate DESC LIMIT 1),
568
                          ?,
547 569
                          (SELECT tax_id 
548 570
                           FROM taxkeys 
549 571
                           WHERE chart_id= (SELECT id  
......
553 575
                           ORDER BY startdate DESC LIMIT 1),
554 576
                          (SELECT link FROM chart WHERE accno = ?))|;
555 577
      @values = (conv_i($form->{id}), $form->{AP}, $amount,
556
                 $form->{"datepaid_$i"}, $form->{AP}, $project_id, $form->{AP}, conv_date($form->{"datepaid_$i"}), $form->{AP});
578
                 $form->{"datepaid_$i"}, $form->{AP}, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AP}, conv_date($form->{"datepaid_$i"}), $form->{AP});
557 579
      do_query($form, $dbh, $query, @values);
558 580
    }
559 581

  
......
563 585
    $query =
564 586
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id, tax_id, chart_link)
565 587
                VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?,
566
                (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
588
                (SELECT taxkey_id 
589
                 FROM taxkeys 
590
                 WHERE chart_id= (SELECT id  
591
                                  FROM chart WHERE accno = ?) 
592
                 AND startdate <= ? 
593
                 ORDER BY startdate DESC LIMIT 1),
594
                ?,
567 595
                (SELECT tax_id 
568 596
                 FROM taxkeys 
569 597
                 WHERE chart_id= (SELECT id  
......
572 600
                 ORDER BY startdate DESC LIMIT 1),
573 601
                (SELECT link FROM chart WHERE accno = ?))|;
574 602
    @values = (conv_i($form->{id}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
575
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id, $accno, conv_date($form->{"datepaid_$i"}), $accno);
603
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, conv_date($form->{"datepaid_$i"}), $project_id, $accno, conv_date($form->{"datepaid_$i"}), $accno);
576 604
    do_query($form, $dbh, $query, @values);
577 605

  
578 606
    $exchangerate = 0;
......
612 640

  
613 641
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id, tax_id, chart_link)
614 642
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1', 0, ?,
615
                  (SELECT tax_id 
616
                   FROM taxkeys 
617
                   WHERE chart_id= (SELECT id  
618
                                   FROM chart 
619
                                   WHERE accno = ?) 
620
                   AND startdate <= ? 
621
                   ORDER BY startdate DESC LIMIT 1),
643
                  (SELECT id FROM tax WHERE taxkey=0 LIMIT 1),
622 644
                  (SELECT link FROM chart WHERE accno = ?))|;
623
      @values = (conv_i($form->{id}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $project_id, $accno, $form->{fx}{$accno}{$transdate}, $accno);
645
      @values = (conv_i($form->{id}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $project_id, $accno);
624 646
      do_query($form, $dbh, $query, @values);
625 647
    }
626 648
  }
SL/IS.pm
870 870
                                       WHERE accno = ?) 
871 871
                      AND startdate <= ? 
872 872
                      ORDER BY startdate DESC LIMIT 1),
873
                     (SELECT taxkey_id  FROM chart WHERE accno = ?), ?,
873
                     (SELECT taxkey_id
874
                      FROM taxkeys 
875
                      WHERE chart_id= (SELECT id  
876
                                       FROM chart 
877
                                       WHERE accno = ?) 
878
                      AND startdate <= ? 
879
                      ORDER BY startdate DESC LIMIT 1),
880
                     ?,
874 881
                     (SELECT link FROM chart WHERE accno = ?))|;
875
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_i($project_id), $accno);
882
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_date($taxdate), conv_i($project_id), $accno);
876 883
        do_query($form, $dbh, $query, @values);
877 884
        $form->{amount}{$trans_id}{$accno} = 0;
878 885
      }
......
892 899
                                       WHERE accno = ?) 
893 900
                      AND startdate <= ? 
894 901
                      ORDER BY startdate DESC LIMIT 1),
895
                     (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
902
                     (SELECT taxkey_id 
903
                      FROM taxkeys 
904
                      WHERE chart_id= (SELECT id 
905
                                       FROM chart 
906
                                       WHERE accno = ?) 
907
                      AND startdate <= ? 
908
                      ORDER BY startdate DESC LIMIT 1),
909
                     ?,
896 910
                     (SELECT link FROM chart WHERE accno = ?))|;
897
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_i($project_id), $accno);
911
        @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_date($taxdate), conv_i($project_id), $accno);
898 912
        do_query($form, $dbh, $query, @values);
899 913
      }
900 914
    }
......
949 963
                                     WHERE accno = ?) 
950 964
                    AND startdate <= ? 
951 965
                    ORDER BY startdate DESC LIMIT 1),
952
                   (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
966
                   (SELECT taxkey_id 
967
                    FROM taxkeys 
968
                    WHERE chart_id= (SELECT id  
969
                                     FROM chart 
970
                                     WHERE accno = ?) 
971
                    AND startdate <= ? 
972
                    ORDER BY startdate DESC LIMIT 1),
973
                   ?,
953 974
                   (SELECT link FROM chart WHERE accno = ?))|;
954
        @values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, conv_date($taxdate), $form->{AR}, $project_id, $form->{AR});
975
        @values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, conv_date($taxdate), $form->{AR}, conv_date($taxdate), $project_id, $form->{AR});
955 976
        do_query($form, $dbh, $query, @values);
956 977
      }
957 978

  
......
969 990
                                   WHERE accno = ?) 
970 991
                  AND startdate <= ? 
971 992
                  ORDER BY startdate DESC LIMIT 1),
972
                 (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
993
                 (SELECT taxkey_id 
994
                  FROM taxkeys 
995
                  WHERE chart_id= (SELECT id  
996
                                   FROM chart 
997
                                   WHERE accno = ?) 
998
                  AND startdate <= ? 
999
                  ORDER BY startdate DESC LIMIT 1),
1000
                 ?,
973 1001
                 (SELECT link FROM chart WHERE accno = ?))|;
974 1002
      @values = (conv_i($form->{"id"}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
975
                 $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, conv_date($taxdate), $accno, $project_id, $accno);
1003
                 $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, conv_date($taxdate), $accno, conv_date($taxdate), $project_id, $accno);
976 1004
      do_query($form, $dbh, $query, @values);
977 1005

  
978 1006
      # exchangerate difference
......
1021 1049
                                   WHERE accno = ?) 
1022 1050
                  AND startdate <= ? 
1023 1051
                  ORDER BY startdate DESC LIMIT 1),
1024
                 (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
1052
                 (SELECT taxkey_id 
1053
                  FROM taxkeys 
1054
                  WHERE chart_id= (SELECT id  
1055
                                   FROM chart 
1056
                                   WHERE accno = ?) 
1057
                  AND startdate <= ? 
1058
                  ORDER BY startdate DESC LIMIT 1),
1059
                 ?,
1025 1060
                 (SELECT link FROM chart WHERE accno = ?))|;
1026
        @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_date($taxdate), $accno, conv_i($project_id), $accno);
1061
        @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_date($taxdate), $accno, conv_date($taxdate), conv_i($project_id), $accno);
1027 1062
        do_query($form, $dbh, $query, @values);
1028 1063
      }
1029 1064
    }

Auch abrufbar als: Unified diff