Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 85ffde7a

Von Holger Lindemann vor etwa 14 Jahren hinzugefügt

  • ID 85ffde7a577589762b70de99ca08b6f25e9e9d1b
  • Vorgänger 7d78285a
  • Nachfolger dcaee5f7

EK-Preise in der makemodel hinterlegen mit Datum der letzten Änderung.

Reihenfolge der Lieferanten nach Wichtigkeit.

Unterschiede anzeigen:

SL/IC.pm
167 167

  
168 168
    # get makes
169 169
    if ($form->{makemodel}) {
170
      $query = qq|SELECT m.make, m.model FROM makemodel m | .
171
               qq|WHERE m.parts_id = ?|;
170
    #hli
171
      $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | .
172
               qq|WHERE m.parts_id = ? order by m.sortorder asc|;
172 173
      my @values = ($form->{id});
173 174
      $sth = $dbh->prepare($query);
174 175
      $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")");
175 176

  
176 177
      my $i = 1;
177
      while (($form->{"make_$i"}, $form->{"model_$i"}) = $sth->fetchrow_array)
178

  
179
      while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"}, 
180
                $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array)
178 181
      {
179 182
        $i++;
180 183
      }
......
493 496

  
494 497
  # insert makemodel records
495 498
  unless ($form->{item} eq 'service') {
499
    my $lastupdate = '';
500
    my $value = 0;
496 501
    for my $i (1 .. $form->{makemodel_rows}) {
497 502
      if (($form->{"make_$i"}) || ($form->{"model_$i"})) {
498

  
499
        $query = qq|INSERT INTO makemodel (parts_id, make, model) | .
500
                 qq|VALUES (?, ?, ?)|;
501
        @values = (conv_i($form->{id}), conv_i($form->{"make_$i"}), $form->{"model_$i"});
503
        #hli
504
        $value = $form->parse_amount($myconfig, $form->{"lastcost_$i"});
505
        if ($value == $form->{"old_lastcost_$i"}) 
506
        {
507
            $lastupdate = $dbh->quote($form->{"lastupdate_$i"});
508
        } else {
509
            $lastupdate = 'now()';
510
        }
511
        $query = qq|INSERT INTO makemodel (parts_id, make, model, lastcost, lastupdate, sortorder) | .
512
                 qq|VALUES (?, ?, ?, ?, ?, ?)|;
513
        @values = (conv_i($form->{id}), conv_i($form->{"make_$i"}), $form->{"model_$i"}, $value, $lastupdate, conv_i($form->{"sortorder_$i"}) );
502 514

  
503 515
        do_query($form, $dbh, $query, @values);
504 516
      }
......
818 830
     ordnumber    => 'apoe.', make         => 'mm.',
819 831
     quonumber    => 'apoe.', model        => 'mm.',
820 832
     invnumber    => 'apoe.', partsgroup   => 'pg.',
821
     lastcost     => ' ',   , soldtotal    => ' ',
833
     lastcost     => 'p.',  , soldtotal    => ' ',
822 834
     factor       => 'pfac.',
823 835
     'SUM(ioi.qty)' => ' ',
824 836
     description  => 'p.',
bin/mozilla/ic.pl
1579 1579
sub makemodel_row {
1580 1580
  $lxdebug->enter_sub();
1581 1581
  my ($numrows) = @_;
1582

  
1583
  my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows;
1582
  #hli
1583
  my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"}, lastcost => $form->{"lastcost_$_"}, lastupdate => $form->{"lastupdate_$_"}, sortorder => $form->{"sortorder_$_"} }, 1 .. $numrows;
1584 1584
  delete @{$form}{grep { m/^make_\d+/ || m/^model_\d+/ } keys %{ $form }};
1585 1585
  print $form->parse_html_template('ic/makemodel', { MM_DATA => [ @mm_data, {} ], mm_rows => scalar @mm_data + 1 });
1586 1586

  
sql/Pg-upgrade2/add_makemodel_prices.sql
1
-- @tag: add_makemodel_prices
2
-- @description: EK-Preis zu jedem Lieferanten speichern und das Datum der Eingabe
3
-- @depends: release_2_6_1
4
ALTER TABLE makemodel ADD COLUMN lastcost  numeric(15,5) ;
5
ALTER TABLE makemodel ADD COLUMN lastupdate  date;
6
ALTER TABLE makemodel ADD COLUMN sortorder integer;
7

  
8
UPDATE makemodel SET sortorder = 1;
9

  
10
--# Da noch keine Daten vorhanden, den Wert "veralten"
11
UPDATE makemodel SET lastupdate = '1999-01-01';
12

  
templates/webpages/ic/makemodel.html
7 7
        <tr>
8 8
          <th class="listheading">[% 'Make' | $T8 %]</th>
9 9
          <th class="listheading">[% 'Model' | $T8 %]</th>
10
          <th class="listheading">[% 'Last Cost' | $T8 %]</th>
11
          <th class="listheading">[% 'Updated' | $T8 %]</th>
12
          <th class="listheading">[% 'order' | $T8 %]</th>
10 13
        </tr>
11 14
      [%- FOREACH row = MM_DATA %]
12 15
        <tr>
......
21 24
            -%]
22 25
          </td>
23 26
          <td><input name="model_[% loop.count %]" size="30" value="[% HTML.escape(row.model) %]"></td>
27
          <td><input type="hidden" name="old_lastcost_[% loop.count %]" value="[% LxERP.format_amount(row.lastcost, -2) %]">
28
              <input name="lastcost_[% loop.count %]" size="10" value="[% LxERP.format_amount(row.lastcost, -2) %]"></td>
29
          <td><input name="lastupdate_[% loop.count %]" size="10" value="[% HTML.escape(row.lastupdate) %]"></td>
30
          <td><input name="sortorder_[% loop.count %]" size="3" value="[% HTML.escape(row.sortorder) %]"></td>
24 31
        </tr>
25 32
      [%- END %]
26 33
      </table>

Auch abrufbar als: Unified diff