X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Far.pl;h=f506cd9cfa22b2922e5bb9d6ba3b768adcdbd6c1;hb=870e380d3248baa87148a6316977b69c8c4b17c4;hp=caf48362feb16f359d1d0fd09cedf9018b13472e;hpb=ea2e84cc75e2879141eea5e957439936280682bf;p=kivitendo-erp.git
diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl
index caf48362f..f506cd9cf 100644
--- a/bin/mozilla/ar.pl
+++ b/bin/mozilla/ar.pl
@@ -32,7 +32,7 @@
#======================================================================
use POSIX qw(strftime);
-use List::Util qw(sum);
+use List::Util qw(sum first);
use SL::AR;
use SL::FU;
@@ -96,8 +96,8 @@ sub add {
$form->{addition} = "ADDED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
-
+ # /saving the history
+
$form->{title} = "Add";
$form->{callback} = "ar.pl?action=add" unless $form->{callback};
@@ -318,8 +318,8 @@ sub form_header {
my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
- $customer = ($form->{selectcustomer})
- ? qq||
+ $customer = ($form->{selectcustomer})
+ ? qq||
: qq||;
$employee = qq|
@@ -472,7 +472,7 @@ sub form_header {
| . $locale->text('Customer') . qq| |
- $customer |
+ $customer |
@@ -577,7 +577,13 @@ $jsscript
$selected_taxchart = "$item->{id}--$item->{rate}";
}
- $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
+ if (!$form->{"taxchart_$i"}) {
+ if ($form->{"AR_amount_$i"} =~ m/.--./) {
+ $selected_taxchart = join '--', map { ($_->{id}, $_->{rate}) } first { $_->{id} == $item->{tax_id} } @{ $form->{ALL_TAXCHARTS} };
+ } else {
+ $selected_taxchart = $taxchart_init;
+ }
+ }
$selectAR_amount =
NTI($cgi->popup_menu('-name' => "AR_amount_$i",
@@ -679,8 +685,8 @@ $jsscript
$column_data{exchangerate} = "" . $locale->text('Exch') . " | ";
$column_data{AR_paid} = "" . $locale->text('Account') . " | ";
$column_data{source} = "" . $locale->text('Source') . " | ";
- $column_data{memo} = "" . $locale->text('Memo') . " | ";
- $column_data{paid_project_id} = "" . $locale->text('Project Number') . " | ";
+ $column_data{memo} = "" . $locale->text('Memo') . " | ";
+ $column_data{paid_project_id} = "" . $locale->text('Project Number') . " | ";
print "
@@ -843,7 +849,7 @@ $follow_ups_block
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
print qq| |
- if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar'));
+ if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($total_paid == 0) || ($total_paid eq "")));
if ($form->{id}) {
if ($form->{radier}) {
@@ -877,9 +883,9 @@ $follow_ups_block
print qq| {id}); name=history id=history value=| . $locale->text('history') . qq|> |;
}
# /button for saving history
- # mark_as_paid button
- if($form->{id} ne "") {
- print qq||;
}
# /mark_as_paid button
@@ -899,7 +905,7 @@ sub mark_as_paid {
$auth->assert('general_ledger');
- &mark_as_paid_common(\%myconfig,"ar");
+ &mark_as_paid_common(\%myconfig,"ar");
$lxdebug->leave_sub();
}
@@ -915,6 +921,8 @@ sub update {
$form->{invtotal} = 0;
+ delete @{ $form }{ grep { m/^tax_\d+$/ } keys %{ $form } };
+
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
@@ -954,9 +962,19 @@ sub update {
$form->{exchangerate} = $form->{forex} if $form->{forex};
$form->{invdate} = $form->{transdate};
- my $save_AR = $form->{AR};
- check_name("customer");
- $form->{AR} = $save_AR;
+
+ $form->{invdate} = $form->{transdate};
+
+ my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1);
+
+ &check_name("customer");
+
+ $form->{AR} = $saved_variables{AR};
+ if ($saved_variables{AR_amount_1} =~ m/.--./) {
+ map { $form->{$_} = $saved_variables{$_} } qw(AR_amount_1 taxchart_1);
+ } else {
+ delete $form->{taxchart_1};
+ }
$form->{invtotal} =
($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
@@ -1046,7 +1064,7 @@ sub post {
my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
$form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig));
- $form->error($locale->text('Zero amount posting!'))
+ $form->error($locale->text('Zero amount posting!'))
unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount};
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
@@ -1090,7 +1108,7 @@ sub post {
$form->{addition} = "POSTED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
remove_draft() if $form->{remove_draft};
$form->redirect($locale->text('Transaction posted!')) unless $inline;
@@ -1110,7 +1128,7 @@ sub post_as_new {
$form->{addition} = "POSTED AS NEW";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
&post;
$lxdebug->leave_sub();
@@ -1183,7 +1201,7 @@ sub yes {
$form->{addition} = "DELETED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
$form->redirect($locale->text('Transaction deleted!'));
}
$form->error($locale->text('Cannot delete transaction!'));
@@ -1228,9 +1246,9 @@ sub search {
| if $form->{selectdepartment};
$form->{title} = $locale->text('AR Transactions');
-
+
$form->{javascript} .= qq||;
-
+
# use JavaScript Calendar or not
$form->{jsscript} = 1;
$jsscript = "";
@@ -1394,6 +1412,26 @@ sub search {
|
| . $locale->text('Transaction description') . qq| |
+
+ | . $locale->text('Customer') . qq| |
+
+
+ |
+ | . $locale->text('Customer Number') . qq| |
+ |
+ | . $locale->text('Country') . qq| |
+ |
+ | . $locale->text('USt-IdNr.') . qq| |
+ |
+ | . $locale->text('Steuersatz') . qq| |
+
+
+ |
+ | . $locale->text('Payment Terms') . qq| |
+ |
+ | . $locale->text('Buchungskonto') . qq| |
+
+
@@ -1462,7 +1500,7 @@ sub ar_transactions {
@columns =
qw(transdate id type invnumber ordnumber name netamount tax amount paid
datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia
- marge_total marge_percent globalprojectnumber);
+ marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts);
my @hidden_variables = map { "l_${_}" } @columns;
push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto);
@@ -1492,6 +1530,12 @@ sub ar_transactions {
'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
'marge_total' => { 'text' => $locale->text('Ertrag'), },
'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), },
+ 'customernumber' => { 'text' => $locale->text('Customer Number'), },
+ 'country' => { 'text' => $locale->text('Country'), },
+ 'ustid' => { 'text' => $locale->text('USt-IdNr.'), },
+ 'taxzone' => { 'text' => $locale->text('Steuersatz'), },
+ 'payment_terms' => { 'text' => $locale->text('Payment Terms'), },
+ 'charts' => { 'text' => $locale->text('Buchungskonto'), },
);
foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia transaction_description)) {
@@ -1507,7 +1551,7 @@ sub ar_transactions {
$report->set_columns(%column_defs);
$report->set_column_order(@columns);
- $report->set_export_options('ar_transactions', @hidden_variables);
+ $report->set_export_options('ar_transactions', @hidden_variables, qw(sort sortdir));
$report->set_sort_indicator($form->{sort}, $form->{sortdir});
@@ -1639,9 +1683,9 @@ sub storno {
$form->{addition} = "STORNO";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
- $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
+ $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
$lxdebug->leave_sub();
}