Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 049677eb

Von Jan Büren vor fast 7 Jahren hinzugefügt

  • ID 049677eb435b63595b0ffb748f26618fc7f6f479
  • Vorgänger dafa4bed
  • Nachfolger 26952628

Kontoauszug verbuchen -> Buchung erstellen erweitert

a) Filter erweitert, um nach Vorlagenname zu suchen
b) Filter korrekt in <form> gepackt, um submit und reset form
wie gewohnt zu unterstützen
c) Buchungsmöglichkeit um gl_transactions (Dialogbuchungsvorlagen)
erweitert, dass heißt in der Auswahlliste der Vorlagen werden
jetzt Dialogbuchungsvorlagen angezeigt, falls ein Buchungskonto
mit dem aktuellem Bankkonto übereinstimmt:
(bank_accounts.chart_id == record_template_items.chart_id)
d) Filter erweitert, um nach Referenz (nur in gl_transactions)
zu suchen
e) gl.pl erweitert, sodass die Metadaten der Vorlage geladen werden
und mit den sinnvollen Vorgaben aus bank_transactions gefüllt werden

Unterschiede anzeigen:

SL/Controller/BankTransaction.pm
263 263
  my $vendor_of_transaction = SL::DB::Manager::Vendor->find_by(iban => $self->transaction->{remote_account_number});
264 264
  my $use_vendor_filter     = $self->transaction->{remote_account_number} && $vendor_of_transaction;
