X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fap.pl;h=dc48e3d70c854f593a335c448f7381d5a1e676c3;hb=b8ee6b6ed46e55095b955ee1800b8a4b8d8ccc3f;hp=d0eeb4f9de14d8a475a43dcb553fb80106ffb3d1;hpb=456a53199fb9ea0990cd336123166e88055261f4;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index d0eeb4f9d..dc48e3d70 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -375,6 +375,10 @@ sub form_header { if ( $form->{'paid_'. $form->{paidaccounts}} ) { $form->{paidaccounts}++; } + + # default account for current assets (i.e. 1801 - SKR04) + $form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); + for my $i (1 .. $form->{paidaccounts}) { $form->{totalpaid} += $form->{"paid_$i"}; @@ -479,23 +483,15 @@ sub update { my $count = 0; my (@a, $j, $totaltax); for my $i (1 .. $form->{rowcount}) { - $form->{"amount_$i"} = - $form->parse_amount(\%myconfig, $form->{"amount_$i"}); - $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"}); + $form->{"amount_$i"} = $form->parse_amount(\%myconfig, $form->{"amount_$i"}); if ($form->{"amount_$i"}) { push @a, {}; $j = $#a; my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); - if ($taxkey > 1) { - if ($form->{taxincluded}) { - $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate; - } else { - $form->{"tax_$i"} = $form->{"amount_$i"} * $rate; - } - } else { - $form->{"tax_$i"} = 0; - } - $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2); + + # calculate tax exactly the same way as AP in post_transaction via form->calculate_tax + my $tmpnetamount; + ($tmpnetamount,$form->{"tax_$i"}) = $form->calculate_tax($form->{"amount_$i"},$rate,$form->{taxincluded},2); $totaltax += $form->{"tax_$i"}; map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds; @@ -606,10 +602,11 @@ sub post { my ($inline) = @_; - # check if there is a vendor, invoice and due date + # check if there is a vendor, invoice, due date and invnumber $form->isblank("transdate", $locale->text("Invoice Date missing!")); $form->isblank("duedate", $locale->text("Due Date missing!")); $form->isblank("vendor", $locale->text('Vendor missing!')); + $form->isblank("invnumber", $locale->text('Invoice Number missing!')); if ($myconfig{mandatory_departments} && !$form->{department}) { $form->{saved_message} = $::locale->text('You have to specify a department.'); @@ -914,6 +911,7 @@ sub ap_transactions { my @options; push @options, $locale->text('Vendor') . " : $form->{vendor}" if ($form->{vendor}); + push @options, $locale->text('Contact Person') . " : $form->{cp_name}" if ($form->{cp_name}); push @options, $locale->text('Department') . " : " . (split /--/, $form->{department})[0] if ($form->{department}); push @options, $locale->text('Invoice Number') . " : $form->{invnumber}" if ($form->{invnumber}); push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if ($form->{ordnumber});