Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 07d71c33

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

  • ID 07d71c33315605fcfc450d3b9abf0fd10e92bed5
  • Vorgänger becc49b1
  • Nachfolger ee583bd5

Merge von 599-602,605,614,615 aus unstable: Preisgruppen Teil 1
--Preisgruppenerweiterung auf Basis von Andres Patch - Thanks
-Preisgruppenverwaltung
-Preiseingabe der Preisgruppen in Masken Waren,etc.
-Auswahl der Preisgruppen in den Verkaufsmasken
-Erweiterung Datenbankschema
-Übersetzungen für Preisgruppen
-Bugfix Preisgruppen, in der Warenmaske zeigte er eine Preisgruppe a
"Gruppe 1" als "Gruppe" an
-Anpassung locale
--Fehler bei negativen Umsaetzen behoben
--Fehler beim Speichern von Rechnungen und Angeboten/Auftraegen wenn keine Preisgruppen vorhanden
--Fehler bei Drucken und Buchen und Preisgruppen behoben, Preisgruppen Quelltext ein wenig modifiziert

Unterschiede anzeigen:

SL/CT.pm
221 221

  
222 222
  my ($self, $myconfig, $form) = @_;
223 223

  
224
  # set pricegroup to default
225
  if ($form->{klass}) { }
226
  else { $form->{klass} = 0; }
227

  
224 228
  # connect to database
225 229
  my $dbh = $form->dbconnect($myconfig);
226 230
##LINET
227
  map({ $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
228
          if ($form->{"selected_cp_${_}"});
231
  map({
232
      $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
233
        if ($form->{"selected_cp_${_}"});
229 234
  } qw(title greeting));
230

  
235
#
231 236
  # escape '
232 237
  map { $form->{$_} =~ s/\'/\'\'/g }
233
    qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language);
238
    qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language pricegroup);
234 239
##/LINET
235 240
  # assign value discount, terms, creditlimit
236 241
  $form->{discount} = $form->parse_amount($myconfig, $form->{discount});
......
314 319
              username = '$form->{username}',
315 320
              salesman_id = '$form->{salesman_id}',
316 321
              user_password = '$form->{user_password}',
317
              c_vendor_id = '$form->{c_vendor_id}'
322
              c_vendor_id = '$form->{c_vendor_id}',
323
              klass = '$form->{klass}'
318 324
	      WHERE id = $form->{id}|;
319 325
  $dbh->do($query) || $form->dberror($query);
320 326

  
......
362 368
  # connect to database
363 369
  my $dbh = $form->dbconnect($myconfig);
364 370
##LINET
365
  map({ $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
366
          if ($form->{"selected_cp_${_}"});
371
  map({
372
      $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
373
        if ($form->{"selected_cp_${_}"});
367 374
  } qw(title greeting));
368 375

  
369 376
  # escape '
SL/Form.pm
382 382
      $jsscript = qq|
383 383
        <style type="text/css">\@import url(js/jscalendar/calendar-win2k-1.css);</style>
384 384
        <script type="text/javascript" src="js/jscalendar/calendar.js"></script>
385
?       <script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>
386
?       <script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
385
        <script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>
386
        <script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
387 387
        $self->{javascript}
388 388
       |;
389 389
    }
......
450 450

  
451 451
  $trigger_1 = qq|
452 452
       Calendar.setup(
453
?      {
454
???      inputField ?: "$inputField_1",
455
???      ifFormat ???:"$ifFormat",
456
      ???align ???: "$align_1", ????
457
???      button ?????: "$button_1"
458
?      }
459
?      );
453
      {
454
      inputField : "$inputField_1",
455
      ifFormat :"$ifFormat",
456
      align : "$align_1", 
457
      button : "$button_1"
458
      }
459
      );
460 460
       |;
461 461

  
462 462
  if ($qty == 2) {
463 463
    $trigger_2 = qq|
464 464
       Calendar.setup(
465 465
       {
466
  ???    inputField ?: "$inputField_2",
467
??  ?    ifFormat ???:"$ifFormat",
468
???      align ???: "$align_2", ????
469
???      button ?????: "$button_2"
470
?      }
471
?      );
466
      inputField : "$inputField_2",
467
      ifFormat :"$ifFormat",
468
      align : "$align_2", 
469
      button : "$button_2"
470
      }
471
      );
472 472
        |;
473 473
  }
474 474
  $jsscript = qq|
......
2120 2120
}
2121 2121

  
2122 2122

  
2123
sub get_pricegroup {
2124
  $main::lxdebug->enter_sub();
2125

  
2126
  my ($self, $myconfig, $p) = @_;
2127

  
2128
  my $dbh = $self->dbconnect($myconfig);
2129

  
2130
  my $query = qq|SELECT p.id, p.pricegroup
2131
                 FROM pricegroup p|;
2132

  
2133
  $query .= qq|
2134
		 ORDER BY pricegroup|;
2135

  
2136
  if ($p->{all}) {
2137
    $query = qq|SELECT id, pricegroup FROM pricegroup
2138
                ORDER BY pricegroup|;
2139
  }
2140

  
2141
  my $sth = $dbh->prepare($query);
2142
  $sth->execute || $self->dberror($query);
2143

  
2144
  $self->{all_pricegroup} = ();
2145
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
2146
    push @{ $self->{all_pricegroup} }, $ref;
2147
  }
2148
  $sth->finish;
2149
  $dbh->disconnect;
2150

  
2151
  $main::lxdebug->leave_sub();
