37 |
37 |
sub init_settings {
|
38 |
38 |
my ($self) = @_;
|
39 |
39 |
|
40 |
|
return { map { ( $_ => $self->controller->profile->get($_) ) } qw(order_column item_column) };
|
|
40 |
return { map { ( $_ => $self->controller->profile->get($_) ) } qw(order_column item_column max_amount_diff) };
|
41 |
41 |
}
|
42 |
42 |
|
43 |
43 |
|
... | ... | |
46 |
46 |
|
47 |
47 |
my $profile = $self->SUPER::init_profile;
|
48 |
48 |
|
|
49 |
# SUPER::init_profile sets row_ident to the class name
|
|
50 |
# overwrite it with the user specified settings
|
49 |
51 |
foreach my $p (@{ $profile }) {
|
50 |
|
my $prof = $p->{profile};
|
51 |
52 |
if ($p->{row_ident} eq 'Order') {
|
|
53 |
$p->{row_ident} = $self->settings->{'order_column'};
|
|
54 |
}
|
|
55 |
if ($p->{row_ident} eq 'OrderItem') {
|
|
56 |
$p->{row_ident} = $self->settings->{'item_column'};
|
|
57 |
}
|
|
58 |
}
|
|
59 |
|
|
60 |
foreach my $p (@{ $profile }) {
|
|
61 |
my $prof = $p->{profile};
|
|
62 |
if ($p->{row_ident} eq $self->settings->{'order_column'}) {
|
52 |
63 |
# no need to handle
|
53 |
64 |
delete @{$prof}{qw(delivery_customer_id delivery_vendor_id proforma quotation amount netamount)};
|
54 |
|
# handable, but not handled by now
|
55 |
65 |
}
|
56 |
|
if ($p->{row_ident} eq 'OrderItem') {
|
|
66 |
if ($p->{row_ident} eq $self->settings->{'item_column'}) {
|
|
67 |
# no need to handle
|
57 |
68 |
delete @{$prof}{qw(trans_id)};
|
58 |
69 |
}
|
59 |
70 |
}
|
... | ... | |
67 |
78 |
|
68 |
79 |
$self->SUPER::setup_displayable_columns;
|
69 |
80 |
|
70 |
|
$self->add_displayable_columns('Order',
|
|
81 |
$self->add_displayable_columns($self->settings->{'order_column'},
|
71 |
82 |
{ name => 'datatype', description => $::locale->text('Zeilenkennung') },
|
72 |
83 |
{ name => 'closed', description => $::locale->text('Closed') },
|
73 |
84 |
{ name => 'curr', description => $::locale->text('Currency') },
|
... | ... | |
111 |
122 |
{ name => 'shipto_id', description => $::locale->text('Ship to (database ID)') },
|
112 |
123 |
);
|
113 |
124 |
|
114 |
|
$self->add_displayable_columns('OrderItem',
|
|
125 |
$self->add_displayable_columns($self->settings->{'item_column'},
|
115 |
126 |
{ name => 'datatype', description => $::locale->text('Zeilenkennung') },
|
116 |
127 |
{ name => 'cusordnumber', description => $::locale->text('Customer Order Number') },
|
117 |
128 |
{ name => 'description', description => $::locale->text('Description') },
|
... | ... | |
353 |
364 |
|
354 |
365 |
# If amounts are given, show calculated amounts as info and given amounts (verify_xxx).
|
355 |
366 |
# And throw an error if the differences are too big.
|
356 |
|
my $max_diff = 0.02;
|
357 |
367 |
my @to_verify = ( { column => 'amount',
|
358 |
368 |
raw_column => 'verify_amount',
|
359 |
369 |
info_header => 'Calc. Amount',
|
... | ... | |
381 |
391 |
if ($entry->{raw_data}->{datatype} eq $self->settings->{'order_column'}) {
|
382 |
392 |
next if !$entry->{raw_data}->{ $tv->{raw_column} };
|
383 |
393 |
my $parsed_value = $::form->parse_amount(\%::myconfig, $entry->{raw_data}->{ $tv->{raw_column} });
|
384 |
|
if (abs($entry->{object}->${ \$tv->{column} } - $parsed_value) > $max_diff) {
|
|
394 |
if (abs($entry->{object}->${ \$tv->{column} } - $parsed_value) > $self->settings->{'max_amount_diff'}) {
|
385 |
395 |
push @{ $entry->{errors} }, $::locale->text($tv->{err_msg});
|
386 |
396 |
}
|
387 |
397 |
}
|
Zeilenkennung und maximaler Differenzbetrag lassen sich an der Oberfläche eingeben.