265 265

  
266
  my $templates             = SL::DB::Manager::RecordTemplate->get_all(
266
  my $templates_ap = SL::DB::Manager::RecordTemplate->get_all(
267 267
    where        => [ template_type => 'ap_transaction' ],
268 268
    with_objects => [ qw(employee vendor) ],
269 269
  );
270
  my $templates_gl = SL::DB::Manager::RecordTemplate->get_all(
271
    query        => [ template_type => 'gl_transaction',
272
                      chart_id      => SL::DB::Manager::BankAccount->find_by(id => $self->transaction->local_bank_account_id)->chart_id,
273
                    ],
274
    with_objects => [ qw(employee record_template_items) ],
275
  );
270 276

  
271
  #Filter templates
272
  $templates = [ grep { $_->vendor_id == $vendor_of_transaction->id } @{ $templates } ] if $use_vendor_filter;
277
  # pre filter templates_ap, if we have a vendor match (IBAN eq IBAN) - show and allow user to edit this via gui!
278
  $templates_ap = [ grep { $_->vendor_id == $vendor_of_transaction->id } @{ $templates_ap } ] if $use_vendor_filter;
273 279

  
274 280
  $self->callback($self->url_for(
275 281
    action                => 'list',
......
281 287
  $self->render(
282 288
    'bank_transactions/create_invoice',
283 289
    { layout => 0 },
284
    title       => t8('Create invoice'),
285
    TEMPLATES   => $templates,
286
    vendor_name => $use_vendor_filter ? $vendor_of_transaction->name : undef,
290
    title        => t8('Create invoice'),
291
    TEMPLATES_GL => $use_vendor_filter ? undef : $templates_gl,
292
    TEMPLATES_AP => $templates_ap,
293
    vendor_name  => $use_vendor_filter ? $vendor_of_transaction->name : undef,
287 294
  );
288 295
}
289 296

  
......
319 326
  $self->{transaction}      = SL::DB::Manager::BankTransaction->find_by(id => $::form->{bt_id});
320 327

  
321 328
  my @filter;
322
  push @filter, ('vendor.name' => { ilike => '%' . $::form->{vendor} . '%' }) if $::form->{vendor};
329
  push @filter, ('vendor.name'   => { ilike => '%' . $::form->{vendor} . '%' })    if $::form->{vendor};
330
  push @filter, ('template_name' => { ilike => '%' . $::form->{template} . '%' })  if $::form->{template};
331
  push @filter, ('reference'     => { ilike => '%' . $::form->{reference} . '%' }) if $::form->{reference};
323 332

  
324
  my $templates = SL::DB::Manager::RecordTemplate->get_all(
325
    where        => [ template_type => 'ap_transaction', (or => \@filter) x !!@filter ],
333
  my $templates_ap = SL::DB::Manager::RecordTemplate->get_all(
334
    where        => [ template_type => 'ap_transaction', (and => \@filter) x !!@filter ],
326 335
    with_objects => [ qw(employee vendor) ],
327 336
  );
337
  my $templates_gl = SL::DB::Manager::RecordTemplate->get_all(
338
    query        => [ template_type => 'gl_transaction',
339
                      chart_id      => SL::DB::Manager::BankAccount->find_by(id => $self->transaction->local_bank_account_id)->chart_id,
340
                      (and => \@filter) x !!@filter
341
                    ],
342
    with_objects => [ qw(employee record_template_items) ],
343
  );
328 344

  
329 345
  $::form->{filter} //= {};
330 346

  
......
338 354
  my $output  = $self->render(
339 355
    'bank_transactions/_template_list',
340 356
    { output => 0 },
341
    TEMPLATES => $templates,
357
    TEMPLATES_AP => $templates_ap,
358
    TEMPLATES_GL => $templates_gl,
342 359
  );
343 360

  
344 361
  $self->render(\to_json({ html => $output }), { type => 'json', process => 0 });
......
864 881
  );
865 882
}
866 883

  
884
sub load_gl_record_template_url {
885
  my ($self, $template) = @_;
886

  
887
  return $self->url_for(
888
    controller                           => 'gl.pl',
889
    action                               => 'load_record_template',
890
    id                                   => $template->id,
891
    'form_defaults.amount_1'             => -1 * $self->transaction->amount,
892
    'form_defaults.transdate'            => $self->transaction->transdate_as_date,
893
    'form_defaults.callback'             => $self->callback,
894
  );
895
}
896

  
867 897
sub setup_search_action_bar {
868 898
  my ($self, %params) = @_;
869 899

  
bin/mozilla/gl.pl
49 49
use SL::Webdav;
50 50
use SL::Locale::String qw(t8);
51 51
use SL::Helper::GlAttachments qw(count_gl_attachments);
52

  
52
use Carp;
53 53
require "bin/mozilla/common.pl";
54 54
require "bin/mozilla/reportgenerator.pl";
55 55

  
......
94 94
  die "invalid template type" unless $template->template_type eq 'gl_transaction';
95 95

  
96 96
  $template->substitute_variables;
97

  
97
  my $payment_suggestion =  $::form->{form_defaults}->{amount_1};
98
  # croak ("hier" . $payment_suggestion);
98 99
  # Clean the current $::form before rebuilding it from the template.
99 100
  my $form_defaults = delete $::form->{form_defaults};
100 101
  delete @{ $::form }{ grep { !m{^(?:script|login)$}i } keys %{ $::form } };
......
133 134

  
134 135
    $::form->{"accno_id_${row}"}          = $item->chart_id;
135 136
    $::form->{"previous_accno_id_${row}"} = $item->chart_id;
136
    $::form->{"debit_${row}"}             = $::form->format_amount(\%::myconfig, $item->amount1, 2) if $item->amount1 * 1;
137
    $::form->{"credit_${row}"}            = $::form->format_amount(\%::myconfig, $item->amount2, 2) if $item->amount2 * 1;
137
    $::form->{"debit_${row}"}             = $::form->format_amount(\%::myconfig, ($payment_suggestion ? $payment_suggestion : $item->amount1), 2) if $item->amount1 * 1;
138
    $::form->{"credit_${row}"}            = $::form->format_amount(\%::myconfig, ($payment_suggestion ? $payment_suggestion : $item->amount2), 2) if $item->amount2 * 1;
138 139
    $::form->{"taxchart_${row}"}          = $item->tax_id . '--' . $tax->rate;
139 140
    $::form->{"${_}_${row}"}              = $item->$_ for qw(source memo project_id);
140 141
  }
......
1317 1318

  
1318 1319
    $form->error($err[$errno]);
1319 1320
  }
1320
  undef($form->{callback});
1321 1321
  # saving the history
1322 1322
  if(!exists $form->{addition} && $form->{id} ne "") {
1323 1323
    $form->{snumbers} = qq|gltransaction_| . $form->{id};
......
1327 1327
  }
1328 1328
  # /saving the history
