Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 67ae175a

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID 67ae175a8aef3e189d6b44c2e0261a8e0448e5b1
  • Vorgänger 6b1f644c
  • Nachfolger 0b33ef7a

Unterscheidung Bankeinzug/Überweisung in zweiter Maske (Bestätigung der Informationen)

Unterschiede anzeigen:

bin/mozilla/sepa.pl
58 58
  my $form          = $main::form;
59 59
  my $locale        = $main::locale;
60 60
  my $myconfig      = \%main::myconfig;
61
  my $vc            = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
61 62

  
62
  $form->{title}    = $locale->text('Create bank transfer via SEPA XML');
63
  $form->{title}    = $vc eq 'customer' ? $::locale->text('Create bank collection via SEPA XML') : $locale->text('Create bank transfer via SEPA XML');
63 64

  
64 65
  my $bank_accounts = SL::BankAccount->list();
65 66

  
......
73 74
    $form->error($locale->text('The selected bank account does not exist anymore.'));
74 75
  }
75 76

  
76
  my $invoices       = SL::SEPA->retrieve_open_invoices();
77
  my $arap_id        = $vc eq 'customer' ? 'ar_id' : 'ap_id';
78
  my $invoices       = SL::SEPA->retrieve_open_invoices(vc => $vc);
79

  
77 80
  my %invoices_map   = map { $_->{id} => $_ } @{ $invoices };
78 81
  my @bank_transfers =
79
    map  +{ %{ $invoices_map{ $_->{ap_id} } }, %{ $_ } },
80
    grep  { $_->{selected} && (0 < $_->{amount}) && $invoices_map{ $_->{ap_id} } }
82
    map  +{ %{ $invoices_map{ $_->{$arap_id} } }, %{ $_ } },
83
    grep  { $_->{selected} && (0 < $_->{amount}) && $invoices_map{ $_->{$arap_id} } }
81 84
    map   { $_->{amount} = $form->parse_amount($myconfig, $_->{amount}); $_ }
82 85
          @{ $form->{bank_transfers} || [] };
83 86

  
......
85 88
    $form->error($locale->text('You have selected none of the invoices.'));
86 89
  }
87 90

  
88
  my ($vendor_bank_info);
91
  my ($vc_bank_info);
89 92
  my $error_message;
