Revision 2746ccd0
Von Sven Schöling vor mehr als 12 Jahren hinzugefügt
SL/DB/DeliveryOrder.pm | ||
---|---|---|
45 | 45 |
return first { $_->is_type('sales_order') } @{ $orders }; |
46 | 46 |
} |
47 | 47 |
|
48 |
sub type { |
|
49 |
return shift->customer_id ? 'sales_delivery_order' : 'purchase_delivery_order'; |
|
50 |
} |
|
51 |
|
|
52 |
sub displayable_state { |
|
53 |
my ($self) = @_; |
|
54 |
|
|
55 |
return join '; ', |
|
56 |
($self->closed ? $::locale->text('closed') : $::locale->text('open')), |
|
57 |
($self->delivered ? $::locale->text('delivered') : $::locale->text('not delivered')); |
|
58 |
} |
|
59 |
|
|
48 | 60 |
1; |
SL/DB/Invoice.pm | ||
---|---|---|
236 | 236 |
} |
237 | 237 |
} |
238 | 238 |
|
239 |
sub invoice_type { |
|
240 |
my ($self) = @_; |
|
241 |
|
|
242 |
return 'ar_transaction' if !$self->invoice; |
|
243 |
return 'credit_note' if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno; |
|
244 |
return 'invoice_storno' if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno; |
|
245 |
return 'credit_note_storno' if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno; |
|
246 |
return 'invoice'; |
|
247 |
} |
|
248 |
|
|
249 |
sub displayable_state { |
|
250 |
my $self = shift; |
|
251 |
|
|
252 |
return $self->closed ? $::locale->text('closed') : $::locale->text('open'); |
|
253 |
} |
|
254 |
|
|
239 | 255 |
1; |
240 | 256 |
|
241 | 257 |
__END__ |
SL/DB/Order.pm | ||
---|---|---|
84 | 84 |
return shift->type eq shift; |
85 | 85 |
} |
86 | 86 |
|
87 |
sub displayable_type { |
|
88 |
my $type = shift->type; |
|
89 |
|
|
90 |
return $::locale->text('Sales quotation') if $type eq 'sales_quotation'; |
|
91 |
return $::locale->text('Request quotation') if $type eq 'request_quotation'; |
|
92 |
return $::locale->text('Sales Order') if $type eq 'sales_order'; |
|
93 |
return $::locale->text('Purchase Order') if $type eq 'purchase_order'; |
|
94 |
|
|
95 |
die 'invalid type'; |
|
96 |
} |
|
97 |
|
|
98 |
|
|
87 | 99 |
sub is_sales { |
88 | 100 |
croak 'not an accessor' if @_ > 1; |
89 | 101 |
return shift->customer_id; |
... | ... | |
105 | 117 |
} |
106 | 118 |
} |
107 | 119 |
|
120 |
sub displayable_state { |
|
121 |
my ($self) = @_; |
|
122 |
|
|
123 |
return $self->closed ? $::locale->text('closed') : $::locale->text('open'); |
|
124 |
} |
|
125 |
|
|
108 | 126 |
sub abschlag_invoices { |
109 | 127 |
return shift()->invoices(query => [ abschlag => 1 ]); |
110 | 128 |
} |
Auch abrufbar als: Unified diff
Helfermethoden in Belegobjekten.