1329 1329

  
1330
  if ($form->{callback} =~ /BankTransaction/) {
1331
    print $form->redirect_header($form->{callback});
1332
    $form->redirect($locale->text('GL transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id});
1333
  }
1334
  # remove or clarify
1335
  undef($form->{callback});
1330 1336
  $main::lxdebug->leave_sub();
1331 1337
}
1332 1338

  
locale/de/all
73 73
  'AP Transaction Storno (one letter abbreviation)' => 'S',
74 74
  'AP Transaction with Storno (abbreviation)' => 'K(S)',
75 75
  'AP Transactions'             => 'Kreditorenbuchungen',
76
  'AP template suggestions'     => 'Vorschlag Kreditorenbuchung',
76 77
  'AP transaction posted.'      => 'Kreditorenbuchung verbucht.',
77 78
  'AP transactions changeable'  => 'Änderbarkeit von Kreditorenbuchungen',
78 79
  'AP transactions with sales taxkeys and/or AR transactions with input taxkeys' => 'Kreditorenbuchungen mit Umsatzsteuer-Steuerschlüsseln und/oder Debitorenbuchungen mit Vorsteuer-Steuerschlüsseln',
......
1343 1344
  'Filter for customer variables' => 'Filter für benutzerdefinierte Kundenvariablen',
1344 1345
  'Filter for item variables'   => 'Filter für benutzerdefinierte Artikelvariablen',
1345 1346
  'Filter parts'                => 'Artikel filtern',
1346
  'Filter vendors'              => 'Lieferanten filtern',
1347 1347
  'Financial Controlling'       => 'Finanzcontrolling',
1348 1348
  'Financial Controlling Report' => 'Finanzcontrollingbericht',
1349 1349
  'Financial Overview'          => 'Finanzübersicht',
......
1404 1404
  'GL Transaction (abbreviation)' => 'DB',
1405 1405
  'GL Transactions'             => 'Dialogbuchungen',
1406 1406
  'GL search'                   => 'FiBu Suche',
1407
  'GL template suggestions'     => 'Vorschlag Dialogbuchung',
1407 1408
  'GL transactions changeable'  => 'Änderbarkeit von Dialogbuchungen',
1408 1409
  'GLN'                         => 'GLN',
1409 1410
  'Gegenkonto'                  => 'Gegenkonto',
......
1856 1857
  'No'                          => 'Nein',
1857 1858
  'No %s was found matching the search parameters.' => 'Es wurde kein %s gefunden, auf den die Suchparameter zutreffen.',
1858 1859
  'No 1:n or n:1 relation'      => 'Keine 1:n oder n:1 Beziehung',
1860
  'No AP template was found.'   => 'Keine Kreditorenbuchungsvorlage gefunden.',
1859 1861
  'No Company Address given'    => 'Keine Firmenadresse hinterlegt!',
1860 1862
  'No Company Name given'       => 'Kein Firmenname hinterlegt!',
1861 1863
  'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
1864
  'No GL template was found.'   => 'Keine Dialogbuchungsvorlage gefunden.',
1862 1865
  'No Journal'                  => 'Kein Journal',
1863 1866
  'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
1864 1867
  'No action defined.'          => 'Keine Aktion definiert.',
......
1914 1917
  'No such job #1 in the database.' => 'Hintergrund-Job #1 existiert nicht mehr.',
1915 1918
  'No summary account'          => 'Kein Sammelkonto',
1916 1919
  'No template has been selected yet.' => 'Es wurde noch keine Vorlage ausgewählt.',
1917
  'No template was found.'      => 'Es wurde keine Vorlage gefunden.',
1918 1920
  'No text blocks have been created for this position.' => 'Für diese Position wurden noch keine Textblöcke angelegt.',
1919 1921
  'No text has been entered yet.' => 'Es wurde noch kein Text eingegeben.',
1920 1922
  'No title yet'                => 'Bisher ohne Titel',
......
2388 2390
  'Reference'                   => 'Referenz',
2389 2391
  'Reference / Invoice Number'  => 'Referenz / Rechnungsnummer',
2390 2392
  'Reference day'               => 'Referenztag',
2393
  'Reference filter for transaction templates' => 'Dialogbuchungs-Referenz',
2391 2394
  'Reference missing!'          => 'Referenz fehlt!',
2392 2395
  'Release From Stock'          => 'Lagerausgang',
2393 2396
  'Remaining'                   => 'Rest',
......
2881 2884
  'Telephone'                   => 'Telefon',
2882 2885
  'Template'                    => 'Druckvorlage',
2883 2886
  'Template Code'               => 'Vorlagenkürzel',
2887
  'Template Description'        => 'Name der Vorlage',
2884 2888
  'Template database'           => 'Datenbankvorlage',
2885 2889
  'Template date'               => 'Vorlagendatum',
2886
  'Template suggestions'        => 'Vorschläge für Vorlagen',
2887 2890
  'Templates'                   => 'Vorlagen',
2888 2891
  'Terms missing in row '       => '+Tage fehlen in Zeile ',
2889 2892
  'Test database connectivity'  => 'Datenbankverbindung testen',
templates/webpages/bank_transactions/_template_list.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE P -%][% IF TEMPLATES.size %]
2
 [% LxERP.t8('Template suggestions') %]:
