Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f921dcbb

Von Stephan Köhler vor fast 19 Jahren hinzugefügt

  • ID f921dcbbe1ea7ac327f37270af3a16ac52b9ff86
  • Vorgänger 82ee2234
  • Nachfolger a7873339

Merge von 732 aus unstable: Bugfix Splitbuchungen
Fehler bei Splitbuchungen beseitigt, wenn mit Steuer inkl. gebucht wurde

Unterschiede anzeigen:

bin/mozilla/ar.pl
116 116

  
117 117
  $form->{duedate}     = $duedate if $duedate;
118 118
  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
119
  $form->{rowcount} = 1;
119
  $form->{rowcount}    = 1;
120

  
120 121
  # currencies
121 122
  @curr = split /:/, $form->{currencies};
122 123
  chomp $curr[0];
......
182 183
    # if there is a value we have an old entry
183 184
    my $j = 0;
184 185
    my $k = 0;
185
    print(STDERR Dumper($form->{acc_trans}));
186

  
186 187
    for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
187 188
      if ($key eq "AR_paid") {
188 189
        $j++;
......
205 206
        $akey = $key;
206 207
        $akey =~ s/AR_//;
207 208

  
208
        if ($key eq "AR_tax") {
209
        if ($key eq "AR_tax" || $key eq "AP_tax") {
209 210
          $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
210 211
            "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
211 212
          $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
......
223 224
              $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
224 225
            $withholdingrate +=
225 226
              $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
226
          }          
227
          print(STDERR $form->{acc_trans}{$key}->[$i - 1]->{amount}, " ACC_TRANS\n");
228
          print(STDERR "$key KEY, $k Zeile\n");
227
          }
229 228
          $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
230 229
          $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
230
          $totaltax += $form->{"tax_$index"};
231 231

  
232 232
        } else {
233 233
          $k++;
......
275 275
        ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
276 276
      $tax = $form->round_amount($taxamount, 2);
277 277
      $diff                += ($taxamount - $tax);
278
      $form->{"amount_$i"} += $tax;
278
      $form->{"amount_$i"} += $form->{"tax_$i"};
279 279
    }
280 280
    $form->{amount_1} += $form->round_amount($diff, 2);
281 281
  }
282 282

  
283
  # check if calculated is equal to stored
284
  if ($form->{taxincluded} && $form->{taxrate} && $withholdingrate) {
285
    if ($form->{"taxrate"} > 0) {
286
      $taxamount =
287
        $form->round_amount(
288
            ($form->{amount_1} - ($form->{amount_1} / ($form->{taxrate} + 1))),
289
            2);
290
    } else {
291
      $taxamount =
292
        $form->round_amount(
293
            ($totalamount + $totaltax + $totalwithholding) * $withholdingrate /
294
              (1 - $withholdingrate),
295
            2
296
        ) * $form->{"taxrate"} / $withholdingrate;
297
    }
298
  } else {
299
    $taxamount = $totalamount * $form->{"taxrate"};
300
  }
301 283
  $taxamount = $form->round_amount($taxamount, 2);
302 284
  $form->{tax} = $taxamount;
303 285

  
304
  $form->{invtotal} = $totalamount + $totaltax + $totalwithholding;
286
  $form->{invtotal} = $totalamount + $totaltax;
305 287

  
306 288
  $form->{locked} =
307 289
    ($form->datetonum($form->{transdate}, \%myconfig) <=
......
353 335
      s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
354 336
  }
355 337
  $selectAR_amount_unquoted = $form->{selectAR_amount};
356
  $taxchart = $form->{taxchart};
357
  map { $form->{$_} =~ s/\"/&quot;/g } qw(AR_amount selectAR_amount AR taxchart);
338
  $taxchart                 = $form->{taxchart};
339
  map { $form->{$_} =~ s/\"/&quot;/g }
340
    qw(AR_amount selectAR_amount AR taxchart);
358 341

  
359 342
  # format amounts
360 343
  $form->{exchangerate} =
......
438 421
    $button1 = qq|
439 422
       <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
440 423
       <td><input type=button name=transdate id="trigger1" value=|
441
      . $locale->text('button')
442
      . qq|></td>
424
      . $locale->text('button') . qq|></td>
443 425
       |;
444 426
    $button2 = qq|
445 427
       <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
446 428
       <td><input type=button name=duedate id="trigger2" value=|
447
      . $locale->text('button')
448
      . qq|></td></td>
429
      . $locale->text('button') . qq|></td></td>
449 430
     |;
450 431

  
451 432
    #write Trigger
......
571 552
	</tr>
572 553
|;
573 554

  
574
 
575

  
576 555
  $amount  = $locale->text('Amount');
577 556
  $project = $locale->text('Project');
578 557

  
579 558
  for $i (1 .. $form->{rowcount}) {
580 559

  
581 560
    # format amounts
582
    $form->{"amount_$i"} = $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
561
    $form->{"amount_$i"} =
562
      $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
583 563
    $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
584 564
    $selectAR_amount = $selectAR_amount_unquoted;
585
    $selectAR_amount =~ s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
565
    $selectAR_amount =~
566
      s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
586 567
    $tax          = $taxchart;
587 568
    $tax_selected = $form->{"taxchart_$i"};
588 569
    $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
589 570
    $tax =
590
            qq|<td><select id="taxchart_$i" name="taxchart_$i">$tax</select></td>|;
571
      qq|<td><select id="taxchart_$i" name="taxchart_$i">$tax</select></td>|;
591 572

  
592 573
    print qq|
593 574
	<tr>
......
605 586
    $project = "";
606 587
  }
607 588

  
608

  
609

  
610

  
611 589
  $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
612 590

  
613 591
  print qq|
......
648 626
      <table width=100%>
649 627
	<tr class=listheading>
650 628
	  <th colspan=6 class=listheading>|
651
    . $locale->text('Incoming Payments')
652
    . qq|</th>
629
    . $locale->text('Incoming Payments') . qq|</th>
653 630
	</tr>
654 631
|;
655 632

  
......
816 793

  
817 794
  $form->{invtotal} = 0;
818 795

  
819
#   $form->{selectAR_amount} = $form->{AR_amount};
820
#   $form->{selectAR_amount} =~
821
#     s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
796
  #   $form->{selectAR_amount} = $form->{AR_amount};
797
  #   $form->{selectAR_amount} =~
798
  #     s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
822 799

  
823 800
  $form->{selectAR} = $form->{AR};
824 801

  
......
843 820
  for $i (1 .. $form->{rowcount}) {
844 821
    $form->{"amount_$i"} =
845 822
      $form->parse_amount(\%myconfig, $form->{"amount_$i"});
846
    $form->{"tax_$i"} =
847
      $form->parse_amount(\%myconfig, $form->{"tax_$i"});
823
    $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
848 824
    if ($form->{"amount_$i"}) {
849 825
      push @a, {};
850 826
      $j = $#a;
......
887 863

  
888 864
  &check_project;
889 865

  
890

  
891 866
  $form->{invtotal} =
892 867
    ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
893 868

  
......
1083 1058
    $button1 = qq|
1084 1059
       <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1085 1060
       <input type=button name=transdatefrom id="trigger1" value=|
1086
      . $locale->text('button')
1087
      . qq|></td>
1061
      . $locale->text('button') . qq|></td>
1088 1062
      |;
1089 1063
    $button2 = qq|
1090 1064
       <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1091 1065
       <input type=button name=transdateto name=transdateto id="trigger2" value=|
1092
      . $locale->text('button')
1093
      . qq|></td>
1066
      . $locale->text('button') . qq|></td>
1094 1067
     |;
1095 1068

  
1096 1069
    #write Trigger
......
1309 1282
    $option   .= $locale->text('Closed');
1310 1283
  }
1311 1284

  
1312
  @columns =
1313
    $form->sort_columns(
1285
  @columns = $form->sort_columns(
1314 1286
    qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee shippingpoint shipvia)
1315
    );
1287
  );
1316 1288

  
1317 1289
  foreach $item (@columns) {
1318 1290
    if ($form->{"l_$item"} eq "Y") {

Auch abrufbar als: Unified diff