Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ba0fb69c

Von Sven Schöling vor mehr als 12 Jahren hinzugefügt

  • ID ba0fb69ce21dd281a09d91418785fa87203f9e6c
  • Vorgänger 9414d575
  • Nachfolger a1ee1265

sellprice information test commit

Unterschiede anzeigen:

SL/DB/OrderItem.pm
2 2

  
3 3
use strict;
4 4

  
5
use List::Util qw(sum);
6
use SL::AM;
7

  
5 8
use SL::DB::MetaSetup::OrderItem;
6 9
use SL::DB::Helper::CustomVariables (
7 10
  sub_module  => 'orderitems',
......
44 47
  return $self->origprice > $self->part->sellprice;
45 48
}
46 49

  
50
sub shipped_qty {
51
  my ($self) = @_;
52

  
53
  my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder');
54
  my @doi      = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @$d_orders;
55

  
56
  return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi);
57
}
58

  
47 59
package SL::DB::Manager::OrderItem;
48 60

  
49 61
use SL::DB::Helper::Paginated;
......
57 69
                        ordnumber     => [ 'order.ordnumber'      ],
58 70
                        customer      => [ 'lower(customer.name)', ],
59 71
                        position      => [ 'trans_id', 'runningnumber' ],
60
                        transdate     => [ 'transdate', 'lower(order.reqdate::text)' ],
72
                        reqdate       => [ 'COALESCE(orderitems.reqdate, order.transdate)' ],
73
                        orddate       => [ 'order.orddate' ],
74
                        sellprice     => [ 'sellprice' ],
75
                        discount      => [ 'discount' ],
61 76
                      },
62 77
           default => [ 'position', 1 ],
63 78
           nulls   => { }

Auch abrufbar als: Unified diff