2152
}
2153

  
2154

  
2123 2155
sub audittrail {
2124 2156
  my ($self, $dbh, $myconfig, $audittrail) = @_;
2125 2157
  
SL/IC.pm
33 33
#======================================================================
34 34

  
35 35
package IC;
36

  
36
use Data::Dumper;
37 37
sub get_part {
38 38
  $main::lxdebug->enter_sub();
39 39

  
......
101 101
  $form->{amount}{IC_expense} = $form->{expense_accno};
102 102
  $form->{amount}{IC_cogs}    = $form->{expense_accno};
103 103

  
104
  # get prices
105
  $query =
106
    qq|SELECT p.parts_id, p.pricegroup_id, p.price, (SELECT pg.pricegroup FROM pricegroup pg WHERE pg.id=p.pricegroup_id) AS pricegroup FROM prices p
107
              WHERE parts_id = $form->{id}
108
              ORDER by pricegroup|;
109

  
110
  $sth = $dbh->prepare($query);
111
  $sth->execute || $form->dberror($query);
112

  
113
  @pricegroups          = ();
114
  @pricegroups_not_used = ();
115

  
116
  #for pricegroups
117
  my $i = 1;
118
  while (
119
         ($form->{"klass_$i"}, $form->{"pricegroup_id_$i"},
120
          $form->{"price_$i"}, $form->{"pricegroup_$i"})
121
         = $sth->fetchrow_array
122
    ) {
123
    $form->{"price_$i"} = $form->round_amount($form->{"price_$i"}, 5);
124
    $form->{"price_$i"} =
125
      $form->format_amount($myconfig, $form->{"price_$i"}, 5);
126
    push @pricegroups, $form->{"pricegroup_id_$i"};
127
    $i++;
128
  }
129

  
130
  $sth->finish;
131

  
132
  # get pricegroups
133
  $query = qq|SELECT p.id, p.pricegroup FROM pricegroup p|;
134

  
135
  $pkq = $dbh->prepare($query);
136
  $pkq->execute || $form->dberror($query);
137
  while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
138
    push @{ $form->{PRICEGROUPS} }, $pkr;
139
  }
140
  $pkq->finish;
141

  
142
  #find not used pricegroups
143
  while ($tmp = pop @{ $form->{PRICEGROUPS} }) {
144
    my $insert = 0;
145
    foreach $item (@pricegroups) {
146
      if ($item eq $tmp->{id}) {
147

  
148
        #drop
149
        $insert = 1;
150
      }
151
    }
152
    if ($insert == 0) {
153
      push @pricegroups_not_used, $tmp;
154
    }
155
  }
156

  
157
  # if not used pricegroups are avaible
158
  if (@pricegroups_not_used) {
159

  
160
    foreach $name (@pricegroups_not_used) {
161
      $form->{"klass_$i"} = "$name->{id}";
162
      $form->{"price_$i"} = $form->round_amount($form->{sellprice}, 5);
163
      $form->{"price_$i"} =
164
        $form->format_amount($myconfig, $form->{"price_$i"}, 5);
165
      $form->{"pricegroup_id_$i"} = "$name->{id}";
166
      $form->{"pricegroup_$i"}    = "$name->{pricegroup}\n";
167
      $i++;
168
    }
169
  }
170

  
171
  #correct rows
172
  $form->{price_rows} = $i - 1;
173

  
104 174
  unless ($form->{item} eq 'service') {
105 175

  
106 176
    # get makes
......
161 231
  $main::lxdebug->leave_sub();
162 232
}
163 233

  
234
sub get_pricegroups {
235
  $main::lxdebug->enter_sub();
236

  
237
  my ($self, $myconfig, $form) = @_;
238
  my $dbh = $form->dbconnect($myconfig);
239
  my $i = 1;
240
  my @pricegroups_not_used = ();
241

  
242
  # get pricegroups
243
  my $query = qq|SELECT p.id, p.pricegroup FROM pricegroup p|;
244

  
245
  my $pkq = $dbh->prepare($query);
246
  $pkq->execute || $form->dberror($query);
247
  while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
248
    push @{ $form->{PRICEGROUPS} }, $pkr;
249
  }
250
  $pkq->finish;
251

  
252
  #find not used pricegroups
253
  while ($tmp = pop @{ $form->{PRICEGROUPS} }) {
254
    push @pricegroups_not_used, $tmp;
255
  }
256

  
257
  # if not used pricegroups are avaible
258
  if (@pricegroups_not_used) {
259

  
260
    foreach $name (@pricegroups_not_used) {
261
      $form->{"klass_$i"} = "$name->{id}";
262
      $form->{"price_$i"} = $form->round_amount($form->{sellprice}, 5);
263
      $form->{"price_$i"} =
264
        $form->format_amount($myconfig, $form->{"price_$i"}, 5);
265
      $form->{"pricegroup_id_$i"} = "$name->{id}";
266
      $form->{"pricegroup_$i"}    = "$name->{pricegroup}\n";
267
      $i++;
268
    }
269
  }
270

  
271
  #correct rows
272
  $form->{price_rows} = $i - 1;
273

  
274
  $dbh->disconnect;
275

  
276
  $main::lxdebug->leave_sub();
277
}
278

  
279

  
164 280
sub save {
165 281
  $main::lxdebug->enter_sub();
166 282

  
......
332 448
	      WHERE id = $form->{id}|;
333 449
  $dbh->do($query) || $form->dberror($query);
334 450

  
451
  # delete price records
452
  $query = qq|DELETE FROM prices
453
              WHERE parts_id = $form->{id}|;
454
  $dbh->do($query) || $form->dberror($query);
455

  
456
  # insert price records only if different to sellprice
457
  for my $i (1 .. $form->{price_rows}) {
458
    if ($form->{"price_$i"} eq "0") {
459
       $form->{"price_$i"} = $form->{sellprice};
460
    }
461
    if ((   $form->{"price_$i"} 
462
        || $form->{"klass_$i"}
463
        || $form->{"pricegroup_id_$i"}) and $form->{"price_$i"} != $form->{sellprice}) {
464
      $klass = $form->parse_amount($myconfig, $form->{"klass_$i"});
465
      $price = $form->parse_amount($myconfig, $form->{"price_$i"});
466
      $pricegroup_id =
467
        $form->parse_amount($myconfig, $form->{"pricegroup_id_$i"});
468
      $query = qq|INSERT INTO prices (parts_id, pricegroup_id, price)
469
                  VALUES($form->{id},$pricegroup_id,$price)|;
470
      $dbh->do($query) || $form->dberror($query);
471
    }
472
  }
473

  
335 474
  # insert makemodel records
336 475
  unless ($form->{item} eq 'service') {
337 476
    for my $i (1 .. $form->{makemodel_rows}) {
SL/IS.pm
34 34

  
35 35
package IS;
36 36

  
37
use Data::Dumper;
38

  
37 39
sub invoice_details {
38 40
  $main::lxdebug->enter_sub();
39 41

  
......
365 367

  
366 368
sub post_invoice {
367 369
  $main::lxdebug->enter_sub();
368

  
370
print STDERR "IS.pm-post_invoice\n";
369 371
  my ($self, $myconfig, $form) = @_;
370 372

  
371 373
  # connect to database, turn off autocommit
......
549 551
        ? qq|'$form->{"deliverydate_$i"}'|
550 552
        : "NULL";
551 553

  
554

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

  
552 559
      # save detail record in invoice table
553 560
      $query = qq|INSERT INTO invoice (trans_id, parts_id, description, qty,
554 561
                  sellprice, fxsellprice, discount, allocated, assemblyitem,
555
		  unit, deliverydate, project_id, serialnumber)
562
		  unit, deliverydate, project_id, serialnumber, pricegroup_id)
556 563
		  VALUES ($form->{id}, $form->{"id_$i"},
557 564
		  '$form->{"description_$i"}', $form->{"qty_$i"},
558 565
		  $form->{"sellprice_$i"}, $fxsellprice,
559 566
		  $form->{"discount_$i"}, $allocated, 'f',
560 567
		  '$form->{"unit_$i"}', $deliverydate, (SELECT id from project where projectnumber = '$project_id'),
561
		  '$form->{"serialnumber_$i"}')|;
568
		  '$form->{"serialnumber_$i"}',
569
      '$pricegroup_id')|;
562 570
      $dbh->do($query) || $form->dberror($query);
563 571

  
564 572
      if ($form->{lizenzen}) {
......
1105 1113

  
1106 1114
sub retrieve_invoice {
1107 1115
  $main::lxdebug->enter_sub();
1108

  
1116
print STDERR "IS.pm-retrieve_invoice\n";
1109 1117
  my ($self, $myconfig, $form) = @_;
1110 1118

  
1111 1119
  # connect to database
......
1211 1219
		i.discount, i.parts_id AS id, i.unit, i.deliverydate,
1212 1220
		i.project_id, pr.projectnumber, i.serialnumber,
1213 1221
		p.partnumber, p.assembly, p.bin, p.notes AS partnotes, i.id AS invoice_pos,
1214
		pg.partsgroup
1222
		pg.partsgroup, i.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=i.pricegroup_id) as pricegroup
1215 1223
		FROM invoice i
1216 1224
	        JOIN parts p ON (i.parts_id = p.id)
1217 1225
	        LEFT JOIN project pr ON (i.project_id = pr.id)
......
1306 1314
                 c.email, c.cc, c.bcc, c.language,
1307 1315
		 c.street, c.zipcode, c.city, c.country,
1308 1316
	         $duedate + c.terms AS duedate, c.notes AS intnotes,
1309
		 b.discount AS tradediscount, b.description AS business
1317
		 b.discount AS tradediscount, b.description AS business, c.klass as customer_klass
1310 1318
                 FROM customer c
1311 1319
		 LEFT JOIN business b ON (b.id = c.business_id)
1312 1320
	         WHERE c.id = $form->{customer_id}|;
......
1513 1521
        $stw->finish;
1514 1522
      }
1515 1523
    }
1516

  
1517 1524
  }
1518 1525
  $sth->finish;
1519 1526
  $dbh->disconnect;
......
1521 1528
  $main::lxdebug->leave_sub();
1522 1529
}
1523 1530

  
1531
##########################
1532
# get pricegroups from database
1533
# build up selected pricegroup
1534
# if an exchange rate - change price 
1535
# for each part
1536
#
1537
sub get_pricegroups_for_parts {
1538
print STDERR "IS.pm - get_pricegroups_for_parts\n";
1539
  $main::lxdebug->enter_sub();
1540

  
1541
  my ($self, $myconfig, $form) = @_;
1542

  
1543
  my $dbh = $form->dbconnect($myconfig);
1544

  
1545
  my $i  = 1;
1546
  my $id = 0;
1547

  
1548
  while (($form->{"id_$i"}) or ($form->{"new_id_$i"})) {
1549

  
1550
    $id = $form->{"id_$i"};
1551

  
1552
    if (!($form->{"id_$i"}) and $form->{"new_id_$i"}) {
1553

  
1554
      $id = $form->{"new_id_$i"};
1555
    }
1556

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

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

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

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

  
1567
 
1568
    $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|;
1569

  
1570
    $pkq = $dbh->prepare($query);
1571
    $pkq->execute || $form->dberror($query);
1572
    while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
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
1579
      if (($form->{exchangerate} * 1) != 0) {
1580
# print STDERR "WECHSELKURS?-$form->{exchangerate}\n";
1581
        $pkr->{price} /= $form->{exchangerate};
1582
      }
1583
      $pkr->{price} = $form->format_amount($myconfig,$pkr->{price},5);
1584

  
1585

  
1586
      if ($selectedpricegroup_id eq undef) {
1587
        if ($pkr->{pricegroup_id} eq $form->{customer_klass}) {
1588
print STDERR "   INIT ROW \n";
1589
#print (STDERR "   PREIS", Dumper($pkr->{price}));
1590
          $pkr->{selected}  = ' selected';
1591
          $last->{selected} = '';
1592
# print (STDERR "   SELLPRICE", Dumper($form->{"sellprice_$i"}));
1593

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

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

  
1606
          } else {
1607
print STDERR "   PREIS IST NICHT NULL\n";
1608
             $form->{"sellprice_$i"} = $pkr->{price};
1609
          }
1610
# print (STDERR "           PRICE", Dumper($pkr->{price}));
1611

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

  
1669
    $pkq->finish;
1670
  }
1671

  
1672
  $dbh->disconnect;
1673

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

  
1524 1679
sub webdav_folder {
1525 1680
  $main::lxdebug->enter_sub();
1526 1681

  
SL/OE.pm
311 311
      $reqdate =
312 312
        ($form->{"reqdate_$i"}) ? qq|'$form->{"reqdate_$i"}'| : "NULL";
313 313

  
314
      # get pricegroup_id and save ist
315
      ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
316
      $pricegroup_id *= 1;
317

  
314 318
      # save detail record in orderitems table
315 319
      $query = qq|INSERT INTO orderitems (|;
316 320
      $query .= "id, " if $form->{"orderitems_id_$i"};
317 321
      $query .= qq|trans_id, parts_id, description, qty, sellprice, discount,
318
		   unit, reqdate, project_id, serialnumber, ship)
322
		   unit, reqdate, project_id, serialnumber, ship, pricegroup_id)
319 323
                   VALUES (|;
320 324
      $query .= qq|$form->{"orderitems_id_$i"},|
321 325
        if $form->{"orderitems_id_$i"};
......
323 327
		   '$form->{"description_$i"}', $form->{"qty_$i"},
324 328
		   $fxsellprice, $form->{"discount_$i"},
325 329
		   '$form->{"unit_$i"}', $reqdate, (SELECT id from project where projectnumber = '$project_id'),
326
		   '$form->{"serialnumber_$i"}', $form->{"ship_$i"})|;
330
		   '$form->{"serialnumber_$i"}', $form->{"ship_$i"},
331
       '$pricegroup_id')|;
327 332
      $dbh->do($query) || $form->dberror($query);
328 333

  
329 334
      $form->{"sellprice_$i"} = $fxsellprice;
......
631 636
		o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes,
632 637
                o.reqdate, o.project_id, o.serialnumber, o.ship,
633 638
		pr.projectnumber,
634
		pg.partsgroup
639
		pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup
635 640
		FROM orderitems o
636 641
		JOIN parts p ON (o.parts_id = p.id)
637 642
		LEFT JOIN chart c1 ON (p.inventory_accno_id = c1.id)
SL/PE.pm
35 35

  
36 36
package PE;
37 37

  
38
use Data::Dumper;
39

  
38 40
sub projects {
39 41
  $main::lxdebug->enter_sub();
40 42

  
......
290 292
  $main::lxdebug->leave_sub();
291 293
}
292 294

  
295
##########################
296
# get pricegroups from database
297
#
298
sub pricegroups {
299
  $main::lxdebug->enter_sub();
300

  
301
  my ($self, $myconfig, $form) = @_;
302

  
303
  my $var;
304

  
305
  # connect to database
306
  my $dbh = $form->dbconnect($myconfig);
307

  
308
  my $sortorder = ($form->{sort}) ? $form->{sort} : "pricegroup";
309

  
310
  my $query = qq|SELECT g.id, g.pricegroup
311
                 FROM pricegroup g|;
312

  
313
  my $where = "1 = 1";
314

  
315
  if ($form->{pricegroup}) {
316
    $var = $form->like(lc $form->{pricegroup});
317
    $where .= " AND lower(g.pricegroup) LIKE '$var'";
318
  }
319
  $query .= qq|
320
               WHERE $where
321
	       ORDER BY $sortorder|;
322

  
323
  if ($form->{status} eq 'orphaned') {
324
    $query = qq|SELECT pg.*
325
                FROM pricegroup pg
326
                LEFT JOIN prices p ON (p.pricegroup_id = pg.id)
327
		WHERE $where
328
                EXCEPT
329
                SELECT pg.*
330
	        FROM pricegroup pg
331
	        JOIN prices p ON (p.pricegroup_id = pg.id)
332
	        WHERE $where
333
		ORDER BY $sortorder|;
334
  }
335
print STDERR "asdfasdf-$query\n";
336

  
337
  $sth = $dbh->prepare($query);
338
  $sth->execute || $form->dberror($query);
339

  
340
  my $i = 0;
341
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
342
    push @{ $form->{item_list} }, $ref;
343
    $i++;
344
  }
345

  
346
  $sth->finish;
347
  $dbh->disconnect;
348

  
349
  $main::lxdebug->leave_sub();
350

  
351
  return $i;
352
}
353
########################
354
# save pricegruop to database
355
#
356
sub save_pricegroup {
357
  $main::lxdebug->enter_sub();
358

  
359
  my ($self, $myconfig, $form) = @_;
360

  
361
  # connect to database
362
  my $dbh = $form->dbconnect($myconfig);
363

  
364
  map { $form->{$_} =~ s/\'/\'\'/g } (pricegroup);
365

  
366
  $form->{discount} /= 100;
367

  
368
  if ($form->{id}) {
369
    $query = qq|UPDATE pricegroup SET
370
                pricegroup = '$form->{pricegroup}'
371
		WHERE id = $form->{id}|;
372
  } else {
373
    $query = qq|INSERT INTO pricegroup
374
                (pricegroup)
375
                VALUES ('$form->{pricegroup}')|;
376
  }
377
  $dbh->do($query) || $form->dberror($query);
378

  
379
  $dbh->disconnect;
380

  
381
  $main::lxdebug->leave_sub();
382
}
383
############################
384
# get one pricegroup from database
385
#
386
sub get_pricegroup {
387
  $main::lxdebug->enter_sub();
388
print STDERR "PE.pm-get_pricegroup\n";
389
  my ($self, $myconfig, $form) = @_;
390

  
391
  # connect to database
392
  my $dbh = $form->dbconnect($myconfig);
393

  
394
  my $query = qq|SELECT p.id, p.pricegroup
395
                 FROM pricegroup p
396
	         WHERE p.id = $form->{id}|;
397
  my $sth = $dbh->prepare($query);
398
  $sth->execute || $form->dberror($query);
399

  
400
  my $ref = $sth->fetchrow_hashref(NAME_lc);
401

  
402
  map { $form->{$_} = $ref->{$_} } keys %$ref;
403

  
404
  $sth->finish;
405

  
406
  # check if it is orphaned
407
  $query = qq|SELECT count(*)
408
              FROM prices p
409
	      WHERE p.pricegroup_id = $form->{id}|;
410
  $sth = $dbh->prepare($query);
411
  $sth->execute || $form->dberror($query);
412

  
413
  ($form->{orphaned}) = $sth->fetchrow_array;
414
  $form->{orphaned} = !$form->{orphaned};
415

  
416
  $sth->finish;
417

  
418
  $dbh->disconnect;
419
#print (STDERR "   ", Dumper($form));
420
  $main::lxdebug->leave_sub();
421
}
422

  
293 423
1;
294 424

  
bin/mozilla/ct.pl
69 69
  if ($form->{db} eq 'vendor') {
70 70
    $gifi = qq|
71 71
		<td><input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |
72
      . $locale->text('GIFI')
73
      . qq|</td>
72
      . $locale->text('GIFI') . qq|</td>
74 73
|;
75 74
  }
76 75

  
......
112 111
	  <td><input name=status class=radio type=radio value=all checked>&nbsp;|
113 112
    . $locale->text('All') . qq|
114 113
	  <input name=status class=radio type=radio value=orphaned>&nbsp;|
115
    . $locale->text('Orphaned')
116
    . qq|</td>
114
    . $locale->text('Orphaned') . qq|</td>
117 115
	</tr>
118 116
	<tr>
119 117
	  <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
......
121 119
	    <table>
122 120
	      <tr>
123 121
	        <td><input name="l_id" type=checkbox class=checkbox value=Y> |
124
    . $locale->text('ID')
125
    . qq|</td>
122
    . $locale->text('ID') . qq|</td>
126 123
		<td><input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |
127
    . $locale->text($label . ' Number')
128
    . qq|</td>
124
    . $locale->text($label . ' Number') . qq|</td>
129 125
		<td><input name="l_name" type=checkbox class=checkbox value=Y checked> |
130
    . $locale->text('Company Name')
131
    . qq|</td>
126
    . $locale->text('Company Name') . qq|</td>
132 127
		<td><input name="l_address" type=checkbox class=checkbox value=Y> |
133
    . $locale->text('Address')
134
    . qq|</td>
128
    . $locale->text('Address') . qq|</td>
135 129
	      </tr>
136 130
	      <tr>
137 131
		<td><input name="l_contact" type=checkbox class=checkbox value=Y checked> |
138
    . $locale->text('Contact')
139
    . qq|</td>
132
    . $locale->text('Contact') . qq|</td>
140 133
		<td><input name="l_phone" type=checkbox class=checkbox value=Y checked> |
141
    . $locale->text('Phone')
142
    . qq|</td>
134
    . $locale->text('Phone') . qq|</td>
143 135
		<td><input name="l_fax" type=checkbox class=checkbox value=Y> |
144
    . $locale->text('Fax')
145
    . qq|</td>
136
    . $locale->text('Fax') . qq|</td>
146 137
		<td><input name="l_email" type=checkbox class=checkbox value=Y checked> |
147
    . $locale->text('E-mail')
148
    . qq|</td>
138
    . $locale->text('E-mail') . qq|</td>
149 139
	      </tr>
150 140
	      <tr>
151 141
		<td><input name="l_taxnumber" type=checkbox class=checkbox value=Y> |
152
    . $locale->text('Tax Number')
153
    . qq|</td>
142
    . $locale->text('Tax Number') . qq|</td>
154 143
		$gifi
155 144
		<td><input name="l_sic_code" type=checkbox class=checkbox value=Y> |
156
    . $locale->text('SIC')
157
    . qq|</td>
145
    . $locale->text('SIC') . qq|</td>
158 146
		<td><input name="l_business" type=checkbox class=checkbox value=Y> |
159
    . $locale->text('Type of Business')
160
    . qq|</td>
147
    . $locale->text('Type of Business') . qq|</td>
161 148
	      </tr>
162 149
	      <tr>
163 150
		<td><input name="l_invnumber" type=checkbox class=checkbox value=Y> |
164
    . $locale->text('Invoices')
165
    . qq|</td>
151
    . $locale->text('Invoices') . qq|</td>
166 152
		<td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> |
167
    . $locale->text('Orders')
168
    . qq|</td>
153
    . $locale->text('Orders') . qq|</td>
169 154
		<td><input name="l_quonumber" type=checkbox class=checkbox value=Y> |
170
    . $locale->text('Quotations')
171
    . qq|</td>
155
    . $locale->text('Quotations') . qq|</td>
172 156
	      </tr>
173 157
	    </table>
174 158
	  </td>
......
363 347

  
364 348
    if ($ref->{id} eq $sameid) {
365 349
      map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
366
      map { $column_data{$_} = "<td>$ref->{$_}&nbsp;</td>" } (invnumber, ordnumber, quonumber);
367 350
    } else {
368 351
      map { $column_data{$_} = "<td>$ref->{$_}&nbsp;</td>" } @column_index;
369 352

  
......
529 512
  </tr>
530 513
|;
531 514
  }
532

  
533 515
  $form->{selectbusiness} = qq|<option>\n|;
534 516
  map {
535
    $form->{selectbusiness} .= qq|<option value=$_->{id}>$_->{description}\n|
517
    $form->{selectbusiness} .=
518
      qq|<option value=$_->{id}>$_->{description}\n|
536 519
  } @{ $form->{all_business} };
537 520
  if ($form->{business_save}) {
538 521
    $form->{selectbusiness} = $form->{business_save};
......
596 579

  
597 580
  $select_greeting =
598 581
    qq|&nbsp;<select name=selected_cp_greeting><option></option>|;
599
  map({ $select_greeting .= qq|<option>$_</option>|; } @{ $form->{GREETINGS} });
582
  map(
583
     { $select_greeting .= qq|<option>$_</option>|; } @{ $form->{GREETINGS} });
600 584
  $select_greeting .= qq|</select>|;
601 585
## /LINET
602 586

  
587
  if ($form->{db} eq 'customer') {
588
  #get pricegroup and form it
589
  $form->get_pricegroup(\%myconfig, { all => 1 });
590

  
591
  $form->{pricegroup}    = "$form->{klass}";
592
  $form->{pricegroup_id} = "$form->{klass}";
593

  
594
  if (@{ $form->{all_pricegroup} }) {
595

  
596
    $form->{selectpricegroup} = qq|<option>\n|;
597
    map {
598
      $form->{selectpricegroup} .=
599
        qq|<option value="$_->{id}">$_->{pricegroup}\n|
600
    } @{ $form->{all_pricegroup} };
601
  }
602

  
603
  if ($form->{selectpricegroup}) {
604
    $form->{selectpricegroup} = $form->unescape($form->{selectpricegroup});
605

  
606
    $pricegroup =
607
      qq|<input type=hidden name=selectpricegroup value="|
608
      . $form->escape($form->{selectpricegroup}, 1) . qq|">|;
609

  
610
    $form->{selectpricegroup} =~
611
      s/(<option value="\Q$form->{klass}\E")/$1 selected/;
612

  
613
    $pricegroup .= qq|<select name=klass>$form->{selectpricegroup}</select>|;
614

  
615
    $group = $locale->text('Hola');
616
  }
617
 }
603 618
  # $locale->text('Customer Number')
604 619
  # $locale->text('Vendor Number')
605 620
  $form->{fokus} = "ct.name";
......
618 633
      <table width=100%>
619 634
	<tr class=listheading>
620 635
	  <th class=listheading colspan=2 width=50%>|
621
    . $locale->text('Billing Address')
622
    . qq|</th>
636
    . $locale->text('Billing Address') . qq|</th>
623 637
	  <th class=listheading width=50%>|
624
    . $locale->text('Shipping Address')
625
    . qq|</th>
638
    . $locale->text('Shipping Address') . qq|</th>
626 639
	</tr>
627 640
	<tr height="5"></tr>
628 641
        $business_salesman
......
649 662
	</tr>
650 663
	<tr>
651 664
	  <th align=right nowrap>|
652
    . $locale->text('Zipcode') . "/"
653
    . $locale->text('City')
654
    . qq|</th>
665
    . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
655 666
	  <td><input name=zipcode size=5 tabindex=5 maxlength=10 value="$form->{zipcode}">
656 667
          <input name=city size=30 tabindex=6 maxlength=75 value="$form->{city}"></td>
657 668
	  <td><input name=shiptozipcode size=5 maxlength=10 value="$form->{shiptozipcode}">
......
695 706
                <table>
696 707
                <tr>
697 708
	          <th align=right nowrap>|
698
    . $locale->text('Contact Person')
699
    . qq|</th>
709
    . $locale->text('Contact Person') . qq|</th>
700 710
                </tr>
701 711
                <tr>
702 712
                  <th></th>
......
710 720
                <tr>
711 721
                  <th></th>
712 722
                  <th align=left nowrap>|
713
    . $locale->text('Given Name')
714
    . qq|</th>
723
    . $locale->text('Given Name') . qq|</th>
715 724
                  <td><input name=cp_givenname size=30 maxlength=40 value="$form->{cp_givenname}"></td>
716 725
	          <th align=left nowrap>| . $locale->text('Name') . qq|</th>
717 726
                  <td><input name=cp_name size=30 maxlength=40 value="$form->{cp_name}"></td>
......
747 756
	  <td><input name=creditlimit tabindex=13 size=9 value="$form->{creditlimit}"></td>
748 757
	  <th align=right>| . $locale->text('Terms: Net') . qq|</th>
749 758
	  <td><input name=terms tabindex=14 size=2 value="$form->{terms}">|
750
    . $locale->text('days')
751
    . qq|</td>
759
    . $locale->text('days') . qq|</td>
752 760
	  <th align=right>| . $locale->text('Discount') . qq|</th>
753 761
	  <td><input name=discount tabindex=15 size=4 value="$form->{discount}">
754 762
	  %</td>
......
773 781
	  <th align=right>| . $locale->text('Language') . qq|</th>
774 782
	  <td><select name=language tabindex=23>$lang
775 783
                          </select></td>|;
784
if ($form->{db} eq 'customer'){
776 785

  
786
print qq|
787
          <th align=right>| . $locale->text('Preisklasse') . qq|</th>
788
          <td>$pricegroup</td>|;
789
}
777 790
  print qq|        </tr>
778 791
        <tr>
779 792
          <td align=right>| . $locale->text('Obsolete') . qq|</td>
......
835 848
<input type=hidden name=callback value="$form->{callback}">
836 849
<input type=hidden name=db value=$form->{db}>
837 850

  
851

  
852

  
838 853
<br>
839 854
$update_button
840 855
<input class=submit type=submit name=action accesskey="s" value="|
bin/mozilla/ic.pl
32 32
#======================================================================
33 33

  
34 34
use SL::IC;
35
#use SL::PE;
35 36

  
36 37
require "$form->{path}/io.pl";
37 38

  
......
50 51

  
51 52
  $form->{unit} =
52 53
    ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea');
53

  
54
  IC->get_pricegroups(\%myconfig, \%$form);
54 55
  &link_part;
55 56
  &display_form;
56 57

  
......
84 85
    $button1 = qq|
85 86
       <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
86 87
       <td><input type=button name=transdatefrom id="trigger1" value=|
87
      . $locale->text('button')
88
      . qq|></td>
88
      . $locale->text('button') . qq|></td>
89 89
      |;
90 90
    $button2 = qq|
91 91
       <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
92 92
       <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
93
      . $locale->text('button')
94
      . qq|></td>
93
      . $locale->text('button') . qq|></td>
95 94
     |;
96 95

  
97 96
    #write Trigger
......
132 131

  
133 132
    $l_serialnumber = qq|
134 133
        <td><input name=l_serialnumber class=checkbox type=checkbox value=Y>&nbsp;|
135
      . $locale->text('Serial Number')
136
      . qq|</td>
134
      . $locale->text('Serial Number') . qq|</td>
137 135
|;
138 136

  
139 137
  }
......
272 270
        </tr>
273 271
        <tr>
274 272
          <th align=right nowrap>|
275
    . $locale->text('Part Description')
276
    . qq|</th>
273
    . $locale->text('Part Description') . qq|</th>
277 274
          <td colspan=3><input name=description size=40></td>
278 275
        </tr>
279 276
	<tr>
......
310 307
	</tr>
311 308
	<tr>
312 309
          <th align=right nowrap>|
313
    . $locale->text('Include in Report')
314
    . qq|</th>
310
    . $locale->text('Include in Report') . qq|</th>
315 311
          <td colspan=3>
316 312
            <table>
317 313
              <tr>
318 314
                <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked>&nbsp;|
319
    . $locale->text('Part Number')
320
    . qq|</td>
315
    . $locale->text('Part Number') . qq|</td>
321 316
		<td><input name=l_description class=checkbox type=checkbox value=Y checked>&nbsp;|
322
    . $locale->text('Part Description')
323
    . qq|</td>
317
    . $locale->text('Part Description') . qq|</td>
324 318
		$l_serialnumber
325 319
		<td><input name=l_unit class=checkbox type=checkbox value=Y checked>&nbsp;|
326
    . $locale->text('Unit of measure')
327
    . qq|</td>
320
    . $locale->text('Unit of measure') . qq|</td>
328 321
	      </tr>
329 322
	      <tr>
330 323
                <td><input name=l_listprice class=checkbox type=checkbox value=Y>&nbsp;|
331
    . $locale->text('List Price')
332
    . qq|</td>
324
    . $locale->text('List Price') . qq|</td>
333 325
		<td><input name=l_sellprice class=checkbox type=checkbox value=Y checked>&nbsp;|
334
    . $locale->text('Sell Price')
335
    . qq|</td>
326
    . $locale->text('Sell Price') . qq|</td>
336 327
		<td><input name=l_lastcost class=checkbox type=checkbox value=Y>&nbsp;|
337
    . $locale->text('Last Cost')
338
    . qq|</td>
328
    . $locale->text('Last Cost') . qq|</td>
339 329
		<td><input name=l_linetotal class=checkbox type=checkbox value=Y checked>&nbsp;|
340
    . $locale->text('Line Total')
341
    . qq|</td>
330
    . $locale->text('Line Total') . qq|</td>
342 331
	      </tr>
343 332
	      <tr>
344 333
                <td><input name=l_priceupdate class=checkbox type=checkbox value=Y>&nbsp;|
345
    . $locale->text('Updated')
346
    . qq|</td>
334
    . $locale->text('Updated') . qq|</td>
347 335
		<td><input name=l_bin class=checkbox type=checkbox value=Y>&nbsp;|
348
    . $locale->text('Bin')
349
    . qq|</td>
336
    . $locale->text('Bin') . qq|</td>
350 337
		<td><input name=l_rop class=checkbox type=checkbox value=Y>&nbsp;|
351
    . $locale->text('ROP')
352
    . qq|</td>
338
    . $locale->text('ROP') . qq|</td>
353 339
		<td><input name=l_weight class=checkbox type=checkbox value=Y>&nbsp;|
354
    . $locale->text('Weight')
355
    . qq|</td>
340
    . $locale->text('Weight') . qq|</td>
356 341
              </tr>
357 342
	      <tr>
358 343
                <td><input name=l_image class=checkbox type=checkbox value=Y>&nbsp;|
359
    . $locale->text('Image')
360
    . qq|</td>
344
    . $locale->text('Image') . qq|</td>
361 345
		<td><input name=l_drawing class=checkbox type=checkbox value=Y>&nbsp;|
362
    . $locale->text('Drawing')
363
    . qq|</td>
346
    . $locale->text('Drawing') . qq|</td>
364 347
		<td><input name=l_microfiche class=checkbox type=checkbox value=Y>&nbsp;|
365
    . $locale->text('Microfiche')
366
    . qq|</td>
348
    . $locale->text('Microfiche') . qq|</td>
367 349
		<td><input name=l_partsgroup class=checkbox type=checkbox value=Y>&nbsp;|
368
    . $locale->text('Group')
369
    . qq|</td>
350
    . $locale->text('Group') . qq|</td>
370 351
              </tr>
371 352
	      <tr>
372 353
                <td><input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
373
    . $locale->text('Subtotal')
374
    . qq|</td>
354
    . $locale->text('Subtotal') . qq|</td>
375 355
		<td><input name=l_soldtotal class=checkbox type=checkbox value=Y>&nbsp;|
376
    . $locale->text('soldtotal')
377
    . qq|</td>
356
    . $locale->text('soldtotal') . qq|</td>
378 357
	      </tr>
379 358
            </table>
380 359
          </td>
......
433 412
      <table>
434 413
	<tr class=listheading>
435 414
         <th class=listheading nowrap>|
436
    . $locale->text('Part Number')
437
    . qq|</th>
415
    . $locale->text('Part Number') . qq|</th>
438 416
         <th class=listheading nowrap>|
439
    . $locale->text('Part Description')
440
    . qq|</th>
417
    . $locale->text('Part Description') . qq|</th>
441 418
        </tr>
442 419
        <tr valign=top>
443 420
         <td><input type=text name=partnumber size=20 value=></td>
......
858 835
    $option   .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
859 836
  }
