X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Far.pl;h=f0c3f4f1882a75a62e31a5739a309c1d99b72db7;hb=04854ac27e2b18b2d5a15089c69ed5b79c495a2b;hp=f170407d894382bf0fbca5ea3ae2d5f422f638a6;hpb=bea3f989a3bb5d1b734cf4e606a668213755e2e0;p=kivitendo-erp.git
diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl
index f170407d8..f0c3f4f18 100644
--- a/bin/mozilla/ar.pl
+++ b/bin/mozilla/ar.pl
@@ -76,8 +76,6 @@ use strict;
# $locale->text('Nov')
# $locale->text('Dec')
-my $totalpaid;
-
sub add {
$main::lxdebug->enter_sub();
@@ -92,7 +90,7 @@ sub add {
if(!exists $form->{addition} && ($form->{id} ne "")) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "ADDED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
@@ -705,7 +703,7 @@ $jsscript
";
my @triggers = ();
- my $totalpaid = 0;
+ $form->{totalpaid} = 0;
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
for my $i (1 .. $form->{paidaccounts}) {
@@ -720,7 +718,7 @@ $jsscript
'-labels' => \%AR_paid_labels,
'-default' => $form->{"AR_paid_$i"}));
- $totalpaid += $form->{"paid_$i"};
+ $form->{totalpaid} += $form->{"paid_$i"};
# format amounts
if ($form->{"paid_$i"}) {
@@ -778,14 +776,14 @@ $jsscript
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
- my $paid_missing = $form->{invtotal_unformatted} - $totalpaid;
+ my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid};
print qq|
|
|
| . $locale->text('Total') . qq| |
- | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| |
+ | . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq| |
|
@@ -862,7 +860,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') && (($totalpaid == 0) || ($totalpaid eq "")));
+ if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq "")));
if ($form->{id}) {
if ($form->{radier}) {
@@ -1005,7 +1003,7 @@ sub update {
$form->parse_amount(\%myconfig, $form->{"${_}_$i"})
} qw(paid exchangerate);
- $totalpaid += $form->{"paid_$i"};
+ $form->{totalpaid} += $form->{"paid_$i"};
$form->{"forex_$i"} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy');
$form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"};
@@ -1013,10 +1011,10 @@ sub update {
}
$form->{creditremaining} -=
- ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
+ ($form->{invtotal} - $form->{totalpaid} + $form->{oldtotalpaid} -
$form->{oldinvtotal});
$form->{oldinvtotal} = $form->{invtotal};
- $form->{oldtotalpaid} = $totalpaid;
+ $form->{oldtotalpaid} = $form->{totalpaid};
&display_form;
@@ -1037,6 +1035,8 @@ sub post_payment {
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+ my $invdate = $form->datetonum($form->{transdate}, \%myconfig);
+
for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
@@ -1089,6 +1089,12 @@ sub post {
$form->isblank("duedate", $locale->text('Due Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
+ if ($myconfig{mandatory_departments} && !$form->{department}) {
+ $form->{saved_message} = $::locale->text('You have to specify a department.');
+ update();
+ exit;
+ }
+
my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
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));
@@ -1121,13 +1127,12 @@ sub post {
my ($customer) = split /--/, $form->{customer};
if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
update();
- exit;
+ ::end_of_request();
}
$form->{AR}{receivables} = $form->{ARselected};
$form->{storno} = 0;
- $main::lxdebug->message(0, $form->{amount});
$form->{id} = 0 if $form->{postasnew};
$form->error($locale->text('Cannot post transaction!')) unless AR->post_transaction(\%myconfig, \%$form);
@@ -1135,7 +1140,7 @@ sub post {
if(!exists $form->{addition} && $form->{id} ne "") {
$form->{snumbers} = "invnumber_$form->{invnumber}";
$form->{addition} = "POSTED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
remove_draft() if $form->{remove_draft};
@@ -1158,7 +1163,7 @@ sub post_as_new {
if(!exists $form->{addition} && $form->{id} ne "") {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "POSTED AS NEW";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
&post;
@@ -1241,7 +1246,7 @@ sub yes {
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "DELETED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
$form->redirect($locale->text('Transaction deleted!'));
@@ -1268,16 +1273,22 @@ sub search {
$form->all_vc(\%myconfig, "customer", "AR");
$form->{title} = $locale->text('AR Transactions');
- $form->{fokus} = "search.customer";
$form->{jsscript} = 1;
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
- "customers" => "ALL_VC");
+ # Auch in Rechnungsübersicht nach Kundentyp filtern - jan
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
+ "departments" => "ALL_DEPARTMENTS",
+ "customers" => "ALL_VC",
+ "employees" => "ALL_EMPLOYEES",
+ "salesmen" => "ALL_SALESMEN",
+ "business_types" => "ALL_BUSINESS_TYPES");
+ $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
# constants and subs for template
$form->{jsscript} = 1;
$form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
+ $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} };
+ $form->{salesman_labels} = $form->{employee_labels};
$form->header;
print $form->parse_html_template('ar/search', { %myconfig });
@@ -1394,6 +1405,9 @@ sub ar_transactions {
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
}
+ if ($form->{department_id}) {
+ push @options, $locale->text('Department Id') . " : $form->{department_id}";
+ }
if ($form->{invnumber}) {
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
}
@@ -1516,7 +1530,7 @@ sub storno {
if(!exists $form->{addition} && $form->{id} ne "") {
$form->{snumbers} = "ordnumber_$form->{ordnumber}";
$form->{addition} = "STORNO";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history