X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Far.pl;h=e867d89168fa7d4f1d6bd21e24b7171f8b9de090;hb=7e6bdfc6728ec15377f5b78dd1fb4eaefed84962;hp=2451cc1a4d9f5c3407a91bb39546824519e8937d;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 2451cc1a4..e867d8916 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -34,6 +34,7 @@ use SL::AR; use SL::IS; use SL::PE; +use Data::Dumper; require "$form->{path}/arap.pl"; @@ -110,11 +111,14 @@ sub create_links { $duedate = $form->{duedate}; $taxincluded = $form->{taxincluded}; - + my $id = $form->{id}; IS->get_customer(\%myconfig, \%$form); + $form->{taxincluded} = $taxincluded; + $form->{id} = $id; $form->{duedate} = $duedate if $duedate; $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; + $form->{rowcount} = 1; # currencies @curr = split /:/, $form->{currencies}; @@ -155,7 +159,7 @@ sub create_links { map { $tax .= - qq|\n"; } else { $form->{"select$key"} .= - "\n"; + "\n"; } } $form->{$key} = $form->{"select$key"}; # if there is a value we have an old entry - $j = 0; + my $j = 0; + my $k = 0; + for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { if ($key eq "AR_paid") { $j++; @@ -202,7 +208,7 @@ sub create_links { $akey = $key; $akey =~ s/AR_//; - if ($key eq "AR_tax") { + if ($key eq "AR_tax" || $key eq "AP_tax") { $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = @@ -221,9 +227,13 @@ sub create_links { $withholdingrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"}; } + $index = $form->{acc_trans}{$key}->[$i - 1]->{index}; + $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount}; + $totaltax += $form->{"tax_$index"}; } else { - $form->{"${akey}_$i"} = + $k++; + $form->{"${akey}_$k"} = $form->round_amount( $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate, 2); @@ -231,24 +241,25 @@ sub create_links { $form->{rowcount}++; $totalamount += $form->{"${akey}_$i"}; - $form->{"oldprojectnumber_$i"} = $form->{"projectnumber_$i"} = + $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}"; $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate}; - $form->{"project_id_$i"} = + $form->{"project_id_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{project_id}"; } - $form->{"${key}_$i"} = + $form->{"${key}_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; $form->{"${key}_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; $form->{"select${key}"} =~ - /(