Revision f6ed86ef
Von Kivitendo Admin vor fast 10 Jahren hinzugefügt
SL/Controller/GL.pm | ||
---|---|---|
1 |
package SL::Controller::GL; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::Base); |
|
5 |
|
|
6 |
use SL::DB::GLTransaction; |
|
7 |
use SL::DB::Invoice; |
|
8 |
use SL::DB::PurchaseInvoice; |
|
9 |
use SL::DB::AccTransaction; |
|
10 |
use SL::Locale::String qw(t8); |
|
11 |
|
|
12 |
__PACKAGE__->run_before('check_auth'); |
|
13 |
|
|
14 |
sub action_quicksearch { |
|
15 |
|
|
16 |
my ($self, %params) = @_; |
|
17 |
|
|
18 |
my $limit = $::form->{limit} || 40; # max number of results per type (AR/AP/GL) |
|
19 |
my $term = $::form->{term} || ''; |
|
20 |
|
|
21 |
my $descriptionquery = { ilike => '%' . $term . '%' }; |
|
22 |
my $referencequery = { ilike => '%' . $term . '%' }; |
|
23 |
my $apinvnumberquery = { ilike => '%' . $term . '%' }; |
|
24 |
my $namequery = { ilike => '%' . $term . '%' }; |
|
25 |
my $arinvnumberquery = { ilike => '%' . $term }; |
|
26 |
# ar match is more restrictive. Left fuzzy beginning so it also matches "Storno zu $INVNUMBER" |
|
27 |
# and numbers like 000123 if you only enter 123. |
|
28 |
# When used in quicksearch short numbers like 1 or 11 won't match because of the |
|
29 |
# ajax autocomplete minlimit of 3 characters |
|
30 |
|
|
31 |
my (@glfilter, @arfilter, @apfilter); |
|
32 |
|
|
33 |
push( @glfilter, (or => [ description => $descriptionquery, reference => $referencequery ] ) ); |
|
34 |
push( @arfilter, (or => [ invnumber => $arinvnumberquery, name => $namequery ] ) ); |
|
35 |
push( @apfilter, (or => [ invnumber => $apinvnumberquery, name => $namequery ] ) ); |
|
36 |
|
|
37 |
my $gls = SL::DB::Manager::GLTransaction->get_all( query => [ @glfilter ], limit => $limit, sort_by => 'transdate DESC'); |
|
38 |
my $ars = SL::DB::Manager::Invoice->get_all( query => [ @arfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'customer' ]); |
|
39 |
my $aps = SL::DB::Manager::PurchaseInvoice->get_all(query => [ @apfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'vendor' ]); |
|
40 |
|
|
41 |
# calculate an amount to be displayed for gl transaction |
|
42 |
foreach my $gl ( @$gls ) { |
|
43 |
my $amount = 0; |
|
44 |
my $acc_trans_lines = SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $gl->id ]); |
|
45 |
foreach my $acc_trans_line ( @$acc_trans_lines ) { |
|
46 |
$amount += $acc_trans_line->amount if $acc_trans_line->amount > 0 ; |
|
47 |
}; |
|
48 |
$gl->{'amount'} = $amount; |
|
49 |
}; |
|
50 |
|
|
51 |
my $gldata = [ |
|
52 |
map( |
|
53 |
{ |
|
54 |
{ |
|
55 |
transdate => DateTime->from_object(object => $_->transdate)->ymd(), |
|
56 |
label => $_->abbreviation. ": " . $_->description . " " . $_->reference . " " . $::form->format_amount(\%::myconfig, $_->{'amount'},2). " (" . $_->transdate->to_lxoffice . ")" , |
|
57 |
value => '', |
|
58 |
url => 'gl.pl?action=edit&id=' . $_->id, |
|
59 |
} |
|
60 |
} |
|
61 |
@{$gls} |
|
62 |
), |
|
63 |
]; |
|
64 |
|
|
65 |
my $ardata = [ |
|
66 |
map( |
|
67 |
{ |
|
68 |
{ |
|
69 |
transdate => DateTime->from_object(object => $_->transdate)->ymd(), |
|
70 |
label => $_->abbreviation . ": " . $_->invnumber . " " . $_->customer->name . " " . $::form->format_amount(\%::myconfig, $_->amount,2) . " (" . $_->transdate->to_lxoffice . ")" , |
|
71 |
value => "", |
|
72 |
url => ($_->invoice ? "is" : "ar" ) . '.pl?action=edit&id=' . $_->id, |
|
73 |
} |
|
74 |
} |
|
75 |
@{$ars} |
|
76 |
), |
|
77 |
]; |
|
78 |
|
|
79 |
my $apdata = [ |
|
80 |
map( |
|
81 |
{ |
|
82 |
{ |
|
83 |
transdate => DateTime->from_object(object => $_->transdate)->ymd(), |
|
84 |
label => $_->abbreviation . ": " . $_->invnumber . " " . $_->vendor->name . " " . $::form->format_amount(\%::myconfig, $_->amount,2) . " (" . $_->transdate->to_lxoffice . ")" , |
|
85 |
value => "", |
|
86 |
url => ($_->invoice ? "ir" : "ap" ) . '.pl?action=edit&id=' . $_->id, |
|
87 |
} |
|
88 |
} |
|
89 |
@{$aps} |
|
90 |
), |
|
91 |
]; |
|
92 |
|
|
93 |
my $data; |
|
94 |
push(@{$data},@{$gldata}); |
|
95 |
push(@{$data},@{$ardata}); |
|
96 |
push(@{$data},@{$apdata}); |
|
97 |
|
|
98 |
@$data = reverse sort { $a->{'transdate_sort'} cmp $b->{'transdate_sort'} } @$data; |
|
99 |
|
|
100 |
$self->render(\SL::JSON::to_json($data), { layout => 0, type => 'json' }); |
|
101 |
} |
|
102 |
|
|
103 |
sub check_auth { |
|
104 |
$::auth->assert('general_ledger'); |
|
105 |
} |
|
106 |
|
|
107 |
1; |
SL/DB/GLTransaction.pm | ||
---|---|---|
9 | 9 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
10 | 10 |
__PACKAGE__->meta->make_manager_class; |
11 | 11 |
|
12 |
sub abbreviation { |
|
13 |
my $self = shift; |
|
14 |
|
|
15 |
my $abbreviation = $::locale->text('GL Transaction (abbreviation)'); |
|
16 |
$abbreviation .= "(" . $::locale->text('Storno (one letter abbreviation)') . ")" if $self->storno; |
|
17 |
return $abbreviation; |
|
18 |
|
|
19 |
} |
|
20 |
|
|
12 | 21 |
1; |
SL/DB/Invoice.pm | ||
---|---|---|
17 | 17 |
use SL::DB::Helper::PriceTaxCalculator; |
18 | 18 |
use SL::DB::Helper::PriceUpdater; |
19 | 19 |
use SL::DB::Helper::TransNumberGenerator; |
20 |
use SL::Locale::String qw(t8); |
|
20 | 21 |
|
21 | 22 |
__PACKAGE__->meta->add_relationship( |
22 | 23 |
invoiceitems => { |
... | ... | |
317 | 318 |
return $self->closed ? $::locale->text('closed') : $::locale->text('open'); |
318 | 319 |
} |
319 | 320 |
|
321 |
sub abbreviation { |
|
322 |
my $self = shift; |
|
323 |
|
|
324 |
return t8('AR Transaction (abbreviation)') if !$self->invoice; |
|
325 |
return t8('Credit note (one letter abbreviation)') if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno; |
|
326 |
return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno; |
|
327 |
return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno; |
|
328 |
return t8('Invoice (one letter abbreviation)'); |
|
329 |
|
|
330 |
} |
|
331 |
|
|
320 | 332 |
sub date { |
321 | 333 |
goto &transdate; |
322 | 334 |
} |
SL/DB/PurchaseInvoice.pm | ||
---|---|---|
7 | 7 |
use SL::DB::MetaSetup::PurchaseInvoice; |
8 | 8 |
use SL::DB::Manager::PurchaseInvoice; |
9 | 9 |
use SL::DB::Helper::LinkedRecords; |
10 |
use SL::Locale::String qw(t8); |
|
11 |
|
|
10 | 12 |
# The calculator hasn't been adjusted for purchase invoices yet. |
11 | 13 |
# use SL::DB::Helper::PriceTaxCalculator; |
12 | 14 |
|
... | ... | |
52 | 54 |
goto &transdate; |
53 | 55 |
} |
54 | 56 |
|
57 |
sub abbreviation { |
|
58 |
my $self = shift; |
|
59 |
|
|
60 |
return t8('AP Transaction (abbreviation)') if !$self->invoice && !$self->storno; |
|
61 |
return t8('AP Transaction (abbreviation)') . '(' . t8('Storno (one letter abbreviation)') . ')' if !$self->invoice && $self->storno; |
|
62 |
return t8('Invoice (one letter abbreviation)'). '(' . t8('Storno (one letter abbreviation)') . ')' if $self->storno; |
|
63 |
return t8('Invoice (one letter abbreviation)'); |
|
64 |
|
|
65 |
} |
|
55 | 66 |
1; |
doc/changelog | ||
---|---|---|
77 | 77 |
- Verkaufsangebotsgültigkeit konfigurierbar per Intervall (nächster Werktag + x Tage) |
78 | 78 |
|
79 | 79 |
- Schnelllöschen von einzelnen Positionen (Ein X vor jeder Zeile) |
80 |
|
|
81 |
- FiBu Schnellsuche in Headerzeile, um nach Belegen zu suchen |
|
82 |
|
|
80 | 83 |
2014-02-28 - Release 3.1.0 |
81 | 84 |
|
82 | 85 |
Größere neue Features: |
js/glquicksearch.js | ||
---|---|---|
1 |
$(function() { |
|
2 |
$( "#glquicksearch" ).autocomplete({ |
|
3 |
source: "controller.pl?action=GL/quicksearch", |
|
4 |
minLength: 3, |
|
5 |
select: function(event, ui) { |
|
6 |
var url = ui.item.url; |
|
7 |
if(url != '#') { |
|
8 |
location.href = url; |
|
9 |
} |
|
10 |
}, |
|
11 |
html: false, |
|
12 |
autoFocus: true |
|
13 |
}); |
|
14 |
}); |
locale/de/all | ||
---|---|---|
1158 | 1158 |
'Function/position' => 'Funktion/Position', |
1159 | 1159 |
'Fwd' => 'Vorwärts', |
1160 | 1160 |
'GL Transaction' => 'Dialogbuchung', |
1161 |
'GL Transaction (abbreviation)' => 'DB', |
|
1162 |
'GL search' => 'FiBu Suche', |
|
1161 | 1163 |
'GL transactions changeable' => 'Änderbarkeit von Dialogbuchungen', |
1162 | 1164 |
'Gegenkonto' => 'Gegenkonto', |
1163 | 1165 |
'Gender' => 'Geschlecht', |
templates/webpages/menu/header.html | ||
---|---|---|
7 | 7 |
[<a href="JavaScript:top.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>] |
8 | 8 |
[<a href="Javascript:top.history.back();" title="[% 'Go one step back' | $T8 %]">[% 'Back' | $T8 %]</a>] |
9 | 9 |
[<a href="Javascript:top.history.forward();" title="[% 'Go one step forward' | $T8 %]">[% 'Fwd' | $T8 %]</a>] |
10 |
[%- IF AUTH.assert('general_ledger', 1) %] |
|
11 |
[[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">] |
|
12 |
[%- END %] |
|
10 | 13 |
</span> |
11 | 14 |
[%- END %] |
12 | 15 |
<span class="frame-header-element frame-header-right"> |
... | ... | |
20 | 23 |
<img src="image/[% IF MYCONFIG.stylesheet == 'lx-office-erp.css' %]spinner-blue.gif[% ELSE %]spinner-white.gif[% END %]" alt="[% LxERP.t8('Loading...') %]"> |
21 | 24 |
</span> |
22 | 25 |
</div> |
26 |
[% IF AUTH.assert('general_ledger', 1) %] |
|
27 |
<script type="text/javascript" src="js/glquicksearch.js"></script> |
|
28 |
[% END %] |
templates/webpages/menu/menunew.html | ||
---|---|---|
19 | 19 |
<span class="frame-header-element frame-header-left"> |
20 | 20 |
[<a href="login.pl?action=company_logo" target="_blank">[% 'new Window' | $T8 %]</a>] |
21 | 21 |
[<a href="JavaScript:top.print()">[% 'print' | $T8 %]</a>] |
22 |
[[% 'Search contacts' | $T8 %] <input size="15" name="search_term" id="search_term" onkeydown="return on_keydown_quicksearch($('#search_term'), event)">] |
|
22 |
[%- IF AUTH.assert('general_ledger', 1) %] |
|
23 |
[[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">] |
|
24 |
[%- END %] |
|
23 | 25 |
</span> |
24 | 26 |
<span class="frame-header-element frame-header-right"> |
25 | 27 |
[[% 'User' | $T8 %]: [% MYCONFIG.login | html %] - |
... | ... | |
98 | 100 |
|
99 | 101 |
--> |
100 | 102 |
</script> |
103 |
[% IF AUTH.assert('general_ledger', 1) %] |
|
104 |
<script type="text/javascript" src="js/glquicksearch.js"></script> |
|
105 |
[% END %] |
templates/webpages/menu/menuv3.html | ||
---|---|---|
20 | 20 |
[<a href="login.pl?action=company_logo" target="_blank">[% 'new Window' | $T8 %]</a>] |
21 | 21 |
[<a href="JavaScript:top.print()">[% 'print' | $T8 %]</a>] |
22 | 22 |
[[% 'Search contacts' | $T8 %] <input size="15" name="search_term" id="search_term" onkeydown="return on_keydown_quicksearch($('#search_term'), event)">] |
23 |
[%- IF AUTH.assert('general_ledger', 1) %] |
|
24 |
[[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">] |
|
25 |
[%- END %] |
|
23 | 26 |
</span> |
24 | 27 |
<span class="frame-header-element frame-header-right"> |
25 | 28 |
[[% 'User' | $T8 %]: [% MYCONFIG.login | html %] - |
... | ... | |
38 | 41 |
|
39 | 42 |
</div> |
40 | 43 |
<div style="clear: both;"></div> |
44 |
[% IF AUTH.assert('general_ledger', 1) %] |
|
45 |
<script type="text/javascript" src="js/glquicksearch.js"></script> |
|
46 |
[% END %] |
Auch abrufbar als: Unified diff
FiBu Schellsuche in Headerzeile
neues Ajax Autocompletefeld im Header für Benutzer mit FiBu-Rechten,
welches Rechnungsnummern und Kunden-/Lieferantennamen durchsucht. Durch
die Auswahl im Dropdown gelangt man direkt zu dem Beleg.