90 93

  
91 94
  if ($form->{confirmation}) {
92
    $vendor_bank_info = { map { $_->{id} => $_ } @{ $form->{vendor_bank_info} || [] } };
95
    $vc_bank_info = { map { $_->{id} => $_ } @{ $form->{vc_bank_info} || [] } };
93 96

  
94
    foreach my $info (values %{ $vendor_bank_info }) {
97
    foreach my $info (values %{ $vc_bank_info }) {
95 98
      if (any { !$info->{$_} } qw(iban bic)) {
96 99
        $error_message = $locale->text('The bank information must not be empty.');
97 100
        last;
......
100 103
  }
101 104

  
102 105
  if ($error_message || !$form->{confirmation}) {
103
    my @vendor_ids             = uniq map { $_->{vendor_id} } @bank_transfers;
104
    $vendor_bank_info        ||= CT->get_bank_info('vc' => 'vendor',
105
                                                   'id' => \@vendor_ids);
106
    my @vendor_bank_info       = sort { lc $a->{name} cmp lc $b->{name} } values %{ $vendor_bank_info };
106
    my @vc_ids                 = uniq map { $_->{"${vc}_id"} } @bank_transfers;
107
    $vc_bank_info            ||= CT->get_bank_info('vc' => $vc,
108
                                                   'id' => \@vc_ids);
109
    my @vc_bank_info           = sort { lc $a->{name} cmp lc $b->{name} } values %{ $vc_bank_info };
107 110

  
108 111
    my $bank_account_label_sub = sub { $locale->text('Account number #1, bank code #2, #3', $_[0]->{account_number}, $_[0]->{bank_code}, $_[0]->{bank}) };
109 112

  
......
113 116
    print $form->parse_html_template('sepa/bank_transfer_create',
114 117
                                     { 'BANK_TRANSFERS'     => \@bank_transfers,
115 118
                                       'BANK_ACCOUNTS'      => $bank_accounts,
116
                                       'VENDOR_BANK_INFO'   => \@vendor_bank_info,
119
                                       'VC_BANK_INFO'       => \@vc_bank_info,
117 120
                                       'bank_account'       => $bank_account,
118 121
                                       'bank_account_label' => $bank_account_label_sub,
119 122
                                       'error_message'      => $error_message,
123
                                       'vc'                 => $vc,
120 124
                                     });
121 125

  
122 126
  } else {
123 127
    foreach my $bank_transfer (@bank_transfers) {
124 128
      foreach (qw(iban bic)) {
125
        $bank_transfer->{"vendor_${_}"} = $vendor_bank_info->{ $bank_transfer->{vendor_id} }->{$_};
126
        $bank_transfer->{"our_${_}"}    = $bank_account->{$_};
129
        $bank_transfer->{"vc_${_}"}  = $vc_bank_info->{ $bank_transfer->{vc_id} }->{$_};
130
        $bank_transfer->{"our_${_}"} = $bank_account->{$_};
127 131
      }
128 132

  
129 133
      $bank_transfer->{chart_id} = $bank_account->{chart_id};
130 134
    }
131 135

  
132 136
    my $id = SL::SEPA->create_export('employee'       => $form->{login},
133
                                     'bank_transfers' => \@bank_transfers);
137
                                     'bank_transfers' => \@bank_transfers,
138
                                     'vc'             => $vc);
134 139

  
135 140
    $form->header();
136
    print $form->parse_html_template('sepa/bank_transfer_created', { 'id' => $id });
141
    print $form->parse_html_template('sepa/bank_transfer_created', { 'id' => $id, 'vc' => $vc });
137 142
  }
138 143

  
139 144
  $main::lxdebug->leave_sub();
locale/de/all
243 243
  'Bank Connections'            => 'Bankverbindungen',
244 244
  'Bank accounts'               => 'Bankkonten',
245 245
  'Bank code'                   => 'Bankleitzahl',
246
  'Bank collection amount'      => 'Einzugsbetrag',
246 247
  'Bank collection via SEPA'    => 'Bankeinzug via SEPA',
247 248
  'Bank collections via SEPA'   => 'Bankeinz?ge via SEPA',
248 249
  'Bank transfer amount'        => '?berweisungssumme',
......
419 420
  'Create and edit sales orders' => 'Auftragsbest&auml;tigungen erfassen und bearbeiten',
420 421
  'Create and edit sales quotations' => 'Angebote erfassen und bearbeiten',
421 422
  'Create and edit vendor invoices' => 'Eingangsrechnungen erfassen und bearbeiten',
423
  'Create bank collection'      => 'Bankeinzug erstellen',
424
  'Create bank collection via SEPA XML' => 'Bank?berweisung via SEPA XML erstellen',
422 425
  'Create bank transfer'        => '?berweisung erstellen',
423 426
  'Create bank transfer via SEPA XML' => '?berweisung via SEPA XML erzeugen',
424 427
  'Create invoice?'             => 'Rechnung erstellen?',
......
1201 1204
  'Phone1'                      => 'Telefon 1 ',
1202 1205
  'Phone2'                      => 'Telefon 2',
1203 1206
  'Pick List'                   => 'Sammelliste',
1207
  'Please Check the bank information for each customer:' => 'Bitte ?berpr?fen Sie die Bankinformationen der Kunden:',
1204 1208
  'Please Check the bank information for each vendor:' => 'Bitte ?berpr?fen Sie die Kontoinformationen der Lieferanten:',
1205 1209
  'Please ask your administrator to create warehouses and bins.' => 'Bitten Sie Ihren Administrator, dass er Lager und Lagerpl&auml;tze anlegt.',
1206 1210
  'Please enter a license key.' => 'Bitte geben Sie einen Lizenzschl?ssel an.',
templates/webpages/sepa/bank_transfer_create.html
1 1
[%- USE T8 %]
2 2
[% USE HTML %][% USE LxERP %]
3
[% IF vc == 'vendor' %]
4
 [% SET is_vendor = 1 %]
5
 [% SET arap = 'ap' %]
6
 [% SET iris = 'ir' %]
7
[% ELSE %]
8
 [% SET is_vendor = 0 %]
9
 [% SET arap = 'ar' %]
10
 [% SET iris = 'is' %]
11
[%- END %]
3 12
<body>
4 13

  
5 14
 [%- IF error_message %]
......
9 18
 <p><div class="listtop">[% title %]</div></p>
10 19

  
11 20
 <form action="sepa.pl" method="post">
12
  <p>1. [% 'Please select the source bank account for the transfers:' | $T8 %]
21
  <p>1.
22
   [%- IF is_vendor %]
23
    [% 'Please select the source bank account for the transfers:' | $T8 %]
24
   [%- ELSE %]
25
    [% 'Please select the destination bank account for the collections:' | $T8 %]
26
   [%- END %]
13 27
   <br>
14 28
   [%- INCLUDE generic/multibox.html
15 29
         name      = 'bank_account.id',
......
20 34
  </p>
21 35

  
22 36
  <p>
23
   2. [% 'Please Check the bank information for each vendor:' | $T8 %]
37
   2.
38
   [%- IF is_vendor %]
39
    [% 'Please Check the bank information for each vendor:' | $T8 %]
40
   [%- ELSE %]
41
    [% 'Please Check the bank information for each customer:' | $T8 %]
42
   [%- END %]
24 43
   <br>
25 44
   <table>
26 45
    <tr>
27
     <th class="listheading">[% 'Vendor' | $T8 %]</th>
46
     <th class="listheading">[%- IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
28 47
     <th class="listheading">[% 'IBAN' | $T8 %]</th>
29 48
     <th class="listheading">[% 'BIC' | $T8 %]</th>
30 49
     <th class="listheading">[% 'Bank' | $T8 %]</th>
31 50
    </tr>
32 51

  
33
    [%- FOREACH vbi = VENDOR_BANK_INFO %]
52
    [%- FOREACH vbi = VC_BANK_INFO %]
34 53
    <tr class="listrow[% loop.count % 1 %]">
35 54
     <td>
36
      <input type="hidden" name="vendor_bank_info[+].id" value="[% HTML.escape(vbi.id) %]">
37
      <input type="hidden" name="vendor_bank_info[].name" value="[% HTML.escape(vbi.name) %]">
55
      <input type="hidden" name="vc_bank_info[+].id" value="[% HTML.escape(vbi.id) %]">
56
      <input type="hidden" name="vc_bank_info[].name" value="[% HTML.escape(vbi.name) %]">
38 57
      [% HTML.escape(vbi.name) %]
39 58
     </td>
40
     <td><input name="vendor_bank_info[].iban" size="20" value="[% HTML.escape(vbi.iban) %]"></td>
41
     <td><input name="vendor_bank_info[].bic" size="20" value="[% HTML.escape(vbi.bic) %]"></td>
42
     <td><input name="vendor_bank_info[].bank" size="30" value="[% HTML.escape(vbi.bank) %]"></td>
59
     <td><input name="vc_bank_info[].iban" size="20" value="[% HTML.escape(vbi.iban) %]"></td>
60
     <td><input name="vc_bank_info[].bic" size="20" value="[% HTML.escape(vbi.bic) %]"></td>
61
     <td><input name="vc_bank_info[].bank" size="30" value="[% HTML.escape(vbi.bank) %]"></td>
43 62
    </tr>
44 63
    [%- END %]
45 64
   </table>
......
50 69
   <br>
51 70
   <table>
52 71
    <tr>
53
     <th class="listheading">[% 'Vendor' | $T8 %]</th>
72
     <th class="listheading">[%- IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
54 73
     <th class="listheading">[% 'Invoice' | $T8 %]</th>
55 74
     <th class="listheading" align="right">[% 'Amount' | $T8 %]</th>
56 75
     <th class="listheading" align="right">[% 'Open amount' | $T8 %]</th>
57 76
     <th class="listheading">[% 'Purpose' | $T8 %]</th>
58
     <th class="listheading" align="right">[% 'Bank transfer amount' | $T8 %]</th>
77
     <th class="listheading" align="right">[%- IF is_vendor %][% 'Bank transfer amount' | $T8 %][%- ELSE %][%- LxERP.t8('Bank collection amount') %][%- END %]</th>
59 78
     <th class="listheading">[% 'Execution date' | $T8 %]</th>
60 79
    </tr>
61 80

  
62 81
    [%- FOREACH bank_transfer = BANK_TRANSFERS %]
63
     <input type="hidden" name="bank_transfers[+].ap_id" value="[% HTML.escape(bank_transfer.id) %]">
64
     <input type="hidden" name="bank_transfers[].vendor_id" value="[% HTML.escape(bank_transfer.vendor_id) %]">
82
     <input type="hidden" name="bank_transfers[+].[% arap %]_id" value="[% HTML.escape(bank_transfer.id) %]">
83
     <input type="hidden" name="bank_transfers[].vc_id" value="[% HTML.escape(bank_transfer.vc_id) %]">
65 84
     <input type="hidden" name="bank_transfers[].selected" value="1">
66 85

  
67 86
     <tr class="listrow[% loop.count % 2 %]">
68 87
      <td>
69
       [%- IF loop.first || (previous_vendorname != bank_transfer.vendorname) %]
70
        <a href="ct.pl?action=edit&db=vendor&id=[% HTML.url(bank_transfer.vendor_id) %]&callback=[% HTML.url('sepa.pl?action=bank_transfer_add') %]">
71
         [%- GET HTML.escape(bank_transfer.vendorname);
72
             SET previous_vendorname = bank_transfer.vendorname; -%]
88
       [%- IF loop.first || (previous_vcname != bank_transfer.vcname) %]
89
        <a href="ct.pl?action=edit&db=[% vc %]&id=[% HTML.url(bank_transfer.vc_id) %]&callback=[% HTML.url('sepa.pl?action=bank_transfer_add&vc=' _ vc) %]">
90
         [%- GET HTML.escape(bank_transfer.vcname);
91
             SET previous_vcname = bank_transfer.vcname; -%]
73 92
        </a>
74 93
       [%- END -%]
75 94
      </td>
76 95

  
77 96
      <td>
78
       <a href="[% IF bank_transfer.invoice %]ir[% ELSE %]ap[% END %].pl?action=edit&id=[% HTML.escape(bank_transfer.id) %]">
97
       <a href="[% IF bank_transfer.invoice %][% iris %][% ELSE %][% arap %][% END %].pl?action=edit&id=[% HTML.escape(bank_transfer.id) %]">
79 98
        [% HTML.escape(bank_transfer.invnumber) %]
80 99
       </a>
81 100
      </td>
......
97 116
  </p>
98 117

  
99 118
  <p>
100
   <input type="submit" class="submit" name="action_bank_transfer_create" value="[% 'Create bank transfer' | $T8 %]">
119
   [%- IF is_vendor %]
120
    <input type="submit" class="submit" name="action_bank_transfer_create" value="[% 'Create bank transfer' | $T8 %]">
121
   [%- ELSE %]
122
    <input type="submit" class="submit" name="action_bank_transfer_create" value="[% 'Create bank collection' | $T8 %]">
123
   [%- END %]
101 124
  </p>
102 125

  
103 126
  <input type="hidden" name="action" value="dispatcher">
127
  <input type="hidden" name="vc" value="[%- HTML.escape(vc) %]">
104 128
  <input type="hidden" name="confirmation" value="1">
105 129
 </form>
106 130

  

Auch abrufbar als: Unified diff