X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=8a04ac5172b3c662131c41a773738de95a551ebf;hb=edc3ebb407771b5538e6938a417605ccc90e3aa1;hp=8efd498facf17845c5b29dfe251c07676619e99f;hpb=ee9f9f9aa4c3b9d5d20ab10a45c12bcaa6aa78d0;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 8efd498fa..8a04ac517 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -95,7 +95,7 @@ sub add { # /saving the history $form->{title} = "Add"; - $form->{callback} = "ar.pl?action=add" unless $form->{callback}; + $form->{callback} = "ar.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback}; AR->get_transdate(\%myconfig, $form); $form->{initial_transdate} = $form->{transdate}; @@ -271,17 +271,9 @@ sub form_header { $form->{exchangerate} = $form->{forex} if $form->{forex}; # format amounts - $form->{exchangerate} = - $form->format_amount(\%myconfig, $form->{exchangerate}); - - if ($form->{exchangerate} == 0) { - $form->{exchangerate} = ""; - } - - $form->{creditlimit} = - $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); - $form->{creditremaining} = - $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); + $form->{exchangerate} = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : ''; + $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); + $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); $exchangerate = qq| {forex}> @@ -444,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|')|; @@ -531,6 +529,10 @@ sub form_header { | . $locale->text('Due Date') . qq| $button2 + + | . $locale->text('Project Number') . qq| + $globalprojectnumber + @@ -982,10 +984,14 @@ sub update { $form->{invdate} = $form->{transdate}; - my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1); + my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1 oldcustomer); &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}; + $form->{AR} = $saved_variables{AR}; if ($saved_variables{AR_amount_1} =~ m/.--./) { map { $form->{$_} = $saved_variables{$_} } qw(AR_amount_1 taxchart_1); @@ -1275,13 +1281,20 @@ sub search { $form->{title} = $locale->text('AR Transactions'); $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 }); @@ -1321,7 +1334,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); @@ -1335,10 +1347,10 @@ 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 customernumber country ustid taxzone payment_terms charts); + 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); @@ -1362,7 +1374,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'), }, @@ -1371,6 +1383,7 @@ sub ar_transactions { 'taxzone' => { 'text' => $locale->text('Steuersatz'), }, 'payment_terms' => { 'text' => $locale->text('Payment Terms'), }, 'charts' => { 'text' => $locale->text('Buchungskonto'), }, + 'customertype' => { 'text' => $locale->text('Customer type'), }, ); foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia transaction_description)) { @@ -1422,6 +1435,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'); } @@ -1433,6 +1454,7 @@ sub ar_transactions { 'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}";