X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=6ff99978453acc03e40ff4ae863face873e03087;hb=95155b0d6ddca4b62319edce20397a3ceebac346;hp=d8eb1a2177a1a112cdddeb492ae960ac67e4d187;hpb=c046c42244acda83029d00cb06ff636063765fb2;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index d8eb1a217..6ff999784 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1646,7 +1646,7 @@ sub list_buchungsgruppe { $column_data{up} = qq|| . qq|| . - qq|| . $locale->text(| . + qq|| . $locale->text(| . qq||; } else { $column_data{up} = qq| |; @@ -1659,7 +1659,7 @@ sub list_buchungsgruppe { $column_data{down} = qq|| . qq|| . - qq|| . $locale->text(| . + qq|| . $locale->text(| . qq||; } @@ -2092,7 +2092,6 @@ sub delete_printer { $lxdebug->leave_sub(); } - sub add_payment { $lxdebug->enter_sub(); @@ -2214,7 +2213,7 @@ sub list_payment { $column_data{up} = qq|| . qq|| . - qq|| . $locale->text(| . + qq|| . $locale->text(| . qq||; } else { $column_data{up} = qq| |; @@ -2227,7 +2226,7 @@ sub list_payment { $column_data{down} = qq|| . qq|| . - qq|| . $locale->text(| . + qq|| . $locale->text(| . qq||; } @@ -3203,6 +3202,100 @@ sub save_unit { $lxdebug->leave_sub(); } +sub show_history_search { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text("History Search"); + $form->header(); + + print $form->parse_html_template("/common/search_history"); + + $lxdebug->leave_sub(); +} + +sub show_am_history { + $lxdebug->enter_sub(); + my %search = ( "Artikelnummer" => "parts", + "Kundennummer" => "customer", + "Lieferantennummer" => "vendor", + "Projektnummer" => "project", + "Buchungsnummer" => "oe", + "Eingangsrechnungnummer" => "ap", + "Ausgangsrechnungnummer" => "ar" + ); + my %searchNo = ( "Artikelnummer" => "partnumber", + "Kundennummer" => "customernumber", + "Lieferantennummer" => "vendornumber", + "Projektnummer" => "projectnummer", + "Buchungsnummer" => "ordnumber", + "Eingangsrechnungnummer" => "invnumber", + "Ausgangsrechnungnummer" => "invnumber" + ); + + my $restriction; + my $tempNo = 0; + foreach(split(/\,/, $form->{einschraenkungen})) { + if($tempNo == 0) { + $restriction .= " AND addition = '" . $_ . "'"; + $tempNo = 1; + } + else { + $restriction .= " OR addition = '" . $_ . "'"; + } + } + + $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "") + ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'| + : (($form->{transdate} ne "" && $form->{reqdate} eq "") + ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'| + : ($form->{transdate} eq "" && $form->{reqdate} ne "") + ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'| + : "" + ) + ); + + my $dbh = $form->dbconnect(\%myconfig); + + $restriction .= ($form->{mitarbeiter} eq "" ? "" + : ($form->{mitarbeiter} =~ /^[0-9]*$/ + ? " AND employee_id = " . $form->{mitarbeiter} + : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh))); + + my $query = qq|SELECT id FROM $search{$form->{what2search}} + WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}' + |; + + my $sth = $dbh->prepare($query); + + $sth->execute() || $form->dberror($query); + + $form->{title} = $locale->text("History Search"); + $form->header(); + + while(my $hash_ref = $sth->fetchrow_hashref()){ + print $form->parse_html_template("/common/show_history", + {"DATEN" => $form->get_history($dbh,$hash_ref->{id},$restriction), + "SUCCESS" => ($form->get_history($dbh,$hash_ref->{id},$restriction) != 0), + "NONEWWINDOW" => "1" + } + ); + } + $dbh->disconnect(); + + $lxdebug->leave_sub(); +} + +sub get_employee_id { + $lxdebug->enter_sub(); + my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|; + my $sth = $_[1]->prepare($query); + $sth->execute() || $form->dberror($query); + my $return = $sth->fetch(); + $sth->finish(); + return ${$return}[0]; + $lxdebug->leave_sub(); +} + sub swap_units { $lxdebug->enter_sub();