--- /dev/null
+package SL::Controller::GL;
+
+use strict;
+use parent qw(SL::Controller::Base);
+
+use SL::DB::GLTransaction;
+use SL::DB::Invoice;
+use SL::DB::PurchaseInvoice;
+use SL::DB::AccTransaction;
+use SL::Locale::String qw(t8);
+
+__PACKAGE__->run_before('check_auth');
+
+sub action_quicksearch {
+
+ my ($self, %params) = @_;
+
+ my $limit = $::form->{limit} || 40; # max number of results per type (AR/AP/GL)
+ my $term = $::form->{term} || '';
+
+ my $descriptionquery = { ilike => '%' . $term . '%' };
+ my $referencequery = { ilike => '%' . $term . '%' };
+ my $apinvnumberquery = { ilike => '%' . $term . '%' };
+ my $namequery = { ilike => '%' . $term . '%' };
+ my $arinvnumberquery = { ilike => '%' . $term };
+ # ar match is more restrictive. Left fuzzy beginning so it also matches "Storno zu $INVNUMBER"
+ # and numbers like 000123 if you only enter 123.
+ # When used in quicksearch short numbers like 1 or 11 won't match because of the
+ # ajax autocomplete minlimit of 3 characters
+
+ my (@glfilter, @arfilter, @apfilter);
+
+ push( @glfilter, (or => [ description => $descriptionquery, reference => $referencequery ] ) );
+ push( @arfilter, (or => [ invnumber => $arinvnumberquery, name => $namequery ] ) );
+ push( @apfilter, (or => [ invnumber => $apinvnumberquery, name => $namequery ] ) );
+
+ my $gls = SL::DB::Manager::GLTransaction->get_all( query => [ @glfilter ], limit => $limit, sort_by => 'transdate DESC');
+ my $ars = SL::DB::Manager::Invoice->get_all( query => [ @arfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'customer' ]);
+ my $aps = SL::DB::Manager::PurchaseInvoice->get_all(query => [ @apfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'vendor' ]);
+
+ # calculate an amount to be displayed for gl transaction
+ foreach my $gl ( @$gls ) {
+ my $amount = 0;
+ my $acc_trans_lines = SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $gl->id ]);
+ foreach my $acc_trans_line ( @$acc_trans_lines ) {
+ $amount += $acc_trans_line->amount if $acc_trans_line->amount > 0 ;
+ };
+ $gl->{'amount'} = $amount;
+ };
+
+ my $gldata = [
+ map(
+ {
+ {
+ transdate => DateTime->from_object(object => $_->transdate)->ymd(),
+ label => $_->abbreviation. ": " . $_->description . " " . $_->reference . " " . $::form->format_amount(\%::myconfig, $_->{'amount'},2). " (" . $_->transdate->to_lxoffice . ")" ,
+ value => '',
+ url => 'gl.pl?action=edit&id=' . $_->id,
+ }
+ }
+ @{$gls}
+ ),
+ ];
+
+ my $ardata = [
+ map(
+ {
+ {
+ transdate => DateTime->from_object(object => $_->transdate)->ymd(),
+ label => $_->abbreviation . ": " . $_->invnumber . " " . $_->customer->name . " " . $::form->format_amount(\%::myconfig, $_->amount,2) . " (" . $_->transdate->to_lxoffice . ")" ,
+ value => "",
+ url => ($_->invoice ? "is" : "ar" ) . '.pl?action=edit&id=' . $_->id,
+ }
+ }
+ @{$ars}
+ ),
+ ];
+
+ my $apdata = [
+ map(
+ {
+ {
+ transdate => DateTime->from_object(object => $_->transdate)->ymd(),
+ label => $_->abbreviation . ": " . $_->invnumber . " " . $_->vendor->name . " " . $::form->format_amount(\%::myconfig, $_->amount,2) . " (" . $_->transdate->to_lxoffice . ")" ,
+ value => "",
+ url => ($_->invoice ? "ir" : "ap" ) . '.pl?action=edit&id=' . $_->id,
+ }
+ }
+ @{$aps}
+ ),
+ ];
+
+ my $data;
+ push(@{$data},@{$gldata});
+ push(@{$data},@{$ardata});
+ push(@{$data},@{$apdata});
+
+ @$data = reverse sort { $a->{'transdate_sort'} cmp $b->{'transdate_sort'} } @$data;
+
+ $self->render(\SL::JSON::to_json($data), { layout => 0, type => 'json' });
+}
+
+sub check_auth {
+ $::auth->assert('general_ledger');
+}
+
+1;
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;
+sub abbreviation {
+ my $self = shift;
+
+ my $abbreviation = $::locale->text('GL Transaction (abbreviation)');
+ $abbreviation .= "(" . $::locale->text('Storno (one letter abbreviation)') . ")" if $self->storno;
+ return $abbreviation;
+
+}
+
1;
use SL::DB::Helper::PriceTaxCalculator;
use SL::DB::Helper::PriceUpdater;
use SL::DB::Helper::TransNumberGenerator;
+use SL::Locale::String qw(t8);
__PACKAGE__->meta->add_relationship(
invoiceitems => {
return $self->closed ? $::locale->text('closed') : $::locale->text('open');
}
+sub abbreviation {
+ my $self = shift;
+
+ return t8('AR Transaction (abbreviation)') if !$self->invoice;
+ return t8('Credit note (one letter abbreviation)') if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno;
+ return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno;
+ return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno;
+ return t8('Invoice (one letter abbreviation)');
+
+}
+
sub date {
goto &transdate;
}
use SL::DB::MetaSetup::PurchaseInvoice;
use SL::DB::Manager::PurchaseInvoice;
use SL::DB::Helper::LinkedRecords;
+use SL::Locale::String qw(t8);
+
# The calculator hasn't been adjusted for purchase invoices yet.
# use SL::DB::Helper::PriceTaxCalculator;
goto &transdate;
}
+sub abbreviation {
+ my $self = shift;
+
+ return t8('AP Transaction (abbreviation)') if !$self->invoice && !$self->storno;
+ return t8('AP Transaction (abbreviation)') . '(' . t8('Storno (one letter abbreviation)') . ')' if !$self->invoice && $self->storno;
+ return t8('Invoice (one letter abbreviation)'). '(' . t8('Storno (one letter abbreviation)') . ')' if $self->storno;
+ return t8('Invoice (one letter abbreviation)');
+
+}
1;
- Verkaufsangebotsgültigkeit konfigurierbar per Intervall (nächster Werktag + x Tage)
- Schnelllöschen von einzelnen Positionen (Ein X vor jeder Zeile)
+
+- FiBu Schnellsuche in Headerzeile, um nach Belegen zu suchen
+
2014-02-28 - Release 3.1.0
Größere neue Features:
--- /dev/null
+$(function() {
+ $( "#glquicksearch" ).autocomplete({
+ source: "controller.pl?action=GL/quicksearch",
+ minLength: 3,
+ select: function(event, ui) {
+ var url = ui.item.url;
+ if(url != '#') {
+ location.href = url;
+ }
+ },
+ html: false,
+ autoFocus: true
+ });
+});
'Function/position' => 'Funktion/Position',
'Fwd' => 'Vorwärts',
'GL Transaction' => 'Dialogbuchung',
+ 'GL Transaction (abbreviation)' => 'DB',
+ 'GL search' => 'FiBu Suche',
'GL transactions changeable' => 'Änderbarkeit von Dialogbuchungen',
'Gegenkonto' => 'Gegenkonto',
'Gender' => 'Geschlecht',
[<a href="JavaScript:top.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>]
[<a href="Javascript:top.history.back();" title="[% 'Go one step back' | $T8 %]">[% 'Back' | $T8 %]</a>]
[<a href="Javascript:top.history.forward();" title="[% 'Go one step forward' | $T8 %]">[% 'Fwd' | $T8 %]</a>]
+[%- IF AUTH.assert('general_ledger', 1) %]
+ [[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">]
+[%- END %]
</span>
[%- END %]
<span class="frame-header-element frame-header-right">
<img src="image/[% IF MYCONFIG.stylesheet == 'lx-office-erp.css' %]spinner-blue.gif[% ELSE %]spinner-white.gif[% END %]" alt="[% LxERP.t8('Loading...') %]">
</span>
</div>
+[% IF AUTH.assert('general_ledger', 1) %]
+ <script type="text/javascript" src="js/glquicksearch.js"></script>
+[% END %]
<span class="frame-header-element frame-header-left">
[<a href="login.pl?action=company_logo" target="_blank">[% 'new Window' | $T8 %]</a>]
[<a href="JavaScript:top.print()">[% 'print' | $T8 %]</a>]
- [[% 'Search contacts' | $T8 %] <input size="15" name="search_term" id="search_term" onkeydown="return on_keydown_quicksearch($('#search_term'), event)">]
+[%- IF AUTH.assert('general_ledger', 1) %]
+ [[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">]
+[%- END %]
</span>
<span class="frame-header-element frame-header-right">
[[% 'User' | $T8 %]: [% MYCONFIG.login | html %] -
-->
</script>
+[% IF AUTH.assert('general_ledger', 1) %]
+ <script type="text/javascript" src="js/glquicksearch.js"></script>
+[% END %]
[<a href="login.pl?action=company_logo" target="_blank">[% 'new Window' | $T8 %]</a>]
[<a href="JavaScript:top.print()">[% 'print' | $T8 %]</a>]
[[% 'Search contacts' | $T8 %] <input size="15" name="search_term" id="search_term" onkeydown="return on_keydown_quicksearch($('#search_term'), event)">]
+[%- IF AUTH.assert('general_ledger', 1) %]
+ [[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">]
+[%- END %]
</span>
<span class="frame-header-element frame-header-right">
[[% 'User' | $T8 %]: [% MYCONFIG.login | html %] -
</div>
<div style="clear: both;"></div>
+[% IF AUTH.assert('general_ledger', 1) %]
+ <script type="text/javascript" src="js/glquicksearch.js"></script>
+[% END %]