X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=cd30053ed5bce3dad0518d7cf8e7a5b31cb087e3;hb=8a2d9daf01083e1271cf6118591bb2c242734261;hp=3d4fe26649274218c5fc0d053ee13fa96def30d7;hpb=d34ee91386259e41c85c100a6736e172bfcd4e69;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 3d4fe2664..cd30053ed 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -215,7 +215,7 @@ sub form_header { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; my ($title, $readonly, $exchangerate, $rows); my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project); @@ -436,6 +436,12 @@ sub form_header { qq|| . qq||; + my $globalprojectnumber = + NTI($cgi->popup_menu('-name' => "globalproject_id", + '-values' => \@project_values, + '-labels' => \%project_labels, + '-default' => $form->{"globalproject_id"} )); + $form->header; $onload = qq|focus()|; $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; @@ -523,6 +529,10 @@ sub form_header { | . $locale->text('Due Date') . qq| $button2 + + | . $locale->text('Project Number') . qq| + $globalprojectnumber + @@ -717,11 +727,23 @@ $jsscript $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); } - $form->{"exchangerate_$i"} = - $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); - if ($form->{"exchangerate_$i"} == 0) { $form->{"exchangerate_$i"} = ""; + } else { + $form->{"exchangerate_$i"} = + $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); + } + + print qq|{"acc_trans_id_$i"}>\n|; + print qq|{"gldate_$i"}>\n|; + my $changeable = 1; + if ($::lx_office_conf{features}->{payments_changeable} == 0) { + # never + $changeable = ($form->{"acc_trans_id_$i"})? 0 : 1; + } + if ($::lx_office_conf{features}->{payments_changeable} == 2) { + # on the same day + $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); } $exchangerate = qq| |; @@ -730,8 +752,13 @@ $jsscript $exchangerate = qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; } else { - $exchangerate = - qq|{"exchangerate_$i"}>|; + if ($changeable) { + $exchangerate = + qq|{"exchangerate_$i"}>|; + } else { + $exchangerate = + qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; + } } } @@ -739,33 +766,78 @@ $jsscript {"forex_$i"}> |; - $column_data{paid} = - qq||; - $column_data{AR_paid} = - qq|${selectAR_paid}|; - $column_data{exchangerate} = qq|$exchangerate|; - $column_data{datepaid} = - qq| + my $datepaid; + if ($changeable) { + $datepaid = qq| |; - $column_data{source} = - qq||; - $column_data{memo} = - qq||; + } else { + $datepaid = qq|$form->{"datepaid_$i"}|. + qq|{"datepaid_$i"}>|; + } + + my $paid; + if ($changeable) { + $paid = qq||; + } else { + $paid = qq|$form->{"paid_$i"}|. + qq|{"paid_$i"}>|; + } - $column_data{paid_project_id} = + my $source; + if ($changeable) { + $source = qq||; + } else { + $source = qq|$form->{"source_$i"}|. + qq|{"source_$i"}>|; + } + + my $memo; + if ($changeable) { + $memo = qq||; + } else { + $memo = qq|$form->{"memo_$i"}|. + qq|{"memo_$i"}>|; + } + + my $AR_paid; + if ($changeable) { + $AR_paid = qq|${selectAR_paid}|; + } else { + $AR_paid = qq|$form->{"AR_paid_$i"}|. + qq|{"AR_paid_$i"}>|; + } + + my $paid_project_id; + if ($changeable) { + $paid_project_id = qq|| . NTI($cgi->popup_menu('-name' => "paid_project_id_$i", '-values' => \@project_values, '-labels' => \%project_labels, '-default' => $form->{"paid_project_id_$i"} )) . qq||; + } else { + my $projectnumber = $project_labels{$form->{"paid_project_id_$i"}}; + $paid_project_id = qq|$projectnumber|. + qq|{"paid_project_id_$i"}>|; + } + + $column_data{paid} = $paid; + $column_data{AR_paid} = $AR_paid; + $column_data{exchangerate} = qq|$exchangerate|; + $column_data{datepaid} = $datepaid; + $column_data{source} = $source; + $column_data{memo} = $memo; + $column_data{paid_project_id} = $paid_project_id; map { print qq|$column_data{$_}\n| } @column_index; print " "; - push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); + if ($changeable) { + push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); + } } my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid}; @@ -807,7 +879,7 @@ sub form_footer { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; my ($transdate, $closedto); @@ -974,13 +1046,12 @@ sub update { $form->{invdate} = $form->{transdate}; - my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1 oldcustomer); + my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1 customer_id); &check_name("customer"); - # check_name ruft get_customer auf, oldcustomer wird überschrieben, daher wird dies vorher gemerkt - # get_customer holt Bemerkungen als intnotes, für Debitorenbuchungen gibt es aber nur das Feld notes - $form->{notes} = $form->{intnotes} if $saved_variables{oldcustomer} ne $form->{customer}; + # check_name loads customer notes into notes, but ar only knows intnotes, so copy them + $form->{notes} = $form->{intnotes} if $saved_variables{customer_id} != $form->{customer_id}; $form->{AR} = $saved_variables{AR}; if ($saved_variables{AR_amount_1} =~ m/.--./) { @@ -1175,7 +1246,7 @@ sub use_as_template { my $form = $main::form; my %myconfig = %main::myconfig; - map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); + map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); $form->{paidaccounts} = 1; $form->{rowcount}--; $form->{invdate} = $form->current_date(\%myconfig); @@ -1260,7 +1331,7 @@ sub search { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; my ($customer, $department); my ($jsscript, $button1, $button2, $onload); @@ -1275,16 +1346,13 @@ sub search { $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->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); $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 }); @@ -1324,7 +1392,6 @@ sub ar_transactions { my ($callback, $href, @columns); - $form->{customer} = $form->unescape($form->{customer}); ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer}); report_generator_set_default_sort('transdate', 1); @@ -1341,7 +1408,7 @@ sub ar_transactions { marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype); my @hidden_variables = map { "l_${_}" } @columns; - push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto); + push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto employee_id salesman_id business_id); $href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables); @@ -1365,7 +1432,7 @@ sub ar_transactions { 'employee' => { 'text' => $locale->text('Employee'), }, 'shippingpoint' => { 'text' => $locale->text('Shipping Point'), }, 'shipvia' => { 'text' => $locale->text('Ship via'), }, - 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), }, + 'globalprojectnumber' => { 'text' => $locale->text('Document Project Number'), }, 'marge_total' => { 'text' => $locale->text('Ertrag'), }, 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), }, 'customernumber' => { 'text' => $locale->text('Customer Number'), }, @@ -1426,6 +1493,14 @@ sub ar_transactions { if ($form->{open}) { push @options, $locale->text('Open'); } + if ($form->{employee_id}) { + my $employee = SL::DB::Employee->new(id => $form->{employee_id})->load; + push @options, $locale->text('Employee') . ' : ' . $employee->name; + } + if ($form->{salesman_id}) { + my $salesman = SL::DB::Employee->new(id => $form->{salesman_id})->load; + push @options, $locale->text('Salesman') . ' : ' . $salesman->name; + } if ($form->{closed}) { push @options, $locale->text('Closed'); }