X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=7f670582c958dd88a3d19a7a7207b3d8f7f6ef2c;hb=8299e7bc0d4463d5ba08e1feaccd8faa60f5c5ae;hp=da4315b2ec7838a6c2ced993b8af5285d4db5fa0;hpb=3253777d478fe7f8b8d85ef867c864cdae16d7fa;p=kivitendo-erp.git
diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl
index da4315b2e..7f670582c 100644
--- a/bin/mozilla/ar.pl
+++ b/bin/mozilla/ar.pl
@@ -89,8 +89,10 @@ sub add {
"$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
- &create_links;
AR->get_transdate(\%myconfig, $form);
+ $form->{initial_transdate} = $form->{transdate};
+ &create_links;
+ $form->{transdate} = $form->{initial_transdate};
&display_form;
$lxdebug->leave_sub();
}
@@ -134,6 +136,9 @@ sub create_links {
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
$form->{rowcount} = 1;
+ # notes
+ $form->{notes} = $form->{intnotes} unless $form->{notes};
+
# currencies
@curr = split(/:/, $form->{currencies});
chomp $curr[0];
@@ -257,8 +262,6 @@ sub create_links {
}
}
- $lxdebug->message(0, "1 ARselected $form->{ARselected}");
-
$form->{taxincluded} = $taxincluded if ($form->{id});
$form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
@@ -359,8 +362,6 @@ sub form_header {
}
}
- $taxincluded = "";
-
$taxincluded = qq|
{taxincluded}> |
@@ -428,6 +429,7 @@ sub form_header {
my (%AR_amount_labels, @AR_amount_values);
my (%AR_labels, @AR_values);
my (%AR_paid_labels, @AR_paid_values);
+ my %charts;
my $taxchart_init;
foreach my $item (@{ $form->{ALL_CHARTS} }) {
@@ -447,16 +449,20 @@ sub form_header {
$AR_paid_labels{$item->{accno}} =
"$item->{accno}--$item->{description}";
}
+
+ $charts{$item->{accno}} = $item;
}
my %taxchart_labels = ();
my @taxchart_values = ();
+ my %taxcharts = ();
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
my $key = "$item->{id}--$item->{rate}";
$taxchart_init = $key if ($taxchart_init eq $item->{id});
push(@taxchart_values, $key);
$taxchart_labels{$key} =
"$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
+ $taxcharts{$item->{id}} = $item;
}
$form->{fokus} = "arledger.customer";
@@ -610,6 +616,24 @@ $jsscript
$form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
+ my $selected_accno_full;
+ my ($accno_row) = split(/--/, $form->{"AR_amount_$i"});
+ my $item = $charts{$accno_row};
+ $selected_accno_full = "$item->{accno}--$item->{tax_id}";
+
+ my $selected_taxchart = $form->{"taxchart_$i"};
+ my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full);
+ my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AR_amount_$i"});
+
+ if ($previous_accno &&
+ ($previous_accno eq $selected_accno) &&
+ ($previous_tax_id ne $selected_tax_id)) {
+ my $item = $taxcharts{$selected_tax_id};
+ $selected_taxchart = "$item->{id}--$item->{rate}";
+ }
+
+ $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
+
$selectAR_amount =
NTI($cgi->popup_menu('-name' => "AR_amount_$i",
'-id' => "AR_amount_$i",
@@ -617,7 +641,9 @@ $jsscript
'-onChange' => "setTaxkey(this, $i)",
'-values' => \@AR_amount_values,
'-labels' => \%AR_amount_labels,
- '-default' => $form->{"AR_amount_$i"}));
+ '-default' => $selected_accno_full))
+ . $cgi->hidden('-name' => "previous_AR_amount_$i",
+ '-default' => $selected_accno_full);
$tax = qq|| .
NTI($cgi->popup_menu('-name' => "taxchart_$i",
@@ -625,8 +651,7 @@ $jsscript
'-style' => 'width:200px',
'-values' => \@taxchart_values,
'-labels' => \%taxchart_labels,
- '-default' => $form->{"taxchart_$i"} eq "" ?
- $taxchart_init : $form->{"taxchart_$i"}))
+ '-default' => $selected_taxchart))
. qq| | |;
$korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
@@ -824,6 +849,15 @@ sub form_footer {
|;
+ if (!$form->{id} && $form->{draft_id}) {
+ print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft',
+ '-value' => 1, '-checked' => $form->{remove_draft},
+ '-label' => '')) .
+ qq|
|);
+ }
+
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
@@ -1050,9 +1084,6 @@ sub post {
$form->{AR}{receivables} = $form->{ARselected};
- $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
- unless $form->{invnumber};
-
$form->{id} = 0 if $form->{postasnew};
if (AR->post_transaction(\%myconfig, \%$form)) {
# saving the history