860 837

  
861
  @columns =
862
    $form->sort_columns(
838
  @columns = $form->sort_columns(
863 839
    qw(number partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
864
    );
840
  );
865 841

  
866 842
  if ($form->{l_linetotal}) {
867 843
    $form->{l_onhand} = "Y";
......
1441 1417
    $option   .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
1442 1418
  }
1443 1419

  
1444
  @columns =
1445
    $form->sort_columns(
1420
  @columns = $form->sort_columns(
1446 1421
    qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
1447
    );
1422
  );
1448 1423

  
1449 1424
  if ($form->{l_linetotal}) {
1450 1425
    $form->{l_onhand} = "Y";
......
1921 1896
  delete $form->{amount};
1922 1897

  
1923 1898
  $form->get_partsgroup(\%myconfig, { all => 1 });
1899

  
1924 1900
  $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
1901

  
1925 1902
  if (@{ $form->{all_partsgroup} }) {
1926 1903
    $form->{selectpartsgroup} = qq|<option>\n|;
1927 1904
    map {
......
2018 1995
      }
2019 1996
    }
2020 1997
  }
1998

  
2021 1999
  if ($form->{selectpartsgroup}) {
2022 2000
    $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
2023 2001
    $partsgroup =
......
2044 2022
  $lastcost = qq|
2045 2023
 	      <tr>
2046 2024
                <th align="right" nowrap="true">|
2047
    . $locale->text('Last Cost')
2048
    . qq|</th>
2025
    . $locale->text('Last Cost') . qq|</th>
2049 2026
                <td><input name=lastcost size=11 value=$form->{lastcost}></td>
2050 2027
              </tr>
2051 2028
|;
......
2153 2130
	      <tr>
2154 2131
		<th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
2155 2132
		<th align=left nowrap class="plus$n">&nbsp;|
2156
      . $form->format_amount(\%myconfig, $form->{onhand})
2157
      . qq|</th>
2133
      . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
2158 2134
	      </tr>
2159 2135
|;
2160 2136

  
......
2183 2159
    $vegv = qq|
2184 2160
 	      <tr>
2185 2161
		<th align="right" nowrap="true">|
2186
      . $locale->text('Verrechnungseinheit')
2187
      . qq|</th>
2162
      . $locale->text('Verrechnungseinheit') . qq|</th>
2188 2163
		<td><input name=ve size=10 value=$form->{ve}></td>
2189 2164
	      </tr>
2190 2165
              <tr>
2191 2166
		<th align="right" nowrap="true">|
2192
      . $locale->text('Gesch?ftsvolumen')
2193
      . qq|</th>
2167
      . $locale->text('Gesch?ftsvolumen') . qq|</th>
2194 2168
		<td><input name=gv size=10 value=$form->{gv}></td>
2195 2169
	      </tr>
2196 2170
|;
......
2227 2201
  $obsolete .= qq|
2228 2202
              <tr>
2229 2203
                <th align=right nowrap>|
2230
    . $locale->text('Shopartikel')
2231
    . qq|</th>
2204
    . $locale->text('Shopartikel') . qq|</th>
2232 2205
                <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
2233 2206
             </tr>
2234 2207
|;
......
2249 2222
    $button1 = qq|
2250 2223
       <td width="13"><input name=priceupdate id=priceupdate size=11  title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
2251 2224
       <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
2252
      . $locale->text('button')
2253
      . qq|></td>
2225
      . $locale->text('button') . qq|></td>
2254 2226
      |;
2255 2227

  
2256 2228
    #write Trigger
......
2314 2286
            <table width="100%" height="100%">
2315 2287
              <tr class="listheading">
2316 2288
                <th class="listheading" align="center" colspan=2>|
2317
    . $locale->text('Link Accounts')
2318
    . qq|</th>
2289
    . $locale->text('Link Accounts') . qq|</th>
2319 2290
              </tr>
2320 2291
              $linkaccounts
2321 2292
              <tr>
......
2332 2303
	    <table width="100%">
2333 2304
	      <tr>
2334 2305
                <th align="right" nowrap="true">|
2335
    . $locale->text('Updated')
2336
    . qq|</th>
2306
    . $locale->text('Updated') . qq|</th>
2337 2307
                $button1
2338 2308
              </tr>
2339 2309
	      <tr>
......
2378 2348
            <table width="100%">
2379 2349
              <tr>
2380 2350
                <th colspan=2 align=right>|
2381
      . $locale->text('Total')
2382
      . qq|&nbsp;</th>
2351
      . $locale->text('Total') . qq|&nbsp;</th>
2383 2352
                <th align=right>|
2384
      . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2)
2385
      . qq|</th>
2353
      . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
2386 2354
              </tr>
2387 2355
            </table>
2388 2356
          </td>
......
2415 2383
    |;
2416 2384
  }