1
[%- USE HTML -%][%- USE LxERP -%][%- USE P -%]
2

  
3
[% IF TEMPLATES_AP.size %]
4
 [% LxERP.t8('AP template suggestions') %]:
3 5
 <table>
4 6
  <thead>
5 7
   <tr>
......
11 13
  </thead>
12 14

  
13 15
  <tbody>
14
   [% FOREACH template = TEMPLATES %]
16
   [% FOREACH template = TEMPLATES_AP %]
15 17
    <tr class="listrow">
16 18
     <td>[% P.link(SELF.load_ap_record_template_url(template), template.template_name) %]</td>
17 19
     <td>[% HTML.escape(template.vendor.name) %]</td>
......
22 24
  </tbody>
23 25
 </table>
24 26
[% ELSE %]
25
 <p class="message_hint">[% LxERP.t8('No template was found.') %]</p>
27
 <p class="message_hint">[% LxERP.t8('No AP template was found.') %]</p>
28
[% END %]
29

  
30
[% IF TEMPLATES_GL.size %]
31
 [% LxERP.t8('GL template suggestions') %]:
32
 <table>
33
  <thead>
34
   <tr>
35
    <th class="listheading">[% LxERP.t8('Description') %]</th>
36
    <th class="listheading">[% LxERP.t8('Reference') %]</th>
37
    <th class="listheading">[% LxERP.t8('Employee') %]</th>
38
    <th class="listheading">[% LxERP.t8('Template date') %]</th>
39
   </tr>
40
  </thead>
41

  
42
  <tbody>
43
   [% FOREACH template = TEMPLATES_GL %]
44
    <tr class="listrow">
45
     <td>[% P.link(SELF.load_gl_record_template_url(template), template.template_name) %]</td>
46
     <td>[% HTML.escape(template.reference) %]</td>
47
     <td>[% HTML.escape(template.employee.name || template.employee.login) %]</td>
48
     <td>[% HTML.escape(template.itime_as_date) %]</td>
49
    </tr>
50
   [% END %]
51
  </tbody>
52
 </table>
53
[% ELSE %]
54
 <p class="message_hint">[% LxERP.t8('No GL template was found.') %]</p>
26 55
[% END %]
templates/webpages/bank_transactions/create_invoice.html
25 25

  
26 26

  
27 27
<br>
28
[% LxERP.t8('Vendor filter for AP transaction templates') %]:
29 28

  
30
<form method="post" action="javascript:kivi.BankTransaction.filter_templates()">
29
<form method="post" action="javascript:kivi.BankTransaction.filter_templates()" id="create_invoice_window_form">
31 30
 [% L.hidden_tag("bt_id",               SELF.transaction.id) %]
32 31
 [% L.hidden_tag("filter.bank_account", FORM.filter.bank_account) %]
33 32
 [% L.hidden_tag("filter.fromdate",     FORM.filter.fromdate) %]
34 33
 [% L.hidden_tag("filter.todate",      FORM.filter.todate) %]
35 34
 <table>
35
  <tr>
36
   <th align="right">[%- LxERP.t8("Template Description") %]</th>
37
   <td>[% P.input_tag("template", template_name, style="width: 250px") %]</td>
38
  </tr>
36 39
  <tr>
37 40
   <th align="right">[%- LxERP.t8("Vendor") %]</th>
38
   <td>[% P.input_tag("vendor", vendor_name, class="initial_focus", style="width: 250px") %]</td>
41
   <td>[% P.input_tag("vendor", vendor_name,  style="width: 250px") %]</td>
42
  </tr>
43
  <tr>
44
   <th align="right">[%- LxERP.t8("Reference") %]</th>
45
   <td>[% P.input_tag("reference", reference_name, style="width: 250px") %]</td>
39 46
  </tr>
40 47
 </table>
41
</form>
42

  
43 48
  <p>
44
   [% P.button_tag("kivi.BankTransaction.filter_templates()", LxERP.t8("Filter vendors")) %]
49
   [% P.submit_tag('', LxERP.t8("Filter")) %]
50
   [% P.button_tag('$("#create_invoice_window_form").resetForm()', LxERP.t8('Reset')) %]
45 51
   <a href="#" onclick="$('#create_invoice_window').dialog('close');">[% LxERP.t8("Cancel") %]</a>
46 52
  </p>
47

  
53
</form>
48 54
  <hr>
49 55
<div id="templates">
50 56
 [% PROCESS "bank_transactions/_template_list.html" %]
51 57
</div>
58

  
59
<script type="text/javascript">
60
<!--
61
$(function() {
62
  $('#template').focus();
63
});
64

  
65
//-->
66
</script>

Auch abrufbar als: Unified diff