Revision fefc824c
Von Tamino Steinert vor 11 Monaten hinzugefügt
SL/Presenter/Record.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use SL::Presenter; |
6 | 6 |
use SL::Presenter::EscapedText qw(escape is_escaped); |
7 |
use SL::Presenter::Tag qw(html_tag); |
|
7 | 8 |
|
8 | 9 |
use Exporter qw(import); |
9 | 10 |
our @EXPORT_OK = qw(grouped_record_list empty_record_list record_list record); |
... | ... | |
13 | 14 |
use Carp; |
14 | 15 |
use List::Util qw(first); |
15 | 16 |
|
17 |
my @ORDERED_TYPES = qw( |
|
18 |
requirement_spec |
|
19 |
shop_order |
|
20 |
sales_quotation |
|
21 |
sales_order_intake |
|
22 |
sales_order |
|
23 |
sales_delivery_order |
|
24 |
rma_delivery_order |
|
25 |
sales_reclamation |
|
26 |
sales_invoice |
|
27 |
ar_transaction |
|
28 |
request_quotation |
|
29 |
purchase_quotation_intake |
|
30 |
purchase_order |
|
31 |
purchase_order_confirmation |
|
32 |
purchase_delivery_order |
|
33 |
supplier_delivery_order |
|
34 |
purchase_reclamation |
|
35 |
purchase_invoice |
|
36 |
ap_transaction |
|
37 |
gl_transaction |
|
38 |
bank_transaction |
|
39 |
sepa_collection |
|
40 |
sepa_transfer |
|
41 |
letter |
|
42 |
email_journal |
|
43 |
dunning |
|
44 |
); |
|
45 |
|
|
46 |
my %TYPE_TO_PARAMS = ( |
|
47 |
# sub gets other params as arguments to override if needed |
|
48 |
# has to encoupsulated in a sub for evaluation of locale translations |
|
49 |
requirement_spec => sub { |
|
50 |
my (%params) = @_; |
|
51 |
{ |
|
52 |
title => $::locale->text('Requirement specs'), |
|
53 |
type => 'requirement_spec', |
|
54 |
columns => [ |
|
55 |
[ $::locale->text('Requirement spec number'), sub { $_[0]->presenter->requirement_spec(display => 'table-cell') } ], |
|
56 |
[ $::locale->text('Customer'), 'customer' ], |
|
57 |
[ $::locale->text('Title'), 'title' ], |
|
58 |
[ $::locale->text('Project'), 'project', ], |
|
59 |
[ $::locale->text('Status'), sub { $_[0]->status->description } ], |
|
60 |
], |
|
61 |
%params, |
|
62 |
} |
|
63 |
}, |
|
64 |
shop_order => sub { |
|
65 |
my (%params) = @_; |
|
66 |
{ |
|
67 |
title => $::locale->text('Shop Orders'), |
|
68 |
type => 'shop_order', |
|
69 |
columns => [ |
|
70 |
[ $::locale->text('Shop Order Date'), sub { $_[0]->order_date->to_kivitendo } ], |
|
71 |
[ $::locale->text('Shop Order Number'), sub { $_[0]->presenter->shop_order(display => 'table-cell') } ], |
|
72 |
[ $::locale->text('Transfer Date'), 'transfer_date' ], |
|
73 |
[ $::locale->text('Amount'), 'amount' ], |
|
74 |
], |
|
75 |
%params, |
|
76 |
} |
|
77 |
}, |
|
78 |
sales_quotation => sub { |
|
79 |
my (%params) = @_; |
|
80 |
{ |
|
81 |
title => $::locale->text('Sales Quotations'), |
|
82 |
type => 'sales_quotation', |
|
83 |
columns => [ |
|
84 |
[ $::locale->text('Quotation Date'), 'transdate' ], |
|
85 |
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->sales_quotation(display => 'table-cell') } ], |
|
86 |
[ $::locale->text('Customer'), 'customer' ], |
|
87 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
88 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
89 |
[ $::locale->text('Project'), 'globalproject', ], |
|
90 |
[ $::locale->text('Closed'), 'closed' ], |
|
91 |
], |
|
92 |
%params, |
|
93 |
} |
|
94 |
}, |
|
95 |
request_quotation => sub { |
|
96 |
my (%params) = @_; |
|
97 |
{ |
|
98 |
title => $::locale->text('Request Quotations'), |
|
99 |
type => 'request_quotation', |
|
100 |
columns => [ |
|
101 |
[ $::locale->text('Quotation Date'), 'transdate' ], |
|
102 |
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->request_quotation(display => 'table-cell') } ], |
|
103 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
104 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
105 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
106 |
[ $::locale->text('Project'), 'globalproject', ], |
|
107 |
[ $::locale->text('Closed'), 'closed' ], |
|
108 |
], |
|
109 |
%params, |
|
110 |
} |
|
111 |
}, |
|
112 |
purchase_quotation_intake => sub { |
|
113 |
my (%params) = @_; |
|
114 |
{ |
|
115 |
title => $::locale->text('Purchase Quotation Intakes'), |
|
116 |
type => 'purchase_quotation_intake', |
|
117 |
columns => [ |
|
118 |
[ $::locale->text('Quotation Date'), 'transdate' ], |
|
119 |
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->purchase_quotation_intake(display => 'table-cell') } ], |
|
120 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
121 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
122 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
123 |
[ $::locale->text('Project'), 'globalproject', ], |
|
124 |
[ $::locale->text('Closed'), 'closed' ], |
|
125 |
], |
|
126 |
%params, |
|
127 |
} |
|
128 |
}, |
|
129 |
sales_order_intake => sub { |
|
130 |
my (%params) = @_; |
|
131 |
{ |
|
132 |
title => $::locale->text('Sales Order Intakes'), |
|
133 |
type => 'sales_order_intake', |
|
134 |
columns => [ |
|
135 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
136 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order_intake(display => 'table-cell') } ], |
|
137 |
[ $::locale->text('Quotation'), 'quonumber' ], |
|
138 |
[ $::locale->text('Customer'), 'customer' ], |
|
139 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
140 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
141 |
[ $::locale->text('Project'), 'globalproject', ], |
|
142 |
[ $::locale->text('Closed'), 'closed' ], |
|
143 |
], |
|
144 |
%params, |
|
145 |
} |
|
146 |
}, |
|
147 |
sales_order => sub { |
|
148 |
my (%params) = @_; |
|
149 |
{ |
|
150 |
title => $::locale->text('Sales Orders'), |
|
151 |
type => 'sales_order', |
|
152 |
columns => [ |
|
153 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
154 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order(display => 'table-cell') } ], |
|
155 |
[ $::locale->text('Quotation'), 'quonumber' ], |
|
156 |
[ $::locale->text('Customer'), 'customer' ], |
|
157 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
158 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
159 |
[ $::locale->text('Project'), 'globalproject', ], |
|
160 |
[ $::locale->text('Closed'), 'closed' ], |
|
161 |
], |
|
162 |
%params, |
|
163 |
} |
|
164 |
}, |
|
165 |
purchase_order => sub { |
|
166 |
my (%params) = @_; |
|
167 |
{ |
|
168 |
title => $::locale->text('Purchase Orders'), |
|
169 |
type => 'purchase_order', |
|
170 |
columns => [ |
|
171 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
172 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->purchase_order(display => 'table-cell') } ], |
|
173 |
[ $::locale->text('Request for Quotation'), 'quonumber' ], |
|
174 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
175 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
176 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
177 |
[ $::locale->text('Project'), 'globalproject', ], |
|
178 |
[ $::locale->text('Closed'), 'closed' ], |
|
179 |
], |
|
180 |
%params, |
|
181 |
} |
|
182 |
}, |
|
183 |
purchase_order_confirmation => sub { |
|
184 |
my (%params) = @_; |
|
185 |
{ |
|
186 |
title => $::locale->text('Purchase Order Confirmations'), |
|
187 |
type => 'purchase_order_confirmation', |
|
188 |
columns => [ |
|
189 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
190 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->purchase_order_confirmation(display => 'table-cell') } ], |
|
191 |
[ $::locale->text('Request for Quotation'), 'quonumber' ], |
|
192 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
193 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
194 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
195 |
[ $::locale->text('Project'), 'globalproject', ], |
|
196 |
[ $::locale->text('Closed'), 'closed' ], |
|
197 |
], |
|
198 |
%params, |
|
199 |
} |
|
200 |
}, |
|
201 |
sales_delivery_order => sub { |
|
202 |
my (%params) = @_; |
|
203 |
{ |
|
204 |
title => $::locale->text('Sales Delivery Orders'), |
|
205 |
type => 'sales_delivery_order', |
|
206 |
columns => [ |
|
207 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
208 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->sales_delivery_order(display => 'table-cell') } ], |
|
209 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
210 |
[ $::locale->text('Customer'), 'customer' ], |
|
211 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
212 |
[ $::locale->text('Project'), 'globalproject', ], |
|
213 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
214 |
[ $::locale->text('Closed'), 'closed' ], |
|
215 |
], |
|
216 |
%params, |
|
217 |
} |
|
218 |
}, |
|
219 |
rma_delivery_order => sub { |
|
220 |
my (%params) = @_; |
|
221 |
{ |
|
222 |
title => $::locale->text('RMA Delivery Orders'), |
|
223 |
type => 'rma_delivery_order', |
|
224 |
columns => [ |
|
225 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
226 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->rma_delivery_order(display => 'table-cell') } ], |
|
227 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
228 |
[ $::locale->text('Customer'), 'customer' ], |
|
229 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
230 |
[ $::locale->text('Project'), 'globalproject', ], |
|
231 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
232 |
[ $::locale->text('Closed'), 'closed' ], |
|
233 |
], |
|
234 |
%params, |
|
235 |
} |
|
236 |
}, |
|
237 |
purchase_delivery_order => sub { |
|
238 |
my (%params) = @_; |
|
239 |
{ |
|
240 |
title => $::locale->text('Purchase Delivery Orders'), |
|
241 |
type => 'purchase_delivery_order', |
|
242 |
columns => [ |
|
243 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
244 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->purchase_delivery_order(display => 'table-cell') } ], |
|
245 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
246 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
247 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
248 |
[ $::locale->text('Project'), 'globalproject', ], |
|
249 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
250 |
[ $::locale->text('Closed'), 'closed' ], |
|
251 |
], |
|
252 |
%params, |
|
253 |
} |
|
254 |
}, |
|
255 |
supplier_delivery_order => sub { |
|
256 |
my (%params) = @_; |
|
257 |
{ |
|
258 |
title => $::locale->text('Supplier Delivery Orders'), |
|
259 |
type => 'supplier_delivery_order', |
|
260 |
columns => [ |
|
261 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
262 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->supplier_delivery_order(display => 'table-cell') } ], |
|
263 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
264 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
265 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
266 |
[ $::locale->text('Project'), 'globalproject', ], |
|
267 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
268 |
[ $::locale->text('Closed'), 'closed' ], |
|
269 |
], |
|
270 |
%params, |
|
271 |
} |
|
272 |
}, |
|
273 |
sales_reclamation => sub { |
|
274 |
my (%params) = @_; |
|
275 |
{ |
|
276 |
title => $::locale->text('Sales Reclamations'), |
|
277 |
type => 'sales_reclamation', |
|
278 |
columns => [ |
|
279 |
[ $::locale->text('Reclamation Date'), 'transdate' ], |
|
280 |
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->sales_reclamation(display => 'table-cell') } ], |
|
281 |
[ $::locale->text('Customer'), 'customer' ], |
|
282 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
283 |
[ $::locale->text('Project'), 'globalproject', ], |
|
284 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
285 |
[ $::locale->text('Closed'), 'closed' ], |
|
286 |
], |
|
287 |
%params, |
|
288 |
} |
|
289 |
}, |
|
290 |
purchase_reclamation => sub { |
|
291 |
my (%params) = @_; |
|
292 |
{ |
|
293 |
title => $::locale->text('Purchase Reclamations'), |
|
294 |
type => 'purchase_reclamation', |
|
295 |
columns => [ |
|
296 |
[ $::locale->text('Reclamation Date'), 'transdate' ], |
|
297 |
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->purchase_reclamation(display => 'table-cell') } ], |
|
298 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
299 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
300 |
[ $::locale->text('Project'), 'globalproject', ], |
|
301 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
302 |
[ $::locale->text('Closed'), 'closed' ], |
|
303 |
], |
|
304 |
%params, |
|
305 |
} |
|
306 |
}, |
|
307 |
sales_invoice => sub { |
|
308 |
my (%params) = @_; |
|
309 |
{ |
|
310 |
title => $::locale->text('Sales Invoices'), |
|
311 |
type => 'sales_invoice', |
|
312 |
columns => [ |
|
313 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
314 |
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ], |
|
315 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->sales_invoice(display => 'table-cell') } ], |
|
316 |
[ $::locale->text('Quotation Number'), 'quonumber' ], |
|
317 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
318 |
[ $::locale->text('Customer'), 'customer' ], |
|
319 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
320 |
[ $::locale->text('Paid'), 'paid' ], |
|
321 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
322 |
], |
|
323 |
%params, |
|
324 |
} |
|
325 |
}, |
|
326 |
purchase_invoice => sub { |
|
327 |
my (%params) = @_; |
|
328 |
{ |
|
329 |
title => $::locale->text('Purchase Invoices'), |
|
330 |
type => 'purchase_invoice', |
|
331 |
columns => [ |
|
332 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
333 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->purchase_invoice(display => 'table-cell') } ], |
|
334 |
[ $::locale->text('Request for Quotation Number'), 'quonumber' ], |
|
335 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
336 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
337 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
338 |
[ $::locale->text('Paid'), 'paid' ], |
|
339 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
340 |
], |
|
341 |
%params, |
|
342 |
} |
|
343 |
}, |
|
344 |
ar_transaction => sub { |
|
345 |
my (%params) = @_; |
|
346 |
{ |
|
347 |
title => $::locale->text('AR Transactions'), |
|
348 |
type => 'ar_transaction', |
|
349 |
columns => [ |
|
350 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
351 |
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ], |
|
352 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ar_transaction(display => 'table-cell') } ], |
|
353 |
[ $::locale->text('Customer'), 'customer' ], |
|
354 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
355 |
[ $::locale->text('Paid'), 'paid' ], |
|
356 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
357 |
], |
|
358 |
%params, |
|
359 |
} |
|
360 |
}, |
|
361 |
ap_transaction => sub { |
|
362 |
my (%params) = @_; |
|
363 |
{ |
|
364 |
title => $::locale->text('AP Transactions'), |
|
365 |
type => 'ap_transaction', |
|
366 |
columns => [ |
|
367 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
368 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ap_transaction(display => 'table-cell') } ], |
|
369 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
370 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
371 |
[ $::locale->text('Paid'), 'paid' ], |
|
372 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
373 |
], |
|
374 |
%params, |
|
375 |
} |
|
376 |
}, |
|
377 |
gl_transaction => sub { |
|
378 |
my (%params) = @_; |
|
379 |
{ |
|
380 |
title => $::locale->text('GL Transactions'), |
|
381 |
type => 'gl_transaction', |
|
382 |
columns => [ |
|
383 |
[ $::locale->text('Transdate'), 'transdate' ], |
|
384 |
[ $::locale->text('Reference'), 'reference' ], |
|
385 |
[ $::locale->text('Description'), sub { $_[0]->presenter->gl_transaction(display => 'table-cell') } ], |
|
386 |
], |
|
387 |
%params, |
|
388 |
} |
|
389 |
}, |
|
390 |
bank_transaction => sub { |
|
391 |
my (%params) = @_; |
|
392 |
{ |
|
393 |
title => $::locale->text('Bank transactions'), |
|
394 |
type => 'bank_transactions', |
|
395 |
columns => [ |
|
396 |
[ $::locale->text('Transdate'), 'transdate' ], |
|
397 |
[ $::locale->text('Local Bank Code'), sub { $_[0]->local_bank_account->presenter->bank_code } ], |
|
398 |
[ $::locale->text('Local account number'), sub { $_[0]->local_bank_account->presenter->account_number } ], |
|
399 |
[ $::locale->text('Remote Bank Code'), 'remote_bank_code' ], |
|
400 |
[ $::locale->text('Remote account number'),'remote_account_number' ], |
|
401 |
[ $::locale->text('Valutadate'), 'valutadate' ], |
|
402 |
[ $::locale->text('Amount'), 'amount' ], |
|
403 |
[ $::locale->text('Currency'), sub { $_[0]->currency->name } ], |
|
404 |
[ $::locale->text('Remote name'), 'remote_name' ], |
|
405 |
[ $::locale->text('Purpose'), 'purpose' ], |
|
406 |
], |
|
407 |
%params, |
|
408 |
} |
|
409 |
}, |
|
410 |
# sepa_export gets called from sepa_transfer and sepa_collection |
|
411 |
sepa_export => sub { |
|
412 |
my (%params) = @_; |
|
413 |
|
|
414 |
my ($source, $destination) = $params{type} eq 'sepa_transfer' ? qw(our vc) : qw(vc our); |
|
415 |
$params{title} = $params{type} eq 'sepa_transfer' ? $::locale->text('Bank transfers via SEPA') : $::locale->text('Bank collections via SEPA'); |
|
416 |
$params{with_columns} = [ grep { $_ ne 'record_link_direction' } @{ $params{with_columns} || [] } ]; |
|
417 |
|
|
418 |
delete $params{edit_record_links}; |
|
419 |
|
|
420 |
{ |
|
421 |
columns => [ |
|
422 |
[ $::locale->text('Export Number'), 'sepa_export', ], |
|
423 |
[ $::locale->text('Execution date'), 'execution_date' ], |
|
424 |
[ $::locale->text('Export date'), sub { $_[0]->sepa_export->itime->to_kivitendo } ], |
|
425 |
[ $::locale->text('Source BIC'), "${source}_bic" ], |
|
426 |
[ $::locale->text('Source IBAN'), "${source}_iban" ], |
|
427 |
[ $::locale->text('Destination BIC'), "${destination}_bic" ], |
|
428 |
[ $::locale->text('Destination IBAN'), "${destination}_iban" ], |
|
429 |
[ $::locale->text('Amount'), 'amount' ], |
|
430 |
], |
|
431 |
%params, |
|
432 |
} |
|
433 |
}, |
|
434 |
sepa_transfer => sub { |
|
435 |
my (%params) = @_; |
|
436 |
_get_type_params('sepa_export', %params, type => 'sepa_transfer'); |
|
437 |
}, |
|
438 |
sepa_collection => sub { |
|
439 |
my (%params) = @_; |
|
440 |
_get_type_params('sepa_export', %params, type => 'sepa_collection'); |
|
441 |
}, |
|
442 |
letter => sub { |
|
443 |
my (%params) = @_; |
|
444 |
{ |
|
445 |
title => $::locale->text('Letters'), |
|
446 |
type => 'letter', |
|
447 |
columns => [ |
|
448 |
[ $::locale->text('Date'), 'date' ], |
|
449 |
[ $::locale->text('Letternumber'), sub { $_[0]->presenter->letter(display => 'table-cell') } ], |
|
450 |
[ $::locale->text('Customer'), 'customer' ], |
|
451 |
[ $::locale->text('Reference'), 'reference' ], |
|
452 |
[ $::locale->text('Subject'), 'subject' ], |
|
453 |
], |
|
454 |
%params, |
|
455 |
} |
|
456 |
}, |
|
457 |
email_journal => sub { |
|
458 |
my (%params) = @_; |
|
459 |
{ |
|
460 |
title => $::locale->text('Email'), |
|
461 |
type => 'email_journal', |
|
462 |
columns => [ |
|
463 |
[ $::locale->text('Sent on'), sub { $_[0]->sent_on->to_kivitendo(precision => 'seconds') } ], |
|
464 |
[ $::locale->text('Subject'), sub { $_[0]->presenter->email_journal(display => 'table-cell') } ], |
|
465 |
[ $::locale->text('Status'), 'status' ], |
|
466 |
[ $::locale->text('From'), 'from' ], |
|
467 |
[ $::locale->text('To'), 'recipients' ], |
|
468 |
], |
|
469 |
%params, |
|
470 |
} |
|
471 |
}, |
|
472 |
dunning => sub { |
|
473 |
my (%params) = @_; |
|
474 |
{ |
|
475 |
title => $::locale->text('Dunnings'), |
|
476 |
type => 'dunning', |
|
477 |
columns => [ |
|
478 |
[ $::locale->text('Dunning Level'), sub { $_[0]->presenter->dunning(display => 'table-cell') } ], |
|
479 |
[ $::locale->text('Dunning Date'), 'transdate' ], |
|
480 |
[ $::locale->text('Dunning Duedate'), 'duedate' ], |
|
481 |
[ $::locale->text('Total Fees'), 'fee' ], |
|
482 |
[ $::locale->text('Interest'), 'interest' ], |
|
483 |
], |
|
484 |
%params, |
|
485 |
} |
|
486 |
}, |
|
487 |
); |
|
488 |
|
|
489 |
sub _get_type_params { |
|
490 |
my ($type, %params) = @_; |
|
491 |
|
|
492 |
my $type_params = $TYPE_TO_PARAMS{$type}; |
|
493 |
croak "Unknown type '$type'" unless $type_params; |
|
494 |
|
|
495 |
return %{$type_params->(%params)}; |
|
496 |
} |
|
497 |
|
|
16 | 498 |
sub _arrayify { |
17 | 499 |
my ($array) = @_; |
18 | 500 |
return [] if !defined $array; |
... | ... | |
26 | 508 |
my %grouped = _group_records( [ $record ] ); # pass $record as arrayref |
27 | 509 |
my $type = (keys %grouped)[0]; |
28 | 510 |
|
29 |
$record->presenter->sales_invoice( $record, %params) if $type eq 'sales_invoices';
|
|
30 |
$record->presenter->purchase_invoice($record, %params) if $type eq 'purchase_invoices';
|
|
31 |
$record->presenter->ar_transaction( $record, %params) if $type eq 'ar_transactions';
|
|
32 |
$record->presenter->ap_transaction( $record, %params) if $type eq 'ap_transactions';
|
|
33 |
$record->presenter->gl_transaction( $record, %params) if $type eq 'gl_transactions';
|
|
511 |
$record->presenter->sales_invoice( $record, %params) if $type eq 'sales_invoice'; |
|
512 |
$record->presenter->purchase_invoice($record, %params) if $type eq 'purchase_invoice'; |
|
513 |
$record->presenter->ar_transaction( $record, %params) if $type eq 'ar_transaction'; |
|
514 |
$record->presenter->ap_transaction( $record, %params) if $type eq 'ap_transaction'; |
|
515 |
$record->presenter->gl_transaction( $record, %params) if $type eq 'gl_transaction'; |
|
34 | 516 |
|
35 | 517 |
return ''; |
36 | 518 |
} |
... | ... | |
43 | 525 |
my %groups = _sort_grouped_lists(_group_records($list)); |
44 | 526 |
my $output = ''; |
45 | 527 |
|
46 |
$output .= _requirement_spec_list( $groups{requirement_specs}, %params) if $groups{requirement_specs}; |
|
47 |
$output .= _shop_order_list( $groups{shop_orders}, %params) if $groups{shop_orders}; |
|
48 |
$output .= _sales_quotation_list( $groups{sales_quotations}, %params) if $groups{sales_quotations}; |
|
49 |
$output .= _sales_order_intake_list( $groups{sales_order_intakes}, %params) if $groups{sales_order_intakes}; |
|
50 |
$output .= _sales_order_list( $groups{sales_orders}, %params) if $groups{sales_orders}; |
|
51 |
$output .= _sales_delivery_order_list( $groups{sales_delivery_orders}, %params) if $groups{sales_delivery_orders}; |
|
52 |
$output .= _rma_delivery_order_list( $groups{rma_delivery_orders}, %params) if $groups{rma_delivery_orders}; |
|
53 |
$output .= _sales_reclamation_list( $groups{sales_reclamation}, %params) if $groups{sales_reclamation}; |
|
54 |
$output .= _sales_invoice_list( $groups{sales_invoices}, %params) if $groups{sales_invoices}; |
|
55 |
$output .= _ar_transaction_list( $groups{ar_transactions}, %params) if $groups{ar_transactions}; |
|
56 |
|
|
57 |
$output .= _request_quotation_list( $groups{purchase_quotations}, %params) if $groups{purchase_quotations}; |
|
58 |
$output .= _purchase_quotation_intake_list( $groups{purchase_quotation_intakes}, %params) if $groups{purchase_quotation_intakes}; |
|
59 |
$output .= _purchase_order_list( $groups{purchase_orders}, %params) if $groups{purchase_orders}; |
|
60 |
$output .= _purchase_order_confirmation_list($groups{purchase_order_confirmations}, %params) if $groups{purchase_order_confirmations}; |
|
61 |
$output .= _purchase_delivery_order_list( $groups{purchase_delivery_orders}, %params) if $groups{purchase_delivery_orders}; |
|
62 |
$output .= _supplier_delivery_order_list( $groups{supplier_delivery_orders}, %params) if $groups{supplier_delivery_orders}; |
|
63 |
$output .= _purchase_reclamation_list( $groups{purchase_reclamation}, %params) if $groups{purchase_reclamation}; |
|
64 |
$output .= _purchase_invoice_list( $groups{purchase_invoices}, %params) if $groups{purchase_invoices}; |
|
65 |
$output .= _ap_transaction_list( $groups{ap_transactions}, %params) if $groups{ap_transactions}; |
|
528 |
foreach my $type (@ORDERED_TYPES) { |
|
529 |
$output .= record_list($groups{$type}, _get_type_params($type, %params)) if $groups{$type}; |
|
530 |
} |
|
66 | 531 |
|
67 |
$output .= _gl_transaction_list( $groups{gl_transactions}, %params) if $groups{gl_transactions};
|
|
532 |
$output = SL::Presenter->get->render('presenter/record/grouped_record_list', %params, output => $output);
|
|
68 | 533 |
|
69 |
$output .= _bank_transactions( $groups{bank_transactions}, %params) if $groups{bank_transactions}; |
|
534 |
return $output; |
|
535 |
} |
|
70 | 536 |
|
71 |
$output .= _sepa_collection_list( $groups{sepa_collections}, %params) if $groups{sepa_collections}; |
|
72 |
$output .= _sepa_transfer_list( $groups{sepa_transfers}, %params) if $groups{sepa_transfers}; |
|
537 |
sub grouped_list { goto &grouped_record_list } |
|
73 | 538 |
|
74 |
$output .= _letter_list( $groups{letters}, %params) if $groups{letters};
|
|
75 |
$output .= _email_journal_list( $groups{email_journals}, %params) if $groups{email_journals};
|
|
539 |
sub simple_grouped_record_list {
|
|
540 |
my ($list, %params) = @_;
|
|
76 | 541 |
|
77 |
$output .= _dunning_list( $groups{dunnings}, %params) if $groups{dunnings}; |
|
542 |
my %groups = _sort_grouped_lists(_group_records($list)); |
|
543 |
my $output = ''; |
|
78 | 544 |
|
79 |
$output = SL::Presenter->get->render('presenter/record/grouped_record_list', %params, output => $output); |
|
545 |
foreach my $type (@ORDERED_TYPES) { |
|
546 |
my $ordered_records = $groups{$type}; |
|
547 |
next unless $ordered_records; |
|
548 |
my %type_params = _get_type_params($type, %params); |
|
549 |
my $type_output = html_tag('b', $type_params{title} . ": "); |
|
550 |
$type_output .= join (', ', |
|
551 |
map { $_->presenter->show(%params) } |
|
552 |
@{ $ordered_records } |
|
553 |
); |
|
554 |
$output .= html_tag('div', $type_output); |
|
555 |
} |
|
80 | 556 |
|
81 | 557 |
return $output; |
82 | 558 |
} |
83 | 559 |
|
84 |
sub grouped_list { goto &grouped_record_list } |
|
85 |
|
|
86 | 560 |
sub empty_record_list { |
87 | 561 |
my (%params) = @_; |
88 | 562 |
return grouped_record_list([], %params); |
... | ... | |
188 | 662 |
sub _group_records { |
189 | 663 |
my ($list) = @_; |
190 | 664 |
my %matchers = ( |
191 |
requirement_specs => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec') },
|
|
192 |
shop_orders => sub { (ref($_[0]) eq 'SL::DB::ShopOrder') && $_[0]->id },
|
|
193 |
sales_quotations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_quotation') },
|
|
194 |
sales_order_intakes => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order_intake') },
|
|
195 |
sales_orders => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order') },
|
|
196 |
sales_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('sales_delivery_order') },
|
|
197 |
rma_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('rma_delivery_order') },
|
|
198 |
sales_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('sales_reclamation') },
|
|
199 |
sales_invoices => sub { (ref($_[0]) eq 'SL::DB::Invoice') && $_[0]->invoice },
|
|
200 |
ar_transactions => sub { (ref($_[0]) eq 'SL::DB::Invoice') && !$_[0]->invoice },
|
|
201 |
purchase_quotations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('request_quotation') },
|
|
202 |
purchase_quotation_intakes => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_quotation_intake') },
|
|
203 |
purchase_orders => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_order') },
|
|
204 |
purchase_order_confirmations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_order_confirmation') },
|
|
205 |
purchase_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('purchase_delivery_order') },
|
|
206 |
supplier_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('supplier_delivery_order') },
|
|
207 |
purchase_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('purchase_reclamation') },
|
|
208 |
purchase_invoices => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && $_[0]->invoice },
|
|
209 |
ap_transactions => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && !$_[0]->invoice },
|
|
210 |
sepa_collections => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ar_id },
|
|
211 |
sepa_transfers => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ap_id },
|
|
212 |
gl_transactions => sub { (ref($_[0]) eq 'SL::DB::GLTransaction') },
|
|
213 |
bank_transactions => sub { (ref($_[0]) eq 'SL::DB::BankTransaction') && $_[0]->id },
|
|
214 |
letters => sub { (ref($_[0]) eq 'SL::DB::Letter') && $_[0]->id },
|
|
215 |
email_journals => sub { (ref($_[0]) eq 'SL::DB::EmailJournal') && $_[0]->id },
|
|
216 |
dunnings => sub { (ref($_[0]) eq 'SL::DB::Dunning') },
|
|
665 |
requirement_spec => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec') },
|
|
666 |
shop_order => sub { (ref($_[0]) eq 'SL::DB::ShopOrder') && $_[0]->id },
|
|
667 |
sales_quotation => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_quotation') },
|
|
668 |
sales_order_intake => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order_intake') },
|
|
669 |
sales_order => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order') },
|
|
670 |
sales_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('sales_delivery_order') },
|
|
671 |
rma_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('rma_delivery_order') },
|
|
672 |
sales_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('sales_reclamation') },
|
|
673 |
sales_invoice => sub { (ref($_[0]) eq 'SL::DB::Invoice') && $_[0]->invoice },
|
|
674 |
ar_transaction => sub { (ref($_[0]) eq 'SL::DB::Invoice') && !$_[0]->invoice },
|
|
675 |
request_quotation => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('request_quotation') },
|
|
676 |
purchase_quotation_intake => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_quotation_intake') },
|
|
677 |
purchase_order => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_order') },
|
|
678 |
purchase_order_confirmation => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_order_confirmation') },
|
|
679 |
purchase_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('purchase_delivery_order') },
|
|
680 |
supplier_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('supplier_delivery_order') },
|
|
681 |
purchase_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('purchase_reclamation')},
|
|
682 |
purchase_invoice => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && $_[0]->invoice },
|
|
683 |
ap_transaction => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && !$_[0]->invoice },
|
|
684 |
sepa_collection => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ar_id },
|
|
685 |
sepa_transfer => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ap_id },
|
|
686 |
gl_transaction => sub { (ref($_[0]) eq 'SL::DB::GLTransaction') },
|
|
687 |
bank_transaction => sub { (ref($_[0]) eq 'SL::DB::BankTransaction') && $_[0]->id },
|
|
688 |
letter => sub { (ref($_[0]) eq 'SL::DB::Letter') && $_[0]->id },
|
|
689 |
email_journal => sub { (ref($_[0]) eq 'SL::DB::EmailJournal') && $_[0]->id },
|
|
690 |
dunning => sub { (ref($_[0]) eq 'SL::DB::Dunning') },
|
|
217 | 691 |
); |
218 | 692 |
|
219 | 693 |
my %groups; |
... | ... | |
242 | 716 |
return %groups; |
243 | 717 |
} |
244 | 718 |
|
245 |
sub _requirement_spec_list { |
|
246 |
my ($list, %params) = @_; |
|
247 |
|
|
248 |
return record_list( |
|
249 |
$list, |
|
250 |
title => $::locale->text('Requirement specs'), |
|
251 |
type => 'requirement_spec', |
|
252 |
columns => [ |
|
253 |
[ $::locale->text('Requirement spec number'), sub { $_[0]->presenter->requirement_spec(display => 'table-cell') } ], |
|
254 |
[ $::locale->text('Customer'), 'customer' ], |
|
255 |
[ $::locale->text('Title'), 'title' ], |
|
256 |
[ $::locale->text('Project'), 'project', ], |
|
257 |
[ $::locale->text('Status'), sub { $_[0]->status->description } ], |
|
258 |
], |
|
259 |
%params, |
|
260 |
); |
|
261 |
} |
|
262 |
|
|
263 |
sub _shop_order_list { |
|
264 |
my ($list, %params) = @_; |
|
265 |
|
|
266 |
return record_list( |
|
267 |
$list, |
|
268 |
title => $::locale->text('Shop Orders'), |
|
269 |
type => 'shop_order', |
|
270 |
columns => [ |
|
271 |
[ $::locale->text('Shop Order Date'), sub { $_[0]->order_date->to_kivitendo } ], |
|
272 |
[ $::locale->text('Shop Order Number'), sub { $_[0]->presenter->shop_order(display => 'table-cell') } ], |
|
273 |
[ $::locale->text('Transfer Date'), 'transfer_date' ], |
|
274 |
[ $::locale->text('Amount'), 'amount' ], |
|
275 |
], |
|
276 |
%params, |
|
277 |
); |
|
278 |
} |
|
279 |
|
|
280 |
sub _sales_quotation_list { |
|
281 |
my ($list, %params) = @_; |
|
282 |
|
|
283 |
return record_list( |
|
284 |
$list, |
|
285 |
title => $::locale->text('Sales Quotations'), |
|
286 |
type => 'sales_quotation', |
|
287 |
columns => [ |
|
288 |
[ $::locale->text('Quotation Date'), 'transdate' ], |
|
289 |
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->sales_quotation(display => 'table-cell') } ], |
|
290 |
[ $::locale->text('Customer'), 'customer' ], |
|
291 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
292 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
293 |
[ $::locale->text('Project'), 'globalproject', ], |
|
294 |
[ $::locale->text('Closed'), 'closed' ], |
|
295 |
], |
|
296 |
%params, |
|
297 |
); |
|
298 |
} |
|
299 |
|
|
300 |
sub _request_quotation_list { |
|
301 |
my ($list, %params) = @_; |
|
302 |
|
|
303 |
return record_list( |
|
304 |
$list, |
|
305 |
title => $::locale->text('Request Quotations'), |
|
306 |
type => 'request_quotation', |
|
307 |
columns => [ |
|
308 |
[ $::locale->text('Quotation Date'), 'transdate' ], |
|
309 |
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->request_quotation(display => 'table-cell') } ], |
|
310 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
311 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
312 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
313 |
[ $::locale->text('Project'), 'globalproject', ], |
|
314 |
[ $::locale->text('Closed'), 'closed' ], |
|
315 |
], |
|
316 |
%params, |
|
317 |
); |
|
318 |
} |
|
319 |
|
|
320 |
sub _purchase_quotation_intake_list { |
|
321 |
my ($list, %params) = @_; |
|
322 |
|
|
323 |
return record_list( |
|
324 |
$list, |
|
325 |
title => $::locale->text('Purchase Quotation Intakes'), |
|
326 |
type => 'purchase_quotation_intake', |
|
327 |
columns => [ |
|
328 |
[ $::locale->text('Quotation Date'), 'transdate' ], |
|
329 |
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->purchase_quotation_intake(display => 'table-cell') } ], |
|
330 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
331 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
332 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
333 |
[ $::locale->text('Project'), 'globalproject', ], |
|
334 |
[ $::locale->text('Closed'), 'closed' ], |
|
335 |
], |
|
336 |
%params, |
|
337 |
); |
|
338 |
} |
|
339 |
|
|
340 |
sub _sales_order_intake_list { |
|
341 |
my ($list, %params) = @_; |
|
342 |
|
|
343 |
return record_list( |
|
344 |
$list, |
|
345 |
title => $::locale->text('Sales Order Intakes'), |
|
346 |
type => 'sales_order_intake', |
|
347 |
columns => [ |
|
348 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
349 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order_intake(display => 'table-cell') } ], |
|
350 |
[ $::locale->text('Quotation'), 'quonumber' ], |
|
351 |
[ $::locale->text('Customer'), 'customer' ], |
|
352 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
353 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
354 |
[ $::locale->text('Project'), 'globalproject', ], |
|
355 |
[ $::locale->text('Closed'), 'closed' ], |
|
356 |
], |
|
357 |
%params, |
|
358 |
); |
|
359 |
} |
|
360 |
|
|
361 |
sub _sales_order_list { |
|
362 |
my ($list, %params) = @_; |
|
363 |
|
|
364 |
return record_list( |
|
365 |
$list, |
|
366 |
title => $::locale->text('Sales Orders'), |
|
367 |
type => 'sales_order', |
|
368 |
columns => [ |
|
369 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
370 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order(display => 'table-cell') } ], |
|
371 |
[ $::locale->text('Quotation'), 'quonumber' ], |
|
372 |
[ $::locale->text('Customer'), 'customer' ], |
|
373 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
374 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
375 |
[ $::locale->text('Project'), 'globalproject', ], |
|
376 |
[ $::locale->text('Closed'), 'closed' ], |
|
377 |
], |
|
378 |
%params, |
|
379 |
); |
|
380 |
} |
|
381 |
|
|
382 |
sub _purchase_order_list { |
|
383 |
my ($list, %params) = @_; |
|
384 |
|
|
385 |
return record_list( |
|
386 |
$list, |
|
387 |
title => $::locale->text('Purchase Orders'), |
|
388 |
type => 'purchase_order', |
|
389 |
columns => [ |
|
390 |
[ $::locale->text('Order Date'), 'transdate' ], |
|
391 |
[ $::locale->text('Order Number'), sub { $_[0]->presenter->purchase_order(display => 'table-cell') } ], |
|
392 |
[ $::locale->text('Request for Quotation'), 'quonumber' ], |
|
393 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
394 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
395 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
396 |
[ $::locale->text('Project'), 'globalproject', ], |
|
397 |
[ $::locale->text('Closed'), 'closed' ], |
|
398 |
], |
|
399 |
%params, |
|
400 |
); |
|
401 |
} |
|
402 |
|
|
403 |
sub _purchase_order_confirmation_list { |
|
404 |
my ($list, %params) = @_; |
|
405 |
|
|
406 |
return record_list( |
|
407 |
$list, |
|
408 |
title => $::locale->text('Purchase Order Confirmations'), |
|
409 |
type => 'purchase_order_confirmation', |
|
410 |
columns => [ |
|
411 |
[ $::locale->text('Confirmation Date'), 'transdate' ], |
|
412 |
[ $::locale->text('Confirmation Number'), sub { $_[0]->presenter->purchase_order_confirmation(display => 'table-cell') } ], |
|
413 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
414 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
415 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
416 |
[ $::locale->text('Project'), 'globalproject', ], |
|
417 |
[ $::locale->text('Closed'), 'closed' ], |
|
418 |
], |
|
419 |
%params, |
|
420 |
); |
|
421 |
} |
|
422 |
|
|
423 |
sub _sales_delivery_order_list { |
|
424 |
my ($list, %params) = @_; |
|
425 |
|
|
426 |
return record_list( |
|
427 |
$list, |
|
428 |
title => $::locale->text('Sales Delivery Orders'), |
|
429 |
type => 'sales_delivery_order', |
|
430 |
columns => [ |
|
431 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
432 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->sales_delivery_order(display => 'table-cell') } ], |
|
433 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
434 |
[ $::locale->text('Customer'), 'customer' ], |
|
435 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
436 |
[ $::locale->text('Project'), 'globalproject', ], |
|
437 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
438 |
[ $::locale->text('Closed'), 'closed' ], |
|
439 |
], |
|
440 |
%params, |
|
441 |
); |
|
442 |
} |
|
443 |
|
|
444 |
sub _rma_delivery_order_list { |
|
445 |
my ($list, %params) = @_; |
|
446 |
|
|
447 |
return record_list( |
|
448 |
$list, |
|
449 |
title => $::locale->text('RMA Delivery Orders'), |
|
450 |
type => 'rma_delivery_order', |
|
451 |
columns => [ |
|
452 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
453 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->rma_delivery_order(display => 'table-cell') } ], |
|
454 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
455 |
[ $::locale->text('Customer'), 'customer' ], |
|
456 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
457 |
[ $::locale->text('Project'), 'globalproject', ], |
|
458 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
459 |
[ $::locale->text('Closed'), 'closed' ], |
|
460 |
], |
|
461 |
%params, |
|
462 |
); |
|
463 |
} |
|
464 |
|
|
465 |
sub _purchase_delivery_order_list { |
|
466 |
my ($list, %params) = @_; |
|
467 |
|
|
468 |
return record_list( |
|
469 |
$list, |
|
470 |
title => $::locale->text('Purchase Delivery Orders'), |
|
471 |
type => 'purchase_delivery_order', |
|
472 |
columns => [ |
|
473 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
474 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->purchase_delivery_order(display => 'table-cell') } ], |
|
475 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
476 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
477 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
478 |
[ $::locale->text('Project'), 'globalproject', ], |
|
479 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
480 |
[ $::locale->text('Closed'), 'closed' ], |
|
481 |
], |
|
482 |
%params, |
|
483 |
); |
|
484 |
} |
|
485 |
|
|
486 |
sub _supplier_delivery_order_list { |
|
487 |
my ($list, %params) = @_; |
|
488 |
|
|
489 |
return record_list( |
|
490 |
$list, |
|
491 |
title => $::locale->text('Supplier Delivery Orders'), |
|
492 |
type => 'supplier_delivery_order', |
|
493 |
columns => [ |
|
494 |
[ $::locale->text('Delivery Order Date'), 'transdate' ], |
|
495 |
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->supplier_delivery_order(display => 'table-cell') } ], |
|
496 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
497 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
498 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
499 |
[ $::locale->text('Project'), 'globalproject', ], |
|
500 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
501 |
[ $::locale->text('Closed'), 'closed' ], |
|
502 |
], |
|
503 |
%params, |
|
504 |
); |
|
505 |
} |
|
506 |
|
|
507 |
sub _sales_reclamation_list { |
|
508 |
my ($list, %params) = @_; |
|
509 |
|
|
510 |
return record_list( |
|
511 |
$list, |
|
512 |
title => $::locale->text('Sales Reclamation'), |
|
513 |
type => 'sales_reclamation', |
|
514 |
columns => [ |
|
515 |
[ $::locale->text('Reclamation Date'), 'transdate' ], |
|
516 |
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->sales_reclamation(display => 'table-cell') } ], |
|
517 |
[ $::locale->text('Customer'), 'customer' ], |
|
518 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
519 |
[ $::locale->text('Project'), 'globalproject', ], |
|
520 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
521 |
[ $::locale->text('Closed'), 'closed' ], |
|
522 |
], |
|
523 |
%params, |
|
524 |
); |
|
525 |
} |
|
526 |
|
|
527 |
sub _purchase_reclamation_list { |
|
528 |
my ($list, %params) = @_; |
|
529 |
|
|
530 |
return record_list( |
|
531 |
$list, |
|
532 |
title => $::locale->text('Purchase Reclamation'), |
|
533 |
type => 'purchase_reclamation', |
|
534 |
columns => [ |
|
535 |
[ $::locale->text('Reclamation Date'), 'transdate' ], |
|
536 |
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->purchase_reclamation(display => 'table-cell') } ], |
|
537 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
538 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
539 |
[ $::locale->text('Project'), 'globalproject', ], |
|
540 |
[ $::locale->text('Delivered'), 'delivered' ], |
|
541 |
[ $::locale->text('Closed'), 'closed' ], |
|
542 |
], |
|
543 |
%params, |
|
544 |
); |
|
545 |
} |
|
546 |
|
|
547 |
sub _sales_invoice_list { |
|
548 |
my ($list, %params) = @_; |
|
549 |
|
|
550 |
return record_list( |
|
551 |
$list, |
|
552 |
title => $::locale->text('Sales Invoices'), |
|
553 |
type => 'sales_invoice', |
|
554 |
columns => [ |
|
555 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
556 |
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ], |
|
557 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->sales_invoice(display => 'table-cell') } ], |
|
558 |
[ $::locale->text('Quotation Number'), 'quonumber' ], |
|
559 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
560 |
[ $::locale->text('Customer'), 'customer' ], |
|
561 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
562 |
[ $::locale->text('Paid'), 'paid' ], |
|
563 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
564 |
], |
|
565 |
%params, |
|
566 |
); |
|
567 |
} |
|
568 |
|
|
569 |
sub _purchase_invoice_list { |
|
570 |
my ($list, %params) = @_; |
|
571 |
|
|
572 |
return record_list( |
|
573 |
$list, |
|
574 |
title => $::locale->text('Purchase Invoices'), |
|
575 |
type => 'purchase_invoice', |
|
576 |
columns => [ |
|
577 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
578 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->purchase_invoice(display => 'table-cell') } ], |
|
579 |
[ $::locale->text('Request for Quotation Number'), 'quonumber' ], |
|
580 |
[ $::locale->text('Order Number'), 'ordnumber' ], |
|
581 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
582 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
583 |
[ $::locale->text('Paid'), 'paid' ], |
|
584 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
585 |
], |
|
586 |
%params, |
|
587 |
); |
|
588 |
} |
|
589 |
|
|
590 |
sub _ar_transaction_list { |
|
591 |
my ($list, %params) = @_; |
|
592 |
|
|
593 |
return record_list( |
|
594 |
$list, |
|
595 |
title => $::locale->text('AR Transactions'), |
|
596 |
type => 'ar_transaction', |
|
597 |
columns => [ |
|
598 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
599 |
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ], |
|
600 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ar_transaction(display => 'table-cell') } ], |
|
601 |
[ $::locale->text('Customer'), 'customer' ], |
|
602 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
603 |
[ $::locale->text('Paid'), 'paid' ], |
|
604 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
605 |
], |
|
606 |
%params, |
|
607 |
); |
|
608 |
} |
|
609 |
|
|
610 |
sub _ap_transaction_list { |
|
611 |
my ($list, %params) = @_; |
|
612 |
|
|
613 |
return record_list( |
|
614 |
$list, |
|
615 |
title => $::locale->text('AP Transactions'), |
|
616 |
type => 'ap_transaction', |
|
617 |
columns => [ |
|
618 |
[ $::locale->text('Invoice Date'), 'transdate' ], |
|
619 |
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ap_transaction(display => 'table-cell') } ], |
|
620 |
[ $::locale->text('Vendor'), 'vendor' ], |
|
621 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
622 |
[ $::locale->text('Paid'), 'paid' ], |
|
623 |
[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
624 |
], |
|
625 |
%params, |
|
626 |
); |
|
627 |
} |
|
628 |
|
|
629 |
sub _gl_transaction_list { |
|
630 |
my ($list, %params) = @_; |
|
631 |
|
|
632 |
return record_list( |
|
633 |
$list, |
|
634 |
title => $::locale->text('GL Transactions'), |
|
635 |
type => 'gl_transaction', |
|
636 |
columns => [ |
|
637 |
[ $::locale->text('Transdate'), 'transdate' ], |
|
638 |
[ $::locale->text('Reference'), 'reference' ], |
|
639 |
[ $::locale->text('Description'), sub { $_[0]->presenter->gl_transaction(display => 'table-cell') } ], |
|
640 |
], |
|
641 |
%params, |
|
642 |
); |
|
643 |
} |
|
644 |
|
|
645 |
sub _bank_transactions { |
|
646 |
my ($list, %params) = @_; |
|
647 |
|
|
648 |
return record_list( |
|
649 |
$list, |
|
650 |
title => $::locale->text('Bank transactions'), |
|
651 |
type => 'bank_transactions', |
|
652 |
columns => [ |
|
653 |
[ $::locale->text('Transdate'), 'transdate' ], |
|
654 |
[ $::locale->text('Local Bank Code'), sub { $_[0]->local_bank_account->presenter->bank_code } ], |
|
655 |
[ $::locale->text('Local account number'), sub { $_[0]->local_bank_account->presenter->account_number } ], |
|
656 |
[ $::locale->text('Remote Bank Code'), 'remote_bank_code' ], |
|
657 |
[ $::locale->text('Remote account number'),'remote_account_number' ], |
|
658 |
[ $::locale->text('Valutadate'), 'valutadate' ], |
|
659 |
[ $::locale->text('Amount'), 'amount' ], |
|
660 |
[ $::locale->text('Currency'), sub { $_[0]->currency->name } ], |
|
661 |
[ $::locale->text('Remote name'), 'remote_name' ], |
|
662 |
[ $::locale->text('Purpose'), 'purpose' ], |
|
663 |
], |
|
664 |
%params, |
|
665 |
); |
|
666 |
} |
|
667 |
|
|
668 |
sub _sepa_export_list { |
|
669 |
my ($list, %params) = @_; |
|
670 |
|
|
671 |
my ($source, $destination) = $params{type} eq 'sepa_transfer' ? qw(our vc) : qw(vc our); |
|
672 |
$params{title} = $params{type} eq 'sepa_transfer' ? $::locale->text('Bank transfers via SEPA') : $::locale->text('Bank collections via SEPA'); |
|
673 |
$params{with_columns} = [ grep { $_ ne 'record_link_direction' } @{ $params{with_columns} || [] } ]; |
|
674 |
|
|
675 |
delete $params{edit_record_links}; |
|
676 |
|
|
677 |
return record_list( |
|
678 |
$list, |
|
679 |
columns => [ |
|
680 |
[ $::locale->text('Export Number'), 'sepa_export', ], |
|
681 |
[ $::locale->text('Execution date'), 'execution_date' ], |
|
682 |
[ $::locale->text('Export date'), sub { $_[0]->sepa_export->itime->to_kivitendo } ], |
|
683 |
[ $::locale->text('Source BIC'), "${source}_bic" ], |
|
684 |
[ $::locale->text('Source IBAN'), "${source}_iban" ], |
|
685 |
[ $::locale->text('Destination BIC'), "${destination}_bic" ], |
|
686 |
[ $::locale->text('Destination IBAN'), "${destination}_iban" ], |
|
687 |
[ $::locale->text('Amount'), 'amount' ], |
|
688 |
], |
|
689 |
%params, |
|
690 |
); |
|
691 |
} |
|
692 |
|
|
693 |
sub _sepa_transfer_list { |
|
694 |
my ($list, %params) = @_; |
|
695 |
_sepa_export_list($list, %params, type => 'sepa_transfer'); |
|
696 |
} |
|
697 |
|
|
698 |
sub _sepa_collection_list { |
|
699 |
my ($list, %params) = @_; |
|
700 |
_sepa_export_list($list, %params, type => 'sepa_collection'); |
|
701 |
} |
|
702 |
|
|
703 |
sub _letter_list { |
|
704 |
my ($list, %params) = @_; |
|
705 |
|
|
706 |
return record_list( |
|
707 |
$list, |
|
708 |
title => $::locale->text('Letters'), |
|
709 |
type => 'letter', |
|
710 |
columns => [ |
|
711 |
[ $::locale->text('Date'), 'date' ], |
|
712 |
[ $::locale->text('Letternumber'), sub { $_[0]->presenter->letter(display => 'table-cell') } ], |
|
713 |
[ $::locale->text('Customer'), 'customer' ], |
|
714 |
[ $::locale->text('Reference'), 'reference' ], |
|
715 |
[ $::locale->text('Subject'), 'subject' ], |
|
716 |
], |
|
717 |
%params, |
|
718 |
); |
|
719 |
} |
|
720 |
|
|
721 |
sub _email_journal_list { |
|
722 |
my ($list, %params) = @_; |
|
723 |
|
|
724 |
return record_list( |
|
725 |
$list, |
|
726 |
title => $::locale->text('Email'), |
|
727 |
type => 'email_journal', |
|
728 |
columns => [ |
|
729 |
[ $::locale->text('Sent on'), sub { $_[0]->sent_on->to_kivitendo(precision => 'seconds') } ], |
|
730 |
[ $::locale->text('Subject'), sub { $_[0]->presenter->email_journal(display => 'table-cell') } ], |
|
731 |
[ $::locale->text('Status'), 'status' ], |
|
732 |
[ $::locale->text('From'), 'from' ], |
|
733 |
[ $::locale->text('To'), 'recipients' ], |
|
734 |
], |
|
735 |
%params, |
|
736 |
); |
|
737 |
} |
|
738 |
sub _dunning_list { |
|
739 |
my ($list, %params) = @_; |
|
740 |
|
|
741 |
return record_list( |
|
742 |
$list, |
|
743 |
title => $::locale->text('Dunnings'), |
|
744 |
type => 'dunning', |
|
745 |
columns => [ |
|
746 |
[ $::locale->text('Dunning Level'), sub { $_[0]->presenter->dunning(display => 'table-cell') } ], |
|
747 |
[ $::locale->text('Dunning Date'), 'transdate' ], |
|
748 |
[ $::locale->text('Dunning Duedate'), 'duedate' ], |
|
749 |
[ $::locale->text('Total Fees'), 'fee' ], |
|
750 |
[ $::locale->text('Interest'), 'interest' ], |
|
751 |
], |
|
752 |
%params, |
|
753 |
); |
|
754 |
} |
|
755 |
|
|
756 | 719 |
1; |
757 | 720 |
|
758 | 721 |
__END__ |
... | ... | |
774 | 737 |
|
775 | 738 |
# Give HTML representation: |
776 | 739 |
my $html = SL::Presenter->get->grouped_record_list($records); |
740 |
# simple html version: |
|
741 |
my $html = SL::Presenter->get->simple_grouped_record_list($records); |
|
777 | 742 |
|
778 | 743 |
=head1 OVERVIEW |
779 | 744 |
|
... | ... | |
793 | 758 |
my $record = SL::DB::Manager::AccTransaction->get_first()->record; |
794 | 759 |
my $html = SL::Presenter->get->record($record, display => 'inline'); |
795 | 760 |
|
796 |
=item C<grouped_record_list $list, %params> |
|
797 |
|
|
798 | 761 |
=item C<empty_record_list> |
799 | 762 |
|
800 | 763 |
Returns a rendered version (actually an instance of |
801 | 764 |
L<SL::Presenter::EscapedText>) of an empty list of records. Is usually |
802 | 765 |
only called by L<grouped_record_list> if its list is empty. |
803 | 766 |
|
767 |
=item C<simple_grouped_record_list $list, %params> |
|
768 |
|
|
769 |
Generates a simple list of records. The order of the records is the |
|
770 |
same as in L<grouped_record_list>. |
|
771 |
|
|
804 | 772 |
=item C<grouped_record_list $list, %params> |
805 | 773 |
|
806 | 774 |
Given a number of Rose::DB objects in the array reference C<$list> |
Auch abrufbar als: Unified diff
SL::Presenter::Record: Schlichte Darstellung für verknüpfte Belege.