2417 2385

  
2386
  print qq|
2387
     <input type=hidden name=price_rows value=$form->{price_rows}>|;
2388

  
2418 2389
  print qq|
2419 2390
      <input class=submit type=submit name=action value="|
2420 2391
    . $locale->text('Save') . qq|">|;
......
2718 2689
  if ($form->{item} eq 'service') {
2719 2690
    map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2720 2691
      qw(sellprice listprice);
2721

  
2722 2692
    &form_header;
2723 2693
    &form_footer;
2724 2694
  }
......
2898 2868
      <table>
2899 2869
        <tr>
2900 2870
          <th align="right" nowrap="true">|
2901
    . $locale->text('Part Number')
2902
    . qq|</th>
2871
    . $locale->text('Part Number') . qq|</th>
2903 2872
          <td><input name=partnumber size=20></td>
2904 2873
          <td>&nbsp;</td>
2905 2874
        </tr>
2906 2875
        <tr>
2907 2876
          <th align="right" nowrap="true">|
2908
    . $locale->text('Part Description')
2909
    . qq|</th>
2877
    . $locale->text('Part Description') . qq|</th>
2910 2878
          <td><input name=description size=40></td>
2911 2879
        </tr>
2912 2880
      </table>
......
3053 3021
  $lxdebug->leave_sub();
