Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 361d8846

Von Sven Schöling vor fast 12 Jahren hinzugefügt

  • ID 361d8846ed83e99bb34b13c46b4e6b5a7090c70f
  • Vorgänger e2a31c82
  • Nachfolger 4b26e243

Revert "tax_id in acc_trans"

This reverts commit 357d134d265637fb37ed2cd47da2ce3ef44d015a.

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 = ?),
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});
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});
275 274
            do_query($form, $dbh, $query, @values);
276 275

  
277 276
# add expense
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});
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});
281 279
            do_query($form, $dbh, $query, @values);
282 280
          }
283 281
        };
......
480 478

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

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

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

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

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

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

  
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});
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);
583 577
      do_query($form, $dbh, $query, @values);
584 578
    }
585 579
  }

Auch abrufbar als: Unified diff