Revision 9af3ce1c
Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
137 | 137 |
$self->js->hide('#shipto_row'); |
138 | 138 |
} |
139 | 139 |
|
140 |
$self->order->taxzone_id($self->order->$cv_method->taxzone_id); |
|
141 |
|
|
142 |
if ($self->order->is_sales) { |
|
143 |
$self->order->taxincluded(defined($self->order->$cv_method->taxincluded_checked) |
|
144 |
? $self->order->$cv_method->taxincluded_checked |
|
145 |
: $::myconfig{taxincluded_checked}); |
|
146 |
} |
|
147 |
|
|
140 | 148 |
$self->order->payment_id($self->order->$cv_method->payment_id); |
141 | 149 |
$self->order->delivery_term_id($self->order->$cv_method->delivery_term_id); |
142 | 150 |
|
151 |
$self->_recalc(); |
|
152 |
|
|
143 | 153 |
$self->js |
144 |
->replaceWith('#order_cp_id', $self->build_contact_select) |
|
145 |
->replaceWith('#order_shipto_id', $self->build_shipto_select) |
|
146 |
->val('#order_taxzone_id', $self->order->taxzone_id) |
|
147 |
->val('#order_payment_id', $self->order->payment_id) |
|
148 |
->val('#order_delivery_term_id', $self->order->delivery_term_id) |
|
149 |
->val('#order_intnotes', $self->order->$cv_method->notes) |
|
150 |
->focus('#order_' . $self->cv . '_id') |
|
151 |
->render($self); |
|
154 |
->replaceWith('#order_cp_id', $self->build_contact_select) |
|
155 |
->replaceWith('#order_shipto_id', $self->build_shipto_select) |
|
156 |
->val( '#order_taxzone_id', $self->order->taxzone_id) |
|
157 |
->val( '#order_taxincluded', $self->order->taxincluded) |
|
158 |
->val( '#order_payment_id', $self->order->payment_id) |
|
159 |
->val( '#order_delivery_term_id', $self->order->delivery_term_id) |
|
160 |
->val( '#order_intnotes', $self->order->$cv_method->notes) |
|
161 |
->focus( '#order_' . $self->cv . '_id'); |
|
162 |
|
|
163 |
$self->_js_redisplay_amounts_and_taxes; |
|
164 |
$self->js->render(); |
|
152 | 165 |
} |
153 | 166 |
|
154 | 167 |
sub action_add_item { |
... | ... | |
220 | 233 |
sub _js_redisplay_amounts_and_taxes { |
221 | 234 |
my ($self) = @_; |
222 | 235 |
|
236 |
if (scalar @{ $self->{taxes} }) { |
|
237 |
$self->js->show('#taxincluded_row_id'); |
|
238 |
} else { |
|
239 |
$self->js->hide('#taxincluded_row_id'); |
|
240 |
} |
|
241 |
|
|
242 |
if ($self->order->taxincluded) { |
|
243 |
$self->js->hide('#subtotal_row_id'); |
|
244 |
} else { |
|
245 |
$self->js->show('#subtotal_row_id'); |
|
246 |
} |
|
247 |
|
|
223 | 248 |
$self->js |
224 | 249 |
->html('#netamount_id', $::form->format_amount(\%::myconfig, $self->order->netamount, -2)) |
225 | 250 |
->html('#amount_id', $::form->format_amount(\%::myconfig, $self->order->amount, -2)) |
... | ... | |
303 | 328 |
|
304 | 329 |
my $rows_as_html; |
305 | 330 |
foreach my $tax (sort { $a->{tax}->rate cmp $b->{tax}->rate } @{ $self->{taxes} }) { |
306 |
$rows_as_html .= $self->p->render('order/tabs/_tax_row', TAX => $tax); |
|
331 |
$rows_as_html .= $self->p->render('order/tabs/_tax_row', TAX => $tax, TAXINCLUDED => $self->order->taxincluded);
|
|
307 | 332 |
} |
308 | 333 |
return $rows_as_html; |
309 | 334 |
} |
... | ... | |
335 | 360 |
$self->{taxes} = []; |
336 | 361 |
foreach my $tax_chart_id (keys %{ $pat{taxes} }) { |
337 | 362 |
my $tax = SL::DB::Manager::Tax->find_by(chart_id => $tax_chart_id); |
338 |
push(@{ $self->{taxes} }, { amount => $pat{taxes}->{$tax_chart_id}, |
|
339 |
tax => $tax }); |
|
363 |
|
|
364 |
my @amount_keys = grep { $pat{amounts}->{$_}->{tax_id} == $tax->id } keys %{ $pat{amounts} }; |
|
365 |
push(@{ $self->{taxes} }, { amount => $pat{taxes}->{$tax_chart_id}, |
|
366 |
netamount => $pat{amounts}->{$amount_keys[0]}->{amount}, |
|
367 |
tax => $tax }); |
|
340 | 368 |
} |
341 | 369 |
|
342 | 370 |
pairwise { $a->{linetotal} = $b->{linetotal} } @{$self->order->items}, @{$pat{items}}; |
Auch abrufbar als: Unified diff
Auftrags-Controller: Option für "Steuer im Preis inbegriffen"