3054 3022
}
3055 3023

  
3024
sub price_row {
3025
  $lxdebug->enter_sub();
3026

  
3027
  my ($numrows) = @_;
3028

  
3029
  print qq|
3030
  <tr>
3031
    <td>
3032
      <table width=100%>
3033
        <tr>
3034
          <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
3035
          <th class="listheading">| . $locale->text('Preis') . qq|</th>
3036
        </tr>
3037
|;
3038
  for $i (1 .. $numrows) {
3039
    print qq|
3040
        <tr>
3041
          <td width=50%><input type=hidden name="pricegroup_$i" size=30  value=$form->{"pricegroup_$i"}>$form->{"pricegroup_$i"}</td>
3042
          <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
3043
          <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
3044
        </tr>
3045
|;
3046
  }
3047

  
3048
  print qq|
3049
      </table>
3050
    </td>
3051
  </tr>
3052
|;
3053

  
3054
  $lxdebug->leave_sub();
3055
}
3056

  
3056 3057
sub continue { &{ $form->{nextsub} } }
bin/mozilla/io.pl
72 72
# $locale->text('Oct')
73 73
# $locale->text('Nov')
74 74
# $locale->text('Dec')
75
use SL::IS;
76
use SL::PE;
75 77
use Data::Dumper;
76 78
########################################
77 79
# Eintrag fuer Version 2.2.0 geaendert #
......
80 82
sub display_row {
81 83
  $lxdebug->enter_sub();
82 84
  my $numrows = shift;
83

  
85
print STDERR "io.pl-display_row\n";
84 86
  if ($lizenzen && $form->{vc} eq "customer") {
85 87
    if ($form->{type} =~ /sales_order/) {
86 88
      @column_index = (runningnumber, partnumber, description, ship, qty);
......
99 101
  }
100 102
############## ENDE Neueintrag ##################
101 103

  
102
  push @column_index, qw(unit sellprice);
104
  push @column_index, qw(unit);
105

  
106
  #for pricegroups column
107
  if ($form->{type} =~ (/sales_quotation/) or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) or ($form->{type} =~ /sales_order/)) {
108
    push @column_index, qw(sellprice_drag);
109
  }
110

  
111
  push @column_index, qw(sellprice);
103 112

  
104 113
  if ($form->{vc} eq 'customer') {
105 114
    push @column_index, qw(discount);
......
153 162
    . $locale->text('Project')
154 163
    . qq|</th>|;
155 164
  $column_data{sellprice} =
156
      qq|<th align=left nowrap width=10 class=listheading>|
165
      qq|<th align=left nowrap width=15 class=listheading>|
157 166
    . $locale->text('Price')
158 167
    . qq|</th>|;
168
  $column_data{sellprice_drag} =
169
      qq|<th align=left nowrap width=15 class=listheading>|
170
    . $locale->text('Pricegroup')
171
    . qq|</th>|;
159 172
  $column_data{discount} =
160 173
      qq|<th align=left class=listheading>|
161 174
    . $locale->text('Discount')
......
201 214
    map {
202 215
      $form->{"${_}_$i"} =
203 216
        $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
204
    } qw(qty ship discount sellprice);
217
    } qw(qty ship discount sellprice price_new price_old);
205 218

  
206 219
    ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
207 220
    $dec           = length $dec;
......
211 224
      $form->round_amount(
212 225
                        $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100,
213 226
                        $decimalplaces);
227

  
214 228
    $linetotal =
215 229
      $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
216 230
    $linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2);
......
239 253
    }
240 254

  
241 255
    $column_data{qty} =
242
        qq|<td align=right><input name="qty_$i" size=5 value=|
243
      . $form->format_amount(\%myconfig, $form->{"qty_$i"})
244
      . qq|></td>|;
256
        qq|<td align=right><input name="qty_$i" size=5 value=|.$form->format_amount(\%myconfig, $form->{"qty_$i"},0).qq|></td>|;
245 257
    $column_data{ship} =
246 258
        qq|<td align=right><input name="ship_$i" size=5 value=|
247 259
      . $form->format_amount(\%myconfig, $form->{"ship_$i"})
248 260
      . qq|></td>|;
249 261
    $column_data{unit} =
250 262
      qq|<td><input name="unit_$i" size=5 value="$form->{"unit_$i"}"></td>|;
251
    $column_data{sellprice} =
252
      qq|<td align=right><input name="sellprice_$i" size=9 value=|
253
      . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
254
                             $decimalplaces)
255
      . qq|></td>|;
263

  
264

  
265

  
266
 #print (STDERR "io.pl---111-i-$i", Dumper($form->{PRICES}));
267
    # build in dragdrop for pricesgroups
268
    if ($form->{"prices_$i"}) {
269
 print STDERR " YES  prices\n";
270
      $price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, 2);
271

  
272
      $column_data{sellprice_drag} =
273
        qq|<td align=right><select name="sellprice_drag_$i">$form->{"prices_$i"}</select></td>|;
274
      $column_data{sellprice} =
275
        qq|<td><input name="sellprice_$i" size=5 value=$price_tmp></td>|;
276
    } else {
277
      print STDERR " NO prices\n";
278
      # for last row and report
279
      # set pricegroup dragdrop from report menu
280
      if ($form->{"sellprice_$i"} != 0) {
281
print STDERR "   HIER NOCH F?R RECHNUNGSAUFRUFE\n";
282
print (STDERR "sellprice_$i   ", Dumper($form->{"sellprice_$i"}), " pricegroup_id_$i ", Dumper($form->{"pricegroup_id_$i"}));
283
        $prices =
284
             qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|;
285

  
286
        $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
287

  
288
        $column_data{sellprice_drag} =
289
          qq|<td align=right><select name="sellprice_drag_$i">$prices</select></td>|;
290

  
291
        }else {
292
          # for last row
293
          $column_data{sellprice_drag} =
294
            qq|<td align=right><input name="sellprice_$i" size=9 value=|
295
              . $form->format_amount(\%myconfig, $form->{"prices_$i"},
296
                               $decimalplaces)
297
            . qq|></td>|;
298
          }
299

  
300
      $column_data{sellprice} =
301
        qq|<td><input name="sellprice_$i" size=5 value=|
302
        . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
303
                               $decimalplaces)
304
        . qq|></td>|;
305
    }
306
#print (STDERR "io.pl---555-i-$i", Dumper($form->{"price_old_$i"}));
256 307
    $column_data{discount} =
257 308
        qq|<td align=right><input name="discount_$i" size=3 value=|
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff