Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9af3ce1c

Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt

  • ID 9af3ce1ca10555dff25e4762d2eb1e7fa0c1e877
  • Vorgänger 2ff1c023
  • Nachfolger aa36021a

Auftrags-Controller: Option für "Steuer im Preis inbegriffen"

Unterschiede anzeigen:

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}};
templates/webpages/order/tabs/_tax_row.html
4 4
[%- USE L %]
5 5

  
6 6
<tr class="tax_row">
7
  <th align="right">[%- TAX.tax.taxdescription %] [% TAX.tax.rate_as_percent %]%</th>
7
  <th align="right">[%- IF TAXINCLUDED %][%- 'Including' | $T8 %]&nbsp;[%- END %][%- TAX.tax.taxdescription %] [% TAX.tax.rate_as_percent %]%</th>
8 8
  <td align="right">[%- LxERP.format_amount(TAX.amount, 2, 0) %]</td>
9 9
</tr>
10
[%- IF TAXINCLUDED %]
11
<tr class="tax_row">
12
  <th align="right">[%- 'Net amount' | $T8 %]</th>
13
  <td align="right">[%- LxERP.format_amount(TAX.netamount, 2, 0) %]</td>
14
</tr>
15
[%- END%]
templates/webpages/order/tabs/basic_data.html
38 38

  
39 39
          <tr>
40 40
            <th align="right">[% 'Steuersatz' | $T8 %]</th>
41
            <td>[% L.select_tag('order.taxzone_id', SELF.all_taxzones, default=SELF.order.taxzone_id, title_key='description', style='width: 300px') %]</td>
41
            <td>[% L.select_tag('order.taxzone_id', SELF.all_taxzones, default=SELF.order.taxzone_id, title_key='description', style='width: 300px', class='recalc') %]</td>
42 42
          </tr>
43 43

  
44 44
          <tr>
......
210 210

  
211 211
            <td align="right">
212 212
              <table>
213
                [%- IF NOT taxincluded %]
214
                <tr>
213
                <tr id="taxincluded_row_id" [%- IF !SELF.taxes.size %]style="display:none"[%- END %]>
214
                  <td align=right colspan="2">
215
                    <label for="order.taxincluded"><b>[% 'Tax Included' | $T8 %]</b></label>
216
                    [% L.yes_no_tag('order.taxincluded', SELF.order.taxincluded, class='recalc') %]
217
                  </td>
218
                </tr>
219

  
220
                <tr id="subtotal_row_id" [%- IF SELF.order.taxincluded %]style="display:none"[%- END %]>
215 221
                  <th align="right">[%- 'Subtotal' | $T8 %]</th>
216 222
                  <td align="right">
217 223
                    [%- L.div_tag(SELF.order.netamount_as_number, id='netamount_id') %]
218 224
                  </td>
219 225
                </tr>
220
                [%- END %]
221 226
                [%- FOREACH tax = SELF.taxes %]
222
                  [%- PROCESS order/tabs/_tax_row.html TAX=tax %]
227
                  [%- PROCESS order/tabs/_tax_row.html TAX=tax TAXINCLUDED=SELF.order.taxincluded %]
223 228
                [%- END %]
224 229
                <tr id="amount_row_id">
225 230
                  <th align="right">[%- 'Total' | $T8 %]</th>
......
244 249

  
245 250
<script type='text/javascript'>
246 251
function reload_cv_dependend_selections() {
247
  $.post("controller.pl", { 'action': 'Order/customer_vendor_changed',
248
                            'cv_id':  function(){ return $('#order_[%- cv_id%]').val() },
249
                            'type':   function(){ return $('#type').val() },
250
                          }, kivi.eval_json_result);
252
  var data = $('#order_form').serialize();
253
  data += '&action=Order/customer_vendor_changed';
254

  
255
  $.post("controller.pl", data, kivi.eval_json_result);
251 256
}
252 257

  
253 258
function add_item() {

Auch abrufbar als: Unified diff