Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1408ca1

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID d1408ca13458a782cbde2b768cdd7abdbdcb9348
  • Vorgänger 2d881637
  • Nachfolger 3af5e2e0

chart_link in acc_trans

Erstellt ein neues Pflichtfeld chart_link in der Tabelle acc_trans.
Wird bisher nur beschrieben und noch an keiner Stelle ausgelesen.

Conflicts:

SL/AP.pm
SL/AR.pm
SL/IR.pm
SL/IS.pm

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 (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?),
273
                                (SELECT tax_id 
273
                               (SELECT tax_id 
274 274
                                FROM taxkeys 
275 275
                                WHERE chart_id= (SELECT id  
276 276
                                                 FROM chart 
277 277
                                                 WHERE accno = ?) 
278 278
                                AND startdate <= ?
279
                                ORDER BY startdate DESC LIMIT 1))|;
280
            @values = ($ref->{trans_id},  $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id}, $ref->{inventory_accno_id}, $ref->{transdate});
279
                                ORDER BY startdate DESC LIMIT 1),
280
                               (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});
281 282
            do_query($form, $dbh, $query, @values);
282 283

  
283 284
# add expense
......
288 289
                                                  FROM chart 
289 290
                                                  WHERE accno = ?) 
290 291
                                 AND startdate <= ? 
291
                                 ORDER BY startdate DESC LIMIT 1))|;
292
            @values = ($ref->{trans_id},  $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id}, $ref->{expense_accno_id}, $ref->{transdate});
292
                                 ORDER BY startdate DESC LIMIT 1),
293
                                (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});
293 295
            do_query($form, $dbh, $query, @values);
294 296
          }
295 297
        };
......
492 494

  
493 495
      next if $payments_only || !$form->{amount}{$trans_id}{$accno};
494 496

  
495
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id)
497
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id, chart_link)
496 498
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
497 499
                  (SELECT taxkey_id  FROM chart WHERE accno = ?), ?,
498 500
                  (SELECT tax_id 
......
501 503
                                    FROM chart 
502 504
                                    WHERE accno = ?) 
503 505
                   AND startdate <= ? 
504
                   ORDER BY startdate DESC LIMIT 1))|;
506
                   ORDER BY startdate DESC LIMIT 1),
507
                  (SELECT link FROM chart WHERE accno = ?))|;
505 508
      @values = ($trans_id, $accno, $form->{amount}{$trans_id}{$accno},
506
                 conv_date($form->{invdate}), $accno, $project_id, $accno, conv_date($form->{invdate}));
509
                 conv_date($form->{invdate}), $accno, $project_id, $accno, conv_date($form->{invdate}), $accno);
507 510
      do_query($form, $dbh, $query, @values);
508 511
    }
509 512
  }
......
538 541

  
539 542
    # record AP
540 543
    if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) {
541
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id)
544
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id, tax_id, chart_link)
542 545
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
543 546
                          (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
544 547
                          (SELECT tax_id 
......
547 550
                                            FROM chart 
548 551
                                            WHERE accno = ?) 
549 552
                           AND startdate <= ? 
550
                           ORDER BY startdate DESC LIMIT 1))|;
553
                           ORDER BY startdate DESC LIMIT 1),
554
                          (SELECT link FROM chart WHERE accno = ?))|;
551 555
      @values = (conv_i($form->{id}), $form->{AP}, $amount,
552
                 $form->{"datepaid_$i"}, $form->{AP}, $project_id, $form->{AP}, conv_date($form->{"datepaid_$i"}));
556
                 $form->{"datepaid_$i"}, $form->{AP}, $project_id, $form->{AP}, conv_date($form->{"datepaid_$i"}), $form->{AP});
553 557
      do_query($form, $dbh, $query, @values);
554 558
    }
555 559

  
......
557 561
    my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
558 562

  
559 563
    $query =
560
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id, tax_id)
564
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id, tax_id, chart_link)
561 565
                VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?,
562 566
                (SELECT taxkey_id FROM chart WHERE accno = ?), ?,
563 567
                (SELECT tax_id 
......
565 569
                 WHERE chart_id= (SELECT id  
566 570
                                  FROM chart WHERE accno = ?) 
567 571
                 AND startdate <= ? 
568
                 ORDER BY startdate DESC LIMIT 1))|;
572
                 ORDER BY startdate DESC LIMIT 1),
573
                (SELECT link FROM chart WHERE accno = ?))|;
569 574
    @values = (conv_i($form->{id}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
570
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id, $accno, conv_date($form->{"datepaid_$i"}));
575
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id, $accno, conv_date($form->{"datepaid_$i"}), $accno);
571 576
    do_query($form, $dbh, $query, @values);
572 577

  
573 578
    $exchangerate = 0;
......
605 610
      $form->{fx}{$accno}{$transdate} = $form->round_amount($form->{fx}{$accno}{$transdate}, 2);
606 611
      next if ($form->{fx}{$accno}{$transdate} == 0);
607 612

  
608
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id, tax_id)
613
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id, tax_id, chart_link)
609 614
                  VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1', 0, ?,
610 615
                  (SELECT tax_id 
611 616
                   FROM taxkeys 
......
613 618
                                   FROM chart 
614 619
                                   WHERE accno = ?) 
615 620
                   AND startdate <= ? 
616
                   ORDER BY startdate DESC LIMIT 1))|;
617
      @values = (conv_i($form->{id}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $project_id, $accno, $form->{fx}{$accno}{$transdate});
621
                   ORDER BY startdate DESC LIMIT 1),
622
                  (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);
618 624
      do_query($form, $dbh, $query, @values);
619 625
    }
620 626
  }

Auch abrufbar als: Unified diff