Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 61ab3c63

Von Jan Büren vor fast 15 Jahren hinzugefügt

  • ID 61ab3c630bf655d54cb44f70f871eed5879f9693
  • Vorgänger 29b7a641
  • Nachfolger 2ef92b3a

Fix für Bug 1081. Bei Buchung einer Einkaufsrechnung geht das Rabatt verloren. 1.) Der Rabatt wurde nicht korrekt in die Tabelle invoice geschrieben, bzw. auch nicht wieder ausgelesen. 2.) Bei Buchung in die acc_trans wurde entsprechend auch nicht der Rabatt vorab berechnen. 3.) Prinzipiell würde ich mir eine zentrale 'Rabatt-Berechnungsfunktion' über alle Buchungsmasken wünschen (s.a. Kommentar)

Unterschiede anzeigen:

SL/IR.pm
131 131
    map { $taxrate += $form->{"${_}_rate"} } @taxaccounts;
132 132

  
133 133
    $price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1;
134

  
134
    #####################################################################
135
    # das ist aus IS.pm kopiert. schlimm. jb 7.10.2009
136
    # ich würde mir wünschen, dass diese vier stellen zusammengefasst werden 
137
    # ... vier stellen = (einkauf + verkauf) * (maske + backend)
138
    # ansonsten stolpert man immer wieder viermal statt einmal heftig
139
    # und auch das undo discount formatting ist nicht besonders wartungsfreundlich
140
 
141
    # keep entered selling price
142
    my $fxsellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"});
143

  
144
    # keine ahnung wofür das in IS.pm gemacht wird:
145
    #      my ($dec) = ($fxsellprice =~ /\.(\d+)/);
146
    #  $dec = length $dec;
147
    #  my $decimalplaces = ($dec > 2) ? $dec : 2;
148

  
149
    # undo discount formatting
150
    $form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100;
151
    # deduct discount
152
    $form->{"sellprice_$i"} = $fxsellprice * (1 - $form->{"discount_$i"});
153
 
154
    ######################################################################
135 155
    if ($form->{"inventory_accno_$i"}) {
136 156

  
137 157
      $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2);
......
298 318

  
299 319
    $query =
300 320
      qq|INSERT INTO invoice (id, trans_id, parts_id, description, qty, base_qty,
301
                              sellprice, fxsellprice, allocated, unit, deliverydate,
321
                              sellprice, fxsellprice, discount, allocated, unit, deliverydate,
302 322
                              project_id, serialnumber, price_factor_id, price_factor, marge_price_factor)
303
         VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT factor FROM price_factors WHERE id = ?), ?)|;
323
         VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT factor FROM price_factors WHERE id = ?), ?)|;
304 324
    @values = ($invoice_id, conv_i($form->{id}), conv_i($form->{"id_$i"}),
305 325
               $form->{"description_$i"}, $form->{"qty_$i"} * -1,
306
               $baseqty * -1, $form->{"sellprice_$i"}, $fxsellprice, $allocated,
326
               $baseqty * -1, $form->{"sellprice_$i"}, $fxsellprice, $form->{"discount_$i"}, $allocated,
307 327
               $form->{"unit_$i"}, conv_date($form->{deliverydate}),
308 328
               conv_i($form->{"project_id_$i"}), $form->{"serialnumber_$i"},
309 329
               conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"marge_price_factor_$i"}));
......
777 797

  
778 798
        i.id AS invoice_id,
779 799
        i.description, i.qty, i.fxsellprice AS sellprice, i.parts_id AS id, i.unit, i.deliverydate, i.project_id, i.serialnumber,
780
        i.price_factor_id, i.price_factor, i.marge_price_factor,
800
        i.price_factor_id, i.price_factor, i.marge_price_factor, i.discount,
781 801
        p.partnumber, p.inventory_accno_id AS part_inventory_accno_id, p.bin, pr.projectnumber, pg.partsgroup
782 802

  
783 803
        FROM invoice i

Auch abrufbar als: Unified diff