X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=af964bbd71ada527df1848e00e269ea6363f3f7a;hb=1b3fe156b5ddfd588c1e55af5e21a36e84d9caf8;hp=eaa0f2224abe8f7729b062db2a2f053d86fed3e1;hpb=456a81dd3b5ccd8b4a48ea166d465ca2b9fb5b6b;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index eaa0f2224..af964bbd7 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -37,6 +37,8 @@ use SL::PE; use Data::Dumper; require "$form->{path}/arap.pl"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/drafts.pl"; 1; @@ -73,19 +75,31 @@ require "$form->{path}/arap.pl"; sub add { $lxdebug->enter_sub(); + return $lxdebug->leave_sub() if (load_draft_maybe()); + + # saving the history + if(!exists $form->{addition} && ($form->{id} ne "")) { + $form->{addition} = "ADDED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->{title} = "Add"; $form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; &create_links; + AR->get_transdate(\%myconfig, $form); &display_form; - $lxdebug->leave_sub(); } sub edit { $lxdebug->enter_sub(); + # show history button + $form->{javascript} = qq||; + #/show hhistory button $form->{title} = "Edit"; @@ -111,14 +125,17 @@ 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; + $form->{rowcount} = 1; + # currencies - @curr = split /:/, $form->{currencies}; + @curr = split(/:/, $form->{currencies}); chomp $curr[0]; $form->{defaultcurrency} = $curr[0]; @@ -156,7 +173,7 @@ sub create_links { map { $tax .= - qq|\n"; } else { $form->{"select$key"} .= - "\n"; + "\n"; } } @@ -182,7 +199,7 @@ sub create_links { # if there is a value we have an old entry my $j = 0; my $k = 0; - print(STDERR Dumper($form->{acc_trans})); + for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { if ($key eq "AR_paid") { $j++; @@ -199,13 +216,14 @@ sub create_links { $form->{"forex_$j"} = $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate}; $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}"; + $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id}; $form->{paidaccounts}++; } else { $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}"} = @@ -223,11 +241,10 @@ sub create_links { $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"}; $withholdingrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"}; - } - print(STDERR $form->{acc_trans}{$key}->[$i - 1]->{amount}, " ACC_TRANS\n"); - print(STDERR "$key KEY, $k Zeile\n"); + } $index = $form->{acc_trans}{$key}->[$i - 1]->{index}; $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount}; + $totaltax += $form->{"tax_$index"}; } else { $k++; @@ -249,14 +266,14 @@ sub create_links { "$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}"; + my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description}); $form->{"select${key}"} =~ - /