Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 58b14f96

Von Stephan Köhler vor fast 19 Jahren hinzugefügt

  • ID 58b14f96d6a7aab3bad2ffac3f8930793cf15a09
  • Vorgänger 7933b6bd
  • Nachfolger 5b9f9bd6

Preisgruppen Kommentar entfernt, nach Perltidy formatiert

Unterschiede anzeigen:

SL/IS.pm
214 214
          $taxbase{$item} += $taxbase;
215 215
        }
216 216
      }
217
      $tax_rate = $taxrate*100;
217
      $tax_rate = $taxrate * 100;
218 218
      push(@{ $form->{tax_rate} }, qq|$tax_rate|);
219 219
      if ($form->{"assembly_$i"}) {
220 220
        $sameitem = "";
......
368 368

  
369 369
sub post_invoice {
370 370
  $main::lxdebug->enter_sub();
371
print STDERR "IS.pm-post_invoice\n";
371

  
372 372
  my ($self, $myconfig, $form) = @_;
373 373

  
374 374
  # connect to database, turn off autocommit
......
552 552
        ? qq|'$form->{"deliverydate_$i"}'|
553 553
        : "NULL";
554 554

  
555

  
556 555
      # get pricegroup_id and save ist
557 556
      ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
558 557
      $pricegroup_id *= 1;
......
1114 1113

  
1115 1114
sub retrieve_invoice {
1116 1115
  $main::lxdebug->enter_sub();
1117
print STDERR "IS.pm-retrieve_invoice\n";
1116

  
1118 1117
  my ($self, $myconfig, $form) = @_;
1119 1118

  
1120 1119
  # connect to database
......
1532 1531
##########################
1533 1532
# get pricegroups from database
1534 1533
# build up selected pricegroup
1535
# if an exchange rate - change price 
1534
# if an exchange rate - change price
1536 1535
# for each part
1537 1536
#
1538 1537
sub get_pricegroups_for_parts {
1539
print STDERR "IS.pm - get_pricegroups_for_parts\n";
1538

  
1540 1539
  $main::lxdebug->enter_sub();
1541 1540

  
1542 1541
  my ($self, $myconfig, $form) = @_;
......
1555 1554
      $id = $form->{"new_id_$i"};
1556 1555
    }
1557 1556

  
1558
    ($price, $selectedpricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
1559
#  print (STDERR "sellprice_drag_$i", Dumper($form->{"sellprice_drag_$i"}));
1557
    ($price, $selectedpricegroup_id) = split /--/,
1558
      $form->{"sellprice_drag_$i"};
1560 1559

  
1561 1560
    $pricegroup_old = $form->{"pricegroup_old_$i"};
1562
#  print (STDERR "pricegroup_old_i-$i", Dumper($pricegroup_old));
1563 1561

  
1564 1562
    $price_new = $form->{"price_new_$i"};
1565 1563

  
1566 1564
    $price_old = $form->{"price_old_$i"};
1567 1565

  
1568
 
1569
    $query = qq|SELECT pricegroup_id, (SELECT p.sellprice from parts p where p.id = $id) as default_sellprice,(SELECT pg.pricegroup FROM pricegroup pg WHERE id=pricegroup_id) AS pricegroup, price, '' AS selected FROM prices WHERE parts_id = $id UNION SELECT 0 as pricegroup_id,(SELECT sellprice FROM parts WHERE id=$id) as default_sellprice,'' as pricegroup, (SELECT DISTINCT sellprice from parts where id=$id) as price, 'selected' AS selected from prices ORDER BY pricegroup|;
1566
    $query =
1567
      qq|SELECT pricegroup_id, (SELECT p.sellprice from parts p where p.id = $id) as default_sellprice,(SELECT pg.pricegroup FROM pricegroup pg WHERE id=pricegroup_id) AS pricegroup, price, '' AS selected FROM prices WHERE parts_id = $id UNION SELECT 0 as pricegroup_id,(SELECT sellprice FROM parts WHERE id=$id) as default_sellprice,'' as pricegroup, (SELECT DISTINCT sellprice from parts where id=$id) as price, 'selected' AS selected from prices ORDER BY pricegroup|;
1570 1568

  
1571 1569
    $pkq = $dbh->prepare($query);
1572 1570
    $pkq->execute || $form->dberror($query);
1573 1571
    while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
1574
#       push @{ $form->{PRICES}{$id} }, $pkr;
1575
        push @{ $form->{PRICES}{$i} }, $pkr;
1576
        $pkr->{id} = $id;
1577
        $pkr->{selected}  = '';
1578 1572

  
1579
    # if there is an exchange rate change price
1573
      #       push @{ $form->{PRICES}{$id} }, $pkr;
1574
      push @{ $form->{PRICES}{$i} }, $pkr;
1575
      $pkr->{id}       = $id;
1576
      $pkr->{selected} = '';
1577

  
1578
      # if there is an exchange rate change price
1580 1579
      if (($form->{exchangerate} * 1) != 0) {
1581
# print STDERR "WECHSELKURS?-$form->{exchangerate}\n";
1580

  
1582 1581
        $pkr->{price} /= $form->{exchangerate};
1583 1582
      }
1584
      $pkr->{price} = $form->format_amount($myconfig,$pkr->{price},5);
1585

  
1583
      $pkr->{price} = $form->format_amount($myconfig, $pkr->{price}, 5);
1586 1584

  
1587 1585
      if ($selectedpricegroup_id eq undef) {
1588 1586
        if ($pkr->{pricegroup_id} eq $form->{customer_klass}) {
1589
print STDERR "   INIT ROW \n";
1590
#print (STDERR "   PREIS", Dumper($pkr->{price}));
1587

  
1591 1588
          $pkr->{selected}  = ' selected';
1592 1589
          $last->{selected} = '';
1593
# print (STDERR "   SELLPRICE", Dumper($form->{"sellprice_$i"}));
1594 1590

  
1595
        # no customer pricesgroup set 
1591
          # no customer pricesgroup set
1596 1592
          if ($pkr->{price} == $pkr->{default_sellprice}) {
1597
print (STDERR "   PREIS IST DEFAULT-SELLPRICE", Dumper($form->{"sellprice_$i"}));
1598
           $pkr->{price} = $form->{"sellprice_$i"};
1599 1593

  
1600
#  if ($form->{tradediscount}){
1601
#  print (STDERR "TRADE--", Dumper($pkr->{price}));
1602
#               $pkr->{price} =$pkr->{price} * (1 - $form->{tradediscount});
1603
#               $pkr->{price} = $form->format_amount($myconfig,$pkr->{price},5);
1604
#  print (STDERR "TRADE--", Dumper($pkr->{price}));
1605
#  }
1594
            $pkr->{price} = $form->{"sellprice_$i"};
1606 1595

  
1607 1596
          } else {
1608
print STDERR "   PREIS IST NICHT NULL\n";
1609
             $form->{"sellprice_$i"} = $pkr->{price};
1597

  
1598
            $form->{"sellprice_$i"} = $pkr->{price};
1610 1599
          }
1611
# print (STDERR "           PRICE", Dumper($pkr->{price}));
1612 1600

  
1613 1601
        } else {
1614
print STDERR "   INIT ROW but what\n";
1615
print (STDERR "   PREIS -", Dumper($pkr->{price}), "Default", Dumper($pkr->{default_sellprice}));
1616 1602
          if ($pkr->{price} == $pkr->{default_sellprice}) {
1617
print (STDERR "   PREIS IST DEFAULT-", Dumper($form->{"sellprice_$i"}));
1618
            $pkr->{price} = $form->{"sellprice_$i"};
1619
            $pkr->{selected}                    = ' selected';
1603

  
1604
            $pkr->{price}    = $form->{"sellprice_$i"};
1605
            $pkr->{selected} = ' selected';
1620 1606
          }
1621 1607
        }
1622 1608
      }
1623
      if ($selectedpricegroup_id or $selectedpricegroup_id == 0){
1609
      if ($selectedpricegroup_id or $selectedpricegroup_id == 0) {
1624 1610
        if ($selectedpricegroup_id ne $pricegroup_old) {
1625 1611
          if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
1626 1612
            if ($price_new != $form->{"sellprice_$i"}) {
1627
print STDERR "   MANUELLEN PREIS W?HLEN\n";
1628 1613
            } else {
1629
print STDERR "   UPDATE CHANGE PRICEGROUP\n";
1630
              $pkr->{selected}                    = ' selected';
1631
              $last->{selected}                   = '';
1632
#$form->{"pricegroup_old_$i"} = $pkr->{$pricegroup_id};
1614
              $pkr->{selected}  = ' selected';
1615
              $last->{selected} = '';
1633 1616
            }
1634 1617
          }
1635
        } else { 
1618
        } else {
1636 1619
          if (($price_new != $form->{"sellprice_$i"}) and ($price_new ne 0)) {
1637 1620
            if ($pkr->{pricegroup_id} == 0) {
1638
print STDERR "   UPDATE CHANGE PRICEGROUP with price manuelly\n";
1639
print (STDERR "  SELLPRICE??? ---", Dumper($form->{"sellprice_$i"}));
1640
print (STDERR "  NEWPRICE??? ---", Dumper($price_new));
1641
              $pkr->{price} = $form->{"sellprice_$i"};
1642
              $pkr->{selected}                    = ' selected';
1643
              $last->{selected}                   = '';
1644
       #$form->{"sellprice_$i"} = $form->format_amount($myconfig, $price_new, 2);
1645
# print (STDERR "----5555---", Dumper($pkr));
1621
              $pkr->{price}     = $form->{"sellprice_$i"};
1622
              $pkr->{selected}  = ' selected';
1623
              $last->{selected} = '';
1646 1624
            }
1647 1625
          } else {
1648 1626
            if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
1649
print STDERR "   UPDATE NO CHANGE\n";
1650
              $pkr->{selected}                    = ' selected';
1651
              $last->{selected}                   = '';
1652
print STDERR "  DEFAULTPRICE??? ---$pkr->{default_sellprice}\n";
1653
print (STDERR "  SELLPRICE??? ---", Dumper($form->{"sellprice_$i"}));
1654
# print (STDERR "  HIER DER SELLPRICE DEFAULT??? ---", Dumper($form));
1655
print STDERR "  NEWPRICE??? ---$price_new_\n";
1656
              if (($pkr->{pricegroup_id} == 0) and ($pkr->{price} == $form->{"sellprice_$i"})) {
1657
print (STDERR "  UPDATE NO CHANGE BUT PRICE MANUELLY SET", Dumper($pkr->{price}));
1627
              $pkr->{selected}  = ' selected';
1628
              $last->{selected} = '';
1629
              if (    ($pkr->{pricegroup_id} == 0)
1630
                  and ($pkr->{price} == $form->{"sellprice_$i"})) {
1631

  
1658 1632
                # $pkr->{price}                         = $form->{"sellprice_$i"};
1659
              } else {
1633
                  } else {
1660 1634
                $pkr->{price} = $form->{"sellprice_$i"};
1661 1635
              }
1662
#print (STDERR "   FEHLER", Dumper($form->{"sellprice_$i"}));
1663 1636
            }
1664 1637
          }
1665 1638
        }
......
1672 1645

  
1673 1646
  $dbh->disconnect;
1674 1647

  
1675
#        print (STDERR "TEST", Dumper($form->{PRICES}));
1676
# print (STDERR "TEST id_$i", Dumper($form->{"id_$i"}));
1677 1648
  $main::lxdebug->leave_sub();
1678 1649
}
1679 1650

  

Auch abrufbar als: Unified diff