Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9f07753b

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 9f07753bc46cf5614fe454656f352bc74de5920a
  • Vorgänger 168836cf
  • Nachfolger 02144d2e

Überflüssige Tabellen customertax, vendortax, partstax entfernt

Fixt #2186.

Unterschiede anzeigen:

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

  
288 288
# add expense
289 289
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?,
290
                                (SELECT taxkey_id 
291
                                 FROM taxkeys 
290
                                (SELECT taxkey_id
291
                                 FROM taxkeys
292 292
                                 WHERE chart_id= ?
293
                                 AND startdate <= ? 
293
                                 AND startdate <= ?
294 294
                                 ORDER BY startdate DESC LIMIT 1),
295
                                (SELECT tax_id 
296
                                 FROM taxkeys 
295
                                (SELECT tax_id
296
                                 FROM taxkeys
297 297
                                 WHERE chart_id= ?
298
                                 AND startdate <= ? 
298
                                 AND startdate <= ?
299 299
                                 ORDER BY startdate DESC LIMIT 1),
300 300
                                (SELECT chart_link FROM chart WHERE id = ?))|;
301 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},
......
504 504

  
505 505
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id, chart_link)
506 506
                  VALUES (?, (SELECT 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 <= ? 
507
                  (SELECT taxkey_id
508
                   FROM taxkeys
509
                   WHERE chart_id= (SELECT id
510
                                    FROM chart
511
                                    WHERE accno = ?)
512
                   AND startdate <= ?
513 513
                   ORDER BY startdate DESC LIMIT 1),
514 514
                  ?,
515
                  (SELECT tax_id 
516
                   FROM taxkeys 
517
                   WHERE chart_id= (SELECT id  
518
                                    FROM chart 
519
                                    WHERE accno = ?) 
520
                   AND startdate <= ? 
515
                  (SELECT tax_id
516
                   FROM taxkeys
517
                   WHERE chart_id= (SELECT id
518
                                    FROM chart
519
                                    WHERE accno = ?)
520
                   AND startdate <= ?
521 521
                   ORDER BY startdate DESC LIMIT 1),
522 522
                  (SELECT link FROM chart WHERE accno = ?))|;
523 523
      @values = ($trans_id, $accno, $form->{amount}{$trans_id}{$accno},
......
558 558
    if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) {
559 559
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id, chart_link)
560 560
                  VALUES (?, (SELECT 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 <= ? 
561
                          (SELECT taxkey_id
562
                           FROM taxkeys
563
                           WHERE chart_id= (SELECT id
564
                                            FROM chart
565
                                            WHERE accno = ?)
566
                           AND startdate <= ?
567 567
                           ORDER BY startdate DESC LIMIT 1),
568 568
                          ?,
569
                          (SELECT tax_id 
570
                           FROM taxkeys 
571
                           WHERE chart_id= (SELECT id  
572
                                            FROM chart 
573
                                            WHERE accno = ?) 
574
                           AND startdate <= ? 
569
                          (SELECT tax_id
570
                           FROM taxkeys
571
                           WHERE chart_id= (SELECT id
572
                                            FROM chart
573
                                            WHERE accno = ?)
574
                           AND startdate <= ?
575 575
                           ORDER BY startdate DESC LIMIT 1),
576 576
                          (SELECT link FROM chart WHERE accno = ?))|;
577 577
      @values = (conv_i($form->{id}), $form->{AP}, $amount,
......
585 585
    $query =
586 586
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id, tax_id, chart_link)
587 587
                VALUES (?, (SELECT 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 <= ? 
588
                (SELECT taxkey_id
589
                 FROM taxkeys
590
                 WHERE chart_id= (SELECT id
591
                                  FROM chart WHERE accno = ?)
592
                 AND startdate <= ?
593 593
                 ORDER BY startdate DESC LIMIT 1),
594 594
                ?,
595
                (SELECT tax_id 
596
                 FROM taxkeys 
597
                 WHERE chart_id= (SELECT id  
598
                                  FROM chart WHERE accno = ?) 
599
                 AND startdate <= ? 
595
                (SELECT tax_id
596
                 FROM taxkeys
597
                 WHERE chart_id= (SELECT id
598
                                  FROM chart WHERE accno = ?)
599
                 AND startdate <= ?
600 600
                 ORDER BY startdate DESC LIMIT 1),
601 601
                (SELECT link FROM chart WHERE accno = ?))|;
602 602
    @values = (conv_i($form->{id}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
......
1314 1314
    my $i = 0;
1315 1315
    while (my $ptr = $stw->fetchrow_hashref("NAME_lc")) {
1316 1316

  
1317
      #    if ($customertax{$ref->{accno}}) {
1318 1317
      if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) {
1319 1318
        $i++;
1320 1319
        $ptr->{accno} = $i;

Auch abrufbar als: Unified diff