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/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) VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?))|;
273
            @values = ($ref->{trans_id},  $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id});
272
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?),
273
                                (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
274
            @values = ($ref->{trans_id},  $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id}, $ref->{inventory_accno_id}, $ref->{transdate});
274 275
            do_query($form, $dbh, $query, @values);
275 276

  
276 277
# add expense
277
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES (?, ?, ?, ?, (SELECT taxkey from tax WHERE chart_id = ?))|;
278
            @values = ($ref->{trans_id},  $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id});
278
            $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) VALUES (?, ?, ?, ?, (SELECT taxkey from tax WHERE chart_id = ?),
279
                                (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
280
            @values = ($ref->{trans_id},  $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id}, $ref->{expense_accno_id}, $ref->{transdate});
279 281
            do_query($form, $dbh, $query, @values);
280 282
          }
281 283
        };
......
478 480

  
479 481
      next if $payments_only || !$form->{amount}{$trans_id}{$accno};
480 482

  
481
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
483
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id)
482 484
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
483
                  (SELECT taxkey_id  FROM chart WHERE accno = ?), ?)|;
485
                  (SELECT taxkey_id  FROM chart WHERE accno = ?), ?,
486
                  (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
484 487
      @values = ($trans_id, $accno, $form->{amount}{$trans_id}{$accno},
485
                 conv_date($form->{invdate}), $accno, $project_id);
488
                 conv_date($form->{invdate}), $accno, $project_id, $accno, conv_date($form->{invdate}));
486 489
      do_query($form, $dbh, $query, @values);
487 490
    }
488 491
  }
......
517 520

  
518 521
    # record AP
519 522
    if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) {
520
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
523
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id)
521 524
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
522
                          (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
525
                          (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
526
                          (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
523 527
      @values = (conv_i($form->{id}), $form->{AP}, $amount,
524
                 $form->{"datepaid_$i"}, $form->{AP}, $project_id);
528
                 $form->{"datepaid_$i"}, $form->{AP}, $project_id, $form->{AP}, conv_date($form->{"datepaid_$i"}));
525 529
      do_query($form, $dbh, $query, @values);
526 530
    }
527 531

  
......
529 533
    my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
530 534

  
531 535
    $query =
532
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id)
536
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id, tax_id)
533 537
                VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?,
534
                (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
538
                (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
539
                (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
535 540
    @values = (conv_i($form->{id}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
536
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
541
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id, $accno, conv_date($form->{"datepaid_$i"}));
537 542
    do_query($form, $dbh, $query, @values);
538 543

  
539 544
    $exchangerate = 0;
......
571 576
      $form->{fx}{$accno}{$transdate} = $form->round_amount($form->{fx}{$accno}{$transdate}, 2);
572 577
      next if ($form->{fx}{$accno}{$transdate} == 0);
573 578

  
574
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id)
575
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1', 0, ?)|;
576
      @values = (conv_i($form->{id}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $project_id);
579
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id, tax_id)
580
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1', 0, ?,
581
                  (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
582
      @values = (conv_i($form->{id}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $project_id, $accno, $form->{fx}{$accno}{$transdate});
577 583
      do_query($form, $dbh, $query, @values);
578 584
    }
579 585
  }

Auch abrufbar als: Unified diff