Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9557707c

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 9557707c3a18daeb9371f2366b8637a7e1f0fa3c
  • Vorgänger c1a8c632
  • Nachfolger ae27679f

Revert "Nutzung der Tabelle currencies"

This reverts commit be776964b83340e69fa2f02eae59b703c0c95b88.

Unterschiede anzeigen:

SL/IS.pm
458 458
  my $query =
459 459
    qq|SELECT ct.*, cp.*, ct.notes as customernotes,
460 460
         ct.phone AS customerphone, ct.fax AS customerfax, ct.email AS customeremail,
461
         (SELECT cu.curr FROM currencies cu WHERE cu.id=ct.curr) AS currency
461
         ct.curr AS currency
462 462
       FROM customer ct
463 463
       LEFT JOIN contacts cp on ct.id = cp.cp_cv_id
464 464
       WHERE (ct.id = ?) $where
......
478 478

  
479 479
  map { $form->{$_} = $ref->{$_} } keys %$ref;
480 480

  
481
  # remove any trailing whitespace
482
  $form->{currency} =~ s/\s*$// if ($form->{currency});
483

  
481 484
  if ($form->{delivery_customer_id}) {
482 485
    $query =
483 486
      qq|SELECT *, notes as customernotes
......
533 536
  }
534 537

  
535 538
  $form->{defaultcurrency} = $form->get_default_currency($myconfig);
536
  my $defaultcurrency = $form->{defaultcurrency};
537

  
538 539
  # Seit neuestem wird die department_id schon übergeben UND $form->department nicht mehr
539 540
  # korrekt zusammengebaut. Sehr wahrscheinlich beim Umstieg auf T8 kaputt gegangen
540 541
  # Ich lass den Code von 2005 erstmal noch stehen ;-) jb 03-2011
......
555 556
      $query = qq|SELECT nextval('glid')|;
556 557
      ($form->{"id"}) = selectrow_query($form, $dbh, $query);
557 558

  
558
      $query = qq|INSERT INTO ar (id, invnumber, curr) VALUES (?, ?, (SELECT id FROM currencies WHERE curr=?))|;
559
      do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}, $form->{currency});
559
      $query = qq|INSERT INTO ar (id, invnumber) VALUES (?, ?)|;
560
      do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"});
560 561

  
561 562
      if (!$form->{invnumber}) {
562 563
        $form->{invnumber} =
......
569 570
  my ($netamount, $invoicediff) = (0, 0);
570 571
  my ($amount, $linetotal, $lastincomeaccno);
571 572

  
573
  my ($currencies)    = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|);
574
  my $defaultcurrency = (split m/:/, $currencies)[0];
575

  
572 576
  if ($form->{currency} eq $defaultcurrency) {
573 577
    $form->{exchangerate} = 1;
574 578
  } else {
......
1081 1085
                amount      = ?, netamount     = ?, paid          = ?,
1082 1086
                duedate     = ?, deliverydate  = ?, invoice       = ?, shippingpoint = ?,
1083 1087
                shipvia     = ?, terms         = ?, notes         = ?, intnotes      = ?,
1084
                curr        = (SELECT id FROM currencies WHERE curr= ?),
1085
                department_id = ?, payment_id    = ?, taxincluded   = ?,
1088
                curr        = ?, department_id = ?, payment_id    = ?, taxincluded   = ?,
1086 1089
                type        = ?, language_id   = ?, taxzone_id    = ?, shipto_id     = ?,
1087 1090
                employee_id = ?, salesman_id   = ?, storno_id     = ?, storno        = ?,
1088 1091
                cp_id       = ?, marge_total   = ?, marge_percent = ?,
......
1555 1558
         (SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id)    AS income_accno,
1556 1559
         (SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id)   AS expense_accno,
1557 1560
         (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id)    AS fxgain_accno,
1558
         (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno
1561
         (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno,
1562
         d.curr AS currencies
1559 1563
         ${query_transdate}
1560 1564
       FROM defaults d|;
1561 1565

  
......
1574 1578
           a.orddate, a.quodate, a.globalproject_id,
1575 1579
           a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate,
1576 1580
           a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id,
1577
           a.duedate, a.taxincluded, (SELECT cu.curr FROM currencies cu WHERE cu.id=a.curr) AS currency, a.shipto_id, a.cp_id,
1581
           a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id,
1578 1582
           a.employee_id, a.salesman_id, a.payment_id,
1579 1583
           a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
1580 1584
           a.transaction_description, a.donumber, a.invnumber_for_credit_note,
......
1586 1590
    $ref = selectfirst_hashref_query($form, $dbh, $query, $id);
1587 1591
    map { $form->{$_} = $ref->{$_} } keys %{ $ref };
1588 1592

  
1593
    # remove any trailing whitespace
1594
    $form->{currency} =~ s/\s*$//;
1595

  
1589 1596
    $form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy");
1590 1597

  
1591 1598
    # get shipto
......
1750 1757
         c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, c.terms,
1751 1758
         c.email, c.cc, c.bcc, c.language_id, c.payment_id,
1752 1759
         c.street, c.zipcode, c.city, c.country,
1753
         c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, (SELECT cu.curr FROM currencies cu WHERE cu.id=c.curr) AS curr,
1760
         c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, c.curr,
1754 1761
         c.taxincluded_checked, c.direct_debit,
1755 1762
         $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
1756 1763
         b.discount AS tradediscount, b.description AS business
......
1765 1772

  
1766 1773
  map { $form->{$_} = $ref->{$_} } keys %$ref;
1767 1774

  
1768
  # use customer currency
1769
  $form->{currency} = $form->{curr};
1775
  # remove any trailing whitespace
1776
  $form->{curr} =~ s/\s*$//;
1777

  
1778
  # use customer currency if not empty
1779
  $form->{currency} = $form->{curr} if $form->{curr};
1770 1780

  
1771 1781
  $query =
1772 1782
    qq|SELECT sum(amount - paid) AS dunning_amount

Auch abrufbar